Author: juraj
Date: 2008-02-10 15:01:25 -0500 (Sun, 10 Feb 2008)
New Revision: 95401
Added:
trunk/mcs/class/System/System.CodeDom/ICodeDomVisitor.cs
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog
trunk/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
trunk/mcs/class/System/System.CodeDom/ChangeLog
trunk/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeCastExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeConstructor.cs
trunk/mcs/class/System/System.CodeDom/CodeDefaultValueExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
trunk/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeGotoStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
trunk/mcs/class/System/System.CodeDom/CodeMemberField.cs
trunk/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
trunk/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
trunk/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeObject.cs
trunk/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
trunk/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
trunk/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
trunk/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
trunk/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
trunk/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
trunk/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
trunk/mcs/class/System/System.dll.sources
trunk/mcs/class/System/net_2_1_System.dll.sources
Log:
2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
* System.dll.sources: Added ICodeDomVisitor.cs.
2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
* CodeObject.cs: Add empty Visit method implementation.
* CodeArgumentReferenceExpression.cs, CodeArrayCreateExpression.cs,
CodeArrayIndexerExpression.cs, CodeAssignStatement.cs,
CodeAttachEventStatement.cs, CodeBaseReferenceExpression.cs,
CodeBinaryOperatorExpression.cs, CodeCastExpression.cs,
CodeCommentStatement.cs, CodeConditionStatement.cs,
CodeConstructor.cs, CodeDefaultValueExpression.cs,
CodeDelegateCreateExpression.cs, CodeDelegateInvokeExpression.cs,
CodeDirectionExpression.cs, CodeEntryPointMethod.cs,
CodeEventReferenceExpression.cs, CodeExpressionStatement.cs,
CodeFieldReferenceExpression.cs, CodeGotoStatement.cs,
CodeIndexerExpression.cs, CodeIterationStatement.cs,
CodeLabeledStatement.cs, CodeMemberEvent.cs,
CodeMemberField.cs, CodeMemberMethod.cs,
CodeMemberProperty.cs, CodeMethodInvokeExpression.cs,
CodeMethodReferenceExpression.cs, CodeMethodReturnStatement.cs,
CodeObjectCreateExpression.cs, CodeParameterDeclarationExpression.cs,
CodePrimitiveExpression.cs, CodePropertyReferenceExpression.cs,
CodePropertySetValueReferenceExpression.cs,
CodeRemoveEventStatement.cs,
CodeSnippetExpression.cs, CodeSnippetTypeMember.cs,
CodeThisReferenceExpression.cs, CodeThrowExceptionStatement.cs,
CodeTryCatchFinallyStatement.cs, CodeTypeConstructor.cs,
CodeTypeOfExpression.cs, CodeTypeReferenceExpression.cs,
CodeVariableDeclarationStatement.cs, CodeVariableReferenceExpression.cs:
Add Visit method implementation.
2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
* CodeGenerator.cs: Mark CurrentClass internal for NET_1_1.
Add nested Visitor class and member.
GenerateExpression, GenerateStatement, GenerateType: Use visitor.
GeneratePrimitiveExpression: Replace if-else chain with switch
on TypeCode.
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/ChangeLog 2008-02-10 20:01:25 UTC (rev 95401)
@@ -1,3 +1,7 @@
+2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
+
+ * System.dll.sources: Added ICodeDomVisitor.cs.
+
2008-01-23 Gert Driesen <[EMAIL PROTECTED]>
* System_test.dll.sources: Added FileVersionInfoTest.cs.
Modified: trunk/mcs/class/System/System.CodeDom/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.CodeDom/ChangeLog 2008-02-10 19:46:47 UTC
(rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/ChangeLog 2008-02-10 20:01:25 UTC
(rev 95401)
@@ -1,3 +1,32 @@
+2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
+
+ * CodeObject.cs: Add empty Visit method implementation.
+
+ * CodeArgumentReferenceExpression.cs, CodeArrayCreateExpression.cs,
+ CodeArrayIndexerExpression.cs, CodeAssignStatement.cs,
+ CodeAttachEventStatement.cs, CodeBaseReferenceExpression.cs,
+ CodeBinaryOperatorExpression.cs, CodeCastExpression.cs,
+ CodeCommentStatement.cs, CodeConditionStatement.cs,
+ CodeConstructor.cs, CodeDefaultValueExpression.cs,
+ CodeDelegateCreateExpression.cs, CodeDelegateInvokeExpression.cs,
+ CodeDirectionExpression.cs, CodeEntryPointMethod.cs,
+ CodeEventReferenceExpression.cs, CodeExpressionStatement.cs,
+ CodeFieldReferenceExpression.cs, CodeGotoStatement.cs,
+ CodeIndexerExpression.cs, CodeIterationStatement.cs,
+ CodeLabeledStatement.cs, CodeMemberEvent.cs,
+ CodeMemberField.cs, CodeMemberMethod.cs,
+ CodeMemberProperty.cs, CodeMethodInvokeExpression.cs,
+ CodeMethodReferenceExpression.cs, CodeMethodReturnStatement.cs,
+ CodeObjectCreateExpression.cs, CodeParameterDeclarationExpression.cs,
+ CodePrimitiveExpression.cs, CodePropertyReferenceExpression.cs,
+ CodePropertySetValueReferenceExpression.cs,
CodeRemoveEventStatement.cs,
+ CodeSnippetExpression.cs, CodeSnippetTypeMember.cs,
+ CodeThisReferenceExpression.cs, CodeThrowExceptionStatement.cs,
+ CodeTryCatchFinallyStatement.cs, CodeTypeConstructor.cs,
+ CodeTypeOfExpression.cs, CodeTypeReferenceExpression.cs,
+ CodeVariableDeclarationStatement.cs, CodeVariableReferenceExpression.cs:
+ Add Visit method implementation.
+
2007-01-18 Atsushi Enomoto <[EMAIL PROTECTED]>
* CodeTypeReference.cs :
Modified:
trunk/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeArgumentReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -65,5 +65,13 @@
parameterName = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -162,6 +162,14 @@
// null.
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeArrayIndexerExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -73,5 +73,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -72,5 +72,13 @@
right = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -87,5 +87,13 @@
listener = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -38,5 +38,12 @@
public class CodeBaseReferenceExpression
: CodeExpression
{
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -86,5 +86,13 @@
right = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeCastExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeCastExpression.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeCastExpression.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -89,5 +89,13 @@
targetType = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -74,5 +74,13 @@
comment = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeConditionStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -94,5 +94,13 @@
return trueStatements;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeConstructor.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeConstructor.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeConstructor.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -70,5 +70,13 @@
return chainedConstructorArgs;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeDefaultValueExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeDefaultValueExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeDefaultValueExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -59,6 +59,14 @@
}
set { type = value; }
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -94,5 +94,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -81,5 +81,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeDirectionExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -76,5 +76,13 @@
expression = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeEntryPointMethod.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -42,5 +42,13 @@
{
Attributes = MemberAttributes.Public |
MemberAttributes.Static;
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeEventReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -76,5 +76,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeExpressionStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -63,5 +63,13 @@
expression = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -76,5 +76,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeGotoStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeGotoStatement.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeGotoStatement.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -68,5 +68,13 @@
label = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -75,5 +75,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeIterationStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -98,5 +98,13 @@
testExpression = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeLabeledStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -82,5 +82,13 @@
statement = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMemberEvent.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMemberEvent.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -85,5 +85,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMemberField.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMemberField.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMemberField.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -88,5 +88,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMemberMethod.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMemberMethod.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -140,5 +140,13 @@
public event EventHandler PopulateParameters;
public event EventHandler PopulateStatements;
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMemberProperty.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMemberProperty.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -133,5 +133,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -84,5 +84,13 @@
return parameters;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMethodReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -103,5 +103,13 @@
}
}
#endif
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -64,5 +64,13 @@
expression = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeObject.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeObject.cs 2008-02-10 19:46:47 UTC
(rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeObject.cs 2008-02-10 20:01:25 UTC
(rev 95401)
@@ -52,5 +52,10 @@
return userData;
}
}
+
+ internal virtual void Accept (ICodeDomVisitor visitor)
+ {
+ throw new NotImplementedException ();
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -91,5 +91,13 @@
return parameters;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified:
trunk/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -113,5 +113,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -63,5 +63,13 @@
this.value = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified:
trunk/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -78,5 +78,13 @@
targetObject = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified:
trunk/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
===================================================================
---
trunk/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++
trunk/mcs/class/System/System.CodeDom/CodePropertySetValueReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -38,5 +38,12 @@
public class CodePropertySetValueReferenceExpression
: CodeExpression
{
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeRemoveEventStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -86,6 +86,14 @@
listener = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeSnippetExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -65,5 +65,13 @@
this.value = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeSnippetTypeMember.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -65,5 +65,13 @@
text = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -45,5 +45,13 @@
public CodeThisReferenceExpression()
{
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -63,5 +63,13 @@
toThrow = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -90,5 +90,13 @@
return catchClauses;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -42,5 +42,13 @@
{
this.Name = ".cctor";
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -76,5 +76,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified: trunk/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -76,5 +76,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified:
trunk/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -129,5 +129,13 @@
type = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Modified:
trunk/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/CodeVariableReferenceExpression.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -65,5 +65,13 @@
variableName = value;
}
}
+
+ //
+ // ICodeDomVisitor method
+ //
+ internal override void Accept (ICodeDomVisitor visitor)
+ {
+ visitor.Visit (this);
+ }
}
}
Added: trunk/mcs/class/System/System.CodeDom/ICodeDomVisitor.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom/ICodeDomVisitor.cs 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom/ICodeDomVisitor.cs 2008-02-10
20:01:25 UTC (rev 95401)
@@ -0,0 +1,85 @@
+//
+// System.CodeDom.ICodeDomVisitor.cs
+//
+// Author:
+// Juraj Skripsky ([EMAIL PROTECTED])
+//
+// Copyright (C) 2008 HotFeet GmbH (http://www.hotfeet.ch)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.CodeDom {
+ internal interface ICodeDomVisitor {
+ // CodeExpression
+ void Visit (CodeArgumentReferenceExpression o);
+ void Visit (CodeArrayCreateExpression o);
+ void Visit (CodeArrayIndexerExpression o);
+ void Visit (CodeBaseReferenceExpression o);
+ void Visit (CodeBinaryOperatorExpression o);
+ void Visit (CodeCastExpression o);
+#if NET_2_0
+ void Visit (CodeDefaultValueExpression o);
+#endif
+ void Visit (CodeDelegateCreateExpression o);
+ void Visit (CodeDelegateInvokeExpression o);
+ void Visit (CodeDirectionExpression o);
+ void Visit (CodeEventReferenceExpression o);
+ void Visit (CodeFieldReferenceExpression o);
+ void Visit (CodeIndexerExpression o);
+ void Visit (CodeMethodInvokeExpression o);
+ void Visit (CodeMethodReferenceExpression o);
+ void Visit (CodeObjectCreateExpression o);
+ void Visit (CodeParameterDeclarationExpression o);
+ void Visit (CodePrimitiveExpression o);
+ void Visit (CodePropertyReferenceExpression o);
+ void Visit (CodePropertySetValueReferenceExpression o);
+ void Visit (CodeSnippetExpression o);
+ void Visit (CodeThisReferenceExpression o);
+ void Visit (CodeTypeOfExpression o);
+ void Visit (CodeTypeReferenceExpression o);
+ void Visit (CodeVariableReferenceExpression o);
+
+ // CodeStatement
+ void Visit (CodeAssignStatement o);
+ void Visit (CodeAttachEventStatement o);
+ void Visit (CodeCommentStatement o);
+ void Visit (CodeConditionStatement o);
+ void Visit (CodeExpressionStatement o);
+ void Visit (CodeGotoStatement o);
+ void Visit (CodeIterationStatement o);
+ void Visit (CodeLabeledStatement o);
+ void Visit (CodeMethodReturnStatement o);
+ void Visit (CodeRemoveEventStatement o);
+ void Visit (CodeThrowExceptionStatement o);
+ void Visit (CodeTryCatchFinallyStatement o);
+ void Visit (CodeVariableDeclarationStatement o);
+
+ // CodeTypeMember
+ void Visit (CodeConstructor o);
+ void Visit (CodeEntryPointMethod o);
+ void Visit (CodeMemberEvent o);
+ void Visit (CodeMemberField o);
+ void Visit (CodeMemberMethod o);
+ void Visit (CodeMemberProperty o);
+ void Visit (CodeSnippetTypeMember o);
+ void Visit (CodeTypeConstructor o);
+ }
+}
Modified: trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog 2008-02-10
19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/ChangeLog 2008-02-10
20:01:25 UTC (rev 95401)
@@ -1,3 +1,11 @@
+2008-02-10 Juraj Skripsky <[EMAIL PROTECTED]>
+
+ * CodeGenerator.cs: Mark CurrentClass internal for NET_1_1.
+ Add nested Visitor class and member.
+ GenerateExpression, GenerateStatement, GenerateType: Use visitor.
+ GeneratePrimitiveExpression: Replace if-else chain with switch
+ on TypeCode.
+
2008-01-27 Gert Driesen <[EMAIL PROTECTED]>
* CodeGenerator.cs: Fixed ArgumentException argument names. Indent
Modified: trunk/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
===================================================================
--- trunk/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
2008-02-10 19:46:47 UTC (rev 95400)
+++ trunk/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
2008-02-10 20:01:25 UTC (rev 95401)
@@ -46,24 +46,29 @@
private CodeGeneratorOptions options;
private CodeTypeMember currentMember;
private CodeTypeDeclaration currentType;
+ private Visitor visitor;
//
// Constructors
//
protected CodeGenerator()
{
+ visitor = new Visitor (this);
}
//
// Properties
//
#if NET_2_0
- protected CodeTypeDeclaration CurrentClass {
+ protected
+#else
+ internal
+#endif
+ CodeTypeDeclaration CurrentClass {
get {
return currentType;
}
}
-#endif
protected CodeTypeMember CurrentMember {
get {
@@ -280,128 +285,11 @@
if (e == null)
throw new ArgumentNullException ("e");
- CodeArgumentReferenceExpression argref = e as
CodeArgumentReferenceExpression;
- if (argref != null) {
- GenerateArgumentReferenceExpression (argref);
- return;
+ try {
+ e.Accept (visitor);
+ } catch (NotImplementedException) {
+ throw new ArgumentException ("Element type " +
e.GetType () + " is not supported.", "e");
}
- CodeArrayCreateExpression mkarray = e as
CodeArrayCreateExpression;
- if (mkarray != null) {
- GenerateArrayCreateExpression (mkarray);
- return;
- }
- CodeArrayIndexerExpression arrayidx = e as
CodeArrayIndexerExpression;
- if (arrayidx != null) {
- GenerateArrayIndexerExpression (arrayidx);
- return;
- }
- CodeBaseReferenceExpression baseref = e as
CodeBaseReferenceExpression;
- if (baseref != null) {
- GenerateBaseReferenceExpression (baseref);
- return;
- }
- CodeBinaryOperatorExpression binary = e as
CodeBinaryOperatorExpression;
- if (binary != null) {
- GenerateBinaryOperatorExpression (binary);
- return;
- }
- CodeCastExpression cast = e as CodeCastExpression;
- if (cast != null) {
- GenerateCastExpression (cast);
- return;
- }
- CodeDelegateCreateExpression mkdel = e as
CodeDelegateCreateExpression;
- if (mkdel != null) {
- GenerateDelegateCreateExpression (mkdel);
- return;
- }
- CodeDelegateInvokeExpression delinvoke = e as
CodeDelegateInvokeExpression;
- if (delinvoke != null) {
- GenerateDelegateInvokeExpression (delinvoke);
- return;
- }
- CodeDirectionExpression direction = e as
CodeDirectionExpression;
- if (direction != null) {
- GenerateDirectionExpression (direction);
- return;
- }
- CodeEventReferenceExpression eventref = e as
CodeEventReferenceExpression;
- if ( eventref != null ) {
- GenerateEventReferenceExpression( eventref );
- return;
- }
- CodeFieldReferenceExpression fieldref = e as
CodeFieldReferenceExpression;
- if (fieldref != null) {
- GenerateFieldReferenceExpression (fieldref);
- return;
- }
- CodeIndexerExpression idx = e as CodeIndexerExpression;
- if (idx != null) {
- GenerateIndexerExpression (idx);
- return;
- }
- CodeMethodInvokeExpression methodinv = e as
CodeMethodInvokeExpression;
- if (methodinv != null) {
- GenerateMethodInvokeExpression (methodinv);
- return;
- }
- CodeMethodReferenceExpression methodref = e as
CodeMethodReferenceExpression;
- if (methodref != null) {
- GenerateMethodReferenceExpression (methodref);
- return;
- }
- CodeObjectCreateExpression objref = e as
CodeObjectCreateExpression;
- if (objref != null) {
- GenerateObjectCreateExpression (objref);
- return;
- }
- CodeParameterDeclarationExpression param = e as
CodeParameterDeclarationExpression;
- if (param != null) {
- GenerateParameterDeclarationExpression (param);
- return;
- }
- CodePrimitiveExpression primitive = e as
CodePrimitiveExpression;
- if (primitive != null) {
- GeneratePrimitiveExpression (primitive);
- return;
- }
- CodePropertyReferenceExpression propref = e as
CodePropertyReferenceExpression;
- if (propref != null) {
- GeneratePropertyReferenceExpression (propref);
- return;
- }
- CodePropertySetValueReferenceExpression propset = e as
CodePropertySetValueReferenceExpression;
- if (propset != null) {
- GeneratePropertySetValueReferenceExpression
(propset);
- return;
- }
- CodeSnippetExpression snippet = e as
CodeSnippetExpression;
- if (snippet != null) {
- GenerateSnippetExpression (snippet);
- return;
- }
- CodeThisReferenceExpression thisref = e as
CodeThisReferenceExpression;
- if (thisref != null) {
- GenerateThisReferenceExpression (thisref);
- return;
- }
- CodeTypeOfExpression typeOf = e as CodeTypeOfExpression;
- if (typeOf != null) {
- GenerateTypeOfExpression (typeOf);
- return;
- }
- CodeTypeReferenceExpression typeref = e as
CodeTypeReferenceExpression;
- if (typeref != null) {
- GenerateTypeReferenceExpression (typeref);
- return;
- }
- CodeVariableReferenceExpression varref = e as
CodeVariableReferenceExpression;
- if (varref != null) {
- GenerateVariableReferenceExpression (varref);
- return;
- }
-
- throw new ArgumentException ("Element type " + e + " is
not supported.", "e");
}
protected abstract void GenerateExpressionStatement
(CodeExpressionStatement statement);
@@ -478,34 +366,40 @@
protected virtual void GeneratePrimitiveExpression
(CodePrimitiveExpression e)
{
- if (e.Value == null) {
+ object value = e.Value;
+ if (value == null) {
output.Write (NullToken);
return;
}
-
- Type type = e.Value.GetType ();
- if (type == typeof (bool)) {
- output.Write (e.Value.ToString ().ToLower
(CultureInfo.InvariantCulture));
- } else if (type == typeof (char)) {
- output.Write ("'" + e.Value.ToString () + "'");
- } else if (type == typeof (string)) {
- output.Write (QuoteSnippetString ((string)
e.Value));
- } else if (type == typeof (float)) {
- GenerateSingleFloatValue((float) e.Value);
- } else if (type == typeof (double)) {
- GenerateDoubleValue((double) e.Value);
- } else if (type == typeof (decimal)) {
- this.GenerateDecimalValue((decimal) e.Value);
- } else if (type == typeof (byte) || type == typeof
(short) ||
- type == typeof (int) || type == typeof (long)) {
- // All of these should be IFormatable, I am
just being safe/slow
- IFormattable formattable = e.Value as
IFormattable;
- if (formattable != null) {
- output.Write (formattable.ToString
(null, CultureInfo.InvariantCulture));
- } else {
- output.Write (e.Value.ToString ());
- }
- } else {
+
+ Type type = value.GetType ();
+ TypeCode typeCode = Type.GetTypeCode (type);
+ switch (typeCode) {
+ case TypeCode.Boolean:
+ output.Write (value.ToString ().ToLower
(CultureInfo.InvariantCulture));
+ break;
+ case TypeCode.Char:
+ output.Write ("'" + value.ToString () + "'");
+ break;
+ case TypeCode.String:
+ output.Write (QuoteSnippetString ((string)
value));
+ break;
+ case TypeCode.Single:
+ GenerateSingleFloatValue ((float) value);
+ break;
+ case TypeCode.Double:
+ GenerateDoubleValue ((double) value);
+ break;
+ case TypeCode.Decimal:
+ GenerateDecimalValue ((decimal) value);
+ break;
+ case TypeCode.Byte:
+ case TypeCode.Int16:
+ case TypeCode.Int32:
+ case TypeCode.Int64:
+ output.Write (((IFormattable)value).ToString
(null, CultureInfo.InvariantCulture));
+ break;
+ default:
throw new ArgumentException
(string.Format(CultureInfo.InvariantCulture,
"Invalid Primitive Type: {0}. Only CLS
compliant primitive " +
"types can be used. Consider using
CodeObjectCreateExpression.",
@@ -544,8 +438,6 @@
protected void GenerateStatement (CodeStatement s)
{
- bool handled = false;
-
#if NET_2_0
if (s.StartDirectives.Count > 0)
GenerateDirectives (s.StartDirectives);
@@ -553,56 +445,6 @@
if (s.LinePragma != null)
GenerateLinePragmaStart (s.LinePragma);
- CodeAssignStatement assign = s as CodeAssignStatement;
- if (assign != null) {
- GenerateAssignStatement (assign);
- handled = true;
- }
- CodeAttachEventStatement attach = s as
CodeAttachEventStatement;
- if (attach != null) {
- GenerateAttachEventStatement (attach);
- handled = true;
- }
- CodeCommentStatement comment = s as
CodeCommentStatement;
- if (comment != null) {
- GenerateCommentStatement (comment);
- handled = true;
- }
- CodeConditionStatement condition = s as
CodeConditionStatement;
- if (condition != null) {
- GenerateConditionStatement (condition);
- handled = true;
- }
- CodeExpressionStatement expression = s as
CodeExpressionStatement;
- if (expression != null) {
- GenerateExpressionStatement (expression);
- handled = true;
- }
- CodeGotoStatement gotostmt = s as CodeGotoStatement;
- if (gotostmt != null) {
- GenerateGotoStatement (gotostmt);
- handled = true;
- }
- CodeIterationStatement iteration = s as
CodeIterationStatement;
- if (iteration != null) {
- GenerateIterationStatement (iteration);
- handled = true;
- }
- CodeLabeledStatement label = s as CodeLabeledStatement;
- if (label != null) {
- GenerateLabeledStatement (label);
- handled = true;
- }
- CodeMethodReturnStatement returnstmt = s as
CodeMethodReturnStatement;
- if (returnstmt != null) {
- GenerateMethodReturnStatement (returnstmt);
- handled = true;
- }
- CodeRemoveEventStatement remove = s as
CodeRemoveEventStatement;
- if (remove != null) {
- GenerateRemoveEventStatement (remove);
- handled = true;
- }
CodeSnippetStatement snippet = s as
CodeSnippetStatement;
if (snippet != null) {
#if NET_2_0
@@ -616,27 +458,14 @@
#else
GenerateSnippetStatement (snippet);
#endif
- handled = true;
+ } else {
+ try {
+ s.Accept (visitor);
+ } catch (NotImplementedException) {
+ throw new ArgumentException ("Element
type " + s.GetType () + " is not supported.", "s");
+ }
}
- CodeThrowExceptionStatement exception = s as
CodeThrowExceptionStatement;
- if (exception != null) {
- GenerateThrowExceptionStatement (exception);
- handled = true;
- }
- CodeTryCatchFinallyStatement trycatch = s as
CodeTryCatchFinallyStatement;
- if (trycatch != null) {
- GenerateTryCatchFinallyStatement (trycatch);
- handled = true;
- }
- CodeVariableDeclarationStatement declaration = s as
CodeVariableDeclarationStatement;
- if (declaration != null) {
- GenerateVariableDeclarationStatement
(declaration);
- handled = true;
- }
- if (!handled)
- throw new ArgumentException ("Element type " +
s + " is not supported.");
-
if (s.LinePragma != null)
GenerateLinePragmaEnd (s.LinePragma);
@@ -1131,48 +960,11 @@
if (member.LinePragma != null)
GenerateLinePragmaStart
(member.LinePragma);
- CodeMemberEvent eventm = member as
CodeMemberEvent;
- if (eventm != null) {
- GenerateEvent (eventm, type);
- continue;
+ try {
+ member.Accept (visitor);
+ } catch (NotImplementedException) {
+ throw new ArgumentException ("Element
type " + member.GetType () + " is not supported.");
}
- CodeMemberField field = member as
CodeMemberField;
- if (field != null) {
- GenerateField (field);
- continue;
- }
- CodeEntryPointMethod epmethod = member as
CodeEntryPointMethod;
- if (epmethod != null) {
- GenerateEntryPointMethod (epmethod,
type);
- continue;
- }
- CodeTypeConstructor typeCtor = member as
CodeTypeConstructor;
- if (typeCtor != null) {
- GenerateTypeConstructor (typeCtor);
- continue;
- }
- CodeConstructor ctor = member as
CodeConstructor;
- if (ctor != null) {
- GenerateConstructor (ctor, type);
- continue;
- }
- CodeMemberMethod method = member as
CodeMemberMethod;
- if (method != null) {
- GenerateMethod (method, type);
- continue;
- }
- CodeMemberProperty property = member as
CodeMemberProperty;
- if (property != null) {
- GenerateProperty (property, type);
- continue;
- }
- CodeSnippetTypeMember snippet = member as
CodeSnippetTypeMember;
- if (snippet != null) {
- GenerateSnippetMember (snippet);
- continue;
- }
-
- this.currentMember = prevMember;
}
// Hack because of previous continue usage
@@ -1295,5 +1087,252 @@
{
}
#endif
+
+ internal class Visitor : ICodeDomVisitor {
+ CodeGenerator g;
+
+ public Visitor (CodeGenerator generator)
+ {
+ this.g = generator;
+ }
+
+ // CodeExpression
+
+ public void Visit (CodeArgumentReferenceExpression o)
+ {
+ g.GenerateArgumentReferenceExpression (o);
+ }
+
+ public void Visit (CodeArrayCreateExpression o)
+ {
+ g.GenerateArrayCreateExpression (o);
+ }
+
+ public void Visit (CodeArrayIndexerExpression o)
+ {
+ g.GenerateArrayIndexerExpression (o);
+ }
+
+ public void Visit (CodeBaseReferenceExpression o)
+ {
+ g.GenerateBaseReferenceExpression (o);
+ }
+
+ public void Visit (CodeBinaryOperatorExpression o)
+ {
+ g.GenerateBinaryOperatorExpression (o);
+ }
+
+ public void Visit (CodeCastExpression o)
+ {
+ g.GenerateCastExpression (o);
+ }
+
+#if NET_2_0
+ public void Visit (CodeDefaultValueExpression o)
+ {
+ g.GenerateDefaultValueExpression (o);
+ }
+#endif
+
+ public void Visit (CodeDelegateCreateExpression o)
+ {
+ g.GenerateDelegateCreateExpression (o);
+ }
+
+ public void Visit (CodeDelegateInvokeExpression o)
+ {
+ g.GenerateDelegateInvokeExpression (o);
+ }
+
+ public void Visit (CodeDirectionExpression o)
+ {
+ g.GenerateDirectionExpression (o);
+ }
+
+ public void Visit (CodeEventReferenceExpression o)
+ {
+ g.GenerateEventReferenceExpression (o);
+ }
+
+ public void Visit (CodeFieldReferenceExpression o)
+ {
+ g.GenerateFieldReferenceExpression (o);
+ }
+
+ public void Visit (CodeIndexerExpression o)
+ {
+ g.GenerateIndexerExpression (o);
+ }
+
+ public void Visit (CodeMethodInvokeExpression o)
+ {
+ g.GenerateMethodInvokeExpression (o);
+ }
+
+ public void Visit (CodeMethodReferenceExpression o)
+ {
+ g.GenerateMethodReferenceExpression (o);
+ }
+
+ public void Visit (CodeObjectCreateExpression o)
+ {
+ g.GenerateObjectCreateExpression (o);
+ }
+
+ public void Visit (CodeParameterDeclarationExpression o)
+ {
+ g.GenerateParameterDeclarationExpression (o);
+ }
+
+ public void Visit (CodePrimitiveExpression o)
+ {
+ g.GeneratePrimitiveExpression (o);
+ }
+
+ public void Visit (CodePropertyReferenceExpression o)
+ {
+ g.GeneratePropertyReferenceExpression (o);
+ }
+
+ public void Visit
(CodePropertySetValueReferenceExpression o)
+ {
+ g.GeneratePropertySetValueReferenceExpression
(o);
+ }
+
+ public void Visit (CodeSnippetExpression o)
+ {
+ g.GenerateSnippetExpression (o);
+ }
+
+ public void Visit (CodeThisReferenceExpression o)
+ {
+ g.GenerateThisReferenceExpression (o);
+ }
+
+ public void Visit (CodeTypeOfExpression o)
+ {
+ g.GenerateTypeOfExpression (o);
+ }
+
+ public void Visit (CodeTypeReferenceExpression o)
+ {
+ g.GenerateTypeReferenceExpression (o);
+ }
+
+ public void Visit (CodeVariableReferenceExpression o)
+ {
+ g.GenerateVariableReferenceExpression (o);
+ }
+
+ // CodeStatement
+
+ public void Visit (CodeAssignStatement o)
+ {
+ g.GenerateAssignStatement (o);
+ }
+
+ public void Visit (CodeAttachEventStatement o)
+ {
+ g.GenerateAttachEventStatement (o);
+ }
+
+ public void Visit (CodeCommentStatement o)
+ {
+ g.GenerateCommentStatement (o);
+ }
+
+ public void Visit (CodeConditionStatement o)
+ {
+ g.GenerateConditionStatement (o);
+ }
+
+ public void Visit (CodeExpressionStatement o)
+ {
+ g.GenerateExpressionStatement (o);
+ }
+
+ public void Visit (CodeGotoStatement o)
+ {
+ g.GenerateGotoStatement (o);
+ }
+
+ public void Visit (CodeIterationStatement o)
+ {
+ g.GenerateIterationStatement (o);
+ }
+
+ public void Visit (CodeLabeledStatement o)
+ {
+ g.GenerateLabeledStatement (o);
+ }
+
+ public void Visit (CodeMethodReturnStatement o)
+ {
+ g.GenerateMethodReturnStatement (o);
+ }
+
+ public void Visit (CodeRemoveEventStatement o)
+ {
+ g.GenerateRemoveEventStatement (o);
+ }
+
+ public void Visit (CodeThrowExceptionStatement o)
+ {
+ g.GenerateThrowExceptionStatement (o);
+ }
+
+ public void Visit (CodeTryCatchFinallyStatement o)
+ {
+ g.GenerateTryCatchFinallyStatement (o);
+ }
+
+ public void Visit (CodeVariableDeclarationStatement o)
+ {
+ g.GenerateVariableDeclarationStatement (o);
+ }
+
+ // CodeTypeMember
+
+ public void Visit (CodeConstructor o)
+ {
+ g.GenerateConstructor (o, g.CurrentClass);
+ }
+
+ public void Visit (CodeEntryPointMethod o)
+ {
+ g.GenerateEntryPointMethod (o, g.CurrentClass);
+ }
+
+ public void Visit (CodeMemberEvent o)
+ {
+ g.GenerateEvent (o, g.CurrentClass);
+ }
+
+ public void Visit (CodeMemberField o)
+ {
+ g.GenerateField (o);
+ }
+
+ public void Visit (CodeMemberMethod o)
+ {
+ g.GenerateMethod (o, g.CurrentClass);
+ }
+
+ public void Visit (CodeMemberProperty o)
+ {
+ g.GenerateProperty (o, g.CurrentClass);
+ }
+
+ public void Visit (CodeSnippetTypeMember o)
+ {
+ g.GenerateSnippetMember (o);
+ }
+
+ public void Visit (CodeTypeConstructor o)
+ {
+ g.GenerateTypeConstructor (o);
+ }
+ }
}
}
Modified: trunk/mcs/class/System/System.dll.sources
===================================================================
--- trunk/mcs/class/System/System.dll.sources 2008-02-10 19:46:47 UTC (rev
95400)
+++ trunk/mcs/class/System/System.dll.sources 2008-02-10 20:01:25 UTC (rev
95401)
@@ -112,6 +112,7 @@
System.CodeDom/CodeTypeReferenceOptions.cs
System.CodeDom/CodeVariableDeclarationStatement.cs
System.CodeDom/CodeVariableReferenceExpression.cs
+System.CodeDom/ICodeDomVisitor.cs
System.CodeDom.Compiler/CodeCompiler.cs
System.CodeDom.Compiler/CodeDomConfigurationHandler.cs
System.CodeDom.Compiler/CodeDomProvider.cs
Modified: trunk/mcs/class/System/net_2_1_System.dll.sources
===================================================================
--- trunk/mcs/class/System/net_2_1_System.dll.sources 2008-02-10 19:46:47 UTC
(rev 95400)
+++ trunk/mcs/class/System/net_2_1_System.dll.sources 2008-02-10 20:01:25 UTC
(rev 95401)
@@ -112,6 +112,7 @@
System.CodeDom/CodeTypeReferenceOptions.cs
System.CodeDom/CodeVariableDeclarationStatement.cs
System.CodeDom/CodeVariableReferenceExpression.cs
+System.CodeDom/ICodeDomVisitor.cs
System.CodeDom.Compiler/CodeCompiler.cs
System.CodeDom.Compiler/CodeDomConfigurationHandler.cs
System.CodeDom.Compiler/CodeDomProvider.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches