Author: rolf
Date: 2007-05-17 10:57:47 -0400 (Thu, 17 May 2007)
New Revision: 77566
Modified:
trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
Log:
* VBCodeGenerator.cs: Always create escaped identifiers if the
identifier matches a keyword.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2007-05-17
14:55:57 UTC (rev 77565)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/ChangeLog 2007-05-17
14:57:47 UTC (rev 77566)
@@ -1,3 +1,8 @@
+2007-05-17 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
+ * VBCodeGenerator.cs: Always create escaped identifiers if the
+ identifier matches a keyword.
+
2007-05-08 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* VBCodeGenerator.cs: Don't add newlines when creating array creations
expressions, fix the initial size expression and make sure a there's always {}
somewhere.
Modified: trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2007-05-17 14:55:57 UTC (rev 77565)
+++ trunk/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs
2007-05-17 14:57:47 UTC (rev 77566)
@@ -264,17 +264,17 @@
GenerateExpression (targetObject);
Output.Write ('.');
}
- Output.Write (expression.FieldName);
+ Output.Write (CreateEscapedIdentifier
(expression.FieldName));
}
protected override void GenerateArgumentReferenceExpression
(CodeArgumentReferenceExpression expression)
{
- Output.Write (expression.ParameterName);
+ Output.Write (CreateEscapedIdentifier
(expression.ParameterName));
}
protected override void GenerateVariableReferenceExpression
(CodeVariableReferenceExpression expression)
{
- Output.Write (expression.VariableName);
+ Output.Write (CreateEscapedIdentifier
(expression.VariableName));
}
protected override void GenerateIndexerExpression
(CodeIndexerExpression expression)
@@ -315,9 +315,11 @@
protected override void GenerateMethodReferenceExpression
(CodeMethodReferenceExpression expression)
{
- GenerateExpression (expression.TargetObject);
- Output.Write ('.');
- Output.Write (expression.MethodName);
+ if (expression.TargetObject != null) {
+ GenerateExpression (expression.TargetObject);
+ Output.Write ('.');
+ }
+ Output.Write (CreateEscapedIdentifier
(expression.MethodName));
}
protected override void GenerateEventReferenceExpression
(CodeEventReferenceExpression expression)
@@ -325,8 +327,10 @@
if (expression.TargetObject != null) {
GenerateExpression (expression.TargetObject);
Output.Write ('.');
+ Output.Write (CreateEscapedIdentifier
(expression.EventName));
+ } else {
+ Output.Write (expression.EventName + "Event");
}
- Output.Write
(CreateEscapedIdentifier(expression.EventName));
}
protected override void GenerateDelegateInvokeExpression
(CodeDelegateInvokeExpression expression)
@@ -394,7 +398,11 @@
protected override void GeneratePropertyReferenceExpression
(CodePropertyReferenceExpression expression)
{
- GenerateMemberReferenceExpression
(expression.TargetObject, expression.PropertyName);
+ if (expression.TargetObject != null) {
+ GenerateMemberReferenceExpression
(expression.TargetObject, expression.PropertyName);
+ } else {
+ Output.Write (CreateEscapedIdentifier
(expression.PropertyName));
+ }
}
protected override void
GeneratePropertySetValueReferenceExpression
(CodePropertySetValueReferenceExpression expression)
@@ -550,7 +558,11 @@
TextWriter output = Output;
Output.Write ("AddHandler ");
- GenerateEventReferenceExpression (statement.Event);
+ if (statement.Event.TargetObject != null) {
+ GenerateEventReferenceExpression
(statement.Event);
+ } else {
+ Output.Write (CreateEscapedIdentifier
(statement.Event.EventName));
+ }
Output.Write ( ", ");
GenerateExpression (statement.Listener);
output.WriteLine ();
@@ -561,7 +573,11 @@
TextWriter output = Output;
Output.Write ("RemoveHandler ");
- GenerateEventReferenceExpression (statement.Event);
+ if (statement.Event.TargetObject != null) {
+ GenerateEventReferenceExpression
(statement.Event);
+ } else {
+ Output.Write (CreateEscapedIdentifier
(statement.Event.EventName));
+ }
Output.Write ( ", ");
GenerateExpression (statement.Listener);
output.WriteLine ();
@@ -1514,6 +1530,7 @@
#endif
default:
output = type.BaseType.Replace('+',
'.');
+ output = CreateEscapedIdentifier
(output);
break;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches