diff options
author | Daniel Stodden <stodden@mono-cvs.ximian.com> | 2002-05-28 10:59:57 +0400 |
---|---|---|
committer | Daniel Stodden <stodden@mono-cvs.ximian.com> | 2002-05-28 10:59:57 +0400 |
commit | 1b4e294c5482d90628b5a360be65282dedcfb091 (patch) | |
tree | fdb98da2ba8093e90e363809f9756ac4f857a2e8 /mcs/class/System/System.CodeDom | |
parent | 34dff677c34e6f82e4bc5513c71b74e8e16e4608 (diff) |
big patch:
- System.CodeDom: lotsa corrections
- System.CodeDom.Compiler: CodeGenerator about 80% complete
- Microsoft.CSharp: CSharpCodegenerator intro
svn path=/trunk/mcs/; revision=4980
Diffstat (limited to 'mcs/class/System/System.CodeDom')
22 files changed, 178 insertions, 52 deletions
diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog index 51774b1a5bf..2352f22b91f 100644 --- a/mcs/class/System/System.CodeDom/ChangeLog +++ b/mcs/class/System/System.CodeDom/ChangeLog @@ -1,3 +1,46 @@ +2002-05-28 Daniel Stodden <stodden@in.tum.de> + + * CodeArrayCreateExpression.cs: typo + comments + + * CodeAttributeArgumentCollection.cs: Add() signature fixed + + * CodeAttributeDeclarationCollection.cs: Add() signature fixed + + * CodeCatchClause.cs: ctor signature fixed + + * CodeCatchClauseCollection.cs: Add() signature fixed + + * CodeCommentStatementCollection.cs: Add() signature fixed + + * CodeConstructor.cs: ctor added + + * CodeExpressionCollection.cs: Populate* events: nullref checks + added + + * CodeNamespace.cs: Populate* events: nullref checks added + + * CodeNamespaceCollection.cs: Add() signature fixed + + * CodeParameterDeclarationExpressionCollection.cs: Add() signature + fixed + + * CodeStatementCollection.cs: Add() signature fixed, missing + overload added + + * CodeTypeConstructor.cs: class name typo :P + + * CodeTypeDeclaration.cs: finally figured out how TypeAttributes + work. + + * CodeTypeDeclarationCollection.cs: Add() signature fixed + + * CodeTypeReference.cs: added MonoTODOs. some corrections on array + type behavior. + + * CodeTypeReferenceCollection.cs: Add() signature fixed + + * MemberAttributes.cs: just comments + 2002-05-11 Daniel Stodden <stodden@in.tum.de> * CodeAttributeArgumentCollection.cs: inherits CollectionBase diff --git a/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs index 475ea9c2666..e7bded6024d 100755 --- a/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs +++ b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs @@ -39,7 +39,7 @@ namespace System.CodeDom { } public CodeArrayCreateExpression (CodeTypeReference createType, - params CodeExpression[] inializers ) + params CodeExpression[] initializers ) { this.createType = createType; this.Initializers.AddRange( initializers ); @@ -132,6 +132,12 @@ namespace System.CodeDom { } set { size = value; + // NOTE: Setting Size in ms.Net does + // not supersede SizeExpression + // values. Instead, the CodeGenerator + // seems to always prefer + // SizeExpression if set to a value != + // null. } } } diff --git a/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs index 8c9e8811561..cca43373ae7 100755 --- a/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs @@ -52,9 +52,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeAttributeArgument value) + public int Add (CodeAttributeArgument value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeAttributeArgument [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs index 2691e5dc62a..913641e6ebc 100755 --- a/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs @@ -52,9 +52,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeAttributeDeclaration value) + public int Add (CodeAttributeDeclaration value) { - List.Add (value); + return List.Add (value); } public void AddRange (CodeAttributeDeclaration [] value) diff --git a/mcs/class/System/System.CodeDom/CodeCatchClause.cs b/mcs/class/System/System.CodeDom/CodeCatchClause.cs index bae7fe6c50c..2d5addf592e 100755 --- a/mcs/class/System/System.CodeDom/CodeCatchClause.cs +++ b/mcs/class/System/System.CodeDom/CodeCatchClause.cs @@ -42,7 +42,7 @@ namespace System.CodeDom public CodeCatchClause ( string localName, CodeTypeReference catchExceptionType, - CodeStatement[] statements ) + params CodeStatement[] statements ) { this.localName = localName; this.catchExceptionType = catchExceptionType; diff --git a/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs index 40fb0fcc63e..5cffe97c99f 100755 --- a/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs @@ -50,9 +50,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeCatchClause value) + public int Add (CodeCatchClause value) { - List.Add (value); + return List.Add (value); } public void AddRange (CodeCatchClause [] value) diff --git a/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs b/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs index 4c3a31d4dfe..10372cc686b 100644 --- a/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeCommentStatementCollection.cs @@ -52,9 +52,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeCommentStatement value) + public int Add (CodeCommentStatement value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeCommentStatement [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeConstructor.cs b/mcs/class/System/System.CodeDom/CodeConstructor.cs index e9522ef26ba..bbf99879bb4 100755 --- a/mcs/class/System/System.CodeDom/CodeConstructor.cs +++ b/mcs/class/System/System.CodeDom/CodeConstructor.cs @@ -20,7 +20,14 @@ namespace System.CodeDom { private CodeExpressionCollection baseConstructorArgs; private CodeExpressionCollection chainedConstructorArgs; - + + // + // Constructors + // + public CodeConstructor() + { + } + // // Properties // diff --git a/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs index 33b3c434843..2ee42a1c9d8 100755 --- a/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs @@ -52,9 +52,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeExpression value) + public int Add (CodeExpression value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeExpression [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeMemberMethod.cs b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs index 1b401815451..da7669adb34 100755 --- a/mcs/class/System/System.CodeDom/CodeMemberMethod.cs +++ b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs @@ -39,7 +39,8 @@ namespace System.CodeDom get { if ( implementationTypes == null ) { implementationTypes = new CodeTypeReferenceCollection(); - PopulateImplementationTypes( this, EventArgs.Empty ); + if ( PopulateImplementationTypes != null ) + PopulateImplementationTypes( this, EventArgs.Empty ); } return implementationTypes; } @@ -49,7 +50,8 @@ namespace System.CodeDom get { if ( parameters == null ) { parameters = new CodeParameterDeclarationExpressionCollection(); - PopulateParameters( this, EventArgs.Empty ); + if ( PopulateParameters != null ) + PopulateParameters( this, EventArgs.Empty ); } return parameters; } @@ -66,6 +68,8 @@ namespace System.CodeDom public CodeTypeReference ReturnType { get { + if ( returnType == null ) + return new CodeTypeReference( typeof(void) ); return returnType; } set { @@ -77,7 +81,8 @@ namespace System.CodeDom get { if ( statements == null ) { statements = new CodeStatementCollection(); - PopulateStatements( this, EventArgs.Empty ); + if ( PopulateStatements != null ) + PopulateStatements( this, EventArgs.Empty ); } return statements; } diff --git a/mcs/class/System/System.CodeDom/CodeNamespace.cs b/mcs/class/System/System.CodeDom/CodeNamespace.cs index 3834de4144d..1de1f7dc76b 100755 --- a/mcs/class/System/System.CodeDom/CodeNamespace.cs +++ b/mcs/class/System/System.CodeDom/CodeNamespace.cs @@ -42,7 +42,8 @@ namespace System.CodeDom get { if ( comments == null ) { comments = new CodeCommentStatementCollection(); - PopulateComments( this, EventArgs.Empty ); + if ( PopulateComments != null ) + PopulateComments( this, EventArgs.Empty ); } return comments; } @@ -52,7 +53,8 @@ namespace System.CodeDom get { if ( imports == null ) { imports = new CodeNamespaceImportCollection(); - PopulateImports( this, EventArgs.Empty ); + if ( PopulateImports != null ) + PopulateImports( this, EventArgs.Empty ); } return imports; } @@ -71,7 +73,8 @@ namespace System.CodeDom get { if ( types == null ) { types = new CodeTypeDeclarationCollection(); - PopulateTypes( this, EventArgs.Empty ); + if ( PopulateTypes != null ) + PopulateTypes( this, EventArgs.Empty ); } return types; } diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs b/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs index ca4089a1003..414fc6826ba 100644 --- a/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeNamespaceCollection.cs @@ -51,9 +51,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeNamespace value) + public int Add (CodeNamespace value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeNamespace [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs index f3bfc1064ac..92d73ed42d9 100755 --- a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs @@ -52,9 +52,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeParameterDeclarationExpression value) + public int Add (CodeParameterDeclarationExpression value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeParameterDeclarationExpression [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeStatementCollection.cs b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs index ee3aef48835..85462d76346 100755 --- a/mcs/class/System/System.CodeDom/CodeStatementCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs @@ -52,18 +52,23 @@ namespace System.CodeDom // // Methods // - public void Add (CodeStatement value) + public int Add (CodeStatement value) { - List.Add( value ); + return List.Add( value ); } - public void AddRange (CodeStatement [] value ) + public int Add (CodeExpression value) { - foreach ( CodeStatement elem in value ) + return Add( new CodeExpressionStatement( value ) ); + } + + public void AddRange (CodeStatement [] statements ) + { + foreach ( CodeStatement elem in statements ) Add( elem ); } - public void AddRange (CodeStatementCollection value) + public void AddRange( CodeStatementCollection value ) { foreach ( CodeStatement elem in value ) Add( elem ); diff --git a/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs b/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs index 941b47a61ce..8213bf56c2a 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeConstructor.cs @@ -14,7 +14,7 @@ namespace System.CodeDom [Serializable] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] - public class CodeType + public class CodeTypeConstructor : CodeMemberMethod { } diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs index 05519da0b5f..be0fdc70cff 100755 --- a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs @@ -9,6 +9,7 @@ // using System.Runtime.InteropServices; +using System.Reflection; namespace System.CodeDom { @@ -20,14 +21,14 @@ namespace System.CodeDom { private CodeTypeReferenceCollection baseTypes; private CodeTypeMemberCollection members; - private bool isClass; + private TypeAttributes typeAttributes; private bool isEnum; - private bool isInterface; private bool isStruct; // // Constructors // + public CodeTypeDeclaration() { } @@ -37,6 +38,8 @@ namespace System.CodeDom this.Name = name; } + /* by default, it's a class */ + // // Properties // @@ -44,7 +47,8 @@ namespace System.CodeDom get { if ( baseTypes == null ) { baseTypes = new CodeTypeReferenceCollection(); - PopulateBaseTypes( this, EventArgs.Empty ); + if ( PopulateBaseTypes != null ) + PopulateBaseTypes( this, EventArgs.Empty ); } return baseTypes; } @@ -52,10 +56,20 @@ namespace System.CodeDom public bool IsClass { get { - return isClass; + if ( (typeAttributes & TypeAttributes.Interface) != 0 ) + return false; + if ( isEnum ) + return false; + if ( isStruct ) + return false; + return true; } set { - isClass = value; + if ( value ) { + typeAttributes &= ~TypeAttributes.Interface; + isEnum = false; + isStruct = false; + } } } @@ -64,16 +78,24 @@ namespace System.CodeDom return isEnum; } set { - isEnum = value; + if ( value ) { + typeAttributes &= ~TypeAttributes.Interface; + isEnum = true; + isStruct = false; + } } } public bool IsInterface { get { - return isInterface; + return (typeAttributes & TypeAttributes.Interface) != 0; } set { - isInterface = value; + if ( value ) { + typeAttributes |= TypeAttributes.Interface; + isEnum = false; + isStruct = false; + } } } @@ -82,7 +104,11 @@ namespace System.CodeDom return isStruct; } set { - isStruct = value; + if ( value ) { + typeAttributes &= ~TypeAttributes.Interface; + isEnum = false; + isStruct = true; + } } } @@ -90,12 +116,29 @@ namespace System.CodeDom get { if ( members == null ) { members = new CodeTypeMemberCollection(); - PopulateMembers( this, EventArgs.Empty ); + if ( PopulateMembers != null ) + PopulateMembers( this, EventArgs.Empty ); } return members; } } + public TypeAttributes TypeAttributes { + get { + return typeAttributes; + } + set { + typeAttributes = value; +#if FALSE + /* MS does not seem to do this, so don't I */ + if ( (typeAttributes & TypeAttributes.Interface) != 0 ) { + isEnum = false; + isStruct = false; + } +#endif + } + } + // // Events // diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs index ac017887b64..9c1c2a1a3b3 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeDeclarationCollection.cs @@ -51,9 +51,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeTypeDeclaration value) + public int Add (CodeTypeDeclaration value) { - List.Add (value); + return List.Add (value); } public void AddRange (CodeTypeDeclaration [] value) diff --git a/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs b/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs index 470d80f25e0..27ef5a95b76 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeDelegate.cs @@ -53,4 +53,3 @@ namespace System.CodeDom } } } - diff --git a/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs index b0690209f77..54b49418590 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeMemberCollection.cs @@ -51,9 +51,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeTypeMember value) + public int Add (CodeTypeMember value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeTypeMember [] value ) diff --git a/mcs/class/System/System.CodeDom/CodeTypeReference.cs b/mcs/class/System/System.CodeDom/CodeTypeReference.cs index f466b93ab6f..2f66b093333 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeReference.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeReference.cs @@ -18,7 +18,7 @@ namespace System.CodeDom : CodeObject { private string baseType; - private CodeTypeReference elementType; + private CodeTypeReference arrayType; private int rank; // @@ -35,13 +35,16 @@ namespace System.CodeDom } // FIXME: probably broken - public CodeTypeReference( CodeTypeReference baseType, int rank ) + [MonoTODO] + public CodeTypeReference( CodeTypeReference arrayType, int rank ) { - this.baseType = typeof(System.Array).Name; + this.arrayType = arrayType; + this.baseType = arrayType.BaseType; this.rank = rank; } // FIXME: probably broken + [MonoTODO] public CodeTypeReference( string baseType, int rank ) { this.baseType = baseType; @@ -52,18 +55,21 @@ namespace System.CodeDom // // Properties // + // FIXME: probably broken + [MonoTODO] public CodeTypeReference ArrayElementType { get { - return elementType;; + return arrayType; } set { - elementType = value; + arrayType = value; } } // FIXME: probably broken + [MonoTODO] public int ArrayRank { get { return rank; @@ -72,5 +78,14 @@ namespace System.CodeDom rank = value; } } + + public string BaseType { + get { + return baseType; + } + set { + baseType = value; + } + } } } diff --git a/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs b/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs index 76d1da51354..e4e5302ba3a 100644 --- a/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs +++ b/mcs/class/System/System.CodeDom/CodeTypeReferenceCollection.cs @@ -51,9 +51,9 @@ namespace System.CodeDom // // Methods // - public void Add (CodeTypeReference value) + public int Add (CodeTypeReference value) { - List.Add( value ); + return List.Add( value ); } public void AddRange (CodeTypeReference [] value ) diff --git a/mcs/class/System/System.CodeDom/MemberAttributes.cs b/mcs/class/System/System.CodeDom/MemberAttributes.cs index 2eb030c147a..5097375c798 100755 --- a/mcs/class/System/System.CodeDom/MemberAttributes.cs +++ b/mcs/class/System/System.CodeDom/MemberAttributes.cs @@ -28,7 +28,7 @@ namespace System.CodeDom { Overloaded = 0x00000100, Assembly = 0x00001000, // internal - FamilyAndAssembly = 0x00002000, + FamilyAndAssembly = 0x00002000, // protected AND internal Family = 0x00003000, // protected FamilyOrAssembly = 0x00004000, // protected internal Private = 0x00005000, // private |