1 2005-03-10 Marek Safar <marek.safar@seznam.cz>
3 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
4 It caused exception in namespace resolving (again!).
6 * class.cs (Class.ctor): Removed exit.
7 (PropertyMethod.ctor): ditto.
9 * codegen.cs (Codegen.Reset): Reset static data.
10 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
12 * cs-tokenizer.cs (Cleanup): Removed.
14 * driver.cs (GetSystemDir): Rewrote to one line command.
15 It caused problem with unloaded dynamic modules.
16 (UnixParseOption): Removed Exit.
17 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
18 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
19 Now can be mcs used as library.
21 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
24 * location.cs (Reset): Reset static data.
26 * namespace.cs (Reset): Reset static data.
28 * report.cs (Report.Reset): Reset static data.
30 * rootcontext.cs (RootContext.Reset): Reset static data.
32 * tree.cs (RootTypes.ctor): Use Location.Null
34 * typemanager.cs (TypeManager.Reset): Reset static data.
35 (CoreLookupType): Removed Exit.
36 (TypeHandle.Reset): Reset static data.
38 2005-03-10 Raja R Harinath <rharinath@novell.com>
41 * typemanager.cs (ComputeNamespaces): Import namespaces from
42 referenced modules too.
44 2005-03-09 Raja R Harinath <rharinath@novell.com>
46 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
49 2005-03-09 Raja R Harinath <rharinath@novell.com>
51 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
52 enclosing DeclSpace. This ensures that a name-lookup populates
53 more caches and there are fewer 'TypeExpression's. Carve out
54 nested type lookup into ...
55 (LookupNestedTypeInHierarchy): ... this.
57 2005-03-09 Raja R Harinath <rharinath@novell.com>
59 Clean up a few partial-class semantics.
60 Fixes test-357.cs and cs1618-2.cs.
61 * cs-parser.jay (struct_declaration): Use 'current_class' as
62 parent of newly-created struct. Remove call to Register ().
63 Use 'pop_current_class' to complete handing the current struct.
64 (interface_declaration): Likewise.
65 (class_declaration): Likewise.
66 (enum_declaration): Use 'current_class' as parent of newly created
68 (delegate_declaration): Likewise.
69 (pop_current_class): New function. This is used to handle closing
70 up the 'current_class' and 'current_container', and pointing them
71 to the enclosing class/container.
72 (CSharpParser): Initialize 'current_class' too.
73 * decl.cs (MemberCore): Add check for invariant: a partial
74 container is not a parsed entity, and thus does not enclose any
76 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
77 (DeclSpace.BaseTypeExpr): Use it.
78 (DeclSpace.LookupType): Add check for invariant.
79 * class.cs (TypeContainer): Add check for invariant: a nested
80 class should have the same NamespaceEntry as its enclosing class.
81 (TypeContainer.EmitFieldInitializers): Make virtual.
82 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
84 (TypeContainer.Register): Remove.
85 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
86 null. Use TypeResolveEmitContext for resolving base types and
87 interfaces. Move initialization of Parts.TypeBuilder here from
89 (TypeContainer.DefineNestedTypes): ... here.
90 (PartialContainer): Take a Namespace not a NamespaceEntry.
91 (PartialContainer.Create): Don't use Register. Call the
92 appropriate Add... function directly.
93 (ClassPart): Take both the PartialContainer and the enclosing
94 class as constructor arguments.
95 (ClassPart.EmitFieldInitializers): Override.
96 (ClassPart.PartFindNestedTypes): Remove.
97 (FieldBase.GetInitializerExpression): Resolve the initializer
98 expression in the emit context of the enclosing class.
99 * tree.cs (RootTypes): Remove Register ().
101 2005-03-08 Marek Safar <marek.safar@seznam.cz>
103 * cs-parser.jay: Removed CS0134.
105 * driver.cs: Removed CS1901.
107 * expression.cs (SizeOf.DoResolve): Don't report CS0233
108 for predefined types.
110 2005-03-07 Duncan Mak <duncan@novell.com>
112 * codegen.cs (Save): Catch UnauthorizedAccessException as
113 well. Fixes bug #73454.
115 2005-03-07 Marek Safar <marek.safar@seznam.cz>
117 * cs-tokenizer.cs (xtoken): Add CS1035.
119 * class.cs (MethodData.Define): Add CS0683.
120 (FieldMember.ctor): Add CS0681.
122 2005-03-07 Raja R Harinath <rharinath@novell.com>
124 * ecore.cs (SimpleName.DoResolve): Rename from
125 SimpleName.DoResolveAllowStatic.
126 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
127 Pass 'intermediate' flag to MemberStaticCheck.
128 (SimpleName.MemberStaticCheck): Skip "static check" only in case
129 of "intermediate" lookups via MemberAccess.
130 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
131 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
133 2005-03-07 Raja R Harinath <rharinath@novell.com>
136 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
137 slipped in because of variable names that are identical to a
138 builtin type's BCL equivalent ('string String;', 'int Int32;').
139 (PropertyExpr.EmitInstance): Likewise.
141 2005-03-04 Marek Safar <marek.safar@seznam.cz>
143 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
145 * report.cs (warning_ignore_table): Made public.
147 2005-03-04 Raja R Harinath <rharinath@novell.com>
150 * class.cs (MethodData.Emit): Pass 'container' to
151 container.GetObsoleteAttribute instead of 'container.Parent'.
153 2005-03-03 Marek Safar <marek.safar@seznam.cz>
155 * cs-parser.jay: Add 1534 error test.
157 * iterators.cs (Yield.CheckContext): Add error 1629.
158 (Iterator.ctor): Save unsafe modifier.
159 (MoveNextMethod.DoEmit): Restore unsafe context.
161 * namespace.cs (UsingAlias): Better error message.
163 2005-03-03 Dan Winship <danw@novell.com>
165 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
166 the warning message [#73219]
168 2005-03-03 Raja R Harinath <rharinath@novell.com>
170 Fix compile with MCS 1.0.0.0.
171 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
172 w_restore to not depend on string constant folding.
174 2005-03-03 Raja R Harinath <rharinath@novell.com>
176 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
177 CS0246 check to users who passed 'silent = false'.
178 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
180 (SimpleName.SimpleNameResolve): Update.
181 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
182 (MemberAccess.IdenticalNameAndTypeName): Update.
183 * doc.cs (FindDocumentedTypeNonArray): Update.
185 2005-03-03 Raja R Harinath <rharinath@novell.com>
187 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
188 * parameters.cs (ComputeAndDefineParameters): Remove.
189 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
190 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
191 Use GetParameterInfo.
193 2005-03-02 Marek Safar <marek.safar@seznam.cz>
195 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
197 2005-03-02 Raja R Harinath <rharinath@novell.com>
199 Unify DeclSpace.LookupType and DeclSpace.FindType.
200 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
201 is in charge of defining nested types on demand.
202 (DeclSpace.LookupType): Use it when the current_type is a
203 TypeBuilder. Use LookupTypeDirect for reflected types.
204 (DeclSpace.FindType): Remove.
205 (DeclSpace.LookupInterfaceOrClass): Likewise.
206 (DeclSpace.DefineTypeAndParents): Likewise.
207 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
208 DeclSpace.LookupType.
209 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
210 * typemanager.cs (LookupType): Simplify.
211 (AddUserType): Remove type from negative_hits.
212 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
213 * class.cs (TypeContainer.FindMembers): Move handling of nested
215 (TypeContainer.FindMembers_NestedTypes): ... here.
216 (TypeContainer.FindNestedType): Implement override.
217 (ClassPart.FindNestedType): Delegate to PartialContainer.
218 (ClassPart.PartFindNestedType): Looks up the nested types of the
221 2005-03-02 Martin Baulig <martin@ximian.com>
223 * class.cs (TypeContainer.DoDefineMembers): We also need a default
224 static constructor in static classes.
226 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
228 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
229 sizeParamIndex is not specified.
231 2005-03-01 Marek Safar <marek.safar@seznam.cz>
234 * report.cs (WarningMessage.IsEnabled): Missing null check.
236 2005-02-28 Marek Safar <marek.safar@seznam.cz>
238 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
239 in the fields and not in the properties.
241 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
243 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
246 2005-02-28 Marek Safar <marek.safar@seznam.cz>
248 * attribute.cs: Small refactoring (improved robustness).
249 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
250 (ValidateGuid): Removed.
251 (Resolve): Removed referenced to above mentioned.
252 (GetAttributeUsage): Made private and changed to work without
254 (GetIndexerAttributeValue): Don't crash.
255 (GetConditionalAttributeValue): Ditto.
256 (GetClsCompliantAttributeValue): Ditto.
257 (ExtractSecurityPermissionSet): All attributes exceptions are
259 (GetPropertyValue): New helper.
260 (GetMethodImplOptions): New method.
261 (DefinePInvokeMethod): Reuse common code. Implemented handling of
262 some missing properties.
264 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
265 (Method.ApplyAttributeBuilder): Updated.
267 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
270 2005-02-28 Raja R Harinath <rharinath@novell.com>
273 * report.cs (Report.SymbolRelatedToPreviousError): Handle
274 non-simple types (array, pointer, reference).
276 2005-02-28 Marek Safar <marek.safar@seznam.cz>
278 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
280 * class.cs (MethodCore.IsDuplicateImplementation): Special error
282 (Method.CheckBase): Catch wrong destructor here.
283 (MethodData.Define): Add errors 550, 668.
285 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
287 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
289 * pending.cs (VerifyPendingMethods): Add error 551.
291 * typemanager.cs (CSharpName): Next error report helper.
293 2005-02-25 Marek Safar <marek.safar@seznam.cz>
295 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
296 attributes. Removed useless attribute double check.
297 It saves almost 2MBs for corlib.
299 2005-02-25 Raja R Harinath <rharinath@novell.com>
302 * statement.cs (ExpressionStatement.Resolve): Make robust to being
303 called twice in case of error.
305 2005-02-23 Chris Toshok <toshok@ximian.com>
307 Fix compiler portions of #72827.
308 * statement.cs (Block.Emit): call Begin/EndScope on the
309 EmitContext instead of the ILGenerator.
311 * codegen.cs (EmitContext.BeginScope): new method, call
312 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
314 (EmitContext.BeginScope): same, but EndScope and CloseScope
316 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
317 offset and call the superclass's OpenScope(int) with it.
318 (SymbolWriter.CloseScope): get the current il
319 offset and call superclass's CloseScope(int) with it.
321 2005-02-23 Marek Safar <marek.safar@seznam.cz>
323 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
324 CS1677 for out and ref as well.
326 * class.cs (Method.Define): Add error CS1599 detection.
328 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
330 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
332 * delegate.cs (Delegate.Define): Add error CS1599 detection.
334 * support.cs.cs (ModifierDesc): New helper method.
336 2005-02-23 Raja R Harinath <rharinath@novell.com>
337 Abin Thomas <projectmonokochi@rediffmail.com>
338 Anoob V E <projectmonokochi@rediffmail.com>
339 Harilal P R <projectmonokochi@rediffmail.com>
342 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
343 MemberLookup (used for error reporting) actually returns a result.
344 Fix error report number (122, not 112).
346 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
347 Anoob V E <projectmonokochi@rediffmail.com>
348 Harilal P R <projectmonokochi@rediffmail.com>
351 * pending.cs (PendingImplementation.GetAbstractMethods):
352 Find NonPublic members too.
354 2005-02-22 Marek Safar <marek.safar@seznam.cz>
356 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
359 * class.cs (MethodCore.CheckMethodAgainstBase):
360 Add error 239 report.
362 2005-02-21 Raja R Harinath <rharinath@novell.com>
365 * expression.cs (Invocation.IsApplicable): Make public.
366 (Invocation.IsParamsMethodApplicable): Likewise.
367 * delegate.cs (Delegate.VerifyApplicability): Don't use
368 Invocation.VerifyArgumentCompat for parameter applicability
369 testing. Use Invocation.IsApplicable and
370 Invocation.IsParamsMethodApplicable.
372 2005-02-21 Marek Safar <marek.safar@seznam.cz>
374 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
376 * class.cs (Operator.Define): Add error 217 report.
378 2005-02-21 Raja R Harinath <rharinath@novell.com>
380 * namespace.cs (UsingEntry.Resolve): Undo change below.
382 2005-02-21 Raja R Harinath <rharinath@novell.com>
385 * ecore.cs (Expression.MemberLookupFailed): Add argument to
386 disable the error message when the extended MemberLookup also
388 (Expression.MemberLookupFinal): Update.
389 (SimpleName.DoSimpleNameResolve): Update.
390 * expression.cs (MemberAccess.ResolveNamespaceOrType):
391 Don't use MemberLookupFinal.
392 (New.DoResolve): Update.
393 (BaseAccess.CommonResolve): Update.
395 2005-02-21 Raja R Harinath <rharinath@novell.com>
398 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
399 occured previously, don't resolve again.
401 2005-02-21 Marek Safar <marek.safar@seznam.cz>
404 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
405 argument. Call ResolveAttributeUsage for unresolved.
406 when types doesn't match ctor arguments.
408 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
409 for nested attribute classes.
410 (Class.attribute_usage): Removed.
411 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
414 * ecore.cs (IsAttribute): Removed.
416 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
418 * rootcontext.cs (RegisterAttribute): Removed, attributes are
420 (attribute_types): Removed.
421 (EmitCode): Global attributes are emited as the latest.
423 2005-02-18 Marek Safar <marek.safar@seznam.cz>
425 * class.cs (EmitFieldInitializers): Don't emit field initializer
426 for default values when optimilization is on.
428 * constant.cs (Constant.IsDefaultValue): New property.
430 * driver.cs: Add /optimize handling.
434 * literal.cs: Implement new IsDefaultValue property.
436 * rootcontext.cs (Optimize): New field, holds /optimize option.
438 2005-02-18 Raja R Harinath <rharinath@novell.com>
440 Fix crasher in re-opened #72347.
441 * namespace.cs (Namespace.Lookup): Return null if
442 DeclSpace.DefineType returns null.
445 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
447 2005-02-18 Raja R Harinath <rharinath@novell.com>
449 Fix remainder of #63202. Change semantics of DoResolveLValue: it
450 now returns null if it cannot resolve to an lvalue.
451 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
452 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
453 returned null. Remove check for SimpleName.
454 (EventExpr.DoResolveLValue): New.
455 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
456 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
458 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
460 (Unary.ResolveOperator): Move CS0211 check ...
461 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
463 (Unary.DoResolveLValue): Simplify.
464 (AddressOf.DoResolveLValue): New.
465 (ArrayAccess.DoResolveLValue): New.
467 2005-02-16 Marek Safar <marek.safar@seznam.cz>
469 * attribute.cs (Attribute.Resolve): Add arguments casting for
470 when types doesn't match ctor arguments.
472 2005-02-16 Raja R Harinath <rharinath@novell.com>
475 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
476 lookup of operator in base type. Ensure that all checks happen
477 when the operator resolves to an "op_..." method.
479 2005-02-15 Raja R Harinath <rharinath@novell.com>
482 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
483 'ignore_cs0104' parameter. Pass it to ...
484 (NamespaceEntry.Lookup): ... this.
485 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
486 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
487 (TypeLookupExpression.DoResolveAsTypeStep): Update.
488 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
489 Update. Request that cs0104 errors be ignored.
490 (ComposedCast.ResolveAsTypeStep): Update.
492 2005-02-14 Raja R Harinath <rharinath@novell.com>
495 * expression.cs (Invocation.BetterFunction): Remove support for
496 comparing virtual functions and their overrides.
497 (Invocation.IsOverride): New.
498 (Invocation.OverloadResolve): Don't consider 'override' functions
499 during candidate selection. Store them in a lookaside list.
500 If the selected method is a 'virtual' function, use the list to
501 find any overrides that are closer to the LHS type.
503 2005-02-14 Marek Safar <marek.safar@seznam.cz>
505 * expression.cs (New.DoResolve): Add complex core type reduction.
506 (New.Constantify): Converts complex core type syntax like 'new int ()'
509 2005-02-14 Raja R Harinath <rharinath@novell.com>
511 * decl.cs (EntryType.EntryType): New constructor to create an
512 updated copy of a cache entry.
513 (MemberCache.AddMethods): Use it.
514 (MemberCache.ClearDeclaredOnly): Remove.
515 (MemberCache.MemberCache): Update.
517 2005-02-11 Miguel de Icaza <miguel@novell.com>
519 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
520 variable. This one is represents the actual low-level declaration
521 of the method, as opposed to the semantic level `IsStatic'.
523 An anonymous method which is hosted into a static method might be
524 actually an instance method. IsStatic would reflect the
525 container, while MethodIsStatic represents the actual code
528 * expression.cs (ParameterReference): Use the new MethodIsStatic
531 * anonymous.cs (AnonymousMethod.Compatible): Pass the
532 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
533 set on the current EmitContext.
535 * expression.cs (Cast): Overload DoResolveLValue so we can pass
536 resolve our casted expression as an LValue. This triggers the
537 proper LValue processing that is later required by Assign.
541 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
543 2005-02-11 Marek Safar <marek.safar@seznam.cz>
545 C# 2.0 Fixed buffer implementation
547 * anonymous.cs: Update after RegisterHelperClass renaming.
549 * attribute.cs (AttributeTester.fixed_buffer_cache):
550 Cache of external fixed buffers.
551 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
552 implementation if field is fixed buffer else null.
555 (TypeContainer.AddField): Accept FieldMember instead of Field.
556 (FieldBase.IsFieldClsCompliant): Extracted code from
557 VerifyClsCompliance descendant customization.
558 (FixedField): New class handles fixed buffer fields.
559 (FixedFieldExternal): Keeps information about imported fixed
561 (IFixedField): Make access to internal or external fixed buffer
564 * cs-parser.jay: Add fixed buffer parsing.
566 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
569 * expression.cs (Indirection): Extended implementation to accept
571 (PointerArithmetic.Emit): Get element from fixed buffer as well.
572 (ElementAccess.MakePointerAccess): Get type as parameter.
573 (DoResolve): Add fixed buffer field expression conversion.
574 (DoResolveLValue): Ditto.
575 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
576 (ArrayPtr): Derives from FixedBufferPtr.
577 (ArrayPtr.Emit): Add extra emit for array elements.
579 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
581 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
582 for compiler generated types.
583 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
585 * statement.cs (Fixed): Refactored to be easier add fixed buffer
586 and consume less memory.
587 (Fixed.Resolve): Add fixed buffer case.
589 * typemanager.cs (compiler_generated_attr_ctor,
590 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
591 (HasElementType): Add our own implementation to work on every
594 2005-02-11 Miguel de Icaza <miguel@novell.com>
596 * anonymous.cs (CaptureContext): Track whether `this' has been
599 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
600 only captured `this' if it was implicitly done (instance
601 methods/variables were used).
603 * codegen.cs (EmitContext.CaptureThis): New method to flag that
604 `this' must be captured.
606 2005-01-30 Miguel de Icaza <miguel@novell.com>
608 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
609 is null it means that there has been no need to capture anything,
610 so we just create a sibling.
612 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
614 Just a partial fix. The other half is fairly elusive.
616 2005-02-10 Raja R Harinath <rharinath@novell.com>
618 Fix #52586, cs0121-4.cs.
619 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
620 and return a hashtable.
621 (MemberCache.ClearDeclaredOnly): New.
622 (MemberCache.MemberCache): Update to change. Make a deep copy of
623 the method_hash of a base type too.
624 (MemberCache.AddMethods): Adapt to having a deep copy of the base
625 type methods. Overwrite entries with the same MethodHandle so
626 that the ReflectedType is correct. The process leaves in base
627 virtual functions and their overrides as distinct entries.
628 (CacheEntry): Now a class instead of a struct. It shouldn't alter
629 matters since it was boxed in a ArrayList before.
630 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
632 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
633 case of a virtual function and its override (choose the overload
635 (Invocation.OverloadResolve): Avoid 'override' members during
636 'applicable_type' calculation.
638 2005-02-09 Raja R Harinath <rharinath@novell.com>
640 Combine two near-redundant caches.
641 * typemanager.cs (method_params): Rename from method_internal_params.
642 (TypeManager.GetParameterData): New. Replace
643 Invocation.GetParameterData.
644 (TypeManager.LookupParametersByBuilder): Remove.
645 * expression.cs (Invocation.method_parameter_cache): Remove.
646 (Invocation.GetParameterData): Remove.
648 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
651 2005-02-08 Raja R Harinath <rharinath@novell.com>
654 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
655 TypeManager.multicast_delegate_type is null, resolve it by looking
656 up "System.MulticastDelegate".
657 * rootcontext.cs (RootContext.ResolveCore): Simplify.
659 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
660 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
661 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
664 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
665 (LabeledStatement.AddReference): New. Set 'referenced'.
666 (Goto.Resolve): Use it.
668 2005-02-05 John Luke <john.luke@gmail.com>
670 * driver.cs: remove duplicate -doc line in Usage ()
672 2005-02-04 Raja R Harinath <rharinath@novell.com>
674 * location.cs (Location.AddFile): Fix CS2002 error report.
676 2005-02-02 Martin Baulig <martin@ximian.com>
678 * delegate.cs (Delegate.DefineType): Report an internal error if
679 TypeManager.multicast_delegate_type is null. See bug #72015 for
682 2005-02-02 Raja R Harinath <rharinath@novell.com>
684 Fix a crasher in a variant of #31984.
685 * const.cs (Constant.CheckBase): New override that defers the
686 new-or-override check in case the base type hasn't been populated
688 (Constant.Define): Ensure the new-or-override check is performed.
690 2005-02-01 Duncan Mak <duncan@ximian.com>
692 * const.cs (LookupConstantValue): Check that `ce' is not null
693 before calling GetValue ().
695 2005-02-01 Raja R Harinath <rharinath@novell.com>
697 Fix test-334.cs (#69519).
698 * cs-parser.jay (using_alias_directive): Pass in an expression to
699 NamespaceEntry.UsingAlias.
700 (using_namespace_directive): Pass in an expression to
701 NamespaceEntry.Using.
702 (namespace_name): Don't flatten to a string.
703 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
704 (NamespaceEntry.AliasEntry.Resolve): Lookup using
706 (NamespaceEntry.UsingEntry): Likewise.
707 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
709 (NamespaceEntry.LookupForUsing): Remove.
710 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
712 (NamespaceEntry.Lookup): Remove support for dotted names.
714 2005-02-01 Raja R Harinath <rharinath@novell.com>
716 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
718 (NamespaceEntry.ImplicitParent): Compute on demand.
719 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
720 parallels the current.
721 (NamespaceEntry.LookupForUsing): Use it.
722 (NamespaceEntry.Lookup): If the current namespace-entry is
723 implicit, don't search aliases and using tables.
725 2005-02-01 Raja R Harinath <rharinath@novell.com>
728 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
730 (TypeContainer.BaseCache): Compute on demand.
731 (TypeContainer.FindMembers): Define constants and types if they're
733 (FieldMember.Define): Move resetting of ec.InUnsafe before error
735 * const.cs (Constant.Define): Make idempotent.
737 2005-01-29 Miguel de Icaza <miguel@novell.com>
739 * pending.cs: Produce better code (no nops produced by using Ldarg
742 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
743 i - 1' it should be arg + 1.
747 2005-01-28 Raja R Harinath <rharinath@novell.com>
749 * attribute.cs (Attribute.CheckAttributeType): Make private
751 (Attribute.ResolveType): Make virtual.
752 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
753 handling of RootContext.Tree.Types.
755 2005-01-27 Raja R Harinath <rharinath@novell.com>
757 Update attribute-handling to use the SimpleName/MemberAccess
759 * cs-parser.jay (attribute): Pass in an expression to the
760 constructors of Attribute and GlobalAttribute.
761 * attribute.cs (Attribute): Take an expression for the name.
762 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
763 passed in attribute name expression.
764 (Attribute.CheckAttributeType): Use it.
765 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
766 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
767 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
768 argument to prevent error messages if the lookup fails.
770 2005-01-27 Marek Safar <marek.safar@seznam.cz>
772 * expression.cs (Indirection): Implemented IVariable interface
773 to support indirection in AddressOf operator.
774 (PointerArithmetic.Emit): Add optimalization for case where
775 result can be precomputed.
777 2005-01-26 Martin Baulig <martin@ximian.com>
779 * class.cs (TypeContainer.AttributeTargets): Return the correct
780 AttributeTargets depending on our `Kind' instead of throwing an
781 exception; fixes #71632.
783 2005-01-26 Marek Safar <marek.safar@seznam.cz>
786 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
789 2005-01-25 Raja R Harinath <rharinath@novell.com>
792 * expression.cs (MemberAccess.DoResolve): Don't complain with
793 cs0572 when the LHS of a member access has identical name and type
796 2005-01-25 Marek Safar <marek.safar@seznam.cz>
799 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
801 Create custom PermissionSet only for PermissionSetAttribute.
803 2005-01-24 Marek Safar <marek.safar@seznam.cz>
806 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
807 delegates in static class.
809 2005-01-24 Martin Baulig <martin@ximian.com>
811 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
812 merging an implicit block, just use its reachability.
814 * statement.cs (Block.Resolve): Make the unreachable code check
815 work wrt. implicit blocks; see test-337 from #63842.
817 2005-01-21 Alp Toker <alp@atoker.com>
819 * cs-parser.jay: destructor_declaration's container is PartialContainer
820 not Class when partial types are used, so use Kind prop instead of
823 2005-01-22 Miguel de Icaza <miguel@ximian.com>
825 * cs-parser.jay: Improve error reporting when an interface
828 2005-01-20 Dick Porter <dick@ximian.com>
830 * support.cs: SeekableStreamReader fix from Sandor Dobos
831 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
832 chars are read. Fixes bug 70369.
834 2005-01-20 Raja R Harinath <rharinath@novell.com>
836 * cs-parser.jay (catch_clause): Simplify current_block handling
839 2005-01-17 Miguel de Icaza <miguel@ximian.com>
841 * convert.cs (ImplicitStandardConversionExists): Synchronize the
842 code with ImplicitStandardConversion to handle the implicit
843 conversion of method groups into valid delegate invocations.
845 The problem is that in parameter handling we were using this code
846 path. Fixes bug #64698
848 2005-01-19 Raja R Harinath <rharinath@novell.com>
850 * cs-parser.jay: Fix several infelicities.
851 - Avoid assigning to the parser value stack. Code like
852 '$3 = null' is unclean. Synthesize a value for the code block
854 - Avoid using oob_stack for storing location information. Use ...
855 (_mark_): ... this. New (empty) rule. Saves the current location
857 (foreach_statement): Avoid using oob_stack for current_block
858 handling. Use technique used in for_statement and
859 using_statement. Synthesize a value for the code block to store
860 additional intermediate information.
862 2005-01-13 Miguel de Icaza <miguel@ximian.com>
864 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
865 of a different type is only allowed to private fields of a
866 containing type, not on fields of a base class.
868 See test-174.cs and error cs0122-9.cs
870 2005-01-13 Raja R Harinath <rharinath@novell.com>
872 Fix test-335.cs (bug #58126).
873 * cs-parser.jay (argument): Split out non-expression parts of the
874 rule into 'non_simple_argument'.
875 (invocation_expression): Support parenthesized invocations with
876 multiple arguments, and with single non-simple arguments.
878 2005-01-13 Raja R Harinath <rharinath@novell.com>
880 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
883 2005-01-12 Raja R Harinath <rharinath@novell.com>
885 Fix cs0038-1.cs, cs1640-6.cs.
886 * ecore.cs (Expression.Resolve): Remove special-case for
887 SimpleName in error-handling.
888 (Expression.almostMatchedMembers): Relax access permission to
890 (Expression.MemberLookupFailed): Handle duplicates in
891 almostMatchedMembers list.
892 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
893 * expression.cs (New.DoResolve): Report CS1540 for more cases.
894 * typemanager.cs (GetFullNameSignature): Use the MethodBase
895 overload if the passed in MemberInfo is a MethodBase.
897 2005-01-12 Marek Safar <marek.safar@seznam.cz>
900 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
901 for non-CAS & merge permission sets properly.
903 2005-01-11 Raja R Harinath <rharinath@novell.com>
905 Improve standard-compliance of simple name and member access
906 resolution. Fixes bugs #52697, #57200, #67520, #69519.
907 * ecore.cs (FullNamedExpression): New abstract base class
908 for Namespaces and TypeExpressions.
909 (ResolveFlags.SimpleName): Remove.
910 (SimpleName): Remove support for dotted names.
911 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
912 DeclSpace.FindType and DeclSpace.LookupType.
913 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
914 (Expression.ExprClassName): Make member function.
915 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
916 a namespace. Remove creation of dotted "SimpleName"s.
917 (MemberAccess.DoResolve): Likewise.
918 * decl.cs (DeclSpace.Cache): Make private.
919 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
920 (DeclSpace.FindType): Update.
921 (DeclSpace.LookupType): Move here from RootContext. Return a
923 * namespace.cs (Namespace): Derive from FullNamedExpression
924 so that it can be part of expression resolution.
925 (Namespace.Lookup): Return an FullNamedExpression.
926 (NamespaceEntry.LookupAlias): Lookup aliases only in current
928 * rootcontext.cs (NamespaceLookup): Remove.
929 (LookupType): Move to DeclSpace.
930 * attribute.cs (CheckAttributeType): Update.
931 * doc.cs (FindDocumentedType): Remove allowAlias argument.
932 (FindDocumentedTypeNonArray): Likewise.
934 2005-01-11 Raja R Harinath <rharinath@novell.com>
936 Fix cs0509.cs, cs1632.cs.
937 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
938 is the same as IsInterface.
939 (TypeContainer.GetClassBases): Likewise.
940 * statement.cs (LabeledStatement.ig): New field.
941 (LabeledStatement.LabelTarget): Save ILGenerator which created the
943 (LabeledStatement.DoEmit): Check that the label was created with
944 the same ILGenerator.
946 2005-01-10 Marek Safar <marek.safar@seznam.cz>
949 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
950 accessors to its properties.
952 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
953 from accessors to property.
955 2005-01-10 Marek Safar <marek.safar@seznam.cz>
958 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
961 2005-01-08 Miguel de Icaza <miguel@ximian.com>
963 * attribute.cs: Check for null and empty strings.
965 I have lost another battle to Paolo.
967 2005-01-07 Marek Safar <marek.safar@seznam.cz>
970 * class.cs (PropertyMethod): Set Parent field in ctors.
971 (SetMethod.InternalParameters): Add unsafe switch hack.
972 Override MarkForDuplicationCheck where it is appropriate.
974 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
975 It says whether container allows members with the same name.
977 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
978 Removed is_method parameter.
980 2005-01-06 Duncan Mak <duncan@ximian.com>
982 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
983 because the previous change led to incorrect reporting of CS1032
984 ("Cannot define/undefine preprocessor symbols after first token in
985 file"). Instead of using `tokens_seen' as the only flag that
986 triggers CS1040, introduce `comments_seen'. This new flag is used
987 to signify having seen comments on the current line, so it is
988 unset after a newline.
990 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
992 * doc.cs : When searching for a type, find nested type too.
993 This fixes bug #71040.
995 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
998 - Warn missing member comment on those classes which also does not
999 have doc comments. Fixed bug #71041.
1000 - Don't warn missing doc comment on default constructor.
1003 2005-01-06 Duncan Mak <duncan@ximian.com>
1005 * cs-tokenizer.cs (xtoken): After handling traditional C-style
1006 comments, set `tokens_seen' to true. This allows us to detect
1007 misplaced preprocessor directives (i.e. not at the beginning of
1008 the a line, nor after whitespaces). In that case, report error
1009 CS1040. This fixes bug #56460.
1011 * cs-parser.jay (interface_member_declaration): Add checks for
1012 IsExplicitImpl, and report CS0541 error if an interface member is
1013 defined as an explicit interface declaration.
1015 2005-01-06 Marek Safar <marek.safar@seznam.cz>
1018 * class.cs (PropertyMethod): Set Parent field in ctors.
1019 (SetMethod.InternalParameters): Add unsafe switch hack.
1021 * decl.cs (MemberCore.Parent): Cannot be readonly.
1023 2005-01-06 Raja R Harinath <rharinath@novell.com>
1025 * decl.cs (DeclSpace.ResolveType): Remove.
1026 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
1027 Merge in code from ...
1028 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
1029 * class.cs, enum.cs: Update to changes.
1031 2005-01-06 Miguel de Icaza <miguel@ximian.com>
1033 * anonymous.cs: Ensure that we init the scope of our parent if it
1034 has not been initialized yet.
1036 2004-12-30 Duncan Mak <duncan@ximian.com>
1038 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
1039 if field.FieldBuilder is null. Fixes #70758.
1041 * convert.cs: Fixed some typos and updated some of the comments.
1042 (ImplicitStandardConversionExists):
1043 (TryImplicitIntConversion): If `target_type' is an interface and
1044 the type of `ic' implements this interface, return true or a new
1045 BoxedCast instead of null. This fixes #70468.
1047 2004-12-29 Duncan Mak <duncan@ximian.com>
1049 * expression.cs (Argument.Emit): Check that Expr is
1050 IMemoryLocation before casting to it, and report CS1510 otherwise.
1054 2004-12-21 Ben Maurer <bmaurer@ximian.com>
1056 * statement.cs (Block.ThisVariable): remove the recursion here, to
1057 make the --profile more sane.
1059 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
1061 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
1062 assembly, by JB Evain.
1064 2004-12-17 Raja R Harinath <rharinath@novell.com>
1066 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
1067 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
1068 "parent" refers to enclosing type/class. "base" refers to superclass.
1070 2004-12-17 Raja R Harinath <rharinath@novell.com>
1072 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1073 Ensure that we only have GlobalAttributes.
1074 * attribute.cs (Attribute.Emit): Make non-virtual.
1075 (GlobalAttribute.Emit): Remove.
1076 (Attribute.Resolve): Make virtual.
1077 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
1078 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
1079 the argument. Don't create one.
1080 (Attribute.GetObsoleteAttribute): Likewise.
1081 (Attribute.GetClsCompliantAttributeValue): Likewise.
1082 * class.cs, decl.cs: Update to changes.
1084 2004-12-17 Marek Safar <marek.safar@seznam.cz>
1086 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
1088 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
1090 * statement.cs (Foreach.Resolve): Add error 186 report.
1092 2004-12-16 Marek Safar <marek.safar@seznam.cz>
1094 * expression.cs (Conditional.DoResolve): Add warning 429.
1096 * statement.cs (If.Resolve): Add warning 665.
1098 2004-12-16 Raja R Harinath <rharinath@novell.com>
1100 New invariant: RootContext.Tree.Types.NamespaceEntry == null
1101 except when in the parser, and in GlobalAttribute.
1102 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
1103 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
1104 RootContext.Tree.Types.NamespaceEntry once work is done.
1105 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
1106 and resets RootContext.Tree.Types.NamespaceEntry.
1108 2004-12-15 Marek Safar <marek.safar@seznam.cz>
1110 * cs-parser.jay: Don't create a block for every variable.
1112 2004-12-14 Miguel de Icaza <miguel@ximian.com>
1114 * location.cs: Provide extra information.
1116 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
1117 variables from the captured environment, it is the ldarg_0.
1119 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1121 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
1124 * class.cs: Changed warning level for 169 to avoid developer
1125 displeasure from warning flooding. It will be changed back when they
1126 fix most of current BCL warnings.
1128 * RootContext.cs: Pushed default WarningLevel to 3.
1130 * statement.cs: Removed unused variable.
1132 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1134 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
1135 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
1136 Add error 502 report.
1137 (StaticClass.DefineType): Add error 441 report.
1138 (Class.AllowedModifiersProp): New virtual property as temporary
1139 extension to AllowedModifiers.
1140 (Class.DefineType): Add error 418 report. Moved ModFlags check here
1141 to share implementation with StaticClass and don't call virtual
1144 * driver.cs (MainDriver): Add error 1558 test.
1146 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
1147 report. Moved error 36 test here.
1149 * statement.cs (Throw.Resolve): Add error 724 report.
1151 * typemanager.cs: Add out_attribute_type core type.
1153 2004-12-13 Marek Safar <marek.safar@seznam.cz>
1155 * class.cs (TypeContainer.VerifyClsCompliance): Add error
1157 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
1159 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
1162 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
1164 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
1165 Add error 3023 report.
1166 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
1168 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
1171 2004-12-12 John Luke <john.luke@gmail.com>
1173 * driver.cs (AddArgs): take -- into account when
1174 adding arguments, fixes bug 65710
1176 2004-12-12 Martin Baulig <martin@ximian.com>
1178 * expression.cs (Unary.TryReduceNegative): Added support for
1179 SByteConstant and ByteConstant.
1180 (Unary.Reduce): Check error values from TryReduceNegative().
1182 2004-12-10 Marek Safar <marek.safar@seznam.cz>
1184 * attributes.cs (Attribute.Resolve): Avoid multiple error report
1185 and report exception as error 182.
1187 2004-12-10 Raja R Harinath <rharinath@novell.com>
1189 * driver.cs (Main): Fix message when there are warnings.
1191 2004-12-09 Miguel de Icaza <miguel@ximian.com>
1193 * delegate.cs: Fixed my fix from yesterday, sorry about that.
1195 2004-12-09 Marek Safar <marek.safar@seznam.cz>
1197 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
1198 Reduced number of warnings.
1200 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
1202 2004-12-08 Miguel de Icaza <miguel@ximian.com>
1204 * driver.cs: Removed message.
1206 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
1208 2004-12-08 <vargaz@freemail.hu>
1210 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
1212 2004-12-08 Martin Baulig <martin@ximian.com>
1214 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1215 instead of a CS3002 for properties and indexer.
1217 2004-12-08 Martin Baulig <martin@ximian.com>
1219 * decl.cs (MemberName.ToString): Make this work again.
1221 2004-12-08 Marek Safar <marek.safar@seznam.cz>
1223 * attribute.cs (Resolve): Add error 591 detection.
1225 * class.cs (FieldMember.Define): Add error 1547 detection.
1226 (Indexer.Define): Add error 620 detection.
1227 (Operator.Define): Add error 590 detection.
1229 * ecore.cs: Missing argument for error 79.
1231 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
1234 2004-12-07 Marek Safar <marek.safar@seznam.cz>
1237 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
1240 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1242 * cs-parser.jay : handle doc comments on implicit/explicit operators.
1243 Some operator comments were suppressed.
1244 * doc.cs : Implicit/explicit operator name in doc comments are like
1245 "op_Explicit(type)~returnType", so added suffix handling.
1247 2004-12-07 Martin Baulig <martin@ximian.com>
1250 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1251 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1252 (DeclSpace.ec): New protected field; store the EmitContext here.
1253 (DeclSpace.EmitContext): New public property; moved here from
1255 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1258 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1259 (Enum.Emit): Don't create a new EmitContext.
1261 * delegate.cs (Delegate.DefineType): Always create the
1264 * iterators.cs (Iterators.DefineIterator): Create a new
1265 EmitContext and store it in `ec'.
1267 2004-08-24 Martin Baulig <martin@ximian.com>
1270 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
1271 this for accessibility checks.
1272 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
1273 IsNestedFamilyAccessible.
1274 (TypeManager.IsSubclassOf): New method, do what the name actually
1277 2004-12-06 Raja R Harinath <rharinath@novell.com>
1279 Fix crash on cs0657-17.cs.
1280 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1281 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1282 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1283 the case where the NamespaceEntry gets overwritten.
1285 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1287 Fixed #69195, #56821
1288 * ecore.cs (ResolveBoolean): Tiny refactoring.
1290 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1291 of right expression resolving when left is false constant and
1292 operator is LogicalAnd OR true constant and operator is LogicalOr.
1294 * statement.cs (ResolveUnreachable): Always reports warning.
1296 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1298 * class.cs: Distinguish between 1721 and 1722 (just a little help
1299 for the programmer).
1301 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1303 * delegate.cs: Only allow this on new versions of the language.
1305 2004-12-02 Duncan Mak <duncan@ximian.com>
1307 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1309 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1310 here as a static method. Take an additional bool out parameter
1311 `must_do_cs1540_check' for signaling to InstanceResolve.
1312 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1313 member field from PropertyExpr class and made it an argument of
1315 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1316 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1317 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1318 and `remove_accessor' as well as InstanceResolve: report CS0122
1323 2004-12-03 Raja R Harinath <rharinath@novell.com>
1325 Fix test-327.cs, test-328.cs, and put in early infrastructure
1326 for eventually fixing #52697.
1327 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
1328 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
1330 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
1331 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
1332 (VerifyUsing, error246): Update.
1333 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1334 'NamespaceEntry.LookupNamespaceOrType'.
1336 2004-12-03 Martin Baulig <martin@ximian.com>
1338 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1339 method as our child, call AnonymousMethod.Compatible() on it.
1341 2004-12-03 Raja R Harinath <rharinath@novell.com>
1343 Disable XML documentation support in 'basic' profile.
1344 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
1345 Redirect XmlElement to System.Object.
1346 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
1347 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
1348 * mcs.exe.sources: Add doc-bootstrap.cs.
1349 * doc-bootstrap.cs: New file. Contains empty stub implementation
1352 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1354 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1355 comments are allowed.
1357 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1359 * delegate.cs: Add checks for subtypes in paramaters and return values
1360 in VerifyMethod () to add support for Covariance/Contravariance
1363 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1365 * report.cs: Remove extra closing parenthesis.
1367 * convert.cs (Error_CannotImplicitConversion): If the name of the
1368 types are the same, provide some extra information.
1370 * class.cs (FieldBase): Use an unused bit field from the field to
1371 encode the `has_offset' property from the FieldMember. This saves
1372 a couple of Ks on bootstrap compilation.
1374 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1375 method as our child, return the AnonymousMethod resolved
1378 * expression.cs (New.DoResolve): Allow return values from
1379 NewDelegate to also include AnonymousMethods.
1383 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1386 * attribute.cs (Resolve): Improved implementation of params
1387 attribute arguments.
1389 * support.cs (ParameterData): Add HasParams to be faster.
1391 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1393 all things are for /doc support:
1395 * doc.cs: new file that supports XML documentation generation.
1396 * mcs.exe.sources: added doc.cs.
1398 Handle /doc command line option.
1399 Report error 2006 instead of 5 for missing file name for /doc.
1400 Generate XML documentation when required, after type resolution.
1402 Added support for picking up documentation (/// and /** ... */),
1403 including a new XmlCommentState enumeration.
1405 Added lines to fill Documentation element for field, constant,
1406 property, indexer, method, constructor, destructor, operator, event
1407 and class, struct, interface, delegate, enum.
1408 Added lines to warn incorrect comment.
1410 Added Documentation field (passed only when /doc was specified).
1412 Added DocComment, DocCommentHeader, GenerateDocComment() and
1413 OnGenerateDocComment() and some supporting private members for
1414 /doc feature to MemberCore.
1416 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1418 Added overriden DocCommentHeader.
1420 Added overriden DocCommentHeader and GenerateDocComment().
1422 2004-12-01 Miguel de Icaza <miguel@ximian.com>
1424 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
1425 unwrapping the enumeration values, chain to
1426 DoConstantNumericPromotions again, so we can promote things to the
1427 fundamental types (takes care of enums that are bytes, sbytes).
1431 2004-12-01 Raja R Harinath <rharinath@novell.com>
1433 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
1434 Fix long-standing bug in type-lookup. Use FindType instead of
1435 LookupType when ec.ResolvingTypeTree.
1436 (Attribute.ResolveType, Attribute.Resolve)
1437 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
1439 (Attributes.Search): Remove internal version. Update.
1440 (Attributes.SearchMulti): Update.
1441 (Attributes.GetClsCompliantAttribute): Remove.
1442 (Attributes.GetIndexerNameAttribute): Remove.
1443 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
1444 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
1445 * class.cs (Indexer.Define): Likewise.
1447 2004-12-01 Marek Safar <marek.safar@seznam.cz>
1450 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
1451 MarshallByReference members access.
1453 * expression.cs: Use CheckMarshallByRefAccess;
1454 Better error CS0197 message.
1456 * report.cs: Print whole related error message.
1458 2004-11-30 Raja R Harinath <rharinath@novell.com>
1460 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
1461 the current directory to help debugging.
1463 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1465 * class (GetClassBases): Better error 60 report.
1466 (EventProperty): Disabled warning 67 detection.
1468 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1471 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
1473 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
1476 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1479 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
1481 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
1483 2004-11-26 Miguel de Icaza <miguel@ximian.com>
1485 * attribute.cs (Attribute.Resolve): Refine error reporting and
1486 report a cs0117 if the identifier does not exist, to distinguish
1487 from 0617 which is a miss-use of the actual identifier.
1489 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
1490 between cs0070 and cs0079.
1492 * class.cs (MemberBase.DoDefine): When reporting a wrong
1493 accessibility level, we use MethodCore to compare instead of
1494 Method (this was a regression in some refactoring effort).
1496 So now we correctly report cs0056 again.
1498 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
1499 testing the target_type (which was known to be object_type) and
1500 not the source type (which is anonymous_method).
1502 Fixed reporting of error cs1660.
1504 * expression.cs (UserCast.Source): Expose the underlying cast.
1506 * statement.cs (Switch.SwitchGoverningType): Sort the list of
1507 allowed types to find a match to int32 first (most common).
1509 In addition, it ignores any ImplicitUserConversions that did an
1510 internal implicit conversion (as the switch statement allows only
1511 one integral conversion to exist).
1513 * class.cs (PartialContainer.Create): rename `name' to
1514 `member_name' for clarity. Then replace the string calls with a
1515 call to MemberName.GetPartialName, as now using
1516 MemberName.ToString is an error (this is due to the side effects
1517 it had, that were fixed in the past).
1519 This will restore the error reporting on a number of partial class
1520 errors that were missusing this (and getting an exception as a
1521 results, which is now just a plain textual warning, because
1522 yyparse debug output would crash otherwise).
1524 2004-11-26 Raja R Harinath <rharinath@novell.com>
1526 * Makefile (PROGRAM_INSTALL_DIR): Remove.
1528 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1530 * rootcontext.cs (LookupType): Make sure to cache lookups that
1531 don't give us a negative result. This saves about 5% of corlib
1534 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1536 * report.cs (AbstractMessage.Print): messages are sent to stderr
1538 * class.cs (TypeContainer.GetClassBases): It is an error to have a
1539 non-interface in the list of interfaces (at this point, either
1540 parent was properly set, or a base class is being listed in the
1541 interfaces section).
1543 This flags error 1722, and resolves the crash from bug 69259.
1545 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1547 * statement.cs (Using.EmitExpressionFinally): make this work right
1548 for valuetypes. Fixes 69926.
1550 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1552 * const.cs (Const.ChangeType): Cope with the "0 literal can be
1553 converted to an enum" here, before we try to change the underlying
1554 type. This code exists, but it is a different code path than the
1555 one used while encoding constants.
1557 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1558 old bug: when converting from the null literal to a pointer,
1559 return an EmptyCast, not the NullLiteral.
1561 This fixes #69921, the recent null_type changes probably made this
1564 (ImplicitReferenceConversionExists): In addition, resynchronized
1565 the code here, so it matches the same code in
1566 ImplicitReferenceConversionExists for the `from any class-type S
1567 to any interface-type T'.
1570 2004-11-25 Marek Safar <marek.safar@seznam.cz>
1572 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
1574 2004-11-24 Miguel de Icaza <miguel@ximian.com>
1576 * cs-parser.jay: Use verbosity accordingly.
1578 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1580 * expression.cs (Unary.ResolveOperator): Do not report warning;
1581 AddressOf reads from variable.
1583 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
1585 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1589 * attribute.cs (Attributable): Removed CheckTargets.
1590 (Attributes.Emit): Explicit attribute targets are tested here.
1592 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1593 not enabled for interfaces.
1595 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1596 (GetAssemblyName): Ouch next bug there.
1598 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1600 * expression.cs: Error 275 added.
1602 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1604 Fix bug #69177 (Implemented decimal constant support)
1606 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1607 (BinaryFold): Add DecimalConstant.
1609 * const.cs (Define): Decimal constant
1611 (ChangeType): Add decimal type handling.
1612 (LookupConstantValue): Don't set value for decimal type but
1613 emit DecimalConstantAttribute. Needed for constant optimization.
1615 * constant.cs (ToDecimal): New method.
1616 (ConvertToDecimal): New method.
1617 (IntConstant): Implemented ConvertToDecimal.
1618 (DecimalConstant.Emit): Emit optimized version for decimals in
1621 * expression.cs (ResolveOperator): Changed order of constant
1622 reduction to work correctly with native types which have
1623 overloaded operators.
1624 (ResolveMemberAccess): Extract constant value from attribute
1627 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1629 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1630 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1631 (ChangeType): Decimal is special.
1632 (TypeToCoreType): Add decimal type.
1634 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1636 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1639 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1641 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1644 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1646 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1648 * pending.cs (PendingImplementation): Grab only interfaces.
1650 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1652 * statement.cs (ForeachHelperMethods): Add location member and
1653 error 202 detection.
1655 2004-11-19 Raja R Harinath <rharinath@novell.com>
1657 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
1658 automatically handled by executable.make.
1659 (PROGRAM): Make profile-specific.
1661 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1663 * expression.cs (DoResolveBase): Fixed wrong warning for out
1666 2004-11-18 Martin Baulig <martin@ximian.com>
1668 Merged latest changes into gmcs. Please keep this comment in
1669 here, it makes it easier for me to see what changed in MCS since
1670 the last time I merged.
1672 2004-11-17 Raja R Harinath <rharinath@novell.com>
1674 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1675 (TypeHandle.GetMemberCache): New.
1676 (TypeHandle.TypeHandle): Update.
1677 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1678 (TypeManager.LookupParentInterfacesCache):
1679 Rename from LookupInterfaceCache. Optimize slightly.
1680 (TypeManager.MemberLookup_FindMembers): Update.
1681 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1683 (AddCacheContents): Rename from AddHashtable.
1684 * class.cs (TypeContainer.parent_container): Remove.
1685 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1686 (TypeContainer.DoDefineMembers): Don't initialize it.
1687 Update to name changes.
1689 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1691 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1692 that factors the code to check access modifiers on override.
1694 (PropertyBase): Use the code here.
1696 Patch from Lluis S'anchez, fixes bug #69361.
1698 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1700 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1701 routine that is used to report the use of a captured variable
1702 whose address has been taken.
1704 There are two checks: one when variables are being captured and
1705 the other check is when the address of a variable is taken.
1707 (because an anonymous methods might be resolved before *or* after
1708 the address has been taken) and
1710 * expression.cs (Conditional.DoResolve): Remove the special
1711 casing that Martin added to trueExpr and falseExpr being both
1712 NullLiteral. We get the right behavior now just by introducing
1713 the null_type into the compiler.
1715 * convert.cs (ExplicitConversion): Change the code to use
1716 null_type instead of testing `expr is NullLiteral'.
1717 (ImplicitConversionStandard): use null_type too.
1718 (ImplicitReferenceConversionExists): use null_type too.
1719 (ImplicitReferenceConversion): use null_type too.
1721 * literal.cs: The type of `NullLiteral' is now null_type instead
1723 (Resolve): Set the type here.
1725 * typemanager.cs: Introduce null_type.
1727 2004-11-17 Martin Baulig <martin@ximian.com>
1729 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1730 direction, like FindMembers() does. Fixes #69546, testcase is in
1733 2004-11-16 Martin Baulig <martin@ximian.com>
1735 This is based on a patch from Marek Safar, see bug #69082.
1736 Fixes bugs #63705 and #67130.
1738 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1739 method; create a MemberCache for an interface type and cache the
1742 * decl.cs (IMemberContainer.ParentContainer): Removed.
1743 (IMemberContainer.ParentCache): New property.
1744 (MemberCache.SetupCacheForInterface): Removed.
1745 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1746 to create a cache for an interface's "parent".
1748 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1751 2004-11-16 Martin Baulig <martin@ximian.com>
1753 Merged back from gmcs; these changes already went into gmcs a
1754 couple of weeks ago.
1757 (TypeManager.AddUserType): Removed the `ifaces' argument.
1758 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
1760 (TypeManager.AddUserInterface): Removed.
1761 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
1763 (TypeManager.GetInterfaces): Likewise.
1764 (TypeManager.GetExplicitInterfaces): Likewise.
1766 * ecore.cs (TypeExpr.GetInterfaces): Removed.
1768 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
1769 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
1771 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1773 * statement.cs: Avoid adding bools to a hashtable.
1775 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1777 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1778 calling an unsafe method from a safe location.
1780 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1783 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1785 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1787 * namespace.cs (VerifyUsing): use GetPartialName instead of
1790 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1792 * statement.cs (Return.Resolve): Fix regression in typo: if
1793 `in_exc', we have to request a NeedReturnLabel, this was a typo
1794 introduced in the anonymous method check-in. Fixes #69131.
1796 * Indexers were using the ShortName when defining themselves,
1797 causing a regression in the compiler bootstrap when applying the
1798 patch from 2004-11-02 (first part), now they use their full name
1799 and the bug is gone.
1801 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1803 * driver.cs: Strip the path from the names of embedded resources. Fixes
1806 2004-11-04 Raja R Harinath <rharinath@novell.com>
1808 Fix error message regression: cs0104-2.cs.
1809 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1810 (AliasEntry.Resolve): Update.
1811 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
1813 (RootContext.LookupType): Update.
1815 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
1817 * cs-parser.jay: Add support for handling accessor modifiers
1818 * class: Add support port accessor modifiers and error checking,
1819 define PropertyMethod.Define as virtual (not abstract anymore)
1820 * ecore.cs: Add checking for proeprties access with access modifiers
1821 * iterators.cs: Modify Accessor constructor call based in the modified
1823 2004-11-02 Ben Maurer <bmaurer@ximian.com>
1825 * expression.cs (StringConcat): Handle being called twice,
1826 as when we have a concat in a field init with more than two
1829 2004-11-02 Miguel de Icaza <miguel@ximian.com>
1831 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
1832 special case explicit implementations, we should always produce
1833 the .property or .event declaration.
1835 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
1836 since it will not return correct data if people use this
1837 unresolved in the presence of using statements (see test-313).
1839 * class.cs (MethodData.Define): If we are an explicit interface
1840 implementation, set the method name to the full name of the
1841 interface plus the name of the method.
1843 Notice that using the method.MethodName.GetFullName() does not
1844 work, as it will only contain the name as declared on the source
1845 file (it can be a shorthand in the presence of using statements)
1846 and not the fully qualifed type name, for example:
1850 class D : ICloneable {
1851 object ICloneable.Clone () {
1855 Would produce a method called `ICloneable.Clone' instead of
1856 `System.ICloneable.Clone'.
1858 * namespace.cs (Alias.Resolve): Use GetPartialName.
1860 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1862 * cs-parser.jay: Add error 1055 report.
1864 2004-11-01 Miguel de Icaza <miguel@ximian.com>
1866 * assign.cs (Assign.DoResolve): Only do the transform of
1867 assignment into a New if the types are compatible, if not, fall
1868 through and let the implicit code deal with the errors and with
1869 the necessary conversions.
1871 2004-11-01 Marek Safar <marek.safar@seznam.cz>
1873 * cs-parser.jay: Add error 1031 report.
1875 * cs-tokenizer.cs: Add location for error 1038.
1877 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1879 * cs-parser.jay: Add error 1016 report.
1881 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1883 * cs-parser.jay: Add errors 1575,1611 report.
1885 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1887 * cs-parser.jay: Add error 1001 report.
1889 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1892 * attribute.cs (GetMarshal): Add method argument for
1893 caller identification.
1895 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
1896 agument for GetMarshal and RuntimeMissingSupport.
1898 2004-10-31 Marek Safar <marek.safar@seznam.cz>
1900 * attribute.cs (ExtractSecurityPermissionSet): Removed
1901 TypeManager.code_access_permission_type.
1903 * typemanager.cs: Removed TypeManager.code_access_permission_type.
1905 2004-10-27 Miguel de Icaza <miguel@ximian.com>
1907 * expression.cs (LocalVariableReference.DoResolveLValue): Check
1908 for obsolete use of a variable here. Fixes regression on errors
1909 cs0619-25 and cs0619-26.
1911 2004-10-27 Marek Safar <marek.safar@seznam.cz>
1913 Fix #62358, implemented security attribute encoding.
1915 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
1916 Tests permitted SecurityAction for assembly or other types.
1917 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
1918 data from SecurityPermissionAttribute to PermisionSet class.
1920 * class.cs (ApplyAttributeBuilder): Added special handling
1921 for System.Security.Permissions.SecurityAttribute based types.
1923 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
1924 special handling for System.Security.Permissions.SecurityAttribute
1927 * enum.cs (ApplyAttributeBuilder): Added special handling
1928 for System.Security.Permissions.SecurityAttribute based types.
1930 * parameter.cs (ApplyAttributeBuilder): Added special handling
1931 for System.Security.Permissions.SecurityAttribute based types.
1933 * rootcontext.cs: Next 2 core types.
1935 * typemanager.cs (TypeManager.security_permission_attr_type):
1936 Built in type for the SecurityPermission Attribute.
1937 (code_access_permission_type): Build in type.
1939 2004-10-17 Miguel de Icaza <miguel@ximian.com>
1941 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
1942 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
1943 all of this information into
1944 EmitContext.EmitCapturedVariableInstance.
1946 * codegen.cs (EmitCapturedVariableInstance): move here the
1947 funcionality of emitting an ldarg.0 in the presence of a
1948 remapping. This centralizes the instance emit code.
1950 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
1951 then emit a load of this: it means that we have reached the
1952 topmost ScopeInfo: the one that contains the pointer to the
1953 instance of the class hosting the anonymous method.
1955 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
1956 captures to the topmost CaptureContext.
1958 2004-10-12 Miguel de Icaza <miguel@ximian.com>
1960 * expression.cs (LocalVariableReference): Move the knowledge about
1961 the iterators into codegen's EmitCapturedVariableInstance.
1963 2004-10-11 Miguel de Icaza <miguel@ximian.com>
1965 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
1966 all code paths return a value from an anonymous method (it is the
1967 same as the 161 error, but for anonymous methods).
1969 2004-10-08 Miguel de Icaza <miguel@ximian.com>
1971 The introduction of anonymous methods in the compiler changed
1972 various ways of doing things in the compiler. The most
1973 significant one is the hard split between the resolution phase
1974 and the emission phases of the compiler.
1976 For instance, routines that referenced local variables no
1977 longer can safely create temporary variables during the
1978 resolution phase: they must do so from the emission phase,
1979 since the variable might have been "captured", hence access to
1980 it can not be done with the local-variable operations from the runtime.
1984 (Block.Flags): New flag `IsTopLevel' to indicate that this block
1985 is a toplevel block.
1987 (ToplevelBlock): A new kind of Block, these are the blocks that
1988 are created by the parser for all toplevel method bodies. These
1989 include methods, accessors and anonymous methods.
1991 These contain some extra information not found in regular blocks:
1992 A pointer to an optional CaptureContext (for tracking captured
1993 local variables and parameters). A pointer to the parent
1996 (Return.Resolve): Catch missmatches when returning a value from an
1997 anonymous method (error 1662).
1998 Invoke NeedReturnLabel from the Resolve phase instead of the emit
2001 (Break.Resolve): ditto.
2003 (SwitchLabel): instead of defining the labels during the
2004 resolution phase, we now turned the public ILLabel and ILLabelCode
2005 labels into methods called GetILLabelCode() and GetILLabel() that
2006 only define the label during the Emit phase.
2008 (GotoCase): Track the SwitchLabel instead of the computed label
2009 (its contained therein). Emit the code by using
2010 SwitchLabel.GetILLabelCode ().
2012 (LocalInfo.Flags.Captured): A new flag has been introduce to track
2013 whether the Local has been captured or not.
2015 (LocalInfo.IsCaptured): New property, used to tell whether the
2016 local has been captured.
2018 * anonymous.cs: Vastly updated to contain the anonymous method
2021 The main classes here are: CaptureContext which tracks any
2022 captured information for a toplevel block and ScopeInfo used to
2023 track the activation frames for various local variables.
2025 Each toplevel block has an optional capture context associated
2026 with it. When a method contains an anonymous method both the
2027 toplevel method and the anonymous method will create a capture
2028 context. When variables or parameters are captured, they are
2029 recorded on the CaptureContext that owns them, for example:
2033 MyDelegate d = delegate {
2038 Here `a' will be recorded as captured on the toplevel
2039 CapturedContext, the inner captured context will not have anything
2040 (it will only have data if local variables or parameters from it
2041 are captured in a nested anonymous method.
2043 The ScopeInfo is used to track the activation frames for local
2044 variables, for example:
2046 for (int i = 0; i < 10; i++)
2047 for (int j = 0; j < 10; j++){
2048 MyDelegate d = delegate {
2053 At runtime this captures a single captured variable `i', but it
2054 captures 10 different versions of the variable `j'. The variable
2055 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
2056 recorded on a child.
2058 The toplevel ScopeInfo will also track information like the `this'
2059 pointer if instance variables were referenced (this is necessary
2060 as the anonymous method lives inside a nested class in the host
2061 type of the method).
2063 (AnonymousMethod): Expanded to track the Toplevel, implement
2064 `AnonymousMethod.Compatible' to tell whether an anonymous method
2065 can be converted to a target delegate type.
2067 The routine now also produces the anonymous method content
2069 (AnonymousDelegate): A helper class that derives from
2070 DelegateCreation, this is used to generate the code necessary to
2071 produce the delegate for the anonymous method that was created.
2073 * assign.cs: API adjustments for new changes in
2074 Convert.ImplicitStandardConversionExists.
2076 * class.cs: Adjustments to cope with the fact that now toplevel
2077 blocks are of type `ToplevelBlock'.
2079 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
2080 insteda of standard blocks.
2082 Flag errors if params arguments are passed to anonymous methods.
2084 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
2085 `CurrentAnonymousMethod' which points to the current Anonymous
2086 Method. The variable points to the AnonymousMethod class that
2087 holds the code being compiled. It is set in the new EmitContext
2088 created for the anonymous method.
2090 (EmitContext.Phase): Introduce a variable and an enumeration to
2091 assist in enforcing some rules about when and where we are allowed
2092 to invoke certain methods (EmitContext.NeedsReturnLabel is the
2093 only one that enfonces this right now).
2095 (EmitContext.HaveCaptureInfo): new helper method that returns
2096 whether we have a CapturedContext initialized.
2098 (EmitContext.CaptureVariable): New method used to register that a
2099 LocalInfo must be flagged for capturing.
2101 (EmitContext.CapturedParameter): New method used to register that a
2102 parameters must be flagged for capturing.
2104 (EmitContext.CapturedField): New method used to register that a
2105 field must be flagged for capturing.
2107 (EmitContext.HaveCapturedVariables,
2108 EmitContext.HaveCapturedFields): Return whether there are captured
2109 variables or fields.
2111 (EmitContext.EmitMethodHostInstance): This is used to emit the
2112 instance for the anonymous method. The instance might be null
2113 (static methods), this (for anonymous methods that capture nothing
2114 and happen to live side-by-side with the current method body) or a
2115 more complicated expression if the method has a CaptureContext.
2117 (EmitContext.EmitTopBlock): Routine that drives the emission of
2118 code: it will first resolve the top block, then emit any metadata
2119 and then emit the code. The split is done so that we can extract
2120 any anonymous methods and flag any captured variables/parameters.
2122 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
2123 during this phase, the ILGenerator should not be used as labels
2124 and local variables declared here might not be accessible to any
2125 code that is part of an anonymous method.
2127 Exceptions to this include the temporary variables that are
2128 created by some statements internally for holding temporary
2131 (EmitContext.EmitMeta): New routine, in charge of emitting all the
2134 (EmitContext.TemporaryReturn): This method is typically called
2135 from the Emit phase, and its the only place where we allow the
2136 ReturnLabel to be defined other than the EmitMeta. The reason is
2137 that otherwise we would have to duplicate a lot of logic in the
2138 Resolve phases of various methods that today is on the Emit
2141 (EmitContext.NeedReturnLabel): This no longer creates the label,
2142 as the ILGenerator is not valid during the resolve phase.
2144 (EmitContext.EmitThis): Extended the knowledge in this class to
2145 work in anonymous methods in addition to iterators.
2147 (EmitContext.EmitCapturedVariableInstance): This emits whatever
2148 code is necessary on the stack to access the instance to a local
2149 variable (the variable will be accessed as a field).
2151 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
2152 EmitContext.EmitAddressOfParameter): Routines to support
2153 parameters (not completed at this point).
2155 Removals: Removed RemapLocal and RemapLocalLValue. We probably
2156 will also remove the parameters.
2158 * convert.cs (Convert): Define a `ConstantEC' which points to a
2159 null. This is just to prefity some code that uses
2160 ImplicitStandardConversion code and do not have an EmitContext
2163 The idea is to flag explicitly that at that point in time, it is
2164 known that the conversion will not trigger the delegate checking
2165 code in implicit conversions (which requires a valid
2168 Everywhere: pass new EmitContext parameter since
2169 ImplicitStandardConversionExists now requires it to check for
2170 anonymous method conversions.
2172 (Convert.ImplicitStandardConversionExists): If the type of an
2173 expression is the anonymous_method_type, and the type is a
2174 delegate, we invoke the AnonymousMethod.Compatible method to check
2175 whether an implicit conversion is possible.
2177 (Convert.ImplicitConversionStandard): Only do implicit method
2178 group conversions if the language level is not ISO_1.
2180 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2181 MethodInfo for the Invoke method. used by Delegate and
2184 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2185 method conversions if the target type is a delegate.
2187 Removed extra debugging nops.
2189 (LocalVariableReference): Turn the `local_info' into a public
2192 Add `prepared' field, the same hack used for FieldExprs to cope
2193 with composed assignments, as Local variables do not necessarily
2194 operate purely on the stack as they used to: they can be captured
2197 Add `temp' for a temporary result, like fields.
2199 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2201 It now copes with Local variables that are captured and emits the
2202 proper instance variable to load it from a field in the captured
2205 (ParameterReference.DoResolveBase): During the resolve phase,
2206 capture parameters if we are in an anonymous method.
2208 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2209 anonymous method, use the EmitContext helper routines to emit the
2210 parameter reference.
2212 * iterators.cs: Set RemapToProxy to true/false during the
2215 * parameters.cs (GetParameterByName): New helper method.
2217 * typemanager.cs (anonymous_method_type) a new type that
2218 represents an anonyous method. This is always an internal type,
2219 used as a fencepost to test against the anonymous-methodness of an
2222 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2224 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2226 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2228 2004-10-18 Martin Baulig <martin@ximian.com>
2230 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2231 `Type' directly, but call ResolveType() on it.
2232 (Catch.Resolve): Likewise.
2233 (Foreach.Resolve): Likewise.
2235 2004-10-18 Martin Baulig <martin@ximian.com>
2237 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2238 `Type' directly, but call ResolveType() on it.
2239 (Probe.DoResolve): Likewise.
2240 (ArrayCreation.LookupType): Likewise.
2241 (TypeOf.DoResolve): Likewise.
2242 (SizeOf.DoResolve): Likewise.
2244 2004-10-18 Martin Baulig <martin@ximian.com>
2246 * expression.cs (Invocation.BetterFunction): Put back
2247 TypeManager.TypeToCoreType().
2249 2004-10-18 Raja R Harinath <rharinath@novell.com>
2251 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2254 2004-10-18 Martin Baulig <martin@ximian.com>
2256 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
2257 `Type' directly, but call ResolveType() on it.
2259 2004-10-18 Martin Baulig <martin@ximian.com>
2261 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2262 `Type' directly, but call ResolveType() on it.
2263 (MemberBase.DoDefine): Likewise.
2265 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2266 `Type' directly, but call ResolveType() on it.
2267 (ComposedCast.DoResolveAsTypeStep): Likewise.
2269 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2270 `Type' directly, but call ResolveType() on it.
2272 2004-10-17 John Luke <john.luke@gmail.com>
2274 * class.cs (Operator.GetSignatureForError): use CSharpName
2276 * parameter.cs (Parameter.GetSignatureForError): Returns
2277 correct name even if was not defined.
2279 2004-10-13 Raja R Harinath <rharinath@novell.com>
2282 * class.cs (TypeContainer.EmitContext): New property.
2283 (DefineNestedTypes): Create an emitcontext for each part.
2284 (MethodCore.DoDefineParameters): Use container's emitcontext.
2285 Pass type array to InternalParameters.
2286 (MemberBase.DoDefine): Use container's emitcontext.
2287 (FieldMember.Define): Likewise.
2288 (Event.Define): Likewise.
2289 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2290 Pass type array to InternalParameters.
2291 (SetIndexerMethod.GetParameterInfo): Likewise.
2292 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2293 * delegate.cs (Define): Pass emitcontext to
2294 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2295 array to InternalParameters.
2296 * expression.cs (ParameterReference.DoResolveBase): Pass
2297 emitcontext to GetParameterInfo.
2298 (ComposedCast.DoResolveAsTypeStep): Remove check on
2299 ec.ResolvingTypeTree.
2300 * parameter.cs (Parameter.Resolve): Change argument to
2301 EmitContext. Use ResolveAsTypeTerminal.
2302 (Parameter.GetSignature): Change argument to EmitContext.
2303 (Parameters.ComputeSignature): Likewise.
2304 (Parameters.ComputeParameterTypes): Likewise.
2305 (Parameters.GetParameterInfo): Likewise.
2306 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2307 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2308 * support.cs (InternalParameters..ctor): Remove variant that takes
2310 * typemanager.cs (system_intptr_expr): New.
2311 (InitExpressionTypes): Initialize it.
2313 2004-10-12 Chris Toshok <toshok@ximian.com>
2315 * cs-parser.jay: fix location for try_statement and catch_clause.
2317 2004-10-11 Martin Baulig <martin@ximian.com>
2319 * report.cs: Don't make --fatal abort on warnings, we have
2320 -warnaserror for that.
2322 2004-10-07 Raja R Harinath <rharinath@novell.com>
2324 More DeclSpace.ResolveType avoidance.
2325 * decl.cs (MemberCore.InUnsafe): New property.
2326 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2327 with newly created EmitContext.
2328 (FieldMember.Define): Likewise.
2329 * delegate.cs (Delegate.Define): Likewise.
2330 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2331 only if normal name-lookup fails.
2332 (TypeExpr.DoResolve): Enable error-checking.
2333 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2334 (SizeOf.DoResolve): Likewise.
2335 (ComposedCast.DoResolveAsTypeStep): Likewise.
2336 (StackAlloc.DoResolve): Likewise.
2337 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2338 (Block.Unsafe): New property.
2339 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2340 (Unsafe): Set 'unsafe' flag of contained block.
2341 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2342 (Fixed.Resolve): Likewise.
2343 (Catch.Resolve): Likewise.
2344 (Using.ResolveLocalVariableDecls): Likewise.
2345 (Foreach.Resolve): Likewise.
2347 2004-10-05 John Luke <john.luke@gmail.com>
2349 * cs-parser.jay: add location to error CS0175
2351 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2353 * ecore.cs (Expression.Constantity): Add support for turning null
2356 * const.cs (Const.Define): Allow constants to be reference types
2357 as long as the value is Null.
2359 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2361 * namespace.cs (NamespaceEntry.Using): No matter which warning
2362 level is set, check if this namespace name has already been added.
2364 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2366 * expression.cs: reftype [!=]= null should always use br[true,false].
2369 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2372 * attribute.cs: Enum conversion moved to
2373 GetAttributeArgumentExpression to be applied to the all
2376 2004-10-01 Raja R Harinath <rharinath@novell.com>
2378 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2379 * class.c (TypeContainer.DefineType): Flag error if
2380 base types aren't accessible due to access permissions.
2381 * decl.cs (DeclSpace.ResolveType): Move logic to
2382 Expression.ResolveAsTypeTerminal.
2383 (DeclSpace.ResolveTypeExpr): Thin layer over
2384 Expression.ResolveAsTypeTerminal.
2385 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2386 Refactor code into NestedAccess. Use it.
2387 (DeclSpace.NestedAccess): New.
2388 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2389 argument to silence errors. Check access permissions.
2390 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2391 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2392 (Cast.DoResolve): Likewise.
2393 (New.DoResolve): Likewise.
2394 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2395 (TypeOf.DoResolve): Likewise.
2397 * expression.cs (Invocation.BetterConversion): Return the Type of
2398 the better conversion. Implement section 14.4.2.3 more faithfully.
2399 (Invocation.BetterFunction): Make boolean. Make correspondence to
2400 section 14.4.2.2 explicit.
2401 (Invocation.OverloadResolve): Update.
2402 (Invocation): Remove is_base field.
2403 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2404 (Invocation.Emit): Likewise.
2406 2004-09-27 Raja R Harinath <rharinath@novell.com>
2408 * README: Update to changes.
2410 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2412 * cs-parser.jay: Reverted 642 warning fix.
2414 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2417 * decl.cs (FindMemberWithSameName): Indexer can have more than
2420 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2422 * expression.cs (LocalVariableReference.DoResolveLValue):
2423 Do not report warning 219 for out values.
2424 (EmptyExpression.Null): New member to avoid extra allocations.
2426 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2428 * cs-parser.jay: Fix wrong warning 642 report.
2430 * cs-tokenizer.cs (CheckNextToken): New helper;
2431 Inspect next character if is same as expected.
2433 2004-09-23 Martin Baulig <martin@ximian.com>
2435 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2436 (Convert.ImplicitReferenceConversionExists): Likewise.
2438 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2440 * class.cs (Operator.Define): Add error 448 and 559 report.
2442 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2444 * class.cs (MemberBase.IsTypePermitted): New protected
2445 method for checking error CS0610.
2447 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2449 * class.cs (TypeContainer.HasExplicitLayout): New property
2450 Returns whether container has StructLayout attribute set Explicit.
2451 (FieldMember): New abstract class for consts and fields.
2452 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2453 (Field): Reuse FieldMember.
2455 * const.cs (Const): Reuse FieldMember.
2457 * rootcontext.cs: EmitConstants call moved to class.
2459 2004-09-22 Martin Baulig <martin@ximian.com>
2461 Thanks to Peter Sestoft for this bug report.
2463 * expression.cs (Conditional): If both the `trueExpr' and the
2464 `falseExpr' is a NullLiteral, return a NullLiteral.
2466 2004-09-22 Martin Baulig <martin@ximian.com>
2468 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2469 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2470 for the "get_Current" call.
2472 2004-09-22 Martin Baulig <martin@ximian.com>
2474 Marek and me just fixed one of our oldest bugs: #28562 :-)
2476 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2478 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2479 we're an EnumConstant, just return that.
2480 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2481 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2482 to get the value which'll actually be written into the attribute.
2483 However, we have to use GetValue() to access the attribute's value
2486 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2488 * constant.cs (Constant.IsNegative): New abstract property
2491 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2492 (StackAlloc.DoResolve): Reused IsNegative.
2494 2004-09-21 Martin Baulig <martin@ximian.com>
2496 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
2497 if we're used in an iterator, we may be called from different
2500 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
2501 we actually have an exception block.
2503 2004-09-20 John Luke <jluke@cfl.rr.com>
2505 * class.cs, cs-parser.jay: Improve the error report for 1520:
2506 report the actual line where the error happens, not where the
2509 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
2510 Pass location information that was available elsewhere.
2512 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
2514 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
2515 runtime to delay sign assemblies.
2517 2004-09-19 Miguel de Icaza <miguel@ximian.com>
2519 * cs-parser.jay: Do not report the stack trace, this is barely
2522 2004-08-22 John Luke <john.luke@gmail.com>
2524 * driver.cs : check that a resource id is not already used
2525 before adding it, report CS1508 if it is, bug #63637
2527 2004-09-19 Miguel de Icaza <miguel@ximian.com>
2529 * ecore.cs: Removed dead code.
2531 2004-09-18 Marek Safar <marek.safar@seznam.cz>
2533 * class.cs: Do not report warning CS0067 on the interfaces.
2535 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2537 * cs-parser.jay: Add error 504 report.
2539 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2541 * rootcontext.cs: WarningLevel is 4 by default now.
2543 * statement.cs (Fixed.Resolve): Do not null
2546 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2549 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
2550 deep search when property is not virtual.
2551 (PropertyExpr.ResolveAccessors): Make one call for both
2554 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2557 * statement.cs: Error 152 report constains also location.
2559 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2562 * const.cs: Explicitly set constant as static.
2564 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2567 * cs-parser.jay: Add error 1017 report.
2569 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2571 Fixed bug #59980, #64224
2572 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
2574 * typemanager.cs (IsSpecialMethod): Simplified
2576 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2578 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
2579 condition with better params.
2581 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2584 * attribute.cs (Resolve): Property has to have both
2587 2004-09-14 Martin Baulig <martin@ximian.com>
2589 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2591 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2594 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2595 called and is obsolete then this member suppress message
2596 when call is inside next [Obsolete] method or type.
2598 * expression.cs: Use TestObsoleteMethodUsage member.
2600 2004-09-14 Martin Baulig <martin@ximian.com>
2602 * cs-parser.jay: Sync a bit with the GMCS version.
2604 2004-09-14 Martin Baulig <martin@ximian.com>
2606 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
2607 (CSharpParser.yacc_verbose_flag): New public field.
2609 * genericparser.cs: Removed.
2611 2004-09-14 Raja R Harinath <rharinath@novell.com>
2613 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
2615 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2617 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2619 2004-09-10 Martin Baulig <martin@ximian.com>
2621 Backported my MemberName changes from GMCS into MCS.
2623 - we are now using a special `MemberName' class instead of using
2624 strings; in GMCS, the `MemberName' also contains the type
2627 - changed the grammar rules a bit:
2628 * the old `member_name' is now a `namespace_or_type_name':
2629 The rule is that we use `namespace_or_type_name' everywhere
2630 where we expect either a "member name" (GetEnumerator) or a
2631 "member name" with an explicit interface name
2632 (IEnumerable.GetEnumerator).
2633 In GMCS, the explicit interface name may include type arguments
2634 (IEnumerable<T>.GetEnumerator).
2635 * we use `member_name' instead of just `IDENTIFIER' for
2637 The rule is that we use `member_name' wherever a member may
2638 have type parameters in GMCS.
2640 * decl.cs (MemberName): New public class.
2641 (MemberCore.MemberName): New public readonly field.
2642 (MemberCore.ctor): Take a `MemberName' argument, not a string.
2643 (DeclSpace): Likewise.
2645 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
2646 * enum.cs (Enum.ctor): Likewise.
2648 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
2650 (AliasEntry.ctor): Take a MemberName, not an Expression.
2651 (AliasEntry.UsingAlias): Likewise.
2653 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
2654 (IMethodData.MemberName): Changed type from string to MemberName.
2655 (MemberBase.ExplicitInterfaceName): Likewise.
2656 (AbstractPropertyEventMethod.SetupName): Make this private.
2657 (AbstractPropertyEventMethod.ctor): Added `string prefix'
2658 argument; compute the member name here.
2659 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
2660 on the `member.MemberName' and the `prefix'.
2662 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
2664 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
2665 thus, we get a `MemberName' instead of a `string'. These
2666 declarations may have type parameters in GMCS.
2667 (interface_method_declaration, delegate_declaration): Likewise.
2668 (class_declaration, interface_declaration): Likewise.
2669 (method_header): Use `namespace_or_type_name' instead of
2670 `member_name'. We may be an explicit interface implementation.
2671 (property_declaration, event_declaration): Likewise.
2672 (member_name): This is now just an `IDENTIFIER', not a
2673 `namespace_or_type_name'.
2674 (type_name, interface_type): Removed.
2675 (namespace_or_type_name): Return a MemberName, not an Expression.
2676 (primary_expression): Use `member_name' instead of `IDENTIFIER';
2677 call GetTypeExpression() on the MemberName to get an expression.
2678 (IndexerDeclaration.interface_type): Changed type from string to
2680 (MakeName): Operate on MemberName's instead of string's.
2682 2004-09-13 Raja R Harinath <rharinath@novell.com>
2685 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
2686 (NamespaceEntry.Lookup): Add new argument to flag if we want the
2687 lookup to avoid symbols introduced by 'using'.
2688 * rootcontext.cs (NamespaceLookup): Update.
2690 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2692 * class.cs (TypeContainer.DoDefineMembers): Do not call
2693 DefineDefaultConstructor for static classes.
2695 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2697 * attribute.cs (Attribute.Resolve): Add error 653 report.
2699 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2701 (Method.ApplyAttributeBuilder): Add error 685 report.
2702 (Operator.Define): Add error 564 report.
2704 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2706 * expression.cs (Invocation.DoResolve): Add error
2709 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2712 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2714 * class.cs (ConstructorInitializer.Resolve):
2715 Wrong error number (515->516).
2717 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2719 * class.cs (Indexer.Define): Add error 631 report.
2721 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2723 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2725 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2727 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2729 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2731 * cs-parser.jay: Added error CS0241 report.
2733 2004-09-10 Raja R Harinath <rharinath@novell.com>
2735 * cs-parser.jay (fixed_statement): Introduce a scope for the
2736 declaration in the 'fixed' statement.
2738 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2740 * cs-parser.jay: Added CS0230 error report.
2742 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2744 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2746 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2748 * expression.cs (Argument.Resolve): Added error CS0192 and
2751 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2753 C# 2.0 #pragma warning feature
2755 * cs-tokenizer.cs (PreProcessPragma): New method;
2756 Handles #pragma directive.
2758 * report.cs (WarningRegions): New class; Support
2759 class for #pragma warning directive. It tests whether
2760 warning is enabled for a given line.
2762 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2764 * const.cs: Add more descriptive error report, tahnks to
2767 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2769 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2771 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2773 * expression.cs: Apply patch from Ben: Remove dead code from
2774 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2775 as that code just threw an exception anwyays.
2777 * const.cs: Remove the call to the turnintoconstant, for details
2780 * literal.cs: The type of the null-literal is the null type; So
2781 we use a placeholder type (literal.cs:System.Null, defined here)
2784 * expression.cs (Conditional.DoResolve): Remove some old code that
2785 is no longer needed, conversions have been fixed.
2787 (ArrayCreationExpression.DoResolve): Return false if we fail to
2788 resolve the inner expression.
2790 2004-09-07 Raja R Harinath <rharinath@novell.com>
2793 * cs-parser.jay (delegate_declaration): Record a delegate
2794 declaration as a type declaration.
2795 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2797 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2799 * parameter.cs: Do not crash if the type can not be resolved.
2801 * expression.cs: Report errors with unsafe pointers, fixes #64896
2803 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2805 * expression.cs: Pointer arith always needs to do a conv.i
2806 if the operand is a long. fix 65320
2808 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2810 Fixed cs0619-37.cs, cs0619-38.cs
2812 * enum.cs (GetObsoleteAttribute): Removed.
2814 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
2815 on Enum member is double staged. The first is tested member
2818 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2820 Fixed #56986, #63631, #65231
2822 * class.cs: (TypeContainer.AddToMemberContainer): New method,
2823 adds member to name container.
2824 (TypeContainer.AddToTypeContainer): New method, adds type to
2826 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
2827 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
2828 AddOperator): Simplified by reusing AddToMemberContainer.
2829 (TypeContainer.UserDefinedStaticConstructor): Changed to property
2831 (Method.CheckForDuplications): Fixed implementation to test all
2833 (MemberBase): Detection whether member is explicit interface
2834 implementation is now in constructor.
2835 (MemberBase.UpdateMemberName): Handles IndexerName.
2836 (Accessor): Changed to keep also location information.
2837 (AbstractPropertyEventMethod): Is derived from MemberCore.
2838 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
2839 will be emited or not.
2840 (PropertyBase.AreAccessorsDuplicateImplementation):
2841 Tests whether accessors are not in collision with some method.
2842 (Operator): Is derived from MethodCore to simplify common
2845 * decl.cs (Flags.TestMethodDuplication): Test for duplication
2847 (DeclSpace.AddToContainer): Adds the member to defined_names
2848 table. It tests for duplications and enclosing name conflicts.
2850 * enum.cs (EnumMember): Clean up to reuse the base structures
2852 2004-09-03 Martin Baulig <martin@ximian.com>
2854 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
2855 into TypeContainer, to make partial classes work again.
2857 2004-09-03 Martin Baulig <martin@ximian.com>
2859 * rootcontext.cs (RootContext.V2): Removed.
2861 2004-03-23 Martin Baulig <martin@ximian.com>
2863 * expression.cs (Invocation.OverloadResolve): Added `bool
2864 may_fail' argument and use it instead of the Location.IsNull() hack.
2866 2004-09-03 Martin Baulig <martin@ximian.com>
2868 Merged latest changes into gmcs. Please keep this comment in
2869 here, it makes it easier for me to see what changed in MCS since
2870 the last time I merged.
2872 2004-09-03 Raja R Harinath <rharinath@novell.com>
2875 * expression.cs (BetterConversion): Don't allow either conversion
2876 to be null. Remove redundant implicit conversion test when 'q ==
2877 null' -- when this function is invoked, we already know that the
2878 implicit conversion exists.
2879 (BetterFunction): Assume that 'best' is non-null. Remove
2880 redundant reimplementation of IsApplicable when 'best' is null.
2881 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
2882 number of arguments.
2883 (IsAncestralType): Extract from OverloadResolve.
2884 (OverloadResolve): Make robust to the MethodGroupExpr being
2885 unsorted. Implement all the logic of Section 14.5.5.1, and
2886 support overloading of methods from multiple applicable types.
2887 Clean up logic somewhat. Don't pass null methods to BetterFunction.
2889 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
2890 (RealError, Warning): Append type of report to related symbol.
2892 2004-09-03 Marek Safar <marek.safar@seznam.cz>
2894 * enum.cs: Fixed CLS-Compliance checks for enum members.
2895 Error tests cs3008-8.cs, cs3014-8.cs
2897 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2899 Fixed bug #62342, #63102
2900 * class.cs: ImplementIndexer uses member.IsExplicitImpl
2901 like ImplementMethod.
2903 2004-09-02 Marek Safar <marek.safar@seznam.cz>
2905 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2908 2004-09-02 Martin Baulig <martin@ximian.com>
2910 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
2911 TypeManager.GetArgumentTypes() rather than calling GetParameters()
2914 2004-09-01 Marek Safar <marek.safar@seznam.cz>
2916 C# 2.0 Static classes implemented
2918 * class.cs (TypeContainer): instance_constructors,
2919 initialized_fields, initialized_static_fields,
2920 default_constructor, base_inteface_types are protected to be
2921 accessible from StaticClass.
2922 (TypeContainer.DefineDefaultConstructor): New virtual method
2923 for custom default constructor generating
2924 (StaticClass): New class to handle "Static classes" feature.
2926 * cs-parser.jay: Handle static keyword on class like instance
2929 * driver.cs: Added "/langversion" command line switch with two
2930 options (iso-1, default).
2932 2004-08-31 Marek Safar <marek.safar@seznam.cz>
2934 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
2936 2004-08-31 Miguel de Icaza <miguel@ximian.com>
2938 * delegate.cs: Style.
2940 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
2942 * delegate.cs: Add seperate instance expr field for miguel.
2944 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2946 * PointerArithmetic (Resolve): make sure we are not doing
2947 pointer arith on void*. Also, make sure we are resolved
2948 by not setting eclass until resolve.
2950 All callers: Make sure that PointerArithmetic gets resolved.
2952 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
2954 * ArrayCreation (LookupType): If the type does not resolve
2955 to an array, give an error.
2957 2004-08-27 Marek Safar <marek.safar@seznam.cz>
2959 * statement.cs (Try.Resolve): Fixed bug #64222
2961 2004-08-27 Martin Baulig <martin@ximian.com>
2964 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
2967 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2969 * ecore.cs (Constantify): Get underlying type via
2970 System.Enum.GetUnderlyingType to avoid StackOverflow on the
2971 Windows in special cases.
2973 2004-08-26 Marek Safar <marek.safar@seznam.cz>
2975 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
2976 for obtaining also private methods.
2977 (GetRemoveMethod): Used GetRemoveMethod (true)
2978 for obtaining also private methods.
2980 2004-08-24 Martin Baulig <martin@ximian.com>
2982 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
2983 MethodAttributes.HideBySig for operators.
2985 2004-08-23 Martin Baulig <martin@ximian.com>
2987 Back to the old error reporting system :-)
2989 * report.cs (Message): Removed.
2990 (Report.MessageData, ErrorData, WarningData): Removed.
2991 (Report.Error, Warning): Back to the old system.
2993 2004-08-23 Martin Baulig <martin@ximian.com>
2995 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2997 * class.cs (TypeContainer.ParentContainer): New public virtual
2998 method; replaces the explicit interface implementation.
2999 (ClassPart.ParentContainer): Override.
3001 2004-08-23 Martin Baulig <martin@ximian.com>
3003 * statement.cs (Switch): Added support for constant switches; see
3004 #59428 or test-285.cs.
3006 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3009 * statement.cs (GetEnumeratorFilter): Removed useless
3010 logic because C# specs is strict. GetEnumerator must be
3013 2004-08-22 Martin Baulig <martin@ximian.com>
3015 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3016 a switch and may break, reset the barrier. Fixes #59867.
3018 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3020 CLS-Compliance speed up (~5% for corlib)
3022 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
3023 New method. Tests container for CLS-Compliant names
3025 * class.cs (TypeContainer.VerifyClsName): New method.
3026 Checks whether container name is CLS Compliant.
3027 (Constructor): Implements IMethodData.
3029 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3030 low-case table for CLS Compliance test.
3031 (MemberCache.VerifyClsParameterConflict): New method.
3032 Checks method parameters for CS3006 error.
3034 * enum.cs (EnumMember): Is derived from MemberCore.
3035 (Enum.VerifyClsName): Optimized for better performance.
3037 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3039 * report.cs: Renamed Error_T to Error and changed all
3042 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3044 * class.cs (TypeContainer.IndexerArrayList): New inner class
3045 container for indexers.
3046 (TypeContainer.DefaultIndexerName): New constant for default
3047 indexer name. Replaced all "Item" with this constant.
3048 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3050 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3051 DefaultMemberAttribute constructor.
3053 2004-08-05 Martin Baulig <martin@ximian.com>
3055 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3058 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3060 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3061 multi platforms problem.
3063 * compiler.csproj: Included shared files.
3065 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3067 Fix bug 60333, 55971 in the more general way
3068 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3069 Added arg_type argument for constant conversion.
3070 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3072 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3075 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3076 OperatorArrayList, MethodCoreArrayList for typecontainer
3077 containers. Changed class member types to these new types.
3078 (MethodArrayList.DefineMembers): Added test for CS0659.
3080 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3082 * cfold.cs: Synchronize the folding with the code in expression.cs
3083 Binary.DoNumericPromotions for uint operands.
3085 * attribute.cs: Revert patch from Raja, it introduced a regression
3086 while building Blam-1.2.1 (hard to isolate a test case).
3088 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3092 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3094 (MethodCore.parent_method): New member. The method we're overriding
3095 if this is an override method.
3096 (MethodCore.CheckBase): Moved from Method class and made common.
3097 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3099 (MethodCore.CheckForDuplications): New abstract method. For custom
3100 member duplication search in a container
3101 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3102 method and its return type.
3103 (Event.conflict_symbol): New member. Symbol with same name in the
3107 (MemberCache.FindMemberWithSameName): New method. The method
3108 is looking for conflict with inherited symbols.
3110 2004-08-04 Martin Baulig <martin@ximian.com>
3112 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3114 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3116 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3118 * report.cs (Message): New enum for better error, warning reference in
3120 (MessageData): New inner abstract class. It generally handles printing of
3121 error and warning messages.
3122 Removed unused Error, Warning, Message methods.
3124 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3126 Fix for cs0592-8.cs test
3128 (Attributable.ValidAttributeTargets): Made public.
3129 (Attribute.ExplicitTarget): New member for explicit target value.
3130 (Attribute.CheckTargets): Now we translate explicit attribute
3131 target to Target here.
3133 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3135 * ecore.cs (MethodGroupExpr): new IsBase property.
3137 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3139 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3140 rather than an instance expr.
3142 (DelegateCreation.Emit): Use the method group rather than
3143 the instance expression. Also, if you have base.Foo as the
3144 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3146 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3148 (NewDelegate.DoResolve): Only check for the existance of Invoke
3149 if the method is going to be needed. Use MethodGroupExpr.
3151 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3153 * expression.cs: For pointer arith., make sure to use
3154 the size of the type, not the size of the pointer to
3157 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3160 * class.cs (Class): Added error CS0502 test.
3162 2004-08-03 John Luke <jluke@cfl.rr.com>
3163 Raja R Harinath <rharinath@novell.com>
3166 * attribute.cs (Attribute.complained_before): New flag.
3167 (Attribute.ResolveType, Attribute.Resolve),
3168 (Attribute.DefinePInvokeMethod): Set it.
3169 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3171 2004-08-03 Martin Baulig <martin@ximian.com>
3173 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3174 use a user-defined operator; we still need to do numeric
3175 promotions in case one argument is a builtin type and the other
3176 one has an implicit conversion to that type. Fixes #62322.
3178 2004-08-02 Martin Baulig <martin@ximian.com>
3180 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3181 (LocalInfo.IsThis): New public property.
3182 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3184 2004-08-01 Martin Baulig <martin@ximian.com>
3186 * class.cs (TypeContainer.GetClassBases): Don't set the default
3187 here since we may get called from GetPartialBases().
3188 (TypeContainer.DefineType): If GetClassBases() didn't return a
3189 parent, use the default one.
3191 2004-07-30 Duncan Mak <duncan@ximian.com>
3193 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
3195 2004-07-30 Martin Baulig <martin@ximian.com>
3197 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3199 * class.cs (SourceMethod): New public class, derive from the
3200 symbol writer's ISourceMethod.
3201 (Method): Use the new symbol writer API.
3203 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3204 as argument and use the new symbol writer.
3207 (SourceFile): Implement the symbol writer's ISourceFile.
3208 (Location.SymbolDocument): Removed.
3209 (Location.SourceFile): New public property.
3211 * symbolwriter.cs: Use the new symbol writer API.
3213 2004-07-30 Raja R Harinath <rharinath@novell.com>
3215 * Makefile (install-local): Remove. Functionality moved to
3218 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3220 * Makefile: Install mcs.exe.config file together with mcs.exe.
3221 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3222 correct runtime version.
3224 2004-07-25 Martin Baulig <martin@ximian.com>
3227 (TypeContainer.RegisterOrder): Removed, this was unused.
3228 (TypeContainer, interface_order): Removed.
3229 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3230 TypeContainer as argument since we can also be called with a
3231 `PartialContainer' for a partial class/struct/interface.
3232 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3233 of checking whether we're an `Interface' - we could be a
3235 (PartialContainer.Register): Override; call
3236 AddClass()/AddStruct()/AddInterface() on our parent.
3238 * cs-parser.jay (interface_member_declaration): Add things to the
3239 `current_container', not the `current_class'.
3241 * rootcontext.cs (RegisterOrder): The overloaded version which
3242 takes an `Interface' was unused, removed.
3244 * typemanager.cs (TypeManager.LookupInterface): Return a
3245 `TypeContainer', not an `Interface'.
3246 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3247 contain a `PartialContainer' for an interface, so check it's
3248 `Kind' to figure out what it is.
3250 2004-07-25 Martin Baulig <martin@ximian.com>
3252 * class.cs (Class.DefaultTypeAttributes): New public constant.
3253 (Struct.DefaultTypeAttributes): Likewise.
3254 (Interface.DefaultTypeAttributes): Likewise.
3255 (PartialContainer.TypeAttr): Override this and add the
3256 DefaultTypeAttributes.
3258 2004-07-25 Martin Baulig <martin@ximian.com>
3260 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3261 we can just use the `Parent' field instead.
3263 2004-07-25 Martin Baulig <martin@ximian.com>
3265 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3267 2004-07-25 Martin Baulig <martin@ximian.com>
3269 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3270 our parts before defining any methods.
3271 (TypeContainer.VerifyImplements): Make this virtual.
3272 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3273 on our PartialContainer.
3275 2004-07-25 Martin Baulig <martin@ximian.com>
3277 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3279 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3280 argument, we can just use the `Parent' field instead.
3283 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3284 (MemberBase.DoDefine): Likewise.
3286 2004-07-24 Martin Baulig <martin@ximian.com>
3288 * decl.cs (MemberCore.Parent): New public field.
3289 (DeclSpace.Parent): Moved to MemberCore.
3291 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3292 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3294 (FieldBase, Field, Operator): Likewise.
3295 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3296 (EventField, Event): Likewise.
3298 2004-07-23 Martin Baulig <martin@ximian.com>
3300 * class.cs (PartialContainer): New public class.
3301 (ClassPart): New public class.
3302 (TypeContainer): Added support for partial classes.
3303 (TypeContainer.GetClassBases): Splitted some of the functionality
3304 out into GetNormalBases() and GetPartialBases().
3306 * cs-tokenizer.cs (Token.PARTIAL): New token.
3307 (Tokenizer.consume_identifier): Added some hacks to recognize
3308 `partial', but only if it's immediately followed by `class',
3309 `struct' or `interface'.
3311 * cs-parser.jay: Added support for partial clases.
3313 2004-07-23 Martin Baulig <martin@ximian.com>
3315 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3316 a `DeclSpace' and also made it readonly.
3317 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3318 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3319 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3321 * cs-parser.jay: Pass the `current_class', not the
3322 `current_container' (at the moment, this is still the same thing)
3323 to a new Method, Property, Event, Indexer or Constructor.
3325 2004-07-23 Martin Baulig <martin@ximian.com>
3327 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3328 and removed the `current_interface' one.
3329 (struct_declaration, class_declaration, interface_declaration):
3330 Set `current_class' to the newly created class/struct/interface;
3331 set their `Bases' and call Register() before parsing their body.
3333 2004-07-23 Martin Baulig <martin@ximian.com>
3335 * class.cs (Kind): New public enum.
3336 (TypeContainer): Made this class abstract.
3337 (TypeContainer.Kind): New public readonly field.
3338 (TypeContainer.CheckDef): New public method; moved here from
3340 (TypeContainer.Register): New public abstract method.
3341 (TypeContainer.GetPendingImplementations): New public abstract
3343 (TypeContainer.GetClassBases): Removed the `is_class' and
3344 `is_iface' parameters.
3345 (TypeContainer.DefineNestedTypes): Formerly known as
3347 (ClassOrStruct): Made this class abstract.
3349 * tree.cs (RootTypes): New public type.
3351 2004-07-20 Martin Baulig <martin@ximian.com>
3353 * tree.cs (Tree.RecordNamespace): Removed.
3354 (Tree.Namespaces): Removed.
3356 * rootcontext.cs (RootContext.IsNamespace): Removed.
3358 * cs-parser.jay (namespace_declaration): Just create a new
3359 NamespaceEntry here.
3361 2004-07-20 Martin Baulig <martin@ximian.com>
3363 * statement.cs (ExceptionStatement): New abstract class. This is
3364 now used as a base class for everyone who's using `finally'.
3365 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
3366 our local variables before using them.
3368 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
3369 virtual method. This is used by Yield.Resolve() to "steal" an
3370 outer block's `finally' clauses.
3371 (FlowBranchingException): The .ctor now takes an ExceptionStatement
3374 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
3375 version which takes an ExceptionStatement. This version must be
3376 used to create exception branchings.
3379 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
3380 (Iterator.EmitMoveNext): Added exception support; protect the
3381 block with a `fault' clause, properly handle 'finally' clauses.
3382 (Iterator.EmitDispose): Run all the `finally' clauses here.
3384 2004-07-20 Martin Baulig <martin@ximian.com>
3386 * iterator.cs: This is the first of a set of changes in the
3387 iterator code. Match the spec more closely: if we're an
3388 IEnumerable, then GetEnumerator() must be called. The first time
3389 GetEnumerator() is called, it returns the current instance; all
3390 subsequent invocations (if any) must create a copy.
3392 2004-07-19 Miguel de Icaza <miguel@ximian.com>
3394 * expression.cs: Resolve the constant expression before returning
3397 2004-07-19 Martin Baulig <martin@ximian.com>
3399 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
3400 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
3401 the return type of the new EmitContext.
3403 2004-07-18 Martin Baulig <martin@ximian.com>
3405 * class.cs (Property.Define): Fix iterators.
3407 * iterators.cs (Iterator.Define): Moved the
3408 `container.AddInterator (this)' call here from the .ctor; only do
3409 it if we resolved successfully.
3411 2004-07-17 Miguel de Icaza <miguel@ximian.com>
3413 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
3414 `true' for preprocessing directives that we parse. The return
3415 value indicates whether we should return to regular tokenizing or
3416 not, not whether it was parsed successfully.
3418 In the past if we were in: #if false ... #line #endif, we would
3419 resume parsing after `#line'. See bug 61604.
3421 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
3422 building: IsEnumType should return true only for enums, not for
3423 enums or System.Enum itself. This fixes #61593.
3425 Likely what happened is that corlib was wrong: mcs depended on
3426 this bug in some places. The bug got fixed, we had to add the
3427 hack, which caused bug 61593.
3429 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
3430 that was a workaround for the older conditions.
3432 2004-07-16 Ben Maurer <bmaurer@ximian.com>
3434 * assign.cs: IAssignMethod has a new interface, as documented
3435 inline. All assignment code now uses this new api.
3437 * ecore.cs, expression.cs: All classes which implement
3438 IAssignMethod now use the new interface.
3440 * expression.cs (Invocation): add a hack to EmitCall so that
3441 IndexerAccess can be the target of a compound assignment without
3442 evaluating its arguments twice.
3444 * statement.cs: Handle changes in Invocation api.
3446 2004-07-16 Martin Baulig <martin@ximian.com>
3448 * iterators.cs: Rewrote this. We're now using one single Proxy
3449 class for both the IEnumerable and the IEnumerator interface and
3450 `Iterator' derives from Class so we can use the high-level API.
3452 * class.cs (TypeContainer.AddIterator): New method.
3453 (TypeContainer.DoDefineType): New protected virtual method, which
3454 is called from DefineType().
3455 (TypeContainer.DoDefineMembers): Call DefineType() and
3456 DefineMembers() on all our iterators.
3457 (TypeContainer.Emit): Call Emit() on all our iterators.
3458 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3460 * codegen.cs (EmitContext.CurrentIterator): New public field.
3462 2004-07-15 Martin Baulig <martin@ximian.com>
3465 (TypeManager.not_supported_exception_type): New type.
3467 2004-07-14 Martin Baulig <martin@ximian.com>
3469 * iterators.cs: Use real error numbers.
3471 2004-07-14 Martin Baulig <martin@ximian.com>
3473 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3474 requires this to be a System.Collection.IEnumerable and not a
3475 class implementing that interface.
3476 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3478 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3480 * class.cs: Fixed previous fix, it broke some error tests.
3482 2004-07-12 Martin Baulig <martin@ximian.com>
3484 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3487 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3489 * assign.cs (LocalTemporary): Add new argument: is_address,If
3490 `is_address' is true, then the value that we store is the address
3491 to the real value, and not the value itself.
3493 * ecore.cs (PropertyExpr): use the new local temporary
3494 stuff to allow us to handle X.Y += z (where X is a struct)
3496 2004-07-08 Martin Baulig <martin@ximian.com>
3498 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3499 not always return, just like we're doing in Using.Resolve().
3501 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3503 * cs-parser.jay (fixed_statement): flag this as Pinned.
3505 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3507 * typemanager.cs (TypeManager): Removed MakePinned method, this
3508 mechanism is replaced with the .NET 2.x compatible mechanism of
3509 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3511 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3512 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3513 `IsFixed' property which has a different meaning.
3515 2004-07-02 Raja R Harinath <rharinath@novell.com>
3517 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3518 visible from inside a nested class, not just the names of the
3519 immediately enclosing class.
3522 2004-06-24 Raja R Harinath <rharinath@novell.com>
3524 * expression.cs (BetterConversion): Remove buggy special-case
3525 handling of "implicit constant expression conversions". At this
3526 point, we already know that the conversion is possible -- we're
3527 only checking to see which is better.
3529 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3531 * cs-parser.jay: Added error CS0210 test.
3533 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3535 * cs-parser.jay: Added error CS0134 test.
3537 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3540 * cs-parser.jay: Added error CS0145 test.
3542 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3544 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3546 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3548 * expression.cs (StackAlloc.Resolve): The argument may not
3549 be a constant; deal with this case.
3551 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3553 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3554 GetIndexerAttributeValue.
3555 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3557 * class.cs (Indexer.Define): Added error tests for CS0415,
3560 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3562 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3565 2004-06-23 Martin Baulig <martin@ximian.com>
3567 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3568 neither return nor throw, reset the barrier as well. Fixes #60457.
3570 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3572 * class.cs : EventAttributes is now set to None by default.
3573 This fixes bug #60459.
3575 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3578 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3579 Don't throw exception but return null (it's sufficient now).
3581 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3583 * typemanager.cs (GetArgumentTypes): Faster implementation.
3585 2004-06-18 Martin Baulig <martin@ximian.com>
3587 * attribute.cs (Attribute.Resolve): Check whether we're an
3588 EmptyCast which a Constant child. Fixes #60333.
3590 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3592 * statement.cs (EmitCollectionForeach): Account for the fact that
3593 not all valuetypes are in areas which we can take the address of.
3594 For these variables, we store to a temporary variable. Also, make
3595 sure that we dont emit a `callvirt' on a valuetype method.
3597 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3599 * expression.cs (StackAlloc.DoReSolve): Added test for
3600 negative parameter (CS0247).
3602 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3605 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3607 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3610 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3613 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3615 Fix bug #58254 & cs1555.cs, cs1556.cs
3616 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3618 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3620 * cs-parser.jay: Added error CS1669 test for indexers.
3622 2004-06-11 Martin Baulig <martin@ximian.com>
3624 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3625 call this twice: for params and varargs methods.
3627 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3630 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3632 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3634 * attribute.cs (Attribute.GetValidTargets): Made public.
3637 (AbstractPropertyEventMethod): New class for better code sharing.
3638 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3640 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3642 2004-06-11 Raja R Harinath <rharinath@novell.com>
3645 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
3646 that the call to Resolve is part of a MemberAccess.
3647 (Expression.Resolve): Use it for SimpleName resolution.
3648 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
3649 Add 'intermediate' boolean argument.
3650 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
3651 error message when the SimpleName can be resolved ambiguously
3652 between an expression and a type.
3653 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
3655 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
3656 call on the left-side.
3658 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3661 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
3663 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3665 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
3667 2004-06-11 Martin Baulig <martin@ximian.com>
3669 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
3670 varargs methods if applicable.
3672 2004-06-11 Martin Baulig <martin@ximian.com>
3674 * expression.cs (Invocation.EmitCall): Don't use
3675 `method.CallingConvention == CallingConventions.VarArgs' since the
3676 method could also have `CallingConventions.HasThis'.
3678 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3680 * class.cs (Event.GetSignatureForError): Implemented.
3681 Fixed crash in error test cs3010.cs
3683 2004-06-10 Miguel de Icaza <miguel@ximian.com>
3685 * cs-tokenizer.cs: Change the way we track __arglist to be
3686 consistent with the other keywords.
3688 2004-06-09 Miguel de Icaza <miguel@ximian.com>
3690 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
3693 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
3695 * codegen.cs: Check that all referenced assemblies have a strongname
3696 before strongnaming the compiled assembly. If not report error CS1577.
3697 Fix bug #56563. Patch by Jackson Harper.
3698 * typemanager.cs: Added a method to return all referenced assemblies.
3699 Fix bug #56563. Patch by Jackson Harper.
3701 2004-06-08 Marek Safar <marek.safar@seznam.cz>
3704 (Method.ApplyAttributeBuilder): Moved and added conditional
3705 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
3708 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
3710 2004-06-08 Marek Safar <marek.safar@seznam.cz>
3713 * class.cs: (EventField.attribute_targets): Changed default target.
3715 2004-06-08 Martin Baulig <martin@ximian.com>
3717 * expression.cs (Invocation.EmitCall): Enable varargs methods.
3719 2004-06-08 Martin Baulig <martin@ximian.com>
3721 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
3723 2004-06-07 Martin Baulig <martin@ximian.com>
3725 Added support for varargs methods.
3727 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
3730 * cs-parser.jay: Added support for `__arglist'.
3732 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
3734 * expression.cs (Argument.AType): Added `ArgList'.
3735 (Invocation): Added support for varargs methods.
3736 (ArglistAccess): New public class.
3737 (Arglist): New public class.
3739 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
3741 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
3742 a method's top-level block if the method has varargs.
3744 * support.cs (ReflectionParameters, InternalParameters): Added
3745 support for varargs methods.
3747 2004-06-07 Miguel de Icaza <miguel@ximian.com>
3749 * class.cs: Provide location in indexer error report.
3751 * driver.cs: Use standard names.
3753 * namespace.cs: Catch the use of using after a namespace has been
3754 declared also on using aliases.
3756 2004-06-03 Raja R Harinath <rharinath@novell.com>
3759 * typemanager.cs (closure_private_ok, closure_invocation_type)
3760 (closure_qualifier_type, closure_invocation_assembly)
3761 (FilterWithClosure): Move to ...
3762 (Closure): New internal nested class.
3763 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
3764 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
3765 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
3766 (MemberLookup, MemberLookupFailed): Use it.
3767 * expression.cs (New.DoResolve): Treat the lookup for the
3768 constructor as being qualified by the 'new'ed type.
3769 (Indexers.GetIndexersForTypeOrInterface): Update.
3771 2004-06-03 Marek Safar <marek.safar@seznam.cz>
3774 (GetConditionalAttributeValue): New method. Returns
3775 condition of ConditionalAttribute.
3776 (SearchMulti): New method. Returns all attributes of type 't'.
3777 Use it when attribute is AllowMultiple = true.
3778 (IsConditionalMethodExcluded): New method.
3781 (Method.IsExcluded): Implemented. Returns true if method has conditional
3782 attribute and the conditions is not defined (method is excluded).
3783 (IMethodData): Extended interface for ConditionalAttribute support.
3784 (PropertyMethod.IsExcluded): Implemented.
3787 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
3790 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
3793 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
3795 * expression.cs (ArrayCreationExpression): Make this just an
3796 `expression'. It can't be a statement, so the code here was
3799 2004-06-02 Marek Safar <marek.safar@seznam.cz>
3802 * typemanager.cs (GetFullNameSignature): New method for
3805 2004-06-02 Marek Safar <marek.safar@seznam.cz>
3808 * class.cs (MemberBase.GetSignatureForError): New virtual method.
3809 Use this method when MethodBuilder is null.
3810 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
3811 Added test for error CS0626 (MONO reports error for this situation).
3812 (IMethodData.GetSignatureForError): Extended interface.
3814 2004-06-01 Marek Safar <marek.safar@seznam.cz>
3817 (AttributeTester.GetObsoleteAttribute): Returns instance of
3818 ObsoleteAttribute when type is obsolete.
3821 (TypeContainer.VerifyObsoleteAttribute): Override.
3822 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
3823 (MethodCode.VerifyObsoleteAttribute): Override.
3824 (MemberBase.VerifyObsoleteAttribute): Override.
3827 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
3828 and report proper error.
3831 Delegate.VerifyObsoleteAttribute): Override.
3834 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
3835 and report proper error.
3836 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
3839 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
3843 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
3844 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
3845 Added test for ObsoleteAttribute.
3848 (Catch): Derived from Statement.
3850 2004-06-01 Marek Safar <marek.safar@seznam.cz>
3852 Fixed bug #59071 & cs0160.cs
3854 * statement.cs (Try.Resolve): Check here whether order of catch
3855 clauses matches their dependencies.
3857 2004-05-31 Miguel de Icaza <miguel@ximian.com>
3859 * Reverted patch to namespace.cs (Use lookuptypedirect). This
3860 caused a regression: #59343. Referencing nested classes from an
3861 assembly stopped working.
3863 2004-05-31 Martin Baulig <martin@ximian.com>
3865 MCS is now frozen for beta 2.
3867 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3869 * convert.cs: add a trivial cache for overload operator resolution.
3871 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3873 * decl.cs: If possible, use lookuptypedirect here. We can only do
3874 this if there is no `.' after the namespace. Avoids using
3875 LookupType, which does lots of slow processing.
3876 (FindNestedType) New method, does what it says :-).
3877 * namespace.cs: use LookupTypeDirect.
3878 * rootcontext.cs: use membercache, if possible.
3879 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
3881 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3884 According to the spec,
3886 In a member access of the form E.I, if E is a single identifier,
3887 and if the meaning of E as a simple-name (§7.5.2) is a constant,
3888 field, property, localvariable, or parameter with the same type as
3889 the meaning of E as a type-name (§3.8), then both possible
3890 meanings of E are permitted.
3892 We did not check that E as a simple-name had the same type as E as
3895 This trivial check gives us 5-7% on bootstrap time.
3897 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
3899 * expression.cs (Invocation.OverloadResolve): Avoid the
3900 use of hashtables and boxing here by allocating on demand.
3902 2004-05-30 Martin Baulig <martin@ximian.com>
3904 * rootcontext.cs (RootContext.LookupType): Don't cache things if
3905 we're doing a silent lookup. Don't try to lookup nested types in
3906 TypeManager.object_type (thanks to Ben Maurer).
3908 2004-05-30 Martin Baulig <martin@ximian.com>
3910 Committing a patch from Ben Maurer.
3912 * rootcontext.cs (RootContext.LookupType): Cache negative results.
3914 2004-05-29 Martin Baulig <martin@ximian.com>
3916 * class.cs (IMethodData.ShouldIgnore): New method.
3918 * typemanager.cs (TypeManager.MethodFlags): Don't take a
3919 `Location' argument, we don't need it anywhere. Use
3920 `IMethodData.ShouldIgnore ()' instead of
3921 `MethodData.GetMethodFlags ()'.
3922 (TypeManager.AddMethod): Removed.
3923 (TypeManager.AddMethod2): Renamed to AddMethod.
3925 2004-05-29 Martin Baulig <martin@ximian.com>
3927 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
3929 * convert.cs (Convert.ImplicitReferenceConversion): If we're
3930 converting from a class type S to an interface type and we already
3931 have an object on the stack, don't box it again. Fixes #52578.
3933 2004-05-29 Martin Baulig <martin@ximian.com>
3935 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3936 Added support for `params' parameters. Fixes #59267.
3938 2004-05-29 Martin Baulig <martin@ximian.com>
3940 * literal.cs (NullPointer): Provide a private .ctor which sets
3941 `type' to TypeManager.object_type. Fixes #59048.
3943 2004-05-29 Martin Baulig <martin@ximian.com>
3945 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
3946 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
3948 * ecore.cs (EventExpr.instance_expr): Make the field private.
3950 2004-05-26 Marek Safar <marek.safar@seznam.cz>
3952 Fixed bug #50080 & cs0214-2.cs
3953 * expression.cs (Cast.DoResolve): Check unsafe context here.
3955 * statement.cs (Resolve.DoResolve): Likewise.
3957 2004-05-26 Martin Baulig <martin@ximian.com>
3959 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
3961 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
3962 (RootContext.LookupType): Pass down the `silent' flag.
3964 2004-05-25 Martin Baulig <martin@ximian.com>
3967 (MethodGroupExpr.IdenticalTypeName): New public property.
3968 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
3969 expression actually refers to a type.
3971 2004-05-25 Martin Baulig <martin@ximian.com>
3973 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
3974 for #56176 and made it actually work.
3976 2004-05-25 Martin Baulig <martin@ximian.com>
3978 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
3979 (FieldExpr, PropertyExpr): Override and implement
3980 CacheTemporaries. Fixes #52279.
3982 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3984 * location.cs: In the new compiler listing a file twice is a
3985 warning, not an error.
3987 2004-05-24 Martin Baulig <martin@ximian.com>
3989 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3990 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3992 2004-05-24 Martin Baulig <martin@ximian.com>
3994 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3995 walking the `using' list. Fixes #53921.
3997 2004-05-24 Martin Baulig <martin@ximian.com>
3999 * const.cs (Const.LookupConstantValue): Added support for
4000 EmptyCast's; fixes #55251.
4002 2004-05-24 Martin Baulig <martin@ximian.com>
4004 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
4005 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
4006 which does the CS0135 check. The reason is that we first need to
4007 check whether the variable actually exists.
4009 2004-05-24 Martin Baulig <martin@ximian.com>
4011 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
4012 than RootContext.LookupType() to find the explicit interface
4015 2004-05-24 Raja R Harinath <rharinath@novell.com>
4017 * Makefile: Simplify. Use executable.make.
4018 * mcs.exe.sources: New file. List of sources of mcs.exe.
4020 2004-05-24 Anders Carlsson <andersca@gnome.org>
4024 Use the invariant culture when doing String.Compare for CLS case
4027 2004-05-23 Martin Baulig <martin@ximian.com>
4029 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4030 don't have any dots. Fixes #52622, added cs0246-8.cs.
4032 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4034 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4036 * class.cs (MemberBase.Define): Reuse MemberType member for
4037 resolved type. Other methods can use it too.
4039 2004-05-23 Martin Baulig <martin@ximian.com>
4041 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4042 the variable also exists in the current block (otherwise, we need
4043 to report a CS0103). Fixes #58670.
4045 2004-05-23 Martin Baulig <martin@ximian.com>
4047 * flowanalysis.cs (Reachability.Reachable): Compute this
4048 on-the-fly rather than storing it as a field.
4050 2004-05-23 Martin Baulig <martin@ximian.com>
4052 * flowanalysis.cs (Reachability.And): Manually compute the
4053 resulting `barrier' from the reachability.
4055 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4058 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4059 instance of ObsoleteAttribute when symbol is obsolete.
4062 (IMethodData): Extended interface for ObsoleteAttribute support.
4064 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4066 * attribute.cs: Fix bug #55970
4068 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4072 (GetObsoleteAttribute): New method. Creates the instance of
4074 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4075 ObsoleteAttribute when member is obsolete.
4076 (AttributeTester.Report_ObsoleteMessage): Common method for
4077 Obsolete error/warning reporting.
4080 (TypeContainer.base_classs_type): New member for storing parent type.
4083 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4084 for this MemberCore.
4086 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4088 * attribute.cs, const.cs: Fix bug #58590
4090 2004-05-21 Martin Baulig <martin@ximian.com>
4092 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4093 out parameters if the end of the method is unreachable. Fixes
4096 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4098 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4099 Hari was right, why extra method.
4101 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4103 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4105 2004-05-20 Martin Baulig <martin@ximian.com>
4107 Merged this back from gmcs to keep the differences to a minumum.
4109 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
4110 instead of a Declspace.
4111 (Attribute.ResolveType): Likewise.
4112 (Attributes.Search): Likewise.
4113 (Attributes.Contains): Likewise.
4114 (Attributes.GetClsCompliantAttribute): Likewise.
4116 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
4118 (MethodData.ApplyAttributes): Take an EmitContext instead of a
4121 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4123 Fix bug #58688 (MCS does not report error when the same attribute
4126 * attribute.cs (Attribute.Emit): Distinction between null and default.
4128 2004-05-19 Raja R Harinath <rharinath@novell.com>
4130 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4131 of a top-level attribute without an attribute target.
4132 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4134 (Attribute.Conditional_GetConditionName),
4135 (Attribute.Obsolete_GetObsoleteMessage): Update.
4136 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4137 part of ScanForIndexerName.
4138 (Attribute.CanIgnoreInvalidAttribute): New function.
4139 (Attribute.ScanForIndexerName): Move to ...
4140 (Attributes.ScanForIndexerName): ... here.
4141 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4142 (Attributes.Search): New internal variant that can choose not to
4143 complain if types aren't resolved. The original signature now
4145 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4146 complaints suppressed.
4147 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4148 only if it not useful.
4149 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4150 top-level for attributes that are shared between the assembly
4151 and a top-level class.
4152 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4153 * class.cs: Update to reflect changes.
4154 (DefineIndexers): Fuse loops.
4155 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4156 a couple more variants of attribute names.
4158 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4160 Fix bug #52585 (Implemented explicit attribute declaration)
4163 (Attributable.ValidAttributeTargets): New abstract method. It gets
4164 list of valid attribute targets for explicit target declaration.
4165 (Attribute.Target): It holds target itself.
4166 (AttributeSection): Removed.
4167 (Attribute.CheckTargets): New method. It checks whether attribute
4168 target is valid for the current element.
4171 (EventProperty): New class. For events that are declared like
4172 property (with add and remove accessors).
4173 (EventField): New class. For events that are declared like field.
4176 * cs-parser.jay: Implemented explicit attribute target declaration.
4178 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4179 Override ValidAttributeTargets.
4182 (ReturnParameter): Class for applying custom attributes on
4184 (ParameterAtribute): New class. Class for applying custom
4185 attributes on the parameter type.
4187 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4189 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4192 (Method): Allow UNSAFE here.
4194 * modifiers.cs: Support unsafe reporting.
4196 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4198 * decl.cs: Fix bug #58478.
4200 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4202 * statement.cs: When checking for unreachable code on an EmptyStatement,
4203 set the location. Fixes bug #58488.
4205 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4207 * driver.cs: Add -pkg handling.
4209 From Gonzalo: UseShelLExecute=false
4211 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4214 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4216 (Attribute.IsClsCompliaceRequired): Moved to base for better
4218 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4219 when attribute is AttributeUsageAttribute.
4220 (Attribute.GetValidTargets): Simplified.
4221 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4222 attribute for this type.
4223 (Attribute.ApplyAttributes): Method renamed to Emit and make
4225 (GlobalAttributeSection): New class for special handling of global
4226 attributes (assembly, module).
4227 (AttributeSection.Emit): New method.
4229 * class.cs: Implemented Attributable abstract methods.
4230 (MethodCore.LabelParameters): Moved to Parameter class.
4231 (Accessor): Is back simple class.
4232 (PropertyMethod): Implemented Attributable abstract class.
4233 (DelegateMethod): Implemented Attributable abstract class.
4234 (Event): New constructor for disctintion between normal Event
4235 and Event with accessors.
4237 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4239 * codegen.cs, const.cs, decl.cs, delegate.cs:
4240 (CommonAssemblyModulClass): Implemented Attributable abstract class
4243 * enum.cs: Implement IAttributeSupport interface.
4244 (EnumMember): New class for emum members. Implemented Attributable
4248 (ParameterBase): Is abstract.
4249 (ReturnParameter): New class for easier [return:] attribute handling.
4251 * typemanager.cs: Removed builder_to_attr.
4253 2004-05-11 Raja R Harinath <rharinath@novell.com>
4256 * attribute.cs (Attribute.GetPositionalValue): New function.
4257 * class.cs (TypeContainer.VerifyMembers): New function.
4258 (TypeContainer.Emit): Use it.
4259 (ClassOrStruct): New base class for Class and Struct.
4260 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4261 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4263 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4264 then each non-static field should have a FieldOffset attribute.
4265 Otherwise, none of the fields should have a FieldOffset attribute.
4266 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4267 and FieldOffset attributes.
4268 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4269 (TypeManager.field_offset_attribute_type): New core types.
4270 (TypeManager.InitCoreTypes): Initialize them.
4272 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4274 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4275 Return correct type.
4278 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4280 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4281 be implicitly converted to ulong.
4283 * expression.cs: The logic for allowing operator &, | and ^ worked
4284 was wrong, it worked before because we did not report an error in
4285 an else branch. Fixes 57895.
4287 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4288 allow volatile fields to be reference types.
4290 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4292 * driver.cs: Add support for /debug-
4294 2004-05-07 Raja R Harinath <rharinath@novell.com>
4296 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4297 Add a 'complain' parameter to silence errors.
4298 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4299 silently overlooked type-resolutions.
4300 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4302 (Attributes.Search): New function.
4303 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4304 (Attributes.GetAttributeFullName): Remove hack.
4305 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4306 Update to reflect changes.
4307 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4308 Use Attributes.Search instead of nested loops.
4310 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4313 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4314 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4315 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4317 * report.cs: (Report.Warning): Renamed to Warning_T because of
4318 parameter collision.
4320 2004-05-05 Raja R Harinath <rharinath@novell.com>
4322 * expression.cs (MemberAccess.ResolveMemberAccess):
4323 Exit with non-zero status after Report.Error.
4324 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4326 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4328 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4330 * support.cs: Don't hang when the file is empty.
4332 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4334 * support.cs: In SeekableStreamReader, compute the preamble size of the
4335 underlying stream. Position changes should take into account that initial
4338 2004-05-03 Todd Berman <tberman@sevenl.net>
4340 * driver.cs: remove unused GetSysVersion function.
4342 2004-05-03 Todd Berman <tberman@sevenl.net>
4344 * driver.cs: Remove the hack from saturday, as well as the hack
4345 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4346 link_paths to get that bit proper.
4348 2004-05-01 Todd Berman <tberman@sevenl.net>
4350 * driver.cs: Try a LoadFrom before a Load, this checks the current
4351 path. This is currently a bug in mono that is be fixed, however, this
4352 provides a workaround for now. This will be removed when the bug
4355 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4357 * CryptoConvert.cs: Updated to latest version. Fix issue with
4358 incomplete key pairs (#57941).
4360 2004-05-01 Todd Berman <tberman@sevenl.net>
4362 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4365 2004-04-30 Jackson Harper <jackson@ximian.com>
4367 * codegen.cs: Open keys readonly.
4369 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4371 * typemanager.cs: don't report cyclic struct layout when a struct
4372 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4373 which has 2 Pango.Rectangle fields.
4375 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4377 * expression.cs: Handle IntPtr comparisons with IL code
4378 rather than a method call.
4380 2004-04-29 Martin Baulig <martin@ximian.com>
4382 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4383 the list of PropertyInfo's in class hierarchy and find the
4384 accessor. Fixes #56013.
4386 2004-04-29 Martin Baulig <martin@ximian.com>
4388 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4390 2004-04-29 Martin Baulig <martin@ximian.com>
4392 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4394 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4396 2004-04-29 Martin Baulig <martin@ximian.com>
4398 * class.cs (ConstructorInitializer.Resolve): Check whether the
4399 parent .ctor is accessible. Fixes #52146.
4401 2004-04-29 Martin Baulig <martin@ximian.com>
4403 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4405 * statement.cs (Using.EmitLocalVariableDecls): Use
4406 TypeManager.idisposable_type, not typeof (IDisposable).
4407 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4409 2004-04-29 Martin Baulig <martin@ximian.com>
4411 * class.cs (Event.Define): Don't emit the field and don't set
4412 RTSpecialName and SpecialName for events on interfaces. Fixes
4415 2004-04-29 Raja R Harinath <rharinath@novell.com>
4417 Refactor Attribute.ApplyAttributes.
4418 * attribute.cs (Attributable): New base class for objects that can
4419 have Attributes applied on them.
4420 (Attribute): Make AttributeUsage fields public.
4421 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4422 (Attribute.IsInternalCall): New property.
4423 (Attribute.UsageAttr): Convert to a public read-only property.
4424 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4425 (Attribute.ResolveType, Attribute.Resolve)
4426 (Attribute.ScanForIndexerName): Update to reflect changes.
4427 (Attribute.CheckAttributeTarget): Re-format.
4428 (Attribute.ApplyAttributes): Refactor, to various
4429 Attributable.ApplyAttributeBuilder methods.
4430 * decl.cs (MemberCore): Make Attributable.
4431 * class.cs (Accessor): Make Attributable.
4432 (MethodData.ApplyAttributes): Use proper attribute types, not
4434 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4435 (TypeContainer.ApplyAttributeBuilder)
4436 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4437 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4438 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4439 (Operator.ApplyAttributeBuilder): New factored-out methods.
4440 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4441 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4442 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4443 * parameter.cs (ParameterBase): New Attributable base class
4444 that can also represent Return types.
4445 (Parameter): Update to the changes.
4447 2004-04-29 Jackson Harper <jackson@ximian.com>
4449 * driver.cs: Prefer the corlib system version when looking for
4450 assemblies in the GAC. This is still a hack, but its a better hack
4453 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4455 * decl.cs, enum.cs: Improved error 3005 reporting.
4457 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4458 (related_symbols): New private member for list of symbols
4459 related to reported error/warning.
4461 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4463 2004-04-29 Martin Baulig <martin@ximian.com>
4465 * ecore.cs (Expression.Constantify): If we're an enum and
4466 TypeManager.TypeToCoreType() doesn't give us another type, use
4467 t.UnderlyingSystemType. Fixes #56178.
4469 2004-04-29 Martin Baulig <martin@ximian.com>
4471 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4472 interfaces and for each interface, only add members directly
4473 declared in that interface. Fixes #53255.
4475 2004-04-28 Martin Baulig <martin@ximian.com>
4477 * expression.cs (ConditionalLogicalOperator): Use a temporary
4478 variable for `left' to avoid that we evaluate it more than once;
4481 2004-04-28 Martin Baulig <martin@ximian.com>
4483 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4486 2004-04-28 Martin Baulig <martin@ximian.com>
4488 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4491 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4492 whether the type is not void (CS1547).
4494 2004-04-28 Martin Baulig <martin@ximian.com>
4496 * expression.cs (Unary.DoResolveLValue): Override this and report
4497 CS0131 for anything but Operator.Indirection.
4499 2004-04-28 Martin Baulig <martin@ximian.com>
4501 Committing a patch from Ben Maurer; see bug #50820.
4503 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4506 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4509 2004-04-28 Martin Baulig <martin@ximian.com>
4511 Committing a patch from Ben Maurer; see bug #50820.
4513 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4516 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4519 2004-04-28 Martin Baulig <martin@ximian.com>
4521 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4522 (Block.AddLabel): Call DoLookupLabel() to only search in the
4525 2004-04-28 Martin Baulig <martin@ximian.com>
4527 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4528 comparing StringConstants and NullLiterals in Equality and Inequality.
4530 2004-04-28 Jackson Harper <jackson@ximian.com>
4532 * driver.cs: Attempt to load referenced assemblies from the
4533 GAC. This is the quick and dirty version of this method that
4534 doesnt take into account versions and just takes the first
4535 canidate found. Will be good enough for now as we will not have more
4536 then one version installed into the GAC until I update this method.
4538 2004-04-28 Martin Baulig <martin@ximian.com>
4540 * typemanager.cs (TypeManager.CheckStructCycles): New public
4541 static method to check for cycles in the struct layout.
4543 * rootcontext.cs (RootContext.PopulateTypes): Call
4544 TypeManager.CheckStructCycles() for each TypeContainer.
4545 [Note: We only need to visit each type once.]
4547 2004-04-28 Martin Baulig <martin@ximian.com>
4549 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4551 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4552 success and added `out object value'. Use a `bool resolved' field
4553 to check whether we've already been called rather than
4554 `ConstantValue != null' since this breaks for NullLiterals.
4556 2004-04-28 Raja R Harinath <rharinath@novell.com>
4558 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4559 setting of this flag, since the 'set' method may be non-public.
4561 2004-04-28 Raja R Harinath <rharinath@novell.com>
4563 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4564 check on current_vector.Block.
4566 2004-04-27 Martin Baulig <martin@ximian.com>
4568 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4569 a field initializer. Fixes #56459.
4571 2004-04-27 Martin Baulig <martin@ximian.com>
4573 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4574 we're not attempting to use an indexer. Fixes #52154.
4576 2004-04-27 Martin Baulig <martin@ximian.com>
4578 * statement.cs (Return): Don't create a return label if we don't
4579 need it; reverts my change from January 20th. Thanks to Ben
4582 2004-04-27 Martin Baulig <martin@ximian.com>
4584 According to the spec, `goto' can only leave a nested scope, but
4587 * statement.cs (Block.LookupLabel): Only lookup in the current
4588 block, don't recurse into parent or child blocks.
4589 (Block.AddLabel): Check in parent and child blocks, report
4590 CS0140/CS0158 if we find a duplicate.
4591 (Block): Removed this indexer for label lookups.
4592 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4593 this already does the error reporting for us.
4596 (FlowBranching.UsageVector.Block): New public variable; may be null.
4597 (FlowBranching.CreateSibling): Added `Block' argument.
4598 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4599 label for the target of a `goto' and check whether we're not
4600 leaving a `finally'.
4602 2004-04-27 Martin Baulig <martin@ximian.com>
4604 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4605 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4608 2004-04-27 Martin Baulig <martin@ximian.com>
4610 * statement.cs (Block.AddLabel): Also check for implicit blocks
4611 and added a CS0158 check.
4613 2004-04-27 Martin Baulig <martin@ximian.com>
4615 * flowanalysis.cs (FlowBranchingLoop): New class.
4616 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4617 UsageVector's instead of an ArrayList.
4618 (FlowBranching.Label): Likewise.
4619 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4620 (FlowBranching.AddBreakVector): New method.
4622 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4624 * attribute.cs: Small regression fix: only convert the type if we
4625 the type is different, fixes System.Drawing build.
4627 2004-04-27 Martin Baulig <martin@ximian.com>
4629 * attribute.cs (Attribute.Resolve): If we have a constant value
4630 for a named field or property, implicity convert it to the correct
4633 2004-04-27 Raja R Harinath <rharinath@novell.com>
4635 * statement.cs (Block.Block): Implicit blocks share
4636 'child_variable_names' fields with parent blocks.
4637 (Block.AddChildVariableNames): Remove.
4638 (Block.AddVariable): Mark variable as "used by a child block" in
4639 every surrounding block.
4640 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4641 been used in a child block, complain about violation of "Invariant
4642 meaning in blocks" rule.
4643 * cs-parser.jay (declare_local_variables): Don't use
4644 AddChildVariableNames.
4645 (foreach_statement): Don't create an implicit block: 'foreach'
4648 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4650 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4651 converting from 0L to ulong. Fixes 57522.
4653 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4655 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4656 derived class hides via 'new' keyword field from base class (test-242.cs).
4657 TODO: Handle this in the more general way.
4659 * class.cs (CheckBase): Ditto.
4661 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4663 * decl.cs (caching_flags): New member for storing cached values
4665 (MemberCore.Flags): New enum where bit flags for caching_flags
4667 (MemberCore.cls_compliance): Moved to caching_flags.
4668 (DeclSpace.Created): Moved to caching_flags.
4670 * class.cs: Use caching_flags instead of DeclSpace.Created
4672 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4674 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4675 if we are only a derived class, not a nested class.
4677 * typemanager.cs: Same as above, but do this at the MemberLookup
4678 level (used by field and methods, properties are handled in
4679 PropertyExpr). Allow for the qualified access if we are a nested
4682 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4684 * class.cs: Refactoring.
4685 (IMethodData): New inteface; Holds links to parent members
4686 to avoid member duplication (reduced memory allocation).
4687 (Method): Implemented IMethodData interface.
4688 (PropertyBase): New inner classes for get/set methods.
4689 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4690 (Event): New inner classes for add/remove methods.
4691 (Event.DelegateMethod): Implemented IMethodData interface.
4693 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4694 EmitContext (related to class.cs refactoring).
4696 2004-04-21 Raja R Harinath <rharinath@novell.com>
4698 * delegate.cs (Delegate.VerifyApplicability): If the number of
4699 arguments are the same as the number of parameters, first try to
4700 verify applicability ignoring any 'params' modifier on the last
4704 2004-04-16 Raja R Harinath <rharinath@novell.com>
4706 * class.cs (TypeContainer.AddIndexer): Use
4707 'ExplicitInterfaceName' to determine if interface name was
4708 explicitly specified. 'InterfaceType' is not initialized at this time.
4709 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4710 Indexers array is already in the required order. Initialize
4711 'IndexerName' only if there are normal indexers.
4712 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4713 (TypeContainer.Emit): Emit DefaultMember attribute only if
4714 IndexerName is initialized.
4717 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4719 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4722 2004-04-15 Raja R Harinath <rharinath@novell.com>
4724 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4728 * attribute.cs (Attribute.Resolve): Check for duplicate named
4732 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4734 * iterators.cs (MarkYield): track whether we are in an exception,
4735 and generate code accordingly. Use a temporary value to store the
4736 result for our state.
4738 I had ignored a bit the interaction of try/catch with iterators
4739 since their behavior was not entirely obvious, but now it is
4740 possible to verify that our behavior is the same as MS .NET 2.0
4744 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4746 * iterators.cs: Avoid creating temporaries if there is no work to
4749 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4750 Enumerations, use TypeManager.EnumToUnderlying and call
4753 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4756 (This.Emit): Use EmitContext.EmitThis to emit our
4759 (This.EmitAssign): Ditto.
4761 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4762 codepaths, we will move all the functionality into
4765 (FieldExpr.EmitAssign): Ditto.
4767 This fixes several hidden bugs that I uncovered while doing a code
4768 review of this today.
4770 * codegen.cs (EmitThis): reworked so the semantics are more clear
4771 and also support value types "this" instances.
4773 * iterators.cs: Changed so that for iterators in value types, we
4774 do not pass the value type as a parameter.
4776 Initialization of the enumerator helpers is now done in the caller
4777 instead of passing the parameters to the constructors and having
4778 the constructor set the fields.
4780 The fields have now `assembly' visibility instead of private.
4782 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4784 * expression.cs (Argument.Resolve): Check if fields passed as ref
4785 or out are contained in a MarshalByRefObject.
4787 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4788 another compiler type.
4790 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4792 * class.cs (Indexer.Define): use the new name checking method.
4793 Also, return false on an error.
4794 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4795 (is_identifier_[start/part]_character): make static.
4797 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4799 * expression.cs (Binary.ResolveOperator): Do no append strings
4800 twice: since we can be invoked more than once (array evaluation)
4801 on the same concatenation, take care of this here. Based on a fix
4802 from Ben (bug #56454)
4804 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4806 * codegen.cs: Fix another case where CS1548 must be reported (when
4807 delay-sign isn't specified and no private is available #56564). Fix
4808 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4809 error when MCS is used on the MS runtime and we need to delay-sign
4810 (which seems unsupported by AssemblyBuilder - see #56621).
4812 2004-04-08 Marek Safar <marek.safar@seznam.cz>
4814 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
4815 (TypeManager.ComputeNamespaces): Faster implementation for
4818 * compiler.csproj: Updated AssemblyName to mcs.
4820 2004-04-07 Miguel de Icaza <miguel@ximian.com>
4822 * rootcontext.cs: Add new types to the boot resolution.
4824 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
4825 MulticastDelegate is not allowed.
4827 * typemanager.cs: Add new types to lookup: System.TypedReference
4830 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
4831 check for TypedReference or ArgIterator, they are not allowed.
4833 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
4834 makes us properly catch 1510 in some conditions (see bug 56016 for
4837 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
4839 * CryptoConvert.cs: update from corlib version
4842 2004-04-05 Miguel de Icaza <miguel@ximian.com>
4844 * class.cs (Indexer.Define): Check indexername declaration
4846 2004-04-05 Marek Safar <marek.safar@seznam.cz>
4848 * attribute.cs (IsClsCompliant): Fixed problem with handling
4849 all three states (compliant, not-compliant, undetected).
4851 2004-03-30 Marek Safar <marek.safar@seznam.cz>
4853 * attribute.cs (Attribute): Location is now public.
4854 (Resolve): Store resolved arguments (pos_values) in attribute class.
4855 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
4856 (GetClsCompliantAttributeValue): New method that gets
4857 CLSCompliantAttribute value.
4858 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
4859 if exists else null.
4860 (AttributeTester): New class for CLS-Compliant verification routines.
4862 * class.cs (Emit): Add CLS-Compliant verification.
4863 (Method.GetSignatureForError): Implemented.
4864 (Constructor.GetSignatureForError): Implemented
4865 (Constructor.HasCompliantArgs): Returns if constructor has
4866 CLS-Compliant arguments.
4867 (Constructor.Emit): Override.
4868 (Construcor.IsIdentifierClsCompliant): New method; For constructors
4869 is needed to test only parameters.
4870 (FieldBase.GetSignatureForError): Implemented.
4871 (TypeContainer): New member for storing base interfaces.
4872 (TypeContainer.FindMembers): Search in base interfaces too.
4874 * codegen.cs (GetClsComplianceAttribute): New method that gets
4875 assembly or module CLSCompliantAttribute value.
4876 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
4878 (ModuleClass.Emit): Add error 3012 test.
4880 * const.cs (Emit): Override and call base for CLS-Compliant tests.
4882 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
4883 state for all decl types.
4884 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
4885 if CLS-Compliant tests are required.
4886 (IsClsCompliaceRequired): New method. Analyze whether code
4887 must be CLS-Compliant.
4888 (IsExposedFromAssembly): New method. Returns true when MemberCore
4889 is exposed from assembly.
4890 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
4891 value or gets cached value.
4892 (HasClsCompliantAttribute): New method. Returns true if MemberCore
4893 is explicitly marked with CLSCompliantAttribute.
4894 (IsIdentifierClsCompliant): New abstract method. This method is
4895 used to testing error 3005.
4896 (IsIdentifierAndParamClsCompliant): New method. Common helper method
4897 for identifier and parameters CLS-Compliant testing.
4898 (VerifyClsCompliance): New method. The main virtual method for
4899 CLS-Compliant verifications.
4900 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
4901 null. I don't know why is null (too many public members !).
4902 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
4903 and get value of first CLSCompliantAttribute that found.
4905 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
4906 (VerifyClsCompliance): Override and add extra tests.
4908 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
4909 clscheck- disable CLS-Compliant verification event if assembly is has
4910 CLSCompliantAttribute(true).
4912 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
4913 ApllyAttribute is now called in emit section as in the other cases.
4914 Possible future Emit integration.
4915 (IsIdentifierClsCompliant): New override.
4916 (VerifyClsCompliance): New override.
4917 (GetEnumeratorName): Returns full enum name.
4919 * parameter.cs (GetSignatureForError): Implemented.
4921 * report.cs (WarningData): New struct for Warning message information.
4922 (LocationOfPreviousError): New method.
4923 (Warning): New method. Reports warning based on the warning table.
4924 (Error_T): New method. Reports error based on the error table.
4926 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
4927 verifications are done here.
4929 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
4931 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
4932 CLSCompliantAttribute.
4933 (all_imported_types): New member holds all imported types from other
4935 (LoadAllImportedTypes): New method fills static table with exported types
4936 from all referenced assemblies.
4937 (Modules): New property returns all assembly modules.
4939 2004-03-30 Miguel de Icaza <miguel@ximian.com>
4941 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
4942 throwing a parser error.
4944 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
4945 which removes the hardcoded get_/set_ prefixes for properties, as
4946 IL allows for the properties to be named something else.
4950 * expression.cs: Do not override operand before we know if it is
4953 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4955 * typemanager.cs: support for pinned variables.
4957 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4959 * decl.cs, typemanager.cs: Avoid using an arraylist
4960 as a buffer if there is only one result set.
4962 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4964 * expression.cs: Make sure you cant call a static method
4965 with an instance expression, bug #56174.
4967 2004-03-29 Miguel de Icaza <miguel@ximian.com>
4969 * class.cs (IsDuplicateImplementation): Improve error reporting to
4970 flag 663 (method only differs in parameter modifier).
4972 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
4973 in preprocessor directives.
4975 * location.cs (LookupFile): Allow for the empty path.
4977 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
4978 better approach for some of that patch, but its failing with the
4979 CharSet enumeration. For now try/catch will do.
4981 * typemanager.cs: Do not crash if a struct does not have fields.
4984 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4986 * expression.cs: cs0213, cant fix a fixed expression.
4989 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4991 * cs-parser.jay: detect invalid embeded statements gracefully.
4994 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4996 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
4999 the invocation type may not be a subclass of the tye of the item/
5000 The type of the item must be a subclass of the invocation item.
5005 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5007 * attribute.cs: Added methods to get a string and a bool from an
5008 attribute. Required to information from AssemblyKeyFileAttribute,
5009 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5010 * codegen.cs: Modified AssemblyName creation to include support for
5011 strongnames. Catch additional exceptions to report them as CS1548.
5012 * compiler.csproj: Updated include CryptoConvert.cs.
5013 * compiler.csproj.user: Removed file - user specific configuration.
5014 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5015 Mono.Security assembly. The original class is maintained and tested in
5016 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5017 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5018 like CSC 8.0 (C# v2) supports.
5019 * Makefile: Added CryptoConvert.cs to mcs sources.
5020 * rootcontext.cs: Added new options for strongnames.
5022 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5024 * driver.cs: For --expect-error, report error code `2'
5025 if the program compiled with no errors, error code `1' if
5026 it compiled with an error other than the one expected.
5028 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5030 * compiler.csproj: Updated for Visual Studio .NET 2003.
5031 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5032 * compiler.sln: Updated for Visual Studio .NET 2003.
5034 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5036 * expression.cs: Fix bug #47234. We basically need to apply the
5037 rule that we prefer the conversion of null to a reference type
5038 when faced with a conversion to 'object' (csc behaviour).
5040 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5042 * statement.cs: Shorter form for foreach, eliminates
5043 a local variable. r=Martin.
5045 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5047 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5048 checks if we can use brtrue/brfalse to test for 0.
5049 * expression.cs: use the above in the test for using brtrue/brfalse.
5052 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5054 * expression.cs: Rewrite string concat stuff. Benefits:
5056 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5057 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5058 rather than a concat chain.
5060 * typemanager.cs: Add lookups for more concat overloads.
5062 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5064 * expression.cs: Emit shorter il code for array init.
5081 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5083 * statement.cs: Before, two switch blocks would be merged if the
5084 total size of the blocks (end_item - begin_item + 1) was less than
5085 two times the combined sizes of the blocks.
5087 Now, it will only merge if after the merge at least half of the
5092 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5094 * class.cs : csc build fix for GetMethods(). See bug #52503.
5096 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5098 * expression.cs: Make sure fp comparisons work with NaN.
5099 This fixes bug #54303. Mig approved this patch a long
5100 time ago, but we were not able to test b/c the runtime
5103 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5105 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5107 2004-03-19 Martin Baulig <martin@ximian.com>
5109 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5110 error here and not in our caller.
5112 2004-03-19 Martin Baulig <martin@ximian.com>
5114 * interface.cs: Completely killed this file.
5115 (Interface): We're now a TypeContainer and live in class.cs.
5117 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5118 argument; we're now also called for interfaces.
5119 (TypeContainer.DefineMembers): Allow this method being called
5121 (TypeContainer.GetMethods): New public method; formerly known as
5122 Interface.GetMethod(). This is used by PendingImplementation.
5123 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5124 it's now private and non-static.
5125 (Interface): Moved this here; it's now implemented similar to
5127 (Method, Property, Event, Indexer): Added `bool is_interface'
5128 argument to their .ctor's.
5129 (MemberBase.IsInterface): New public field.
5131 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5132 instances instead of InterfaceMethod, InterfaceProperty, etc.
5133 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5134 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5136 2004-03-19 Martin Baulig <martin@ximian.com>
5138 * class.cs (MethodCore.IsDuplicateImplementation): New private
5139 method which does the CS0111 checking.
5140 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5141 Use IsDuplicateImplementation().
5143 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5145 * decl.cs (FindMemberToOverride): New method to find the correct
5146 method or property to override in the base class.
5148 - Make Method/Property use the above method to find the
5149 version in the base class.
5150 - Remove the InheritableMemberSignatureCompare as it is now
5153 This patch makes large code bases much faster to compile, as it is
5154 O(n) rather than O(n^2) to do this validation.
5156 Also, it fixes bug 52458 which is that nested classes are not
5157 taken into account when finding the base class member.
5159 Reviewed/Approved by Martin.
5161 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5163 * interface.cs: In all interface classes removed redundant
5164 member initialization.
5166 2004-03-16 Martin Baulig <martin@ximian.com>
5168 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5170 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5172 * decl.cs (DefineTypeAndParents): New helper method to define a
5173 type's containers before the type itself is defined; This is a
5174 bug exposed by the recent changes to Windows.Forms when an
5175 implemented interface was defined inside a class that had not been
5178 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5180 (Check): Loop correctly to report errors modifiers
5181 (UNSAFE was not in the loop, since it was the same as TOP).
5183 * interface.cs: Every interface member now takes a ModFlags,
5184 instead of a "is_new" bool, which we set on the base MemberCore.
5186 Every place where we called "UnsafeOk" in the interface, now we
5187 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5188 the unsafe settings from the member declaration instead of the
5189 container interface.
5191 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5193 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5194 `set_indexer_name' to the pending bits (one per type).
5196 We fixed a bug today that was picking the wrong method to
5197 override, since for properties the existing InterfaceMethod code
5198 basically ignored the method name. Now we make sure that the
5199 method name is one of the valid indexer names.
5201 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5203 * support.cs (SeekableStreamReader): Keep track of stream byte
5204 positions and don't mix them with character offsets to the buffer.
5206 Patch from Gustavo Giráldez
5208 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5210 * interface.cs (InterfaceSetGetBase): Removed double member
5211 initialization, base class does it as well.
5213 2004-03-13 Martin Baulig <martin@ximian.com>
5215 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5216 when compiling corlib.
5218 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5220 * convert.cs (ExplicitConversion): We were reporting an error on
5221 certain conversions (object_type source to a value type, when the
5222 expression was `null') before we had a chance to pass it through
5223 the user defined conversions.
5225 * driver.cs: Replace / and \ in resource specifications to dots.
5228 * class.cs: Add check for duplicate operators. Fixes 52477
5230 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5232 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5233 that are in the middle of the statements, not only at the end.
5236 * class.cs (TypeContainer.AddField): No longer set the
5237 `HaveStaticConstructor' flag, now we call it
5238 `UserDefineStaticConstructor' to diferentiate the slightly
5239 semantic difference.
5241 The situation is that we were not adding BeforeFieldInit (from
5242 Modifiers.TypeAttr) to classes that could have it.
5243 BeforeFieldInit should be set to classes that have no static
5248 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5250 And most importantly Zoltan's comment:
5252 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5254 "I think beforefieldinit means 'it's ok to initialize the type sometime
5255 before its static fields are used', i.e. initialization does not need
5256 to be triggered by the first access to the type. Setting this flag
5257 helps the JIT to compile better code, since it can run the static
5258 constructor at JIT time, and does not need to generate code to call it
5259 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5260 this flag for lots of classes like String.
5262 csc sets this flag if the type does not have an explicit static
5263 constructor. The reasoning seems to be that if there are only static
5264 initalizers for a type, and no static constructor, then the programmer
5265 does not care when this initialization happens, so beforefieldinit
5268 This bug prevents the AOT compiler from being usable, since it
5269 generates so many calls to mono_runtime_class_init that the AOT code
5270 is much slower than the JITted code. The JITted code is faster,
5271 because it does not generate these calls if the vtable is type is
5272 already initialized, which is true in the majority of cases. But the
5273 AOT compiler can't do this."
5275 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5277 * class.cs (MethodData.Emit): Refactor the code so symbolic
5278 information is generated for destructors; For some reasons we
5279 were taking a code path that did not generate symbolic information
5282 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5284 * class.cs: Create a Constructor.CheckBase method that
5285 takes care of all validation type code. The method
5286 contains some code that was moved from Define.
5288 It also includes new code that checks for duplicate ctors.
5289 This fixes bug #55148.
5291 2004-03-09 Joshua Tauberer <tauberer@for.net>
5293 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5294 a { ... }-style array creation invokes EmitStaticInitializers
5295 which is not good for reference-type arrays. String, decimal
5296 and now null constants (NullCast) are not counted toward
5297 static initializers.
5299 2004-03-05 Martin Baulig <martin@ximian.com>
5301 * location.cs (SourceFile.HasLineDirective): New public field;
5302 specifies whether the file contains or is referenced by a "#line"
5304 (Location.DefineSymbolDocuments): Ignore source files which
5305 either contain or are referenced by a "#line" directive.
5307 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5309 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5310 direct access to our parent, so check the method inline there.
5312 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5314 * expression.cs (Invocation.EmitCall): Miguel's last commit
5315 caused a regression. If you had:
5320 In Foo the implict this would be null.
5322 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5324 * expression.cs (Invocation.EmitCall): If the method is not
5325 virtual, do not emit a CallVirt to it, use Call.
5327 * typemanager.cs (GetFullNameSignature): Improve the method to
5328 cope with ".ctor" and replace it with the type name.
5330 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5331 as an argument the ConstructorBuilder where it is being defined,
5332 to catch the recursive constructor invocations.
5334 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5336 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5337 routines to check if a type is an enumerable/enumerator allow
5338 classes that implement the IEnumerable or IEnumerator interfaces.
5340 * class.cs (Property, Operator): Implement IIteratorContainer, and
5341 implement SetYields.
5343 (Property.Define): Do the block swapping for get_methods in the
5344 context of iterators. We need to check if Properties also
5345 include indexers or not.
5347 (Operator): Assign the Block before invoking the
5348 OperatorMethod.Define, so we can trigger the Iterator code
5351 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5352 Property and Operator classes are not created when we parse the
5353 declarator but until we have the block completed, so we use a
5354 singleton SimpleIteratorContainer.Simple to flag whether the
5355 SetYields has been invoked.
5357 We propagate this setting then to the Property or the Operator to
5358 allow the `yield' to function.
5360 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5362 * codegen.cs: Implemented attribute support for modules.
5363 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5364 Assembly/Module functionality.
5366 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5367 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5368 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5370 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5372 * interface.cs (FindMembers): The operation is performed on all base
5373 interfaces and not only on the first. It is required for future CLS Compliance patch.
5375 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5377 * statement.cs, codegen.cs:
5378 This patch deals with patterns such as:
5380 public class List : IEnumerable {
5382 public MyEnumerator GetEnumerator () {
5383 return new MyEnumerator(this);
5386 IEnumerator IEnumerable.GetEnumerator () {
5390 public struct MyEnumerator : IEnumerator {
5395 Before, there were a few things we did wrong:
5396 1) we would emit callvirt on a struct, which is illegal
5397 2) we emited ldarg when we needed to emit ldarga
5398 3) we would mistakenly call the interface methods on an enumerator
5399 type that derived from IEnumerator and was in another assembly. For example:
5401 public class MyEnumerator : IEnumerator
5403 Would have the interface methods called, even if there were public impls of the
5404 method. In a struct, this lead to invalid IL code.
5406 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5408 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5411 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5413 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5415 * cs-parser.jay: Fix small regression: we were not testing V2
5416 compiler features correctly.
5418 * interface.cs: If the emit context is null, then create one
5420 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5422 * decl.cs (GetSignatureForError): New virtual method to get full name
5425 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5426 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5428 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5429 Duplicated members and code in these classes has been removed.
5430 Better encapsulation in these classes.
5432 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5434 * assign.cs (Assign.DoResolve): When dealing with compound
5435 assignments, there is a new rule in ECMA C# 2.4 (might have been
5436 there before, but it is documented here) that states that in:
5440 If b is of type int, and the `op' is a shift-operator, then the
5441 above is evaluated as:
5445 * expression.cs (Binary.ResolveOperator): Instead of testing for
5446 int/uint/long/ulong, try to implicitly convert to any of those
5447 types and use that in pointer arithmetic.
5449 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5450 method to print information for from the type, not from the
5451 null-method we were given.
5453 2004-02-01 Duncan Mak <duncan@ximian.com>
5455 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5456 parsing for cmd, fixes bug #53694.
5458 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5460 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5461 in the member name duplication tests. Property and operator name duplication
5462 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5464 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5466 * interface.cs (PopulateMethod): Fixed crash when interface method
5467 returns not existing type (error test cs0246-3.cs).
5469 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5471 * cs-parser.jay (interface_accessors): Re-write actions to also
5472 store attributes attached to get and set methods. Fix spelling
5475 (inteface_property_declaration): Modify accordingly.
5477 (InterfaceAccessorInfo): New helper class to store information to pass
5478 around between rules that use interface_accessors.
5480 * interface.cs (Emit): Apply attributes on the get and set
5481 accessors of properties and indexers too.
5483 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5484 right MethodBuilder when applying attributes to the get and set accessors.
5486 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5488 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5490 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5492 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5494 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5496 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5497 changes that treat `yield' specially when present before `break'
5500 * cs-tokenizer.cs: yield is no longer a keyword.
5502 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5504 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5505 setting for default constructors.
5506 For default constructors are almost every time set wrong Modifier. The
5507 generated IL code has been alright. But inside mcs this values was
5508 wrong and this was reason why several of my CLS Compliance tests
5511 2004-01-22 Martin Baulig <martin@ximian.com>
5513 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5514 not a QualifiedIdentifier. This is what `type_name_expression'
5515 was previously doing.
5516 (type_name_expression): Removed; the code is now in
5517 `namespace_or_type_name'.
5518 (qualified_identifier): Removed, use `namespace_or_type_name'
5520 (QualifiedIdentifier): Removed this class.
5522 2004-01-22 Martin Baulig <martin@ximian.com>
5524 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5525 not a string as alias name.
5527 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5529 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5530 #52730 bug, and instead compute correctly the need to use a
5531 temporary variable when requesting an address based on the
5532 static/instace modified of the field and the constructor.
5534 2004-01-21 Martin Baulig <martin@ximian.com>
5536 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5537 class and namespace before looking up aliases. Fixes #52517.
5539 2004-01-21 Martin Baulig <martin@ximian.com>
5541 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5542 assinged in a 'try'; fixes exception4.cs.
5544 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5545 * class.cs : Implemented parameter-less constructor for TypeContainer
5547 * decl.cs: Attributes are now stored here. New property OptAttributes
5549 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5551 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5553 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5555 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5556 (CSharpSignature): New method for indexer and property signature.
5558 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5560 * pending.cs (IsVirtualFilter): Faster implementation.
5562 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5564 * typemanager.cs: Avoid inclusion of same assembly more than once.
5566 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5568 * cs-parser.jay: Fixed problem where the last assembly attribute
5569 has been applied also to following declaration (class, struct, etc.)
5571 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5573 * class.cs: Added error CS0538, CS0539 reporting.
5574 Fixed crash on Microsoft runtime when field type is void.
5576 * cs-parser.jay: Added error CS0537 reporting.
5578 * pending.cs: Added error CS0535 reporting.
5579 Improved error report for errors CS0536, CS0534.
5581 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5583 Merge a few bits from the Anonymous Method MCS tree.
5585 * statement.cs (ToplevelBlock): New class for toplevel methods,
5586 will hold anonymous methods, lifted variables.
5588 * cs-parser.jay: Create toplevel blocks for delegates and for
5589 regular blocks of code.
5591 2004-01-20 Martin Baulig <martin@ximian.com>
5593 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5594 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5595 and `NeedExplicitReturn'; added `IsLastStatement'.
5596 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5597 have a `ReturnLabel' or we're not unreachable.
5599 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5600 child's reachability; don't just override ours with it. Fixes
5601 #58058 (lluis's example).
5602 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5603 InFinally(), InLoop(), InSwitch() and
5604 BreakCrossesTryCatchBoundary() methods.
5606 * statement.cs (Return): Do all error checking in Resolve().
5607 Unless we are the last statement in a top-level block, always
5608 create a return label and jump to it.
5609 (Break, Continue): Do all error checking in Resolve(); also make
5610 sure we aren't leaving a `finally'.
5611 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
5612 statement in a top-level block.
5613 (Block.Flags): Added `IsDestructor'.
5614 (Block.IsDestructor): New public property.
5616 2004-01-20 Martin Baulig <martin@ximian.com>
5618 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
5620 2004-01-20 Martin Baulig <martin@ximian.com>
5622 * statement.cs (Statement.ResolveUnreachable): New public method.
5623 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
5624 (Block.Resolve): Resolve unreachable statements.
5626 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5628 * expression.cs: We need to fix the case where we do
5629 not have a temp variable here.
5631 * assign.cs: Only expression compound assignments need
5632 temporary variables.
5634 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5636 * flowanalysis.cs: Reduce memory allocation in a few ways:
5637 - A block with no variables should not allocate a bit
5639 - A method with no out parameters does not need any tracking
5640 for assignment of the parameters, so we need not allocate
5643 public readonly Type[] VariableTypes;
5644 public readonly string[] VariableNames;
5645 Are redundant. The data is already stored in the variable
5646 map, so we need not allocate another array for it.
5647 - We need to add alot of checks for if (params | locals) == null
5648 due to the first two changes.
5650 2004-01-18 Miguel de Icaza <miguel@ximian.com>
5652 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
5653 implement IMemoryLocation, we store a copy on a local variable and
5654 take the address of it. Patch from Benjamin Jemlich
5656 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
5657 to use a special "type_name_expression" rule which reduces the
5658 number of "QualifiedIdentifier" classes created, and instead
5659 directly creates MemberAccess expressions.
5661 2004-01-17 Miguel de Icaza <miguel@ximian.com>
5663 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
5664 that fixes #52853. Null literal assignment to ValueType
5666 * class.cs (MethodData.Emit): Instead of checking the name of the
5667 method to determine if its a destructor, create a new derived
5668 class from Method called Destructor, and test for that.
5670 * cs-parser.jay: Create a Destructor object instead of a Method.
5672 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
5676 2004-01-16 Miguel de Icaza <miguel@ximian.com>
5678 * expression.cs (Binary.ResolveOperator): Perform an implicit
5679 conversion from MethodGroups to their delegate types on the
5682 * delegate.cs: Introduce a new class DelegateCreation that is the
5683 base class for `NewDelegate' and `ImplicitDelegateCreation',
5684 factor some code in here.
5686 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
5687 conversion from MethodGroups to compatible delegate types.
5689 * ecore.cs (Expression.Resolve): Do not flag error 654
5690 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
5691 we allow conversions from MethodGroups to delegate types now.
5693 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
5694 assignments in v2 either.
5696 2004-01-10 Miguel de Icaza <miguel@ximian.com>
5698 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
5699 static read-only fields in ctors.
5701 Applied patch from Benjamin Jemlich
5703 * expression.cs (UnaryMutator): Avoid leaking local variables.
5705 2004-01-09 Miguel de Icaza <miguel@ximian.com>
5707 * cs-tokenizer.cs (IsCastToken): Allow the various native types
5708 here to return true, as they can be used like this:
5712 Fixed 49836 and all the other dups
5714 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
5716 * driver.cs: Implement /win32res and /win32icon.
5718 2004-01-08 Miguel de Icaza <miguel@ximian.com>
5720 * cs-parser.jay: Add a rule to improve error handling for the
5721 common mistake of placing modifiers after the type.
5723 2004-01-07 Miguel de Icaza <miguel@ximian.com>
5725 * cs-parser.jay (interface_event_declaration): Catch
5726 initialization of events on interfaces, and report cs0068
5728 * cs-parser.jay (interface_event_declaration): Catch
5729 initialization of events.
5731 * ecore.cs: Better report missing constructors.
5733 * expression.cs (Binary.ResolveOperator): My previous bug fix had
5734 the error reporting done in the wrong place. Fix.
5736 * expression.cs (Binary.ResolveOperator): Catch the
5737 operator + (E x, E y) error earlier, and later allow for implicit
5738 conversions in operator +/- (E e, U x) from U to the underlying
5741 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
5742 52596, if the container class is abstract, the default constructor
5743 is protected otherwise its public (before, we were always public).
5745 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
5748 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
5749 Jemlich that fixes bug #52597, MCS was generating invalid code for
5750 idisposable structs. Thanks to Ben for following up with this
5753 2004-01-06 Miguel de Icaza <miguel@ximian.com>
5755 * driver.cs: Allow assemblies without code to be generated, fixes
5758 2004-01-07 Nick Drochak <ndrochak@gol.com>
5760 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
5762 2004-01-05 Miguel de Icaza <miguel@ximian.com>
5764 * cs-parser.jay: Add rules to improve error reporting if fields or
5765 methods are declared at the namespace level (error 116)
5767 * Add rules to catch event add/remove
5769 2004-01-04 David Sheldon <dave-mono@earth.li>
5771 * expression.cs: Added matching ")" to error message for
5774 2004-01-03 Todd Berman <tberman@gentoo.org>
5776 * ecore.cs, attribute.cs:
5777 Applying fix from #52429.
5779 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5781 * ecore.cs, expression.cs, statement.cs:
5782 Total rewrite of how we handle branching. We
5783 now handle complex boolean expressions with fewer
5784 jumps. As well if (x == 0) no longer emits a ceq.
5786 if (x is Foo) is much faster now, because we generate
5789 Overall, we get a pretty big improvement on our benchmark
5790 tests. The code we generate is smaller and more readable.
5792 I did a full two-stage bootstrap. The patch was reviewed
5793 by Martin and Miguel.
5795 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5797 * cs-parser.jay: Make primary_expression not take a QI.
5798 we dont need this because the member_access rule covers
5799 us here. So we replace the rule with just IDENTIFIER.
5801 This has two good effects. First, we remove a s/r conflict.
5802 Second, we allocate many fewer QualifiedIdentifier objects.
5804 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5806 * attribute.cs: Handle MarshalAs attributes as pseudo, and
5807 set the correct information via SRE. This prevents
5808 hanging on the MS runtime. Fixes #29374.
5810 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5812 * convert.cs: correctly handle conversions to value types
5813 from Enum and ValueType as unboxing conversions.
5815 Fixes bug #52569. Patch by Benjamin Jemlich.
5817 2004-01-02 Ravi Pratap <ravi@ximian.com>
5819 * expression.cs (BetterConversion): Prefer int -> uint
5820 over int -> ulong (csc's behaviour). This fixed bug #52046.
5822 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
5824 * decl.cs (MemberCache.FindMembers): now returns a
5827 * typemanager.cs: In general, go with with ^^.
5828 (CopyNewMethods): take an IList.
5829 (RealMemberLookup): Only allocate an arraylist
5830 if we copy from two sets of methods.
5832 This change basically does two things:
5833 1) Fewer array lists allocated due to CopyNewMethods.
5834 2) the explicit cast in MemberList costed ALOT.
5836 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
5838 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
5839 a hashtable to avoid needless string allocations when an identifier is
5840 used more than once (the common case).
5842 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
5844 * pending.cs: MS's TypeBuilder.GetInterfaces ()
5845 is broken, it will not return anything. So, we
5846 have to use the information we have in mcs to
5849 * typemanager.cs: Add a cache for GetInterfaces,
5850 since this will now be used more often (due to ^^)
5852 (GetExplicitInterfaces) New method that gets the
5853 declared, not effective, interfaces on a type
5854 builder (eg, if you have interface IFoo, interface
5855 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
5858 This patch makes MCS able to bootstrap itself on
5861 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
5863 * expression.cs: Remove the Nop's that Miguel put
5866 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5868 * report.cs, codegen.cs: Give the real stack trace to
5869 the error when an exception is thrown.
5871 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5873 * decl.cs: only allocate hashtables for ifaces if
5876 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5878 * expression.cs: fix the error from cs0121-2.cs
5879 (a parent interface has two child interfaces that
5880 have a function with the same name and 0 params
5881 and the function is called through the parent).
5883 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
5885 * class.cs, rootcontext.cs, typmanager.cs: do not
5888 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
5890 * codegen.cs: remove stack for the ec flow branching.
5891 It is already a linked list, so no need.
5893 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
5895 * Makefile: Allow custom profiler here.
5897 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
5899 * typemanager.cs (LookupType):
5900 - Use a static char [], because split takes
5901 a param array for args, so it was allocating
5903 - Do not store true in a hashtable, it boxes.
5905 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
5907 * flowanalysis.cs: bytify common enums.
5909 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5911 * modifiers.cs: Add a new set of flags for the
5912 flags allowed on explicit interface impls.
5913 * cs-parser.jay: catch the use of modifiers in
5914 interfaces correctly.
5915 * class.cs: catch private void IFoo.Blah ().
5917 All related to bug #50572.
5919 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5921 * decl.cs: Rewrite the consistant accessability checking.
5922 Accessability is not linear, it must be implemented in
5923 a tableish way. Fixes #49704.
5925 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5927 * expression.cs: Handle negation in a checked context.
5928 We must use subtraction from zero. Fixes #38674.
5930 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
5932 * class.cs: Ignore static void main in DLLs.
5933 * rootcontext.cs: Handle the target type here,
5934 since we are have to access it from class.cs
5935 * driver.cs: account for the above.
5937 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
5939 * report.cs: Give line numbers and files if available.
5941 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
5943 * driver.cs: Implement /addmodule.
5945 * typemanager.cs: Change 'modules' field so it now contains Modules not
5948 2003-12-20 Martin Baulig <martin@ximian.com>
5950 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
5951 (FieldBase.IsAssigned): Removed this field.
5952 (FieldBase.SetAssigned): New public method.
5953 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
5955 2003-12-20 Martin Baulig <martin@ximian.com>
5957 * expression.cs (LocalVariableReference.DoResolve): Don't set
5958 `vi.Used' if we're called from DoResolveLValue().
5960 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
5961 returns the usage vector it just merged into the current one -
5962 pass this one to UsageWarning().
5963 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
5964 of the `EmitContext', don't call this recursively on our children.
5966 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
5968 * driver.cs: Implement /target:module.
5970 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
5972 * support.cs (CharArrayHashtable): New helper class.
5974 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
5975 char arrays, not strings, so we can avoid creating a string in
5976 consume_identifier if the identifier is a keyword.
5978 2003-12-16 Martin Baulig <martin@ximian.com>
5980 * statement.cs (LocalInfo.Assigned): Removed this property.
5981 (LocalInfo.Flags): Removed `Assigned'.
5982 (LocalInfo.IsAssigned): New public method; takes the EmitContext
5983 and uses flow analysis.
5984 (Block.UsageWarning): Made this method private.
5985 (Block.Resolve): Call UsageWarning() if appropriate.
5987 * expression.cs (LocalVariableReference.DoResolve): Always set
5988 LocalInfo.Used here.
5990 2003-12-13 Martin Baulig <martin@ximian.com>
5992 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
5993 any value here; we're now using flow analysis to figure out
5994 whether a statement/block returns a value.
5996 2003-12-13 Martin Baulig <martin@ximian.com>
5998 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6000 (FlowBranching.MergeFinally): Don't call
6001 `branching.CheckOutParameters()' here, this is called in
6003 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6004 when adding the `finally' vector.
6006 2003-12-13 Martin Baulig <martin@ximian.com>
6009 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6010 actually work and also fix #48962.
6012 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6014 * decl.cs: Do not check System.Object for nested types,
6015 since we know it does not have any. Big bang for buck:
6020 corlib: 17.99 seconds
6024 corlib: 17.39 seconds
6026 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6028 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6029 time we are returning 0 members, so we save alot here.
6031 2003-12-11 Martin Baulig <martin@ximian.com>
6033 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6034 `MergeChild()', also just take the `FlowBranching' as argument;
6035 call Merge() on it and return the result.
6036 (FlowBranching.Merge): We don't need to do anything if we just
6039 2003-12-11 Martin Baulig <martin@ximian.com>
6041 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6042 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6043 Maurer for this idea.
6045 2003-12-11 Martin Baulig <martin@ximian.com>
6047 * flowanalysis.cs (MergeResult): This class is now gone; we now
6048 use the `UsageVector' for this. The reason for this is that if a
6049 branching just has one sibling, we don't need to "merge" them at
6050 all - that's the next step to do.
6051 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6054 2003-12-11 Martin Baulig <martin@ximian.com>
6056 Reworked flow analyis and made it more precise and bug-free. The
6057 most important change is that we're now using a special `Reachability'
6058 class instead of having "magic" meanings of `FlowReturns'. I'll
6059 do some more cleanups and optimizations and also add some more
6060 documentation this week.
6062 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6063 largely reworked this class.
6064 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6065 the new `Reachability' class instead of having "magic" values here.
6066 (FlowBranching): We're now using an instance of `Reachability'
6067 instead of having separate `Returns', `Breaks' etc. fields.
6069 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6070 based on flow analysis; ignore the return value of block.Emit ().
6072 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6074 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6075 if they are private.
6077 2003-12-09 Martin Baulig <martin@ximian.com>
6079 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6080 call them directly on the UsageVector.
6082 2003-12-09 Martin Baulig <martin@ximian.com>
6084 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6085 Changed return type from `FlowReturns' to `Reachability'.
6087 2003-12-09 Martin Baulig <martin@ximian.com>
6089 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6090 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6091 `Reachable' fields with a single `Reachability' one.
6093 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6095 * class.cs (FindMembers): Remove foreach's.
6108 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6113 This patch does a few things:
6114 1. EmptyStatement is now a singleton, so it is never reallocated.
6115 2. All blah is EmptyStatement constructs have been changed to
6116 blah == EmptyStatement.Value, which is much faster and valid
6117 now that EmptyStatement is a singleton.
6118 3. When resolving a block, rather than allocating a new array for
6119 the non-empty statements, empty statements are replaced with
6120 EmptyStatement.Value
6121 4. Some recursive functions have been made non-recursive.
6122 Mainly the performance impact is from (3), however (1) and (2) are needed for
6123 this to work. (4) does not make a big difference in normal situations, however
6124 it makes the profile look saner.
6129 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6130 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6131 Total memory allocated: 56397 KB
6134 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6135 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6136 Total memory allocated: 55666 KB
6138 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6140 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6141 than the hashtable in a hashtable version
6143 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6144 we always end up concating a string. This results in a huge perf
6145 loss, because many strings have to be tracked by the GC. In this
6146 patch, we first use a hashtable that works with two keys, so that
6147 the strings do not need to be concat'ed.
6158 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6160 * Makefile: Add a new target `do-time' that does a quick and simple
6161 profile, leaving easy to parse output.
6163 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6165 * codegen.cs (Init): Create the dynamic assembly with
6166 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6168 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6170 * support.cs: Make the PtrHashtable use only one
6171 instance of its comparer.
6173 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6175 * typemanager.cs: Fix lookup of GetNamespaces.
6177 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6179 * expression.cs: Removed redundant line.
6181 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6182 ArrayLists, use for loops with bounds.
6184 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6187 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6188 arraylists, use for loop with bounds.
6190 The above three changes give us a 0.071 second performance
6191 improvement out of 3.294 seconds down to 3.223. On my machine
6192 the above changes reduced the memory usage by 1,387 KB during
6195 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6196 QualifiedIdentifiers. Before we created a new string through
6197 concatenation, and mostly later on, the result would be
6198 manipulated by DecomposeQI through string manipulation.
6200 This reduced the compiler memory usage for bootstrapping from
6201 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6202 compile times in 0.05 seconds.
6204 2003-11-28 Dick Porter <dick@ximian.com>
6206 * support.cs: Do string compares with the Invariant culture.
6214 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6215 the comparison is done with the Invariant culture.
6217 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6219 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6220 GetEnumerator method.
6222 (ProbeCollectionType): Iterate starting at the most specific type
6223 upwards looking for a GetEnumerator
6225 * expression.cs: Shift count can be up to 31 for int/uint and 63
6228 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6230 * statement.cs (Block.LookupLabel): Also look for the label on the
6231 children blocks. Use a hash table to keep track of visited
6234 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6235 we actually did transform the other operand, otherwise fall back
6236 to the common codepath that casts to long.
6238 * cs-tokenizer.cs: Use the same code pattern as the int case.
6239 Maybe I should do the parsing myself, and avoid depending on the
6240 Parse routines to get this done.
6242 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6244 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6245 which fixes bug 51347. This time test it.
6247 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6248 attributes for example can not tell the difference between these.
6249 The difference was only a syntax feature of the language.
6251 * attribute.cs: Apply attributes to delegates.
6253 * delegate.cs: Call the apply attributes method.
6255 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6257 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6258 comparing 0 vs Byte.MinValue, not the value
6260 (ImplicitConversionRequired): When reporting a conversion error,
6261 use error 31 to print out the constant error instead of the
6264 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6265 which fixes bug 51347.
6267 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6269 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6270 which fixes the -warnaserror command line option.
6272 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6274 * cfold.cs (DoNumericPromotions): During constant folding of
6275 additions on UIntConstant, special case intconstants with
6276 IntConstants like we do on the expression binary operator.
6278 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6280 * convert.cs (ImplicitReferenceConversion): We were missing a case
6281 (System.Enum are not value types or class types, so we need to
6282 classify them separatedly).
6284 * driver.cs: We do not support error 2007.
6286 2003-11-12 Jackson Harper <jackson@ximian.com>
6288 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6289 system directory. Also use the full file name so users can
6290 libraries names mscorlib-o-tron.dll in a non system dir.
6292 2003-11-10 Martin Baulig <martin@ximian.com>
6294 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6295 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6296 calling `ResolveType()' on them, directly assign their `Type'.
6298 2003-11-08 Martin Baulig <martin@ximian.com>
6300 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6301 return value and the `out parent' parameter.
6302 (TypeContainer.DefineType): Moved the CS0644 check into
6303 GetClassBases(). Don't pass the interface types to the
6304 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6305 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6307 * ecore.cs (TypeExpr.IsAttribute): New property.
6308 (TypeExpr.GetInterfaces): New method.
6310 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6311 TypeExpr instead of a Type.
6312 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6313 (Interface.DefineType): Don't pass the interface types to the
6314 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6315 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6317 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6318 instead of a `Type[]'.
6319 (TypeManager.RegisterBuilder): Likewise.
6320 (TypeManager.AddUserInterface): Likewise.
6321 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6322 `Type[]' and also return a `TypeExpr[]'.
6323 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6325 2003-11-08 Martin Baulig <martin@ximian.com>
6327 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6330 2003-11-08 Martin Baulig <martin@ximian.com>
6332 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6333 TypeManager.ResolveExpressionTypes().
6335 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6336 instead of an Expression.
6337 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6338 (TypeExpression): New public class; formerly known as `TypeExpr'.
6340 * expression.cs (ComposedCast): Derive from TypeExpr.
6342 * typemanager.cs (TypeManager.system_*_expr): These are now
6343 TypExpr's instead of Expression's.
6344 (TypeManager.ResolveExpressionTypes): New public static function;
6345 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6348 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6350 * expression.cs (New.DoResolve): Do not dereference value that
6351 might be a null return.
6353 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6354 sure that the constant value has the right type. Fixes an
6355 unreported bug, similar to 50425.
6357 * const.cs (Const.LookupConstantValue): Call
6358 ImplicitStandardConversionExists before doing a conversion to
6359 avoid havng the TypeManager.ChangeType do conversions.
6361 Reduced the number of casts used
6363 (Const.ChangeType): New routine to enable reuse of the constant
6364 type changing code from statement.
6366 * typemanager.cs (ChangeType): Move common initialization to
6367 static global variables.
6371 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6372 every value type to go through, even if it was void. Fix that.
6374 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6375 character of the define, and the is_identifier_part_character for
6376 the rest of the string.
6378 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6380 * expression.cs (UnaryMutator.EmitCode): When I updated
6381 LocalVariableReference.DoResolve, I overdid it, and dropped an
6382 optimization done on local variable references.
6384 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6386 * ecore.cs: Convert the return from Ldlen into an int.
6388 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6390 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6391 the accessibility, this is a special case for toplevel non-public
6392 classes (internal for instance).
6394 2003-10-20 Nick Drochak <ndrochak@gol.com>
6396 * ecore.cs: Fix typo and build. Needed another right paren.
6398 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6400 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6401 `internal' case regular and protected, but not allowing protected
6402 to be evaluated later. Bug 49840
6404 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6406 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6407 to kb.Nlast, and not the kb.nFirst to isolate the switch
6410 Extract the underlying type, so enumerations of long/ulong are
6411 treated like long/ulong.
6413 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6415 * expression.cs (New): Overload the meaning of RequestedType to
6416 track the possible creation of the NewDelegate type, since
6417 DoResolve is invoked more than once for new constructors on field
6420 See bugs: #48800 and #37014
6422 * cs-parser.jay (declare_local_constants): Take an arraylist
6423 instead of a single constant.
6425 (local_constant_declaration): It should take a
6426 constant_declarators, not a constant_declarator. Fixes 49487
6428 * convert.cs: Fix error report.
6430 2003-10-13 Jackson Harper <jackson@ximian.com>
6432 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6435 2003-10-09 Martin Baulig <martin@ximian.com>
6437 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
6439 (MethodCore.DoDefineParameters): Removed the TypeContainer
6440 argument; use the DeclSpace which was passed to the .ctor instead.
6441 (MethodCore.CheckParameter): Take a DeclSpace instead of a
6442 TypeContainer; we only need a DeclSpace here.
6444 2003-10-09 Martin Baulig <martin@ximian.com>
6446 * class.cs (MethodData): Added additional `DeclSpace ds' argument
6448 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
6449 EmitContext's .ctor.
6451 2003-10-09 Martin Baulig <martin@ximian.com>
6453 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
6454 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
6455 AsAccessible(), moved them as well.
6457 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
6459 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6461 * cs-parser.jay : Renamed yyName to yyNames related to jay.
6463 2003-10-07 Miguel de Icaza <miguel@ximian.com>
6465 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
6466 generation for >=, as spotted by Paolo, bug 48679.
6467 Patch from David Waite.
6469 * cs-tokenizer.cs: Add handling for #pragma.
6471 * cs-parser.jay: Allow for both yield and yield return in the
6472 syntax. The anti-cobolization of C# fight will go on!
6474 * class.cs (TypeBuilder.DefineType): Catch error condition here
6475 (Parent.DefineType erroring out and returning null).
6477 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
6478 coping with enumerations variables, we were mistakenly processing
6479 them as a regular value type instead of built-in types. Fixes the
6482 * typemanager.cs (IsBuiltinOrEnum): New method.
6484 2003-09-30 Miguel de Icaza <miguel@ximian.com>
6486 * cs-parser.jay: Upgrade: yield now needs the return clause.
6488 2003-09-19 Martin Baulig <martin@ximian.com>
6490 * decl.cs (MemberCache.SetupCacheForInterface): Take a
6491 `MemberCache parent' argument. Normally, an interface doesn't
6492 have a parent type except System.Object, but we use this in gmcs
6493 for generic type parameters.
6495 2003-09-18 Martin Baulig <martin@ximian.com>
6497 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
6498 on `type.IsInterface'; don't check whether the type has a parent
6499 to determine whether it's an interface.
6501 2003-09-15 Martin Baulig <martin@ximian.com>
6503 * class.cs (TypeContainer.DefineType): Added an error flag to
6504 avoid reporting duplicate CS0146's ("class definition is
6507 * driver.cs (Driver.MainDriver): Abort if
6508 RootContext.ResolveTree() reported any errors.
6510 2003-09-07 Martin Baulig <martin@ximian.com>
6512 * report.cs (Error, Warning): Added overloaded versions which take
6513 a `params object[] args' and call String.Format().
6515 2003-09-07 Martin Baulig <martin@ximian.com>
6517 * decl.cs (DeclSpace..ctor): Don't call
6518 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
6519 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
6520 (DeclSpace.RecordDecl): New method.
6522 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
6524 2003-09-02 Ravi Pratap <ravi@ximian.com>
6526 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
6527 value attributes to be applied to ParameterBuilders.
6529 * class.cs (MethodCore.LabelParameters): Make static and more
6530 generic so that it can be used from other places - like interface
6531 methods, for instance.
6533 * interface.cs (Interface.Emit): Call LabelParameters before
6534 emitting attributes on the InterfaceMethod.
6536 2003-08-26 Martin Baulig <martin@ximian.com>
6538 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
6539 resolving aliases; fixes #47927.
6541 2003-08-26 Martin Baulig <martin@ximian.com>
6543 * statement.cs (Using.DoResolve): This is internally emitting a
6544 try/finally clause, so we need to set ec.NeedExplicitReturn if we
6545 do not always return. Fixes #47681.
6547 2003-08-26 Martin Baulig <martin@ximian.com>
6549 * decl.cs (MemberCore): Moved WarningNotHiding(),
6550 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
6552 (AdditionResult): Make this nested in DeclSpace.
6553 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
6554 argument; call NamespaceEntry.Define() unless we're nested in a
6557 * namespace.cs (Namespace.DefineName): New public function. This
6558 is called from DeclSpace's .ctor to add
6559 (Namespace.Lookup): Include DeclSpaces in the lookup.
6561 * class.cs (Operator): Derive from MemberBase, not MemberCore.
6563 * const.cs (Const): Derive from MemberBase, not MemberCore.
6565 2003-08-25 Martin Baulig <martin@ximian.com>
6567 * convert.cs (Convert.ExplicitReferenceConversion): When
6568 converting from an interface type to a class, unbox if the target
6569 type is a struct type. Fixes #47822.
6571 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6573 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
6576 2003-08-22 Martin Baulig <martin@ximian.com>
6578 * class.cs (TypeManager.DefineType): When defining a nested type,
6579 call DefineType() on our parent; fixes #47801.
6581 2003-08-22 Martin Baulig <martin@ximian.com>
6583 * class.cs (MethodData.Define): While checking if a method is an
6584 interface implementation, improve the test a bit more to fix #47654.
6586 2003-08-22 Martin Baulig <martin@ximian.com>
6588 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
6589 correctly; fixes #47722.
6591 2003-08-22 Martin Baulig <martin@ximian.com>
6593 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
6594 LocalVariableReference, ensure it's not read-only. Fixes #47536.
6596 * statement.cs (Fixed.DoResolve): Make all variables read-only.
6598 2003-08-22 Martin Baulig <martin@ximian.com>
6600 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
6601 can only be assigned in static constructors. Fixes #47161.
6603 2003-08-22 Martin Baulig <martin@ximian.com>
6605 Rewrote and improved the flow analysis code.
6607 * flowbranching.cs (FlowBranching): Make this class abstract.
6608 (FlowBranching.CreateBranching): New static function to create a
6610 (FlowBranchingBlock, FlowBranchingException): New classes.
6611 (FlowBranching.UsageVector.Type): New public readonly field.
6612 (FlowBranching.UsageVector.Breaks): Removed the setter.
6613 (FlowBranching.UsageVector.Returns): Removed the setter.
6614 (FlowBranching.UsageVector): Added Break(), Return(),
6615 NeverReachable() and Throw() methods to modify the reachability.
6616 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
6617 done by FlowBranching.Merge().
6618 (FlowBranching.UsageVector.MergeChild): New method; merges the
6619 merge result into the current vector.
6620 (FlowBranching.Merge): New abstract method to merge a branching.
6622 2003-08-12 Martin Baulig <martin@ximian.com>
6624 * expression.cs (Indirection.CacheTemporaries): Create the
6625 LocalTemporary with the pointer type, not its element type.
6627 2003-08-10 Miguel de Icaza <miguel@ximian.com>
6629 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
6630 token was a keyword or not.
6632 Add `error' options where an IDENTIFIER was expected; Provide
6633 CheckToken and CheckIdentifierToken convenience error reporting
6636 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
6638 * decl.cs: Rename `NamespaceEntry Namespace' public field into
6639 NameSpaceEntry NameSpaceEntry.
6641 (LookupInterfaceOrClass): Avoid creating a full qualified name
6642 from namespace and name: avoid doing lookups when we know the
6643 namespace is non-existant. Use new Tree.LookupByNamespace which
6644 looks up DeclSpaces based on their namespace, name pair.
6646 * driver.cs: Provide a new `parser verbose' to display the
6647 exception thrown during parsing. This is turned off by default
6648 now, so the output of a failure from mcs is more graceful.
6650 * namespace.cs: Track all the namespaces defined in a hashtable
6653 (IsNamespace): New method
6655 2003-08-09 Miguel de Icaza <miguel@ximian.com>
6657 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
6658 we know that we need to concatenate (full typename can never be
6663 * statement.cs: Use a bitfield; Do not initialize to null things
6664 which are done by the constructor by default.
6666 * cs-parser.jay: bug fix, parameter was 4, not 3.
6668 * expression.cs: Just use the property;
6670 * statement.cs: No need for GetVariableInfo method.
6672 2003-08-08 Martin Baulig <martin@ximian.com>
6674 * flowanalysis.cs (FlowReturns): This is now nested in the
6675 `FlowBranching' class.
6676 (MyBitVector): Moved this here from statement.cs.
6677 (FlowBranching.SiblingType): New enum type.
6678 (FlowBranching.CreateSibling): Added `SiblingType' argument.
6680 2003-08-07 Martin Baulig <martin@ximian.com>
6682 * flowanalysis.cs (FlowBranchingType): This is now nested in the
6683 `FlowBranching' class and called `BranchingType'.
6685 2003-08-07 Martin Baulig <martin@ximian.com>
6687 * flowanalysis.cs: Moved all the control flow analysis code into
6690 2003-08-07 Martin Baulig <martin@ximian.com>
6692 * assign.cs (Assign.DoResolve): `target' must either be an
6693 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
6696 2003-08-07 Miguel de Icaza <miguel@ximian.com>
6698 * expression.cs (BinaryMethod): This kind of expression is created by the
6699 Binary class if it determines that the operator has to be handled
6702 (BinaryDelegate): This kind of expression is created if we are
6703 dealing with a + or - operator on delegates.
6705 (Binary): remove method, argumetns, and DelegateOperator: when
6706 dealing with methods,
6708 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
6710 * statement.cs (Block): use bitfields for the three extra booleans
6711 we had in use. Remove unused topblock parameter.
6713 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
6715 * assign.cs: Drop extra unneeded tests.
6717 2003-08-06 Miguel de Icaza <miguel@ximian.com>
6719 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
6721 * statement.cs (Foreach): Use VariableStorage instead of
6724 * codegen.cs (VariableStorage): New class used by clients that
6725 require a variable stored: locals or fields for variables that
6726 need to live across yield.
6728 Maybe provide a convenience api for EmitThis+EmitLoad?
6730 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
6733 2003-08-05 Miguel de Icaza <miguel@ximian.com>
6735 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
6736 RemapParameterLValue): New methods that are used to turn a
6737 precomputed FieldInfo into an expression like this:
6741 The idea is to use this instead of making LocalVariableReference
6742 have more than one meaning.
6744 * cs-parser.jay: Add error production to BASE.
6746 * ecore.cs: Deal with TypeManager.GetField returning null, which
6747 is now a valid return value.
6749 (FieldExprNoAddress): New expression for Fields whose address can
6752 * expression.cs (LocalVariableReference): During the resolve
6753 phases, create new expressions if we are in a remapping context.
6754 Remove code that dealt with remapping here.
6756 (ParameterReference): same.
6758 (ProxyInstance): New expression, like the `This' expression, but
6759 it is born fully resolved. We know what we are doing, so remove
6760 the errors that are targeted to user-provided uses of `this'.
6762 * statement.cs (Foreach): our variable is now stored as an
6763 Expression; During resolution, follow the protocol, dont just
6764 assume it will return this.
6766 2003-08-06 Martin Baulig <martin@ximian.com>
6768 * support.cs (SeekableStreamReader.cs): New public class.
6770 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
6771 SeekableStreamReader instead of the normal StreamReader.
6773 2003-08-04 Martin Baulig <martin@ximian.com>
6775 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
6776 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
6777 deambiguate casts and delegate invocations.
6778 (parenthesized_expression): Use the new tokens to ensure this is
6779 not a cast of method invocation.
6781 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
6782 when reading a `)' and Deambiguate_CloseParens () was previously
6785 * expression.cs (ParenthesizedExpression): New class. This is
6786 just used for the CS0075 test.
6787 (Binary.DoResolve): Check for CS0075.
6789 2003-07-29 Ravi Pratap <ravi@ximian.com>
6791 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
6792 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
6793 reference comparison.
6795 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
6796 examine the ReturnType for equality - this is necessary in the
6797 cases of implicit and explicit operators whose signature also
6798 includes the return type.
6800 2003-07-26 Miguel de Icaza <miguel@ximian.com>
6802 * namespace.cs: Cache the result of the namespace computation,
6803 instead of computing it every time.
6805 2003-07-24 Miguel de Icaza <miguel@ximian.com>
6807 * decl.cs: Use a global arraylist that we reuse over invocations
6808 to avoid excesive memory consumption. Reduces memory usage on an
6809 mcs compile by one meg (45 average).
6811 * typemanager.cs (LookupTypeReflection): In .NET pointers are
6812 private, work around that.
6814 2003-07-23 Miguel de Icaza <miguel@ximian.com>
6816 * literal.cs (IntLiteral): Define Zero and One static literals.
6818 * cs-parser.jay (integer_literal): use static literals to reduce
6819 memory usage for the most used literals (0, 1 and -1). 211kb
6820 reduced in memory usage.
6822 Replace all calls to `new ArrayList' with `new
6823 ArrayList(4)' which is a good average number for most allocations,
6824 and also requires only 16 bytes of memory for its buffer by
6827 This reduced MCS memory usage in seven megabytes for the RSS after
6830 2003-07-28 Ravi Pratap <ravi@ximian.com>
6832 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
6833 handle params methods the correct way by forming only one
6834 applicable set with params and normal methods in them. Earlier we
6835 were looking at params methods only if we found no normal methods
6836 which was not the correct thing to do.
6838 (Invocation.BetterFunction): Take separate arguments indicating
6839 when candidate and the best method are params methods in their
6842 This fixes bugs #43367 and #46199.
6844 * attribute.cs: Documentation updates.
6846 (CheckAttribute): Rename to CheckAttributeTarget.
6847 (GetValidPlaces): Rename to GetValidTargets.
6849 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
6850 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
6854 2003-07-28 Martin Baulig <martin@ximian.com>
6856 * class.cs (TypeContainer.DefineMembers): Use the base type's full
6857 name when looking up the base class of a nested class. Fixes #46977.
6859 2003-07-26 Martin Baulig <martin@ximian.com>
6861 * expression.cs (Indexers.Indexer): New nested struct; contains
6862 getter, setter and the indexer's type.
6863 (Indexers.Properties): This is now an ArrayList of
6865 (IndexerAccess.DoResolveLValue): Correctly set the type if the
6866 indexer doesn't have any getters.
6868 * assign.cs (Assign.DoResolve): Also do the implicit conversions
6869 for embedded property and indexer assignments.
6871 2003-07-26 Martin Baulig <martin@ximian.com>
6873 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
6874 preprocessor directive is not the first non-whitespace character
6877 2003-07-26 Martin Baulig <martin@ximian.com>
6879 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
6880 namespace parsing, follow the spec more closely.
6882 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
6883 NamespaceEntry.Lookup().
6885 2003-07-25 Martin Baulig <martin@ximian.com>
6887 * MethodCore.cs (OverridesSomething): New public field; it's set
6888 from TypeContainer.DefineMembers if this method overrides
6889 something (which doesn't need to be a method). Fix #39462.
6891 2003-07-25 Ravi Pratap <ravi@ximian.com>
6893 * typemanager.cs (GetMembers): Ensure that the list of members is
6894 reversed. This keeps things in sync.
6896 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
6897 find an AttributeUsage attribute.
6899 * expression.cs (Invocation.OverloadResolve): Perform the check
6900 which disallows Invoke to be directly called on a Delegate.
6902 (Error_InvokeOnDelegate): Report error cs1533.
6904 2003-07-25 Martin Baulig <martin@ximian.com>
6906 * expression.cs (Indexers.GetIndexersForType): Only look in the
6907 interface hierarchy if the requested type is already an
6908 interface. Fixes #46788 while keeping #46502 fixed.
6910 2003-07-25 Martin Baulig <martin@ximian.com>
6912 * class.cs (TypeContainer.DefineMembers): Check whether all
6913 readonly fields have been assigned and report warning CS0649 if
6916 * statement.cs (LocalInfo.IsFixed): Always return true if this is
6919 2003-07-24 Ravi Pratap <ravi@ximian.com>
6921 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
6922 returned from GetMethods to make things consistent with the
6923 assumptions MCS makes about ordering of methods.
6925 This should comprehensively fix bug #45127 and it does :-)
6927 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
6928 ordering is actually reverse.
6930 * Clean up some debug messages I left lying around.
6932 * interface.cs (Populate*): Get rid of code which emits attributes
6933 since the stage in which we emit attributes is the 'Emit' stage,
6934 not the define stage.
6936 (Emit): Move attribute emission for interface members here.
6938 2003-07-22 Ravi Pratap <ravi@ximian.com>
6940 * expression.cs (Invocation.OverloadResolve): Follow the spec more
6941 closely: we eliminate methods in base types when we have an
6942 applicable method in a top-level type.
6944 Please see section 14.5.5.1 for an exact description of what goes
6947 This fixes bug #45127 and a host of other related to corlib compilation.
6949 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
6950 array is the method corresponding to the top-level type (this is
6951 because of the changes made to icall.c) so we change this
6954 (MethodGroupExpr.Name): This too.
6956 * typemanager.cs (GetElementType): New method which does the right
6957 thing when compiling corlib.
6959 * everywhere: Make use of the above in the relevant places.
6961 2003-07-22 Martin Baulig <martin@ximian.com>
6963 * cs-parser.jay (invocation_expression): Moved
6964 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
6965 `cast_expression', but create a InvocationOrCast which later
6966 resolves to either an Invocation or a Cast.
6968 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
6969 method; call this before EmitStatement() to make sure that this
6970 expression can be used as a statement.
6972 * expression.cs (InvocationOrCast): New class; resolves to either
6973 an Invocation or a Cast.
6975 * statement.cs (StatementExpression): Call ResolveStatement() on
6976 the ExpressionStatement before emitting it.
6978 2003-07-21 Martin Baulig <martin@ximian.com>
6980 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
6981 `ref' and `out' attributes match; fixes #46220.
6982 (MemberAccess.ResolveMemberAccess): You can't reference a type
6983 through an expression; fixes #33180.
6984 (Indexers.GetIndexersForType): Don't return the indexers from
6985 interfaces the class implements; fixes #46502.
6987 2003-07-21 Martin Baulig <martin@ximian.com>
6989 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
6990 CS0661 checks; fixes bug #30442.
6992 2003-07-21 Martin Baulig <martin@ximian.com>
6994 * decl.cs (AdditionResult): Added `Error'.
6996 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
6998 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
6999 makes cs0031.cs actually work.
7001 2003-07-20 Martin Baulig <martin@ximian.com>
7003 * namespace.cs: Fixed that bug which caused a crash when compiling
7006 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7008 * typemanager.cs (LookupTypeReflection): Never expose types which
7009 are NotPublic, NestedPrivate, NestedAssembly, or
7010 NestedFamANDAssem. We used to return these, and later do a check
7011 that would report a meaningful error, but the problem is that we
7012 would not get the real match, if there was a name override.
7014 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7016 * namespace.cs (Namespace, Name): Do not compute the namespace
7017 name dynamically, compute it in the constructor. This reduced
7018 memory usage by 1697 KB.
7020 * driver.cs: Use --pause to pause at the end.
7022 2003-07-17 Peter Williams <peter@newton.cx>
7024 * Makefile: Change the name of the test target so that it doesn't
7025 conflict with the recursive test target.
7027 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7029 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7030 AddressOf): Do not use EmitThis, that was wrong, use the actual
7033 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7035 * class.cs (MethodData.Define): While checking if a method is an
7036 interface implementation, improve the test: If we are not public
7037 (use new test here: use the computed MethodAttributes directly,
7038 instead of the parsed modifier flags) check if the `implementing'
7039 method comes from an interface or not.
7041 * pending.cs (VerifyPendingMethods): Slightly better error
7044 * makefile: add test target that does the mcs bootstrap.
7046 2003-07-16 Ravi Pratap <ravi@ximian.com>
7048 * interface.cs (Define): Do nothing here since there are no
7049 members to populate etc. Move the attribute emission out of here
7050 since this was just totally the wrong place to put it. Attribute
7051 application happens during the 'Emit' phase, not in the 'Define'
7054 (Emit): Add this method and move the attribute emission here
7056 * rootcontext.cs (EmitCode): Call the Emit method on interface
7059 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7061 * expression.cs (OverloadResolve): Report error only if Location
7062 is not 'Null' which means that there was a probe going on.
7064 2003-07-14 Martin Baulig <martin@ximian.com>
7066 * expression.cs (ConditionalLogicalOperator): New public class to
7067 implement user defined conditional logical operators.
7068 This is section 14.11.2 in the spec and bug #40505.
7070 2003-07-14 Martin Baulig <martin@ximian.com>
7072 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7074 2003-07-14 Martin Baulig <martin@ximian.com>
7076 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7078 * ecore.cs (IVariable.VerifyFixed): New interface method.
7080 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7081 operator, check whether the variable is actually fixed. Fixes bug
7082 #36055. Set a variable definitely assigned when taking its
7083 address as required by the spec.
7085 * statement.cs (LocalInfo.IsFixed): New field.
7086 (LocalInfo.MakePinned): Set `IsFixed' to true.
7088 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7090 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7091 for .ctors, ensure that we only ask for members declared in the
7092 attribute type (BindingFlags.DeclaredOnly).
7096 * expression.cs (Error_WrongNumArguments): Report error 1501
7097 correctly the way CSC does.
7099 2003-07-13 Martin Baulig <martin@ximian.com>
7101 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7102 lookup on the fully qualified name, to make things like "X.X" work
7103 where "X.X" is a fully qualified type name, but we also have a
7104 namespace "X" in the using list. Fixes #41975.
7106 2003-07-13 Martin Baulig <martin@ximian.com>
7108 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7109 function. If we're a CompoundAssign, we need to create an embedded
7110 CompoundAssign, not an embedded Assign.
7111 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7114 2003-07-13 Martin Baulig <martin@ximian.com>
7116 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7117 work to fix bug #46088.
7119 2003-07-13 Ravi Pratap <ravi@ximian.com>
7121 * class.cs (Operator.Emit): Do not emit attributes here - it is
7122 taken care of by the Method class that we delegate too. This takes
7125 2003-07-10 Martin Baulig <martin@ximian.com>
7127 * expression.cs (TypeOfVoid): New class.
7128 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7130 2003-07-10 Martin Baulig <martin@ximian.com>
7132 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7135 2003-07-10 Martin Baulig <martin@ximian.com>
7137 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7138 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7140 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7142 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7144 2003-07-10 Martin Baulig <martin@ximian.com>
7146 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7147 of decimal. Fixes #42850.
7149 NOTE: I also fixed the created byte blob, but this doesn't work on
7150 the MS runtime and csc never produces any byte blobs for decimal
7153 2003-07-10 Martin Baulig <martin@ximian.com>
7155 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7156 structs; fixes #32068.
7157 (Block.AddChildVariableNames): Fixed #44302.
7159 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7161 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7163 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7165 * attribute.cs: And this test is onger needed.
7167 2003-07-08 Martin Baulig <martin@ximian.com>
7169 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7170 inaccessible types. Fixes #36313.
7172 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7174 * namespace.cs (NamespaceEntry): Create implicit entries for all
7175 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7176 implicit entries for N1.N2 and N1.
7178 2003-07-08 Martin Baulig <martin@ximian.com>
7180 Rewrote the handling of namespaces to fix a lot of the issues
7181 wrt. `using' aliases etc.
7183 * namespace.cs (Namespace): Splitted this class into a
7184 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7186 * typemanager.cs (TypeManager.IsNamespace): Removed.
7187 (TypeManager.ComputeNamespaces): Only compute namespaces from
7188 loaded assemblies here, not the namespaces from the assembly we're
7189 currently compiling.
7191 2003-07-08 Martin Baulig <martin@ximian.com>
7193 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7195 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7197 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7200 I thought about the memory savings here, but LookupTypeReflection
7201 is used under already very constrained scenarios. Compiling
7202 corlib or mcs only exposes one hit, so it would not really reduce
7203 any memory consumption.
7205 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7207 * typemanager.cs: fixes bug #45889 by only adding public types from
7208 other assemblies to the list of known types.
7210 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7212 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7213 on the type we resolved.
7215 2003-07-05 Martin Baulig <martin@ximian.com>
7217 * pending.cs (PendingImplementation.ParentImplements): Don't
7218 create the proxy if the parent is abstract.
7220 * class.cs (TypeContainer.DefineIndexers): Process explicit
7221 interface implementations first. Fixes #37714.
7223 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7225 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7226 defined recursively; but since we modify the input parameters
7227 (left is set to `this' temporarily), we reset this value if the
7228 left_is_explicit is false, which gives the original semantics to
7231 * literal.cs (NullPointer): new class used to represent a null
7232 literal in a pointer context.
7234 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7235 type is a pointer, use a NullPointer object instead of a
7236 NullLiteral. Closes 43687
7238 (ExplicitConversion): Convert pointer values using
7239 the conv opcode to the proper type.
7241 * ecore.cs (New): change ValueTypeVariable property into a method,
7242 that returns whether the valuetype is suitable for being used.
7244 * expression.cs (Binary.DoNumericPromotions): Only return if we
7245 the int constant was a valid uint, and we can return both left and
7246 right as uints. If not, we continue processing, to trigger the
7247 type conversion. This fixes 39018.
7249 * statement.cs (Block.EmitMeta): During constant resolution, set
7250 the CurrentBlock property on the emitcontext, so that we resolve
7251 constants propertly.
7253 2003-07-02 Martin Baulig <martin@ximian.com>
7255 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7256 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7258 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7259 than emitting it here.
7261 * statement.cs: Fixed some more flow analysis bugs.
7263 2003-07-02 Martin Baulig <martin@ximian.com>
7265 * class.cs (MethodData.Define): When implementing interface
7266 methods, set Final unless we're Virtual.
7268 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7269 check work for interface methods.
7271 2003-07-01 Martin Baulig <martin@ximian.com>
7273 * ecore.cs (EmitContext.This): Replaced this property with a
7274 GetThis() method which takes a Location argument. This ensures
7275 that we get the correct error location for a CS0188.
7277 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7279 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7280 ImplicitStandardConversion.
7282 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7284 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7286 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7289 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7291 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7294 (MethodData.Define): Turn off initlocals for unsafe methods.
7296 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7298 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7299 complete; Fixes #37521.
7301 * delegate.cs: Use Modifiers.TypeAttr to compute the
7302 TypeAttributes, instead of rolling our own. This makes the flags
7303 correct for the delegates.
7305 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7307 * class.cs (Constructor.Define): Set the private flag for static
7308 constructors as well.
7310 * cs-parser.jay (statement_expression): Set the return value to
7311 null, to avoid a crash when we catch an error.
7313 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7315 * cs-parser.jay: Applied patch from Jackson that adds support for
7316 extern and unsafe modifiers to destructor declarations.
7318 * expression.cs: Report error 21 if the user is trying to index a
7321 * driver.cs: Add an error message, suggested by the bug report.
7323 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7324 if we do not have a ": this ()" constructor initializer. Fixes 45149
7326 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7328 * namespace.cs: Add some information to reduce FAQs.
7330 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7332 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7333 underlying enumeration types. Fixes #43915.
7335 * expression.cs: Treat ushort/short as legal values to be used in
7338 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7340 * delegate.cs: transfer custom attributes for paramenters from
7341 the delegate declaration to Invoke and BeginInvoke.
7343 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7345 * attribute.cs: handle custom marshalers and emit marshal info
7348 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7350 * makefile.gnu: Added anonymous.cs to the compiler sources.
7352 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7354 * iterators.cs: Change the name of the proxy class to include two
7357 * cs-parser.jay: Update grammar to include anonymous methods.
7359 * anonymous.cs: new file.
7361 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7363 * class.cs (Field.Define): Add missing test for pointers and
7366 2003-05-27 Ravi Pratap <ravi@ximian.com>
7368 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7369 we use the stobj opcode.
7371 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7372 since it wasn't the correct fix.
7374 It still is puzzling that we are required to use stobj for IntPtr
7375 which seems to be a ValueType.
7377 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7379 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7380 during regular simple name resolution. Now, the trick is that
7381 instead of returning for processing the simplename, we do a
7382 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7383 contextual lookup type). If a match is found, return that, if
7384 not, return for further composition.
7386 This fixes long-standing 30485.
7388 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7389 using the address to initialize an object, do an Stobj instead of
7390 using the regular Stelem.
7392 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7393 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
7394 Because if we are a BaseIndexerAccess that value will be true.
7397 * statement.cs (GotoCase.Resolve): Return after reporting an
7398 error, do not attempt to continue.
7400 * expression.cs (PointerArithmetic.Emit): If our operand is a
7401 long, convert our constants to match the operand before
7402 multiplying. Convert to I type before adding. Fixes 43670.
7404 2003-05-14 Ravi Pratap <ravi@ximian.com>
7406 * enum.cs (ImplicitConversionExists) : Rename to
7407 ImplicitEnumConversionExists to remove ambiguity.
7409 * ecore.cs (NullCast): New type of cast expression class which
7410 basically is very similar to EmptyCast with the difference being
7411 it still is a constant since it is used only to cast a null to
7415 * convert.cs (ImplicitReferenceConversion): When casting a null
7416 literal, we return a NullCast.
7418 * literal.cs (NullLiteralTyped): Remove - I don't see why this
7419 should be around anymore.
7421 The renaming (reported was slightly wrong). Corrections:
7423 ConvertImplicitStandard -> ImplicitConversionStandard
7424 ConvertExplicitStandard -> ExplicitConversionStandard
7426 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
7427 before passing them in !
7429 * convert.cs (ImplicitConversionStandard): When comparing for
7430 equal expr and target types, ensure that expr is not a
7433 In general, we must not be checking (expr_type ==
7434 target_type) in the top level conversion methods
7435 (ImplicitConversion, ExplicitConversion etc). This checking is
7436 done in the methods that they delegate to.
7438 2003-05-20 Miguel de Icaza <miguel@ximian.com>
7440 * convert.cs: Move Error_CannotConvertType,
7441 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
7442 ImplicitNumericConversion, ImplicitConversionExists,
7443 ImplicitUserConversionExists, StandardConversionExists,
7444 FindMostEncompassedType, FindMostSpecificSource,
7445 FindMostSpecificTarget, ImplicitUserConversion,
7446 ExplicitUserConversion, GetConversionOperators,
7447 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
7448 TryImplicitIntConversion, Error_CannotConvertImplicit,
7449 ConvertImplicitRequired, ConvertNumericExplicit,
7450 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
7451 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
7454 Perform the following renames:
7456 StandardConversionExists -> ImplicitStandardConversionExists
7457 ConvertImplicit -> ImplicitConversion
7458 ConvertImplicitStandard -> ImplicitStandardConversion
7459 TryImplicitIntConversion -> ImplicitIntConversion
7460 ConvertImplicitRequired -> ImplicitConversionRequired
7461 ConvertNumericExplicit -> ExplicitNumericConversion
7462 ConvertReferenceExplicit -> ExplicitReferenceConversion
7463 ConvertExplicit -> ExplicitConversion
7464 ConvertExplicitStandard -> ExplicitStandardConversion
7466 2003-05-19 Martin Baulig <martin@ximian.com>
7468 * statement.cs (TypeInfo.StructInfo): Made this type protected.
7469 (TypeInfo): Added support for structs having structs as fields.
7471 * ecore.cs (FieldExpr): Implement IVariable.
7472 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
7473 VariableInfo for the field.
7475 2003-05-18 Martin Baulig <martin@ximian.com>
7477 * expression.cs (This.DoResolve): Report a CS0027 if we're
7478 emitting a field initializer.
7480 2003-05-18 Martin Baulig <martin@ximian.com>
7482 * expression.cs (This.ResolveBase): New public function.
7483 (This.DoResolve): Check for CS0188.
7485 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
7488 * ecore.cs (MethodGroupExpr.DoResolve): Set the
7489 `instance_expression' to null if we don't have any non-static
7492 2003-05-18 Martin Baulig <martin@ximian.com>
7494 Reworked the way how local variables and parameters are handled by
7495 the flow analysis code.
7497 * statement.cs (TypeInfo, VariableMap): New public classes.
7498 (VariableInfo): New public class. This is now responsible for
7499 checking whether a variable has been assigned. It is used for
7500 parameters and local variables.
7501 (Block.EmitMeta): Take the InternalParameters as argument; compute
7502 the layout of the flow vectors here.
7503 (Block.LocalMap, Block.ParameterMap): New public properties.
7504 (FlowBranching): The .ctor doesn't get the InternalParameters
7505 anymore since Block.EmitMeta() now computes the layout of the flow
7507 (MyStructInfo): This class is now known as `StructInfo' and nested
7508 in `TypeInfo'; we don't access this directly anymore.
7510 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
7511 property and removed IsAssigned(), IsFieldAssigned(),
7512 SetAssigned() and SetFieldAssigned(); we now call them on the
7513 VariableInfo so we don't need to duplicate this code everywhere.
7515 * expression.cs (ParameterReference): Added `Block block' argument
7517 (LocalVariableReference, ParameterReference, This): The new
7518 VariableInfo class is now responsible for all the definite
7521 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
7522 IsParameterAssigned, SetParameterAssigned): Removed.
7524 2003-05-18 Martin Baulig <martin@ximian.com>
7526 * typemanager.cs (InitCoreTypes): Try calling
7527 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
7528 the 3-args-version. Corlib now also needs our `void_type'.
7529 (GetMethod): Added overloaded version which takes an optional
7530 `bool report_errors' to allow lookups of optional methods.
7532 2003-05-12 Martin Baulig <martin@ximian.com>
7534 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
7535 only used for locals and not for parameters.
7537 2003-05-12 Miguel de Icaza <miguel@ximian.com>
7539 * support.cs (InternalParameters.ParameterType): Return the
7540 ExternalType of the parameter.
7542 * parameter.cs (Parameter.ExternalType): drop the two arguments,
7545 2003-05-11 Miguel de Icaza <miguel@ximian.com>
7547 * class.cs (MethodData.Define): Do not set the `newslot' on
7548 interface members, if they are also flagged as "override".
7550 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
7551 better code for ++i and i++. This only works for static fields
7552 and local variables.
7554 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
7555 want to pull the DeclSpace out of the builder_to_declspace instead
7556 of the TypeBuilder (like in TypeContainer.FindMembers).
7558 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
7559 instead of LookupTypeContainer. Fixes the crash on .NET for
7560 looking up interface members.
7562 * const.cs: Create our own emit context during the Definition
7563 stage, so that constants are evaluated in the proper context, when
7564 a recursive definition happens.
7566 2003-05-11 Martin Baulig <martin@ximian.com>
7568 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
7569 new block for a switch section.
7570 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
7571 the adding/lookup in the switch block. Fixes #39828.
7573 2003-05-09 Miguel de Icaza <miguel@ximian.com>
7575 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
7576 functionality: I needed to convert the data after I had performed
7577 the add/sub operation into the operands type size.
7579 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
7580 pass the type for the box operation, otherwise the resulting
7581 object would have been of type object.
7583 (BoxedCast): Add constructor to specify the type to box as.
7585 2003-05-07 Miguel de Icaza <miguel@ximian.com>
7587 * iterators.cs: I was reusing the `count' variable inadvertently,
7588 take steps to not allow this to happen.
7590 2003-05-06 Miguel de Icaza <miguel@ximian.com>
7592 * attribute.cs (Attribute.Resolve): Params attributes are encoded
7593 by creating an array at the point where the params starts and
7594 putting all those arguments there, then adjusting the size of the
7597 2003-05-05 Miguel de Icaza <miguel@ximian.com>
7599 * expression.cs (New.AddressOf): Implement interface
7600 IMemoryLocation. This is used when the `new' operator is used in
7601 the context of an invocation to a method on a value type.
7603 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
7606 * namespace.cs: Also check the using aliases here.
7608 * driver.cs: Move the test for using validity after the types have
7609 been entered, so we do a single pass that also includes the using
7612 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
7613 in the regular case. CreateSiblingForFinally is doing extra
7616 * attribute.cs (GetAttributeArgumentExpression): Store the result
7617 on an out value, and use the return value to indicate failure
7618 instead of using null (which is a valid return for Constant.GetValue).
7620 * statement.cs: Perform the analysis flow for the increment
7621 portion after the statement, because this will be the real flow of
7622 execution. Fixes #42385
7624 * codegen.cs (EmitContext.EmitArgument,
7625 EmitContext.EmitStoreArgument): New helper functions when the
7626 RemapToProxy flag is set.
7628 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
7631 Add support for remapping parameters.
7633 * iterators.cs: Propagate parameter values; Store parameter
7634 values in the proxy classes.
7636 2003-05-04 Miguel de Icaza <miguel@ximian.com>
7638 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
7639 need a proxy reference; I do not know what I was thinking
7641 * cs-parser.jay (constructor_initializer): catch another error,
7642 and display nice message.
7644 (field_declaration): catch void field declaration
7645 to flag a better error.
7647 * class.cs (MemberBase.CheckBase): Report an error instead of a
7648 warning if a new protected member is declared in a struct.
7649 (Field.Define): catch the error of readonly/volatile.
7651 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
7653 (FieldExpr.AddressOf): ditto. Catch error where the address of a
7654 volatile variable is taken
7656 2003-05-02 Miguel de Icaza <miguel@ximian.com>
7658 * statement.cs (Fixed.Resolve): Report an error if we are not in
7661 2003-05-01 Miguel de Icaza <miguel@ximian.com>
7663 * typemanager.cs: reuse the code that handles type clashes for
7664 delegates and enumerations.
7666 * class.cs (Report28): Always report.
7668 * expression.cs (EncodeAsAttribute): Allow nulls here.
7670 2003-04-28 Miguel de Icaza <miguel@ximian.com>
7672 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
7673 the functionality for testing whether an expression is valid for
7674 an attribute here. Also handle the case of arrays of elements
7677 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
7678 encoding a linear array into an array of objects that are suitable
7679 to be passed to an CustomAttributeBuilder.
7681 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
7683 * ecore.cs: (FieldExpr): Handle field remapping here.
7685 * iteratators.cs: Pass the instance variable (if the method is an
7686 instance method) to the constructors, so we can access the field
7687 variables on the class.
7689 TODO: Test this with structs. I think the THIS variable on
7690 structs might have to be a pointer, and not a refenrece
7692 2003-04-27 Miguel de Icaza <miguel@ximian.com>
7694 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
7695 local variables to fields in a proxy class.
7697 * iterators.cs (PopulateProxy): Rename our internal fields to
7699 Create a <THIS> field if we are an instance method, so we can
7700 reference our parent container variables.
7701 (MapVariable): Called back from the EmitContext code to enter a
7702 new variable to field mapping into the proxy class (we just create
7706 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
7707 for using the remapped locals to fields.
7709 I placed the code here, because that gives the same semantics to
7710 local variables, and only changes the Emit code.
7712 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
7713 statements inside iterators.
7714 (VariableInfo): Add a FieldBuilder for the cases when we are
7715 remapping local variables to fields in a proxy class
7717 * ecore.cs (SimpleNameResolve): Avoid testing two times for
7718 current_block != null.
7720 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
7721 not cope with strings, as it has been moved to the
7722 TableSwitchEmit. Fixed bug in switch generation.
7724 * expression.cs (New.DoResolve): Provide more context for the user
7725 when reporting an error.
7727 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
7730 * expression.cs (MemberAccess.DoResolve): When we get a type back,
7731 check the permissions for it. Note than in a type-resolution
7732 context the check was already present in DeclSpace.ResolveType,
7733 but was missing from the MemberAccess.
7735 (ArrayCreation.CheckIndices): warn if the user has
7736 more nested levels of expressions, but there are no more
7737 dimensions specified. Avoids crash on bug 41906.
7739 2003-04-26 Miguel de Icaza <miguel@ximian.com>
7741 * statement.cs (Block): replace Implicit bool, for a generic
7743 New flag: `Unchecked'. This is used during the EmitMeta phase
7744 (which is out-of-line with the regular Resolve/Emit process for a
7745 statement, as this is done ahead of time, but still gets a chance
7746 to call constant resolve).
7748 (Block.Flags): new enum for adding a new flag.
7750 (Block.EmitMeta): track the state of unchecked.
7752 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
7753 to enable constant resolution to work there as well.
7755 2003-04-22 Miguel de Icaza <miguel@ximian.com>
7757 * typemanager.cs (ienumerable_type): Also look up
7758 System.Collections.IEnumerable.
7760 2003-04-21 Miguel de Icaza <miguel@ximian.com>
7762 TODO: Test more than one conditional per method.
7764 * class.cs (Indexer.Define): Report the location where the user is
7765 referencing the unsupported feature.
7767 (MethodData): Overload the use of `conditionals' to
7768 minimize the creation of needless ArrayLists. This saves roughly
7769 212kb on my machine.
7771 (Method): Implement the new IIteratorContainer interface.
7772 (Method.SetYields): Implement the method by setting the ModFlags
7773 to contain METHOD_YIELDS.
7775 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
7776 which just got set to null.
7778 * iterators.cs: New file.
7780 (Yield, YieldBreak): New statements.
7782 * statement.cs (Return.Resolve): Flag an error if we are used in
7785 * codegen.cs (InIterator): New flag set if the code is being
7786 compiled in an iterator method.
7788 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
7789 internal modifier, and we just use it to avoid adding extra
7790 fields, as this is seldom used.
7792 * cs-parser.jay: Add yield_statement (yield and yield break).
7794 * driver.cs: New flag -v2 to turn on version 2 features.
7796 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
7797 hashtable when v2 is enabled.
7799 2003-04-20 Miguel de Icaza <miguel@ximian.com>
7801 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
7802 there is already a namespace defined with this name.
7804 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
7805 people upgraded their corlibs.
7807 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
7808 always use fully qualified types, no need to use the compiler
7811 (TypeManager.IsNamespace): Use binarysearch.
7813 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
7814 AddDelegate): I did not quite use the new IsValid API properly: I
7815 have to pass the short-name and the fullname. I was passing only
7816 the basename instead of the fullname sometimes.
7818 (TypeContainer.DefineType): call NamespaceClash.
7820 * interface.cs (Interface.DefineType): use NamespaceClash before
7823 * delegate.cs (Delegate.DefineType): use NamespaceClash before
7826 * enum.cs: (Enum.DefineType): use NamespaceClash before
7829 * typemanager.cs (: 3-line patch that gives us some tasty 11%
7830 speed increase. First, use the negative_hits cache when we get a
7831 negative. Second, add the type with its full original name
7832 instead of the new . and + encoded name (reflection uses + to
7833 separate type from a nested type). Use LookupTypeReflection
7834 directly which bypasses the type->name hashtable (that we already
7835 know does not contain the type.
7837 * decl.cs (DeclSpace.ResolveTypeExpr): track the
7838 location/container type.
7840 * driver.cs: When passing utf8, use directly the UTF8Encoding.
7842 2003-04-19 Miguel de Icaza <miguel@ximian.com>
7844 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
7846 * delegate.cs (NewDelegate.Resolve): Test whether an instance
7847 method is being referenced in the method group from a static
7848 context, and report error 120 if so.
7850 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
7853 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
7854 is created, we create the A namespace).
7856 * cs-parser.jay: A namespace also introduces a DeclarationFound.
7859 2003-04-18 Miguel de Icaza <miguel@ximian.com>
7861 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
7862 invocation to ModuleBuilder.GetType with the same values will
7863 return a new type instance, so we need to cache its return
7866 * expression.cs (Binary.ResolveOperator): Only allow the compare
7867 operators on enums if they are of the same type.
7869 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
7870 types of ValueType on their own case. Before we were giving them
7871 the same treatment as objects.
7873 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
7874 fullname. Short name is used to compare against container name.
7875 Fullname is used to check against defined namespace names.
7877 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
7878 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
7880 (Method.CheckBase): Call parent.
7881 (MemberBase.CheckBase): Check for protected members on sealed
7883 (PropertyBase.CheckBase): Call parent.
7884 (Field.Define): Call parent.
7886 * report.cs: Negative error codes are now mapped to 8000 - code,
7887 so that the display is render more nicely.
7889 * typemanager.cs: Do not use try/catch, instead report a regular
7892 (GetPointerType, GetReferenceType): These methods provide
7893 mechanisms to obtain the T* and T& from a T. We had the code
7894 previously scattered around the code base, and it also used
7895 TypeManager.LookupType that would go through plenty of caches.
7896 This one goes directly to the type source.
7898 In some places we did the Type.GetType followed by
7899 ModuleBuilder.GetType, but not in others, so this unifies the
7902 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
7903 statements now that we have namespace information.
7905 * typemanager.cs (IsNamespace): New method, returns whether the
7906 string presented is a namespace or not.
7908 (ComputeNamespaces): New public entry point, computes the list of
7909 available namespaces, using the GetNamespaces API call in Mono, or
7910 the slower version in MS.NET.
7912 Now before we start the semantic analysis phase, we have a
7913 complete list of namespaces including everything that the user has
7916 Deleted old code to cache namespaces in .nsc files.
7918 2003-04-17 Miguel de Icaza <miguel@ximian.com>
7920 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
7921 class/struct location definition Location for the implicit
7922 constructor location.
7924 (Operator.Define): Use the location of the operator for the
7925 implicit Method definition.
7927 (Constructor.Emit): use the constructor location for the implicit
7928 base initializer constructor.
7930 * ecore.cs: Remove ITypeExpression. This interface is now gone,
7931 and the Expression class now contains two new methods:
7933 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
7934 isolate type lookup from the rest of the resolution process.
7936 Since we use Expressions to hold type definitions due to the way
7937 we parse the input we have historically overloaded Resolve to
7938 perform the Type lookups if a special flag is passed. Now this is
7939 eliminated and two methods take their place.
7941 The differences in the two methods between xStep and xTerminal is
7942 that xStep is involved in our current lookup system that uses
7943 SimpleNames to compose a name, while xTerminal is used just to
7944 catch the case where the simplename lookup failed.
7946 2003-04-16 Miguel de Icaza <miguel@ximian.com>
7948 * expression.cs (ResolveMemberAccess): Remove redundant code.
7949 TypeExpr expressions are always born fully resolved.
7951 * interface.cs (PopulateMethod): Do not lookup the types twice.
7952 We were doing it once during SemanticAnalysis and once during
7955 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
7956 in local variable type definitions, were being returned as a
7957 SimpleName (we decomposed everything into a string), that is
7958 because primary_expression was being used instead of a type in the
7959 grammar (reduce/reduce conflicts).
7961 The part that was wrong is that we converted the expression into a
7962 string (an oversimplification in one hand, compounded with primary
7963 expressions doing string concatenation).
7969 Would return "A.B.C[]" as a SimpleName. This stopped things like
7970 using clauses from working on this particular context. And a type
7971 was being matched directly against "A.B.C[]".
7973 We now use the correct approach, and allow for ComposedCast to be
7974 part of the unary expression. So the "A.B.C []" become a composed
7975 cast of "A.B.C" (as a nested group of MemberAccess with a
7976 SimpleName at the end) plus the rank composition "[]".
7980 2003-04-10 Miguel de Icaza <miguel@ximian.com>
7982 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
7983 for the access level checking.
7985 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
7986 `TypeContainer container', because I kept getting confused when I
7987 was debugging this code.
7989 * expression.cs (Indexers): Instead of tracking getters/setters,
7990 we now track them in parallel. We create one arraylist less, but
7991 most importantly it is possible now for the LValue code to find a
7992 matching get for a set.
7994 (IndexerAccess.DoResolveLValue): Update the code.
7995 GetIndexersForType has been modified already to extract all the
7996 indexers from a type. The code assumed it did not.
7998 Also make the code set the correct return type for the indexer.
7999 This was fixed a long time ago for properties, but was missing for
8000 indexers. It used to be void_type.
8002 (Binary.Emit): Test first for doubles instead of
8003 floats, as they are more common.
8005 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8006 when dealing with floats and the <=, >= operators. This fixes bug
8009 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8010 to load the array value by emitting a load on the foreach variable
8011 type. This was incorrect.
8013 We now emit the code to load an element using the the array
8014 variable type, and then we emit the conversion operator.
8018 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8020 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8022 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8024 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8025 test for protection before we test for signatures.
8027 (MethodSignature.ToString): implement.
8029 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8030 to the case where we reduced into a LongConstant.
8032 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8033 depend on whether the information is acurrate, because the
8034 Microsoft runtime will always claim that the array type is public,
8035 regardless of the real state.
8037 If the type is a pointer, another problem happens: the type is
8038 reported as non-public in Microsoft.
8040 In both cases we have to call CheckAccessLevel recursively with
8041 the underlying type as the argument to be tested.
8043 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8045 * assign.cs (Assign.Emit): If we are dealing with a compound
8046 assignment expression, we should use the code path that stores the
8047 intermediate result in a temporary value. This fixes #40903.
8049 *expression.cs (Indirection.ToString): Provide ToString method for
8052 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8054 * class.cs: Null out fields holding references to Block objects so
8055 they can be garbage collected.
8057 * expression.cs (OverloadResolve): Remove unused local.
8059 2003-04-07 Martin Baulig <martin@ximian.com>
8061 * codegen.cs (EmitContext.CurrentFile): New public field.
8062 (EmitContext.Mark): Use the CurrentFile to check whether the
8063 location is in the correct file.
8064 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8066 2003-04-07 Martin Baulig <martin@ximian.com>
8068 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8070 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8071 location. [FIXME: The location argument which gets passed to this
8072 method is sometimes wrong!]
8074 2003-04-07 Nick Drochak <ndrochak@gol.com>
8076 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8078 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8080 * expression.cs (Indirection.EmitAssign): We were using the
8081 temporary, but returning immediately instead of continuing the
8084 2003-04-06 Martin Baulig <martin@ximian.com>
8086 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8087 if it's a nested child, but also deriving from the outer class.
8090 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8091 nested child, but also deriving from the outer class. See
8093 (FilterWithClosure): We may access private members of the outer
8094 class if we're a nested child and deriving from the outer class.
8095 (RealMemberLookup): Only set `closure_private_ok' if the
8096 `original_bf' contained BindingFlags.NonPublic.
8098 2003-04-05 Martin Baulig <martin@ximian.com>
8100 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
8102 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8104 * class.cs (Event.Define): Do not allow abstract events to have
8107 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8109 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8110 block in event declarations.
8112 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8113 value type, get its address.
8115 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8116 leaving a class on the stack instead of a boolean value (int
8117 0/1). Change the code so we compare against null, and then the
8118 result against zero.
8120 * class.cs (TypeContainer.GetClassBases): We were checking for the
8121 parent class being sealed too late.
8123 * expression.cs (Binary.Emit): For <= and >= when dealing with
8124 floating point values, use cgt.un and clt.un instead of cgt and
8127 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8129 * statement.cs: Apply the same optimization as MS: skip the
8130 GetEnumerator returning an IEnumerator, and use the one returning a
8131 CharEnumerator instead. This allows us to avoid the try-finally block
8134 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8136 * cs-parser.jay: Attributes cannot be applied to
8137 namespaces. Fixes #40473
8139 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8142 (Add*): check if the name is valid using the full name for constants,
8143 fields, properties and events.
8145 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8147 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8148 char constants to be part of the enumeration.
8150 * expression.cs (Conditional.DoResolve): Add support for operator
8151 true. Implements the missing functionality from 14.12
8153 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8154 operator true/false as required by the spec.
8156 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8157 implicit conversion to boolean.
8159 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8160 also one where the type implements `operator true'.
8162 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8163 get an expression that will invoke operator true based on an
8166 (GetConversionOperators): Removed the hack that called op_True
8169 (Expression.ResolveBoolean): Move this from Statement.
8171 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8173 * ecore.cs (FieldExpr): do not allow initialization of initonly
8174 fields on derived classes
8176 2003-03-13 Martin Baulig <martin@ximian.com>
8178 * statement.cs (Block.Emit): Call ig.BeginScope() and
8179 ig.EndScope() when compiling with debugging info; call
8180 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8182 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8184 * expression.cs (Indexers): Do not construct immediately, allow
8185 for new members to be appended as we go. Fixes 38143
8187 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8189 * expression.cs: save/restore context when resolving an unchecked
8192 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8194 * cfold.cs: Catch division by zero in modulus operator during
8197 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8199 * interface.cs (Interface.DefineMembers): Avoid defining members
8202 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8204 * driver.cs: handle the +/- options for -noconfig
8206 * statement.cs (Unckeched.Resolve): Also track the state of
8207 unchecked in the Resolve phase.
8209 2003-02-27 Martin Baulig <martin@ximian.com>
8211 * ecore.cs (Expression.MemberLookup): Don't create a
8212 MethodGroupExpr for something which is not a method. Fixes #38291.
8214 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8216 * class.cs (MemberBase.CheckParameters): Also check that the type
8217 is unmanaged if it is a pointer.
8219 * expression.cs (SizeOf.Resolve): Add location information.
8221 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8222 a managed type is declared.
8224 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8225 parameter modifiers as well. Fixes bug 38606
8227 * class.cs: Very sad. Am backing out the speed up changes
8228 introduced by the ArrayList -> Array in the TypeContainer, as they
8229 were not actually that much faster, and introduced a bug (no error
8230 reports on duplicated methods).
8232 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8233 source first, this will guarantee that we have a valid expression
8234 before calling in lower levels functions that will require a
8235 resolved object. Then use this original_source in the
8236 target.ResolveLValue instead of the original source that was
8239 Another change. Use target.Resolve instead of LValueResolve.
8240 Although we are resolving for LValues, we will let the Assign code
8241 take care of that (it will be called again from Resolve). This
8242 basically allows code like this:
8244 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8245 class Y { void A (X x) { x [0] += o; }
8247 The problem was that the indexer was trying to resolve for
8248 set_Item (idx, object o) and never finding one. The real set_Item
8249 was set_Item (idx, X). By delaying the process we get the right
8254 2003-02-23 Martin Baulig <martin@ximian.com>
8256 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8257 while calling DoEmit ().
8259 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8260 source files; if you use the #line directive inside a method, the
8261 compiler stops emitting line numbers for the debugger until it
8262 reaches the end of the method or another #line directive which
8263 restores the original file.
8265 2003-02-23 Martin Baulig <martin@ximian.com>
8267 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8269 2003-02-23 Martin Baulig <martin@ximian.com>
8271 * statement.cs (Block.AddChildVariableNames): We need to call this
8272 recursively, not just for our immediate children.
8274 2003-02-23 Martin Baulig <martin@ximian.com>
8276 * class.cs (Event.Define): Always make the field private, like csc does.
8278 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8279 actually work, fixes bug #37521.
8281 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8283 * delegate.cs: When creating the various temporary "Parameters"
8284 classes, make sure that we call the ComputeAndDefineParameterTypes
8285 on those new parameters (just like we do with the formal ones), to
8286 allow them to be resolved in the context of the DeclSpace.
8288 This fixes the bug that Dick observed in Bugzilla #38530.
8290 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8292 * expression.cs (ResolveMemberAccess): When resolving a constant,
8293 do not attempt to pull a constant if the value was not able to
8294 generate a valid constant.
8296 * const.cs (LookupConstantValue): Do not report more errors than required.
8298 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8300 * expression.cs: fixes bug #38328.
8302 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8304 * class.cs: Changed all the various members that can be part of a
8305 class from being an ArrayList to be an Array of the right type.
8306 During the DefineType type_list, interface_list, delegate_list and
8307 enum_list are turned into types, interfaces, delegates and enums
8310 And during the member population, indexer_list, event_list,
8311 constant_list, field_list, instance_constructor_list, method_list,
8312 operator_list and property_list are turned into their real arrays.
8314 Although we could probably perform this operation earlier, for
8315 good error reporting we need to keep the lists and remove the
8316 lists for longer than required.
8318 This optimization was triggered by Paolo profiling the compiler
8319 speed on the output of `gen-sample-program.pl' perl script.
8321 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8322 not crash in methods like MemberLookupFailed that use this field.
8324 This problem arises when the compiler fails to resolve a type
8325 during interface type definition for example.
8327 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8329 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8330 inherit from System.Object, so we have to stop at null, not only
8331 when reaching System.Object.
8333 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8335 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8336 DeclaredOnly because the parent indexer might have had a different
8337 name, but did not loop until the top of the hierarchy was reached.
8339 The problem this one fixes is 35492: when a class implemented an
8340 indexer from an interface, we were getting the interface method
8341 (which was abstract) and we were flagging an error (can not invoke
8344 This also keeps bug 33089 functioning, and test-148 functioning.
8346 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8347 out if a method is special is to see if it is declared in a
8348 property or event, or whether it is one of the predefined operator
8349 names. This should fix correctly #36804.
8351 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8353 The goal here is to remove the dependency on EmptyCast.Peel ().
8354 Killing it completely.
8356 The problem is that currently in a number of places where
8357 constants are expected, we have to "probe" for an EmptyCast, and
8358 Peel, which is not the correct thing to do, as this will be
8359 repetitive and will likely lead to errors.
8361 The idea is to remove any EmptyCasts that are used in casts that
8362 can be reduced to constants, so we only have to cope with
8365 This bug hunt was triggered by Bug 37363 and the desire to remove
8366 the duplicate pattern where we were "peeling" emptycasts to check
8367 whether they were constants. Now constants will always be
8370 * ecore.cs: Use an enumconstant here instead of wrapping with
8373 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
8374 throwing me off. By handling this we can get rid of a few hacks.
8376 * statement.cs (Switch): Removed Peel() code.
8378 2003-02-14 Miguel de Icaza <miguel@ximian.com>
8380 * class.cs: Location information for error 508
8382 * expression.cs (New.DoResolve): Add a guard against double
8383 resolution of an expression.
8385 The New DoResolve might be called twice when initializing field
8386 expressions (see EmitFieldInitializers, the call to
8387 GetInitializerExpression will perform a resolve on the expression,
8388 and later the assign will trigger another resolution
8390 This leads to bugs (#37014)
8392 * delegate.cs: The signature for EndInvoke should contain any ref
8393 or out parameters as well. We were not doing this in the past.
8395 * class.cs (Field.Define): Do not overwrite the type definition
8396 inside the `volatile' group. Turns out that volatile enumerations
8397 were changing the type here to perform a validity test, which
8400 2003-02-12 Miguel de Icaza <miguel@ximian.com>
8402 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
8403 and structs, we do not want to load the instance variable
8405 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
8406 enum_type has to be handled like an object reference (implicit
8407 conversions exists from this to object), but the regular IsClass
8408 and IsValueType tests will never return true for this one.
8410 Also we use TypeManager.IsValueType instead of type.IsValueType,
8411 just for consistency with the rest of the code (this is only
8412 needed if we ever use the construct exposed by test-180.cs inside
8413 corlib, which we dont today).
8415 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
8417 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
8420 2003-02-09 Martin Baulig <martin@ximian.com>
8422 * namespace.cs (Namespace..ctor): Added SourceFile argument.
8423 (Namespace.DefineNamespaces): New static public method; this is
8424 called when we're compiling with debugging to add all namespaces
8427 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
8428 pass it to the Namespace's .ctor.
8430 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
8431 and MethodBase arguments; pass the namespace ID to the symwriter;
8432 pass the MethodBase instead of the token to the symwriter.
8433 (SymbolWriter.DefineNamespace): New method to add a namespace to
8436 2003-02-09 Martin Baulig <martin@ximian.com>
8438 * symbolwriter.cs: New file. This is a wrapper around
8439 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
8440 methods here in near future.
8442 2003-02-09 Martin Baulig <martin@ximian.com>
8444 * codegen.cs (EmitContext.Mark): Just pass the arguments to
8445 ILGenerator.MarkSequencePoint() which are actually used by the
8448 2003-02-09 Martin Baulig <martin@ximian.com>
8450 * location.cs (SourceFile): New public sealed class. This
8451 contains the name and an index which is used in the location's token.
8452 (Location): Reserve an appropriate number of bits in the token for
8453 the source file instead of walking over that list, this gives us a
8454 really huge performance improvement when compiling with debugging.
8456 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
8457 `SourceFile' argument instead of a string.
8458 (Driver.ProcessFile): Add all the files via Location.AddFile(),
8459 but don't parse/tokenize here, we need to generate the list of all
8460 source files before we do that.
8461 (Driver.ProcessFiles): New static function. Parses/tokenizes all
8464 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
8465 instead of a string.
8467 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
8470 2003-02-09 Martin Baulig <martin@ximian.com>
8472 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
8473 filename on `#line default'.
8475 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
8477 * statement.cs: don't clear the pinned var when the fixed statement
8478 returns from the method (fixes bug#37752).
8480 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
8482 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
8485 2003-02-07 Martin Baulig <martin@ximian.com>
8487 * driver.cs: Removed the `--debug-args' command line argument.
8489 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
8490 automatically by the AsssemblyBuilder.
8491 (CodeGen.InitializeSymbolWriter): We don't need to call any
8492 initialization function on the symbol writer anymore. This method
8493 doesn't take any arguments.
8495 2003-02-03 Miguel de Icaza <miguel@ximian.com>
8497 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
8498 from referenced assemblies as well.
8500 2003-02-02 Martin Baulig <martin@ximian.com>
8502 * class.cs (MethodData.Emit): Generate debugging info for external methods.
8504 2003-02-02 Martin Baulig <martin@ximian.com>
8506 * class.cs (Constructor.Emit): Open the symbol writer before
8507 emitting the constructor initializer.
8508 (ConstructorInitializer.Emit): Call ec.Mark() to allow
8509 single-stepping through constructor initializers.
8511 2003-01-30 Miguel de Icaza <miguel@ximian.com>
8513 * class.cs: Handle error 549: do not allow virtual methods in
8516 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
8518 * decl.cs: Check access levels when resolving types
8520 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
8522 * statement.cs: Add parameters and locals set in catch blocks that might
8523 return to set vector
8525 2003-01-29 Miguel de Icaza <miguel@ximian.com>
8527 * class.cs (Operator): Set the SpecialName flags for operators.
8529 * expression.cs (Invocation.DoResolve): Only block calls to
8530 accessors and operators on SpecialName methods.
8532 (Cast.TryReduce): Handle conversions from char constants.
8535 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
8537 * statement.cs: small memory and time optimization in FlowBranching.
8539 2003-01-28 Pedro Mart <yoros@wanadoo.es>
8541 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
8542 problem that the last fix but in the other sid (Set).
8544 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
8545 access when there is no indexer in the hierarchy.
8547 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
8549 * class.cs: Combine some if statements.
8551 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8553 * driver.cs: fixed bug #37187.
8555 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
8557 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
8558 any indexer, it's needed to build a list with all the indexers in the
8559 hierarchy (AllGetters), else we have problems. Fixes #35653.
8561 2003-01-23 Miguel de Icaza <miguel@ximian.com>
8563 * class.cs (MethodData.Define): It is wrong for an interface
8564 implementation to be static in both cases: explicit and implicit.
8565 We were only handling this in one case.
8567 Improve the if situation there to not have negations.
8569 * class.cs (Field.Define): Turns out that we do not need to check
8570 the unsafe bit on field definition, only on usage. Remove the test.
8572 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8574 * driver.cs: use assembly.Location instead of Codebase (the latest
8575 patch made mcs fail when using MS assemblies).
8577 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
8579 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
8580 get the path to *corlib.dll.
8582 2003-01-21 Nick Drochak <ndrochak@gol.com>
8586 * typemanager.cs: Remove compiler warnings
8588 2003-01-20 Duncan Mak <duncan@ximian.com>
8590 * AssemblyInfo.cs: Bump the version number to 0.19.
8592 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8594 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
8596 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
8598 * class.cs (Constructor::Emit): Emit debugging info for constructors.
8600 2003-01-17 Miguel de Icaza <miguel@ximian.com>
8602 * cs-parser.jay: Small fix: we were not comparing the constructor
8603 name correctly. Thanks to Zoltan for the initial pointer.
8605 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
8607 * cs-tokenizer.cs: Set file name when specified with #line
8609 2003-01-15 Miguel de Icaza <miguel@ximian.com>
8611 * cs-parser.jay: Only perform the constructor checks here if we
8612 are named like the class; This will help provider a better
8613 error. The constructor path is taken when a type definition is
8614 not found, but most likely the user forgot to add the type, so
8615 report that rather than the constructor error.
8617 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
8619 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
8622 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8624 * cs-parser.jay: Add cleanup call.
8626 2003-01-13 Duncan Mak <duncan@ximian.com>
8628 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
8629 consistent with other methods.
8631 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8633 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
8635 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
8637 * attribute.cs: only set GuidAttr to true when we have a
8640 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8644 * typemanager.cs: fixes to allow mcs compile corlib with the new
8645 Type.IsSubclassOf fix.
8647 2003-01-08 Miguel de Icaza <miguel@ximian.com>
8649 * expression.cs (LocalVariableReference.DoResolve): Classify a
8650 constant as a value, not as a variable. Also, set the type for
8653 * cs-parser.jay (fixed_statement): take a type instead of a
8654 pointer_type, so we can produce a better error message later.
8656 * statement.cs (Fixed.Resolve): Flag types that are not pointers
8659 (For.DoEmit): Make inifinite loops have a
8660 non-conditional branch back.
8662 (Fixed.DoEmit): First populate the pinned variables, then emit the
8663 statement, then clear the variables. Before I was emitting the
8664 code once for each fixed piece.
8667 2003-01-08 Martin Baulig <martin@ximian.com>
8669 * statement.cs (FlowBranching.MergeChild): A break in a
8670 SWITCH_SECTION does not leave a loop. Fixes #36155.
8672 2003-01-08 Martin Baulig <martin@ximian.com>
8674 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
8675 lives in the same number space than `param_map'. Fixes #36154.
8677 2003-01-07 Miguel de Icaza <miguel@ximian.com>
8679 * cs-parser.jay (constructor_declaration): Set the
8680 Constructor.ModFlags before probing for it. This makes the
8681 compiler report 514, 515 and 132 (the code was there, but got
8684 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
8685 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
8686 (GotoCase.Resolve): Set `Returns' to ALWAYS.
8688 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
8690 * enum.cs: create the enum static fields using the enum type.
8692 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
8694 * class.cs: don't try to create the ParamBuilder for the return
8695 type if it's not needed (and handle it breaking for the ms runtime
8698 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
8700 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
8702 2002-12-29 Miguel de Icaza <miguel@ximian.com>
8704 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
8705 the command. This showed up while compiling the JANET source
8706 code, which used \r as its only newline separator.
8708 2002-12-28 Miguel de Icaza <miguel@ximian.com>
8710 * class.cs (Method.Define): If we are an operator (because it
8711 reuses our code), then set the SpecialName and HideBySig. #36128
8713 2002-12-22 Miguel de Icaza <miguel@ximian.com>
8715 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
8716 exception, report error 120 `object reference required'.
8718 * driver.cs: Add --pause option, used during to measure the size
8719 of the process as it goes with --timestamp.
8721 * expression.cs (Invocation.DoResolve): Do not allow methods with
8722 SpecialName to be invoked.
8724 2002-12-21 Miguel de Icaza <miguel@ximian.com>
8726 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
8727 number before adding it.
8729 2002-12-21 Ravi Pratap <ravi@ximian.com>
8731 * ecore.cs (StandardImplicitConversion): When in an unsafe
8732 context, we allow conversion between void * to any other pointer
8733 type. This fixes bug #35973.
8735 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
8737 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
8738 is not thrown when extensionless outputs are used
8740 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8742 * rootcontext.cs: fixed compilation of corlib.
8744 2002-12-19 Miguel de Icaza <miguel@ximian.com>
8746 * attribute.cs (Attributes.Contains): Add new method.
8748 * class.cs (MethodCore.LabelParameters): if the parameter is an
8749 `out' parameter, check that no attribute `[In]' has been passed.
8751 * enum.cs: Handle the `value__' name in an enumeration.
8753 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
8755 * decl.cs: Added special case to allow overrides on "protected
8758 2002-12-18 Ravi Pratap <ravi@ximian.com>
8760 * attribute.cs (Attributes.AddAttributeSection): Rename to this
8761 since it makes much more sense.
8763 (Attributes.ctor): Don't require a Location parameter.
8765 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
8767 * attribute.cs (ApplyAttributes): Remove extra Location parameters
8768 since we already have that information per attribute.
8770 * everywhere : make appropriate changes.
8772 * class.cs (LabelParameters): Write the code which actually
8773 applies attributes to the return type. We can't do this on the MS
8774 .NET runtime so we flag a warning in the case an exception is
8777 2002-12-18 Miguel de Icaza <miguel@ximian.com>
8779 * const.cs: Handle implicit null conversions here too.
8781 2002-12-17 Ravi Pratap <ravi@ximian.com>
8783 * class.cs (MethodCore.LabelParameters): Remove the extra
8784 Type [] parameter since it is completely unnecessary. Instead
8785 pass in the method's attributes so that we can extract
8786 the "return" attribute.
8788 2002-12-17 Miguel de Icaza <miguel@ximian.com>
8790 * cs-parser.jay (parse): Use Report.Error to flag errors instead
8791 of ignoring it and letting the compile continue.
8793 * typemanager.cs (ChangeType): use an extra argument to return an
8794 error condition instead of throwing an exception.
8796 2002-12-15 Miguel de Icaza <miguel@ximian.com>
8798 * expression.cs (Unary.TryReduce): mimic the code for the regular
8799 code path. Perform an implicit cast in the cases where we can
8800 implicitly convert to one of the integral types, and then reduce
8801 based on that constant. This fixes bug #35483.
8803 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8805 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
8807 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8809 * namespace.cs: fixed bug #35489.
8811 2002-12-12 Miguel de Icaza <miguel@ximian.com>
8813 * class.cs: Remove some dead code.
8815 * cs-parser.jay: Estimate the number of methods needed
8816 (RootContext.MethodCount);
8818 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
8819 numbers instead of StringBuilders.
8821 * support.cs (PtrHashtable): Add constructor with initial size;
8822 We can now reduce reallocations of the method table.
8824 2002-12-10 Ravi Pratap <ravi@ximian.com>
8826 * attribute.cs (ApplyAttributes): Keep track of the emitted
8827 attributes on a per-target basis. This fixes bug #35413.
8829 2002-12-10 Miguel de Icaza <miguel@ximian.com>
8831 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
8832 default to the Windows 1252 encoding.
8834 (UnixParseOption): Support version, thanks to Alp for the missing
8837 * AssemblyInfo.cs: Add nice assembly information.
8839 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
8842 * cs-parser.jay: Allow a trailing comma before the close bracked
8843 in the attribute_section production.
8845 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
8846 address of the instance was being taken, I will take this out,
8847 because we take the address of the object immediately here.
8849 2002-12-09 Ravi Pratap <ravi@ximian.com>
8851 * typemanager.cs (AreMultipleAllowed): Take care of the most
8852 obvious case where attribute type is not in the current assembly -
8855 2002-12-08 Miguel de Icaza <miguel@ximian.com>
8857 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
8858 definitions, instead of doing that afterwards.
8860 Also we use a nice little hack, depending on the constructor, we
8861 know if we are a "composed" name or a simple name. Hence, we
8862 avoid the IndexOf test, and we avoid
8864 * codegen.cs: Add code to assist in a bug reporter to track down
8865 the source of a compiler crash.
8867 2002-12-07 Ravi Pratap <ravi@ximian.com>
8869 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
8870 types have been emitted for a given element and flag an error
8871 if something which does not have AllowMultiple set is used more
8874 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
8875 attribute types and their corresponding AllowMultiple properties
8877 (AreMultipleAllowed): Check the property for a given type.
8879 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
8880 property in the case we have a TypeContainer.
8882 (Attributes.AddAttribute): Detect duplicates and just skip on
8883 adding them. This trivial fix catches a pretty gross error in our
8884 attribute emission - global attributes were being emitted twice!
8886 Bugzilla bug #33187 is now fixed.
8888 2002-12-06 Miguel de Icaza <miguel@ximian.com>
8890 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
8893 * expression.cs (Binary.ResolveOperator): I can only use the
8894 Concat (string, string, string) and Concat (string, string,
8895 string, string) if the child is actually a concatenation of
8898 2002-12-04 Miguel de Icaza <miguel@ximian.com>
8900 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
8901 context where we need a 2-character lookahead.
8903 * pending.cs (PendingImplementation): Rework so we can keep track
8904 of interface types all the time, and flag those which were
8905 implemented by parents as optional.
8907 2002-12-03 Miguel de Icaza <miguel@ximian.com>
8909 * expression.cs (Binary.ResolveOperator): Use
8910 String.Concat(string,string,string) or
8911 String.Concat(string,string,string,string) when possible.
8913 * typemanager: More helper methods.
8916 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
8918 * pending.cs: remove the bogus return from GetMissingInterfaces()
8919 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
8921 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8923 * namespace.cs: avoid duplicated 'using xxx' being added to
8924 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
8925 when we get more than one 'using' statement for the same namespace.
8926 Report a CS0105 warning for it.
8928 2002-11-30 Miguel de Icaza <miguel@ximian.com>
8930 * cs-tokenizer.cs (consume_identifier): use read directly, instead
8931 of calling getChar/putback, uses internal knowledge of it.
8933 (xtoken): Reorder tokenizer so most common patterns are checked
8934 first. This reduces the compilation time in another 5% (from 8.11s
8935 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
8937 The parsing time is 22% of the compilation in mcs, and from that
8938 64% is spent on the tokenization process.
8940 I tried using a binary search for keywords, but this is slower
8941 than the hashtable. Another option would be to do a couple of
8944 * Not use a StringBuilder, instead use an array of chars,
8945 with a set value. Notice that this way we could catch
8946 the 645 error without having to do it *afterwards*.
8948 * We could write a hand-parser to avoid the hashtable
8949 compares altogether.
8951 The identifier consumption process takes 37% of the tokenization
8952 time. Another 15% is spent on is_number. 56% of the time spent
8953 on is_number is spent on Int64.Parse:
8955 * We could probably choose based on the string length to
8956 use Int32.Parse or Int64.Parse and avoid all the 64-bit
8959 Another 3% is spend on wrapping `xtoken' in the `token' function.
8961 Handle 0xa0 as whitespace (#34752)
8963 2002-11-26 Miguel de Icaza <miguel@ximian.com>
8965 * typemanager.cs (IsCLRType): New routine to tell whether a type
8966 is one of the builtin types.
8968 Maybe it needs to use TypeCodes to be faster. Maybe we could use
8969 typecode in more places instead of doing pointer comparissions.
8970 We could leverage some knowledge about the way the typecodes are
8973 New code to cache namespaces in assemblies, it is currently not
8974 invoked, to be used soon.
8976 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
8978 * expression.cs (Binary.ResolveOperator): specially handle
8979 strings, and do not perform user-defined operator overloading for
8982 2002-11-24 Miguel de Icaza <miguel@ximian.com>
8984 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
8985 internalcall as it is a pretty simple operation; Avoid whenever
8986 possible to call Char.IsLetter.
8988 (consume_identifier): Cut by half the number of
8989 hashtable calls by merging the is_keyword and GetKeyword behavior.
8991 Do not short-circuit, because if we do, we
8992 report errors (ie, #if false && true would produce an invalid
8996 2002-11-24 Martin Baulig <martin@ximian.com>
8998 * expression.cs (Cast.TryReduce): If we're in checked syntax,
8999 check constant ranges and report a CS0221. Fixes #33186.
9001 2002-11-24 Martin Baulig <martin@ximian.com>
9003 * cs-parser.jay: Make this work for uninitialized variable
9004 declarations in the `for' initializer. Fixes #32416.
9006 2002-11-24 Martin Baulig <martin@ximian.com>
9008 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9009 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9011 2002-11-24 Martin Baulig <martin@ximian.com>
9013 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9014 argument; if true, we also check for user-defined conversions.
9015 This is only needed if both arguments are of a user-defined type.
9016 Fixes #30443, added test-175.cs.
9017 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9019 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9021 2002-11-24 Martin Baulig <martin@ximian.com>
9023 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9024 function to get the store opcode.
9025 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9026 only emit the Ldelema if the store opcode is Stobj. You must run
9027 both test-34 and test-167 to test this. Fixes #34529.
9029 2002-11-23 Martin Baulig <martin@ximian.com>
9031 * ecore.cs (Expression.MemberLookup): Added additional
9032 `qualifier_type' argument which is used when we're being called
9033 from MemberAccess.DoResolve() and null if we're called from a
9035 (Expression.MemberLookupFailed): New method to report errors; this
9036 does the CS1540 check and reports the correct error message.
9038 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9039 argument for the CS1540 check and redone the way how we're dealing
9040 with private members. See the comment in the source code for details.
9041 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9042 `closure_start_type' to `closure_qualifier_type' and check whether
9043 it's not null. It was not this filter being broken, it was just
9044 being called with the wrong arguments.
9046 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9047 and pass it the correct `qualifier_type'; this also does the error
9050 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9052 * expression.cs (Invocation.EmitParams): If the we are dealing
9053 with a non-built-in value type, load its address as well.
9055 (ArrayCreation): Use a a pretty constant instead
9056 of the hardcoded value 2. Use 6 instead of 2 for the number of
9057 static initializers.
9059 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9060 because they are not really value types, just glorified integers.
9062 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9064 * ecore.cs: Remove redundant code for enumerations, make them use
9065 the same code path as everything else, fixes the casting issue
9066 with enumerations in Windows.Forms.
9068 * attribute.cs: Do only cast to string if it is a string, the
9069 validation happens later.
9071 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9072 people upgrade their corlibs.
9074 * ecore.cs: Oops, enumerations were not following the entire code path
9076 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9078 * typemanager.cs (FilterWithClosure): Commented out the test for
9079 1540 in typemanager.cs, as it has problems when accessing
9080 protected methods from a parent class (see test-174.cs).
9082 * attribute.cs (Attribute.ValidateGuid): new method.
9083 (Attribute.Resolve): Use above.
9085 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9087 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9089 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9090 handling for enumerations, as we only needed the TypeContainer
9091 functionality to begin with (this is required for the fix below to
9092 work for enums that reference constants in a container class for
9095 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9097 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9098 a valid TypeBuilder to perform lookups on.o
9100 * class.cs (InheritableMemberSignatureCompare): Use true in the
9101 call to GetGetMethod and GetSetMethod, because we are comparing
9102 the signature, and we need to get the methods *even* if they are
9105 (PropertyBase.CheckBase): ditto.
9107 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9108 GotoCase.Resolve): Use Peel on EmpytCasts.
9110 * ecore.cs (EmptyCast): drop child, add Peel method.
9112 2002-11-17 Martin Baulig <martin@ximian.com>
9114 * ecore.cs (EmptyCast.Child): New public property.
9116 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9117 label resolved to an EmptyCast. Fixes #34162.
9118 (GotoCase.Resolve): Likewise.
9119 (Block.EmitMeta): Likewise.
9121 2002-11-17 Martin Baulig <martin@ximian.com>
9123 * expression.cs (Invocation.BetterConversion): Prefer int over
9124 uint; short over ushort; long over ulong for integer literals.
9125 Use ImplicitConversionExists instead of StandardConversionExists
9126 since we also need to check for user-defined implicit conversions.
9127 Fixes #34165. Added test-173.cs.
9129 2002-11-16 Martin Baulig <martin@ximian.com>
9131 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9132 with the `true' and `false' literals. Fixes #33151.
9134 2002-11-16 Martin Baulig <martin@ximian.com>
9136 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9137 October 22nd; don't do the cs1540 check for static members.
9139 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9140 now using our own filter here and doing the cs1540 check again.
9142 2002-11-16 Martin Baulig <martin@ximian.com>
9144 * support.cs (InternalParameters): Don't crash if we don't have
9145 any fixed parameters. Fixes #33532.
9147 2002-11-16 Martin Baulig <martin@ximian.com>
9149 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9150 when looking up static methods to make this work on Windows.
9153 2002-11-16 Martin Baulig <martin@ximian.com>
9155 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9156 a setter rather than using PropertyInfo.CanWrite.
9158 2002-11-15 Nick Drochak <ndrochak@gol.com>
9160 * class.cs: Allow acces to block member by subclasses. Fixes build
9163 2002-11-14 Martin Baulig <martin@ximian.com>
9165 * class.cs (Constructor.Emit): Added the extern/block check.
9168 2002-11-14 Martin Baulig <martin@ximian.com>
9170 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9171 iteration while looking for indexers, this is needed because the
9172 indexer may have a different name in our base classes. Fixed the
9173 error reporting (no indexers at all, not get accessor, no
9174 overloaded match). Fixes bug #33089.
9175 (IndexerAccess.DoResolveLValue): Likewise.
9177 2002-11-14 Martin Baulig <martin@ximian.com>
9179 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9180 indexers. Fixes the first part of bug #33089.
9181 (MethodSignature.InheritableMemberSignatureCompare): Added support
9184 2002-11-13 Ravi Pratap <ravi@ximian.com>
9186 * attribute.cs (Attribute.Resolve): Catch the
9187 NullReferenceException and report it since it isn't supposed to
9190 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9192 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9193 LogicalOr and LogicalAnd that can benefit from recursively
9194 handling EmitBranchable. The code now should be nice for Paolo.
9196 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9198 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9199 the Type lookups, as we perform quite a number of lookups on
9200 non-Types. This can be removed once we can deterministically tell
9201 whether we have a type or a namespace in advance.
9203 But this might require special hacks from our corlib.
9207 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9208 and double which avoids a conversion from an integer to a double.
9210 * expression.cs: tiny optimization, avoid calling IsConstant,
9211 because it effectively performs the lookup twice.
9213 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9215 But a bogus return here to keep the semantics of the old code
9216 until the Mono runtime is fixed.
9218 * pending.cs (GetMissingInterfaces): New method used to remove all
9219 the interfaces that are already implemented by our parent
9220 classes from the list of pending methods.
9222 * interface.cs: Add checks for calls after ResolveTypeExpr.
9224 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9226 * class.cs (Class.Emit): Report warning 67: event not used if the
9227 warning level is beyond 3.
9229 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9230 being a NullLiteral.
9232 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9235 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9236 path that might fail if a type can not be resolved.
9238 * expression.cs (Binary.Emit): Emit unsigned versions of the
9241 * driver.cs: use error 5.
9243 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9245 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9247 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9249 * cs-parser.jay (switch_section): A beautiful patch from Martin
9250 Baulig that fixed 33094.
9252 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9254 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9255 Check whether the base is abstract and report an error if so.
9257 * expression.cs (IndexerAccess.DoResolveLValue,
9258 IndexerAccess.DoResolve): ditto.
9260 (Invocation.DoResolve): ditto.
9262 (Invocation.FullMethodDesc): Improve the report string.
9264 * statement.cs (Block): Eliminate IsVariableDefined as it is
9265 basically just a wrapper for GetVariableInfo.
9267 * ecore.cs (SimpleName): Use new
9269 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9270 type, as we return the actual parameter ref/unref state on a
9273 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9275 * support.cs: Return proper flags REF/OUT fixing the previous
9278 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9279 not used to mean `ref' but `ref or out' in ParameterReference
9281 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9282 full type signature instead of calling TypeManger.CSharpName
9285 * support.cs (InternalParameters.ParameterDesc): Do not compare
9286 directly to the modflags, because REF/OUT will actually be bitsets
9289 * delegate.cs (VerifyMethod): Check also the modifiers.
9291 * cs-tokenizer.cs: Fix bug where floating point values with an
9292 exponent where a sign was missing was ignored.
9294 * driver.cs: Allow multiple assemblies to be specified in a single
9297 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9299 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9300 because identifiers after a parenthesis would end up in this kind
9301 of production, and we needed to desamiguate it for having casts
9304 (UserDefinedType *) xxx
9306 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9308 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9309 we should set on the Bindingflags.NonPublic, but not turn on
9310 private_ok. private_ok controls whether a Private member is
9311 returned (this is chekced on the filter routine), while the
9312 BindingFlags.NonPublic just controls whether private/protected
9313 will be allowed. This fixes the problem part of the problem of
9314 private properties being allowed to be used in derived classes.
9316 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9317 so we can call the children DoResolveLValue method (this will
9318 properly signal errors on lvalue assignments to base properties)
9320 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9321 getter are null, and we have a property info, we know that this
9322 happened because the lookup failed, so we report an error 122 for
9323 protection level violation.
9325 We also silently return if setter and getter are null in the
9326 resolve functions, this condition only happens if we have flagged
9327 the error before. This is the other half of the problem.
9329 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9330 not have accessibility information, that is why we were returning
9331 true in the filter function in typemanager.cs.
9333 To properly report 122 (property is inaccessible because of its
9334 protection level) correctly, we report this error in ResolveAccess
9335 by failing if both the setter and the getter are lacking (ie, the
9338 DoResolve and DoLResolve have been modified to check for both
9339 setter/getter being null and returning silently, the reason being
9340 that I did not want to put the knowledge about this error in upper
9343 int old = Report.Errors;
9344 x = new PropertyExpr (...);
9345 if (old != Report.Errors)
9350 So the property expr is returned, but it is invalid, so the error
9351 will be flagged during the resolve process.
9353 * class.cs: Remove InheritablePropertySignatureCompare from the
9354 class, as we no longer depend on the property signature to compute
9355 whether it is possible to implement a method or not.
9357 The reason is that calling PropertyInfo.GetGetMethod will return
9358 null (in .NET, in Mono it works, and we should change this), in
9359 cases where the Get Method does not exist in that particular
9364 class X { public virtual int A { get { return 1; } } }
9366 class Z : Y { public override int A { get { return 2; } } }
9368 Would fail in Z because the parent (Y) would not have the property
9369 defined. So we avoid this completely now (because the alternative
9370 fix was ugly and slow), and we now depend exclusively on the
9373 (PropertyBase.CheckBase): Use a method-base mechanism to find our
9374 reference method, instead of using the property.
9376 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
9377 routines are gone now.
9379 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
9380 names, they were incorrectly named.
9382 * cs-tokenizer.cs: Return are more gentle token on failure.
9384 * pending.cs (PendingImplementation.InterfaceMethod): This routine
9385 had an out-of-sync index variable, which caused it to remove from
9386 the list of pending methods the wrong method sometimes.
9388 2002-10-22 Miguel de Icaza <miguel@ximian.com>
9390 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
9391 CanWrite, because those refer to this particular instance of the
9392 property, and do not take into account the fact that we can
9393 override single members of a property.
9395 Constructor requires an EmitContext. The resolution process does
9396 not happen here, but we need to compute the accessors before,
9397 because the resolution does not always happen for properties.
9399 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
9400 subclass, before we did not update this flag, but we did update
9403 (GetAccessors): Drop this routine, as it did not work in the
9404 presence of partially overwritten set/get methods.
9406 Notice that this broke the cs1540 detection, but that will require
9409 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9413 * driver.cs: issue a warning instead of an error if we don't support
9414 debugging for the platform. Also ignore a couple of errors that may
9415 arise when trying to write the symbols. Undo my previous patch.
9417 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9419 * driver.cs: ignore /debug switch except for Unix platforms.
9421 2002-10-23 Nick Drochak <ndrochak@gol.com>
9423 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
9425 2002-10-21 Miguel de Icaza <miguel@ximian.com>
9427 * driver.cs: Do not make mcs-debug conditional, so we do not break
9430 * statement.cs (UsageVector.MergeChildren): I would like Martin to
9431 review this patch. But basically after all the children variables
9432 have been merged, the value of "Breaks" was not being set to
9433 new_breaks for Switch blocks. I think that it should be set after
9434 it has executed. Currently I set this to the value of new_breaks,
9435 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
9436 conservative, but I do not understand this code very well.
9438 I did not break anything in the build, so that is good ;-)
9440 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
9442 2002-10-20 Mark Crichton <crichton@gimp.org>
9444 * cfold.cs: Fixed compile blocker. Really fixed it this time.
9446 2002-10-20 Nick Drochak <ndrochak@gol.com>
9448 * cfold.cs: Fixed compile blocker.
9450 2002-10-20 Miguel de Icaza <miguel@ximian.com>
9452 * driver.cs: I was chekcing the key, not the file.
9454 2002-10-19 Ravi Pratap <ravi@ximian.com>
9456 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
9457 message that we were generating - we just need to silently return
9460 2002-10-19 Miguel de Icaza <miguel@ximian.com>
9462 * class.cs (Event.Define): Change my previous commit, as this
9463 breaks the debugger. This is a temporary hack, as it seems like
9464 the compiler is generating events incorrectly to begin with.
9466 * expression.cs (Binary.ResolveOperator): Added support for
9467 "U operator - (E x, E y)"
9469 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
9472 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
9473 init-only variables, but this path did not take into account that
9474 there might be also instance readonly variables. Correct this
9477 This fixes bug 32253
9479 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
9482 * driver.cs: Change the extension for modules to `netmodule'
9484 * cs-parser.jay: Improved slightly the location tracking for
9485 the debugger symbols.
9487 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
9488 modifiers that were specified instead of the hardcoded value
9489 (FamAndAssem). This was basically ignoring the static modifier,
9490 and others. Fixes 32429.
9492 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
9493 fixed a bug in the process (32476)
9495 * expression.cs (ArrayAccess.EmitAssign): Patch from
9496 hwang_rob@yahoo.ca that fixes bug 31834.3
9498 2002-10-18 Miguel de Icaza <miguel@ximian.com>
9500 * driver.cs: Make the module extension .netmodule.
9502 2002-10-16 Miguel de Icaza <miguel@ximian.com>
9504 * driver.cs: Report an error if the resource file is not found
9505 instead of crashing.
9507 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
9508 false, like Emit does.
9510 2002-10-16 Nick Drochak <ndrochak@gol.com>
9512 * typemanager.cs: Remove unused private member. Also reported mcs
9513 bug to report this as a warning like csc.
9515 2002-10-15 Martin Baulig <martin@gnome.org>
9517 * statement.cs (Statement.Emit): Made this a virtual method; emits
9518 the line number info and calls DoEmit().
9519 (Statement.DoEmit): New protected abstract method, formerly knows
9520 as Statement.Emit().
9522 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
9524 2002-10-11 Miguel de Icaza <miguel@ximian.com>
9526 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
9527 have fixed a remaining problem: not every AddXXXX was adding a
9528 fully qualified name.
9530 Now everyone registers a fully qualified name in the DeclSpace as
9531 being defined instead of the partial name.
9533 Downsides: we are slower than we need to be due to the excess
9534 copies and the names being registered this way.
9536 The reason for this is that we currently depend (on the corlib
9537 bootstrap for instance) that types are fully qualified, because
9538 we dump all the types in the namespace, and we should really have
9539 types inserted into the proper namespace, so we can only store the
9540 basenames in the defined_names array.
9542 2002-10-10 Martin Baulig <martin@gnome.org>
9544 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
9545 from bug #31834, see the bug report for a testcase which is
9548 2002-10-10 Martin Baulig <martin@gnome.org>
9550 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
9551 flow analysis code for this.
9553 * statement.cs (Do, While, For): Tell the flow analysis code about
9555 (FlowBranching.UsageVector): Added support for infinite loops.
9556 (Block.Resolve): Moved the dead code elimination here and use flow
9559 2002-10-09 Miguel de Icaza <miguel@ximian.com>
9561 * class.cs (Field.Define): Catch cycles on struct type
9564 * typemanager.cs (IsUnmanagedtype): Do not recursively check
9565 fields if the fields are static. We only need to check instance
9568 * expression.cs (As.DoResolve): Test for reference type.
9570 * statement.cs (Using.ResolveExpression): Use
9571 ConvertImplicitRequired, not ConvertImplicit which reports an
9573 (Using.ResolveLocalVariableDecls): ditto.
9575 * expression.cs (Binary.ResolveOperator): Report errors in a few
9576 places where we had to.
9578 * typemanager.cs (IsUnmanagedtype): Finish implementation.
9580 2002-10-08 Miguel de Icaza <miguel@ximian.com>
9582 * expression.cs: Use StoreFromPtr instead of extracting the type
9583 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
9585 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
9586 an enumeration value to a System.Enum, but System.Enum is not a
9587 value type, but an class type, so we need to box.
9589 (Expression.ConvertExplicit): One codepath could return
9590 errors but not flag them. Fix this. Fixes #31853
9592 * parameter.cs (Resolve): Do not allow void as a parameter type.
9594 2002-10-06 Martin Baulig <martin@gnome.org>
9596 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
9597 if it's a class type and not a struct. Fixes #31815.
9599 2002-10-06 Martin Baulig <martin@gnome.org>
9601 * statement.cs: Reworked the flow analysis code a bit to make it
9602 usable for dead code elimination.
9604 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9606 * cs-parser.jay: allow empty source files. Fixes bug #31781.
9608 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9610 * expression.cs (ComposedCast.DoResolveType): A quick workaround
9611 to fix the test 165, will investigate deeper.
9613 2002-10-04 Martin Baulig <martin@gnome.org>
9615 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
9616 finally blocks actually work.
9617 (Try.Resolve): We don't need to create a sibling for `finally' if
9618 there is no finally block.
9620 2002-10-04 Martin Baulig <martin@gnome.org>
9622 * class.cs (Constructor.Define): The default accessibility for a
9623 non-default constructor is private, not public.
9625 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9627 * class.cs (Constructor): Make AllowedModifiers public, add
9630 * cs-parser.jay: Perform the modifiers test here, as the
9631 constructor for the Constructor class usually receives a zero
9632 because of the way we create it (first we create, later we
9633 customize, and we were never checking the modifiers).
9635 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
9636 is a version of LookupTypeReflection that includes the type-name
9637 cache. This can be used as a fast path for functions that know
9638 the fully qualified name and are only calling into *.GetType() to
9639 obtain a composed type.
9641 This is also used by TypeManager.LookupType during its type
9644 (LookupType): We now also track the real type name, as sometimes
9645 we can get a quey for the real type name from things like
9646 ComposedCast. This fixes bug 31422.
9648 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
9649 complete type fullname, it does not have to go through the type
9650 resolution system to obtain the composed version of the type (for
9651 obtaining arrays or pointers).
9653 (Conditional.Emit): Use the EmitBoolExpression to
9654 generate nicer code, as requested by Paolo.
9656 (ArrayCreation.CheckIndices): Use the patch from
9657 hwang_rob@yahoo.ca to validate the array initializers.
9659 2002-10-03 Miguel de Icaza <miguel@ximian.com>
9661 * class.cs (ConstructorInitializer.Emit): simplify code by using
9662 Invocation.EmitCall, and at the same time, fix the bugs in calling
9663 parent constructors that took variable arguments.
9665 * ecore.cs (Expression.ConvertNumericExplicit,
9666 Expression.ImplicitNumericConversion): Remove the code that
9667 manually wrapped decimal (InternalTypeConstructor call is now gone
9670 * expression.cs (Cast.TryReduce): Also handle decimal types when
9671 trying to perform a constant fold on the type.
9673 * typemanager.cs (IsUnmanagedtype): Partially implemented.
9675 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
9676 that only turned off an error report, and did nothing else.
9678 2002-10-02 Miguel de Icaza <miguel@ximian.com>
9680 * driver.cs: Handle and ignore /fullpaths
9682 2002-10-01 Miguel de Icaza <miguel@ximian.com>
9684 * expression.cs (Binary.ResolveOperator): Catch the case where
9685 DoNumericPromotions returns true,
9687 (Binary.DoNumericPromotions): Simplify the code, and the tests.
9689 2002-09-27 Miguel de Icaza <miguel@ximian.com>
9691 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
9694 2002-09-26 Miguel de Icaza <miguel@ximian.com>
9696 * ecore.cs (ConvertNumericExplicit): It is not enough that the
9697 conversion exists, but it is also required that the conversion be
9698 performed. This manifested in "(Type64Enum) 2".
9700 * class.cs (TypeManager.AddMethod): The fix is not to change
9701 AddEnum, because that one was using a fully qualified name (every
9702 DeclSpace derivative does), but to change the AddMethod routine
9703 that was using an un-namespaced name. This now correctly reports
9704 the duplicated name.
9706 Revert patch until I can properly fix it. The issue
9707 is that we have a shared Type space across all namespaces
9708 currently, which is wrong.
9710 Options include making the Namespace a DeclSpace, and merge
9711 current_namespace/current_container in the parser.
9713 2002-09-25 Miguel de Icaza <miguel@ximian.com>
9715 * cs-parser.jay: Improve error reporting when we get a different
9716 kind of expression in local_variable_type and
9717 local_variable_pointer_type.
9719 Propagate this to avoid missleading errors being reported.
9721 * ecore.cs (ImplicitReferenceConversion): treat
9722 TypeManager.value_type as a target just like object_type. As
9727 Is valid, and needs to result in the int 1 being boxed before it
9728 is assigned to the value type v.
9730 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
9731 to validate the enumeration name.
9733 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
9734 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
9735 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
9737 * ecore.cs (TryImplicitIntConversion): When doing an
9738 implicit-enumeration-conversion, check if the type is 64-bits and
9739 perform a conversion before passing to EnumConstant.
9741 2002-09-23 Miguel de Icaza <miguel@ximian.com>
9743 * decl.cs (Error_AmbiguousTypeReference); New routine used to
9744 report ambiguous type references. Unlike the MS version, we
9745 report what the ambiguity is. Innovation at work ;-)
9747 (DeclSpace.FindType): Require a location argument to
9748 display when we display an ambiguous error.
9750 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
9752 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
9754 * expression.cs (EmitDynamicInitializers): Apply patch from
9755 hwang_rob@yahoo.ca that fixes the order in which we emit our
9758 2002-09-21 Martin Baulig <martin@gnome.org>
9760 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
9761 delegate takes no arguments.
9763 2002-09-20 Miguel de Icaza <miguel@ximian.com>
9765 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
9768 * expression.cs: Extract the underlying type.
9770 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
9772 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
9774 2002-09-19 Miguel de Icaza <miguel@ximian.com>
9776 * class.cs (TypeContainer.DefineType): We can not use the nice
9777 PackingSize with the size set to 1 DefineType method, because it
9778 will not allow us to define the interfaces that the struct
9781 This completes the fixing of bug 27287
9783 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
9784 means also structs. This fixes part of the problem.
9785 (Expresion.ImplicitReferenceConversionExists): ditto.
9787 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
9788 error if there were no errors reported during the type lookup
9789 process, to avoid duplicates or redundant errors. Without this
9790 you would get an ambiguous errors plus a type not found. We have
9791 beaten the user enough with the first error.
9793 (DeclSparce.FindType): Emit a warning if we have an ambiguous
9796 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
9797 during the resolution process, stop the lookup, this avoids
9798 repeated error reports (same error twice).
9800 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
9802 * typemanager.cs (LookupType): Redo the type lookup code to match
9803 the needs of System.Reflection.
9805 The issue is that System.Reflection requires references to nested
9806 types to begin with a "+" sign instead of a dot. So toplevel
9807 types look like: "NameSpace.TopLevelClass", and nested ones look
9808 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
9811 2002-09-19 Martin Baulig <martin@gnome.org>
9813 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
9814 says that a method always returns or always throws an exception,
9815 don't report the CS0161.
9817 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
9818 set `Returns = new_returns'.
9820 2002-09-19 Martin Baulig <martin@gnome.org>
9822 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
9823 to an enum constant, check for a CS0176.
9825 2002-09-18 Miguel de Icaza <miguel@ximian.com>
9827 * class.cs (TypeContainer.CheckPairedOperators): Now we check
9828 for operators that must be in pairs and report errors.
9830 * ecore.cs (SimpleName.DoResolveType): During the initial type
9831 resolution process, when we define types recursively, we must
9832 check first for types in our current scope before we perform
9833 lookups in the enclosing scopes.
9835 * expression.cs (MakeByteBlob): Handle Decimal blobs.
9837 (Invocation.VerifyArgumentsCompat): Call
9838 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
9839 I thought we were supposed to always call this, but there are a
9840 few places in the code where we dont do it.
9842 2002-09-17 Miguel de Icaza <miguel@ximian.com>
9844 * driver.cs: Add support in -linkres and -resource to specify the
9845 name of the identifier.
9847 2002-09-16 Miguel de Icaza <miguel@ximian.com>
9849 * ecore.cs (StandardConversionExists): Sync with the conversion
9850 code: allow anything-* to void* conversions.
9852 (FindMostSpecificSource): Use an Expression argument
9853 instead of a Type, because we might be handed over a Literal which
9854 gets a few more implicit conversions that plain types do not. So
9855 this information was being lost.
9857 Also, we drop the temporary type-holder expression when not
9860 2002-09-17 Martin Baulig <martin@gnome.org>
9862 * class.cs (PropertyBase.CheckBase): Don't check the base class if
9863 this is an explicit interface implementation.
9865 2002-09-17 Martin Baulig <martin@gnome.org>
9867 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
9868 different `IndexerName' attributes.
9870 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
9871 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
9872 virtual CommonResolve().
9874 2002-09-16 Miguel de Icaza <miguel@ximian.com>
9876 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
9877 and convert that to the UnderlyingType.
9879 * statement.cs (Foreach.Resolve): Indexers are just like variables
9880 or PropertyAccesses.
9882 * cs-tokenizer.cs (consume_string): Track line numbers and columns
9883 inside quoted strings, we were not doing this before.
9885 2002-09-16 Martin Baulig <martin@gnome.org>
9887 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
9888 resolve it. This is needed for the definite assignment check of the
9889 instance expression, fixes bug #29846.
9890 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
9892 2002-09-16 Nick Drochak <ndrochak@gol.com>
9894 * parameter.cs: Fix compile error. Cannot reference static member
9895 from an instance object. Is this an mcs bug?
9897 2002-09-14 Martin Baulig <martin@gnome.org>
9899 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
9900 multiple times. Fixes bug #30295, added test-166.cs.
9902 2002-09-14 Martin Baulig <martin@gnome.org>
9904 * statement.cs (Block.Emit): Don't emit unreachable code.
9905 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
9907 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
9909 2002-09-14 Martin Baulig <martin@gnome.org>
9911 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
9914 2002-09-14 Martin Baulig <martin@gnome.org>
9916 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
9917 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
9918 be false on the ms runtime.
9920 2002-09-13 Martin Baulig <martin@gnome.org>
9922 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
9923 the CS0038 error message.
9925 2002-09-12 Miguel de Icaza <miguel@ximian.com>
9927 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
9928 constant inside, return it.
9930 2002-09-12 Martin Baulig <martin@gnome.org>
9932 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
9933 implicit conversion can be done between enum types.
9935 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
9936 check whether an implicit conversion to the current enum's UnderlyingType
9937 exists and report an error if not.
9939 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
9940 without debugging support.
9942 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
9943 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
9945 2002-09-12 Martin Baulig <martin@gnome.org>
9947 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
9949 * ecore.cs (IMemberExpr.DeclaringType): New property.
9950 (SimpleName.SimpleNameResolve): Check whether we're accessing a
9951 nonstatic member of an outer type (CS0038).
9953 2002-09-11 Miguel de Icaza <miguel@ximian.com>
9955 * driver.cs: Activate the using-error detector at warning level
9956 4 (at least for MS-compatible APIs).
9958 * namespace.cs (VerifyUsing): Small buglett fix.
9960 * pending.cs (PendingImplementation): pass the container pointer.
9962 * interface.cs (GetMethods): Allow for recursive definition. Long
9963 term, I would like to move every type to support recursive
9964 definitions, not the current ordering mechanism that we have right
9967 The situation is this: Attributes are handled before interfaces,
9968 so we can apply attributes to interfaces. But some attributes
9969 implement interfaces, we will now handle the simple cases
9970 (recursive definitions will just get an error).
9972 * parameter.cs: Only invalidate types at the end if we fail to
9975 2002-09-09 Martin Baulig <martin@gnome.org>
9977 * ecore.cs (PropertyExpr.Emit): Also check for
9978 TypeManager.system_int_array_get_length so this'll also work when
9979 compiling corlib. Fixes #30003.
9981 2002-09-09 Martin Baulig <martin@gnome.org>
9983 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
9984 and throw an exception if we can't get the type's size. Fixed #30040,
9987 2002-09-09 Martin Baulig <martin@gnome.org>
9989 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
9991 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
9992 context. Fixes bug #30027.
9994 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
9995 virtual functions. Fixes bug #30043, added test-164.cs.
9997 2002-09-08 Ravi Pratap <ravi@ximian.com>
9999 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10001 2002-09-08 Nick Drochak <ndrochak@gol.com>
10003 * driver.cs: Use an object to get the windows codepage since it's not a
10006 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10008 * statement.cs (For.Emit): for infinite loops (test == null)
10009 return whether there is a break inside, not always "true".
10011 * namespace.cs (UsingEntry): New struct to hold the name of the
10012 using definition, the location where it is defined, and whether it
10013 has been used in a successful type lookup.
10015 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10020 2002-09-06 Ravi Pratap <ravi@ximian.com>
10022 * attribute.cs : Fix incorrect code which relied on catching
10023 a NullReferenceException to detect a null being passed in
10024 where an object was expected.
10026 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10028 * statement.cs (Try): flag the catch variable as assigned
10030 * expression.cs (Cast): Simplified by using ResolveType instead of
10031 manually resolving.
10033 * statement.cs (Catch): Fix bug by using ResolveType.
10035 2002-09-06 Ravi Pratap <ravi@ximian.com>
10037 * expression.cs (BetterConversion): Special case for when we have
10038 a NullLiteral as the argument and we have to choose between string
10039 and object types - we choose string the way csc does.
10041 * attribute.cs (Attribute.Resolve): Catch the
10042 NullReferenceException and report error #182 since the Mono
10043 runtime no more has the bug and having this exception raised means
10044 we tried to select a constructor which takes an object and is
10047 2002-09-05 Ravi Pratap <ravi@ximian.com>
10049 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10050 message (1502, 1503) when we can't locate a method after overload
10051 resolution. This is much more informative and closes the bug
10054 * interface.cs (PopulateMethod): Return if there are no argument
10055 types. Fixes a NullReferenceException bug.
10057 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10058 expressions too. Previously we were checking only in one place for
10059 positional arguments leaving out named arguments.
10061 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10062 type to the enum type is not allowed. Remove code corresponding to
10065 (ConvertNumericExplicit): Allow explicit conversions from
10066 the underlying type to enum type. This precisely follows the spec
10067 and closes a bug filed by Gonzalo.
10069 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10072 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10074 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10076 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10077 it was important that we stored the right value after the
10078 reduction in `converted'.
10080 2002-09-04 Martin Baulig <martin@gnome.org>
10082 * location.cs (Location.SymbolDocument): Use full pathnames for the
10085 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10087 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10088 of the expression resolve mechanism, because that will catch the
10089 SimpleName error failures.
10091 (Conditional): If we can not resolve the
10092 expression, return, do not crash.
10094 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10097 (location): display token name instead of its number.
10099 2002-08-28 Martin Baulig <martin@gnome.org>
10101 * expression.cs (Binary.ResolveOperator): Don't silently return
10102 but return an error if an operator cannot be applied between two
10105 2002-08-28 Martin Baulig <martin@gnome.org>
10107 * class.cs (Constructor.Define): Set the permission attributes
10108 correctly instead of making all constructors public.
10110 2002-08-28 Martin Baulig <martin@gnome.org>
10112 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10113 for private members before reporting a CS0103; if we find anything,
10116 2002-08-28 Martin Baulig <martin@gnome.org>
10118 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10119 to check whether `closure_start_type == closure_invocation_type',
10120 we also need to check whether `m.DeclaringType == closure_invocation_type'
10121 before bypassing the permission checks. We might be accessing
10122 protected/private members from the base class.
10123 (TypeManager.RealMemberLookup): Only set private_ok if private
10124 members were requested via BindingFlags.NonPublic.
10126 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10128 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10129 MethodGroupExpr.IsExplicitImpl if appropriate.
10130 (Invocation.DoResolve): Don't report the CS0120 for explicit
10131 interface implementations.
10133 2002-08-27 Martin Baulig <martin@gnome.org>
10135 * expression.cs (Invocation.DoResolve): If this is a static
10136 method and we don't have an InstanceExpression, we must report
10139 2002-08-25 Martin Baulig <martin@gnome.org>
10141 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10142 `==' between a valuetype and an object.
10144 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10146 * ecore.cs (TypeExpr): Provide a ToString method.
10148 2002-08-24 Martin Baulig <martin@gnome.org>
10150 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10151 now called proggie.dbg and it's a binary file.
10153 2002-08-23 Martin Baulig <martin@gnome.org>
10155 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10157 2002-08-23 Martin Baulig <martin@gnome.org>
10159 * struct.cs (MyStructInfo.ctor): Make this work with empty
10160 structs; it's not allowed to use foreach() on null.
10162 2002-08-23 Martin Baulig <martin@gnome.org>
10164 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10165 writer the full pathname of the generated assembly.
10167 2002-08-23 Martin Baulig <martin@gnome.org>
10169 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10170 A `finally' block never returns or breaks; improved handling of
10173 2002-08-23 Martin Baulig <martin@gnome.org>
10175 * statement.cs (Throw.Resolve): Allow `throw null'.
10177 2002-08-23 Martin Baulig <martin@gnome.org>
10179 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10180 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10181 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10182 MemberLookup would return a wrong event if this is an explicit
10183 interface implementation and the class has an event with the same
10186 2002-08-23 Martin Baulig <martin@gnome.org>
10188 * statement.cs (Block.AddChildVariableNames): New public method.
10189 (Block.AddChildVariableName): Likewise.
10190 (Block.IsVariableNameUsedInChildBlock): Likewise.
10191 (Block.AddVariable): Check whether a variable name has already
10192 been used in a child block.
10194 * cs-parser.jay (declare_local_variables): Mark all variable names
10195 from the current block as being used in a child block in the
10198 2002-08-23 Martin Baulig <martin@gnome.org>
10200 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10201 find the symbol writer.
10203 * driver.cs: csc also allows the arguments to /define being
10204 separated by commas, not only by semicolons.
10206 2002-08-23 Martin Baulig <martin@gnome.org>
10208 * interface.cs (Interface.GetMembers): Added static check for events.
10210 2002-08-15 Martin Baulig <martin@gnome.org>
10212 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10213 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10215 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10216 why the MethodData.EmitDestructor() change was necessary.
10218 2002-08-20 Martin Baulig <martin@gnome.org>
10220 * class.cs (TypeContainer.FindMembers): Added static check for events.
10222 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10224 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10225 use Type.GetEvents(), not Type.FindMembers().
10227 2002-08-20 Martin Baulig <martin@gnome.org>
10229 * decl.cs (MemberCache): Added a special method cache which will
10230 be used for method-only searched. This ensures that a method
10231 search will return a MethodInfo with the correct ReflectedType for
10234 2002-08-20 Martin Baulig <martin@gnome.org>
10236 * decl.cs (DeclSpace.FindMembers): Made this public.
10238 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10240 * delegate.cs: fixed build on windows.
10241 [FIXME: Filed as bug #29150: MCS must report these errors.]
10243 2002-08-19 Ravi Pratap <ravi@ximian.com>
10245 * ecore.cs (StandardConversionExists): Return a false
10246 if we are trying to convert the void type to anything else
10247 since that is not allowed.
10249 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10250 we flag error 70 in the event an event is trying to be accessed
10251 directly from outside the declaring type.
10253 2002-08-20 Martin Baulig <martin@gnome.org>
10255 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10256 MemberCache from typemanager.cs to decl.cs.
10258 2002-08-19 Martin Baulig <martin@gnome.org>
10260 * class.cs (TypeContainer): Implement IMemberContainer.
10261 (TypeContainer.DefineMembers): Create the MemberCache.
10262 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10263 return public members if BindingFlags.Public was given, check
10264 whether members are static.
10266 2002-08-16 Martin Baulig <martin@gnome.org>
10268 * decl.cs (DeclSpace.Define): Splitted this in Define and
10269 DefineMembers. DefineMembers is called first and initializes the
10272 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10273 DefineMembers() on all our DeclSpaces.
10275 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10276 but call DefineMembers() on all nested interfaces. We call their
10277 Define() in our new Define() function.
10279 * interface.cs (Interface): Implement IMemberContainer.
10280 (Interface.Define): Moved all code except the attribute stuf to
10282 (Interface.DefineMembers): Initialize the member cache.
10284 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10285 need this anymore since we can use MemberCache.FindMembers directly.
10287 2002-08-19 Martin Baulig <martin@gnome.org>
10289 * typemanager.cs (MemberCache): When creating the cache for an
10290 interface type, add all inherited members.
10291 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10292 to `out bool used_cache' and documented it.
10293 (TypeManager.MemberLookup): If we already used the cache in the first
10294 iteration, we don't need to do the interfaces check.
10296 2002-08-19 Martin Baulig <martin@gnome.org>
10298 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10299 here from IMemberFinder and don't implement this interface anymore.
10300 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10302 * typemanager.cs (IMemberFinder): This interface is now only used by
10303 classes which actually support the member cache.
10304 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10305 since we only put DeclSpaces into this Hashtable.
10306 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10307 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10309 2002-08-16 Martin Baulig <martin@gnome.org>
10311 * typemanager.cs (ICachingMemberFinder): Removed.
10312 (IMemberFinder.MemberCache): New property.
10313 (TypeManager.FindMembers): Merged this with RealFindMembers().
10314 This function will never be called from TypeManager.MemberLookup()
10315 so we can't use the cache here, just the IMemberFinder.
10316 (TypeManager.MemberLookup_FindMembers): Check whether the
10317 IMemberFinder has a MemberCache and call the cache's FindMembers
10319 (MemberCache): Rewrote larger parts of this yet another time and
10320 cleaned it up a bit.
10322 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10324 * driver.cs (LoadArgs): Support quoting.
10326 (Usage): Show the CSC-like command line arguments.
10328 Improved a few error messages.
10330 2002-08-15 Martin Baulig <martin@gnome.org>
10332 * typemanager.cs (IMemberContainer.Type): New property.
10333 (IMemberContainer.IsInterface): New property.
10335 The following changes are conditional to BROKEN_RUNTIME, which is
10336 defined at the top of the file.
10338 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10339 class'es members, but add all members from TypeHandle.ObjectType
10340 if we're an interface.
10341 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10342 is the current type.
10343 (MemberCache.CacheEntry.Container): Removed this field.
10344 (TypeHandle.GetMembers): Include inherited members.
10346 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10348 * typemanager.cs: fixed compilation and added a comment on a field that
10351 2002-08-15 Martin Baulig <martin@gnome.org>
10353 * class.cs (ConstructorInitializer.Resolve): In the
10354 Expression.MemberLookup call, use the queried_type as
10357 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10358 declared' attribute, it's always true.
10359 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10360 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10361 temporary wrapper for FindMembers which tells MemberLookup whether
10362 members from the base classes are included in the return value.
10363 This will go away soon.
10364 (TypeManager.MemberLookup): Use this temporary hack here; once the
10365 new MemberCache is completed, we don't need to do the DeclaredOnly
10366 looping here anymore since the MemberCache will take care of this.
10367 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10368 (MemberCache): When creating the MemberCache for a class, get
10369 members from the current class and all its base classes.
10370 (MemberCache.CacheEntry.Container): New field. This is a
10371 temporary hack until the Mono runtime is fixed to distinguish
10372 between ReflectedType and DeclaringType. It allows us to use MCS
10373 with both the MS runtime and the unfixed Mono runtime without
10374 problems and without accecting performance.
10375 (MemberCache.SearchMembers): The DeclaredOnly looping from
10376 TypeManager.MemberLookup is now done here.
10378 2002-08-14 Martin Baulig <martin@gnome.org>
10380 * statement.cs (MyStructInfo.MyStructInfo): Don't call
10381 Type.GetFields on dynamic types but get the fields from the
10382 corresponding TypeContainer.
10383 (MyStructInfo.GetStructInfo): Added check for enum types.
10385 * typemanager.cs (MemberList.IsSynchronized): Implemented.
10386 (MemberList.SyncRoot): Implemented.
10387 (TypeManager.FilterWithClosure): No need to check permissions if
10388 closure_start_type == closure_invocation_type, don't crash if
10389 closure_invocation_type is null.
10391 2002-08-13 Martin Baulig <martin@gnome.org>
10393 Rewrote TypeContainer.FindMembers to use a member cache. This
10394 gives us a speed increase of about 35% for the self-hosting MCS
10395 build and of about 15-20% for the class libs (both on GNU/Linux).
10397 * report.cs (Timer): New class to get enhanced profiling. This
10398 whole class is "TIMER" conditional since it remarkably slows down
10401 * class.cs (MemberList): New class. This is an IList wrapper
10402 which we're now using instead of passing MemberInfo[]'s around to
10403 avoid copying this array unnecessarily.
10404 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
10405 (ICachingMemberFinder, IMemberContainer): New interface.
10406 (TypeManager.FilterWithClosure): If `criteria' is null, the name
10407 has already been checked, otherwise use it for the name comparision.
10408 (TypeManager.FindMembers): Renamed to RealMemberFinder and
10409 provided wrapper which tries to use ICachingMemberFinder.FindMembers
10410 if possible. Returns a MemberList, not a MemberInfo [].
10411 (TypeHandle): New class, implements IMemberContainer. We create
10412 one instance of this class per type, it contains a MemberCache
10413 which is used to do the member lookups.
10414 (MemberCache): New class. Each instance of this class contains
10415 all members of a type and a name-based hash table.
10416 (MemberCache.FindMembers): This is our new member lookup
10417 function. First, it looks up all members of the requested name in
10418 the hash table. Then, it walks this list and sorts out all
10419 applicable members and returns them.
10421 2002-08-13 Martin Baulig <martin@gnome.org>
10423 In addition to a nice code cleanup, this gives us a performance
10424 increase of about 1.4% on GNU/Linux - not much, but it's already
10425 half a second for the self-hosting MCS compilation.
10427 * typemanager.cs (IMemberFinder): New interface. It is used by
10428 TypeManager.FindMembers to call FindMembers on a TypeContainer,
10429 Enum, Delegate or Interface.
10430 (TypeManager.finder_to_member_finder): New PtrHashtable.
10431 (TypeManager.finder_to_container): Removed.
10432 (TypeManager.finder_to_delegate): Removed.
10433 (TypeManager.finder_to_interface): Removed.
10434 (TypeManager.finder_to_enum): Removed.
10436 * interface.cs (Interface): Implement IMemberFinder.
10438 * delegate.cs (Delegate): Implement IMemberFinder.
10440 * enum.cs (Enum): Implement IMemberFinder.
10442 * class.cs (TypeContainer): Implement IMemberFinder.
10444 2002-08-12 Martin Baulig <martin@gnome.org>
10446 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
10448 2002-08-12 Martin Baulig <martin@gnome.org>
10450 * ecore.cs (ITypeExpression): New interface for expressions which
10452 (TypeExpression): Renamed to TypeLookupExpression.
10453 (Expression.DoResolve): If we're doing a types-only lookup, the
10454 expression must implement the ITypeExpression interface and we
10455 call DoResolveType() on it.
10456 (SimpleName): Implement the new ITypeExpression interface.
10457 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
10458 hack, the situation that we're only looking up types can't happen
10459 anymore when this method is called. Moved the type lookup code to
10460 DoResolveType() and call it.
10461 (SimpleName.DoResolveType): This ITypeExpression interface method
10462 is now doing the types-only lookup.
10463 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
10464 (ResolveFlags): Added MaskExprClass.
10466 * expression.cs (MemberAccess): Implement the ITypeExpression
10468 (MemberAccess.DoResolve): Added support for a types-only lookup
10469 when we're called via ITypeExpression.DoResolveType().
10470 (ComposedCast): Implement the ITypeExpression interface.
10472 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
10473 Expression.Resolve() with ResolveFlags.Type instead.
10475 2002-08-12 Martin Baulig <martin@gnome.org>
10477 * interface.cs (Interface.Define): Apply attributes.
10479 * attribute.cs (Attribute.ApplyAttributes): Added support for
10480 interface attributes.
10482 2002-08-11 Martin Baulig <martin@gnome.org>
10484 * statement.cs (Block.Emit): Only check the "this" variable if we
10485 do not always throw an exception.
10487 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
10488 whether the property has a set accessor.
10490 2002-08-11 Martin Baulig <martin@gnome.org>
10492 Added control flow analysis support for structs.
10494 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
10495 with control flow analysis turned off.
10496 (IVariable): New interface.
10497 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
10498 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
10499 (FieldExpr.DoResolve): Resolve the instance expression with flow
10500 analysis turned off and do the definite assignment check after the
10501 resolving when we know what the expression will resolve to.
10503 * expression.cs (LocalVariableReference, ParameterReference):
10504 Implement the new IVariable interface, only call the flow analysis
10505 code if ec.DoFlowAnalysis is true.
10506 (This): Added constructor which takes a Block argument. Implement
10507 the new IVariable interface.
10508 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
10509 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
10510 This does the definite assignment checks for struct members.
10512 * class.cs (Constructor.Emit): If this is a non-static `struct'
10513 constructor which doesn't have any initializer, call
10514 Block.AddThisVariable() to tell the flow analysis code that all
10515 struct elements must be initialized before control returns from
10518 * statement.cs (MyStructInfo): New public class.
10519 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
10520 argument to this indexer. If non-zero, check an individual struct
10521 member, not the whole struct.
10522 (FlowBranching.CheckOutParameters): Check struct members.
10523 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
10524 overloaded versions of these methods which take an additional
10525 `int field_idx' argument to check struct members.
10526 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
10527 overloaded versions of these methods which take an additional
10528 `string field_name' argument to check struct member.s
10529 (VariableInfo): Implement the IVariable interface.
10530 (VariableInfo.StructInfo): New public property. Returns the
10531 MyStructInfo instance of the variable if it's a struct or null.
10532 (Block.AddThisVariable): New public method. This is called from
10533 Constructor.Emit() for non-static `struct' constructor which do
10534 not have any initializer. It creates a special variable for the
10535 "this" instance variable which will be checked by the flow
10536 analysis code to ensure that all of the struct's fields are
10537 initialized before control returns from the constructor.
10538 (UsageVector): Added support for struct members. If a
10539 variable/parameter is a struct with N members, we reserve a slot
10540 in the usage vector for each member. A struct is considered fully
10541 initialized if either the struct itself (slot 0) or all its
10542 members are initialized.
10544 2002-08-08 Martin Baulig <martin@gnome.org>
10546 * driver.cs (Driver.MainDriver): Only report an error CS5001
10547 if there were no compilation errors.
10549 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
10550 `UnsafeContext' property to determine whether the parent is in
10551 unsafe context rather than checking the parent's ModFlags:
10552 classes nested in an unsafe class are unsafe as well.
10554 2002-08-08 Martin Baulig <martin@gnome.org>
10556 * statement.cs (UsageVector.MergeChildren): Distinguish between
10557 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
10558 we return. Added test17() and test18() to test-154.cs.
10560 2002-08-08 Martin Baulig <martin@gnome.org>
10562 * typemanager.cs (TypeManager.FilterWithClosure): If we have
10563 Family access, make sure the invoking type isn't a subclass of the
10564 queried type (that'd be a CS1540).
10566 * ecore.cs (Expression.MemberLookup): Added overloaded version of
10567 this method which takes an additional `Type invocation_type'.
10569 * expression.cs (BaseAccess.DoResolve): Use the base type as
10570 invocation and query type.
10571 (MemberAccess.DoResolve): If the lookup failed and we're about to
10572 report a CS0122, try a lookup with the ec.ContainerType - if this
10573 succeeds, we must report a CS1540.
10575 2002-08-08 Martin Baulig <martin@gnome.org>
10577 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
10578 (MethodGroupExpr): Implement the IMemberExpr interface.
10580 * expression (MemberAccess.ResolveMemberAccess): No need to have
10581 any special code for MethodGroupExprs anymore, they're now
10584 2002-08-08 Martin Baulig <martin@gnome.org>
10586 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
10587 Family, FamANDAssem and FamORAssem permissions.
10588 (TypeManager.IsSubclassOrNestedChildOf): New public method.
10590 2002-08-08 Martin Baulig <martin@gnome.org>
10592 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
10593 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
10596 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
10598 * driver.cs: implemented /resource option to embed managed resources.
10600 2002-08-07 Martin Baulig <martin@gnome.org>
10602 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
10603 (FieldBase.HasFieldInitializer): New public property.
10604 (FieldBase.GetInitializerExpression): New public method. Resolves and
10605 returns the field initializer and makes sure it is only resolved once.
10606 (TypeContainer.EmitFieldInitializers): Call
10607 FieldBase.GetInitializerExpression to get the initializer, this ensures
10608 that it isn't resolved multiple times.
10610 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
10611 the resolving process (SimpleName/MemberLookup) that we're currently
10612 emitting a field initializer (which must not access any instance members,
10613 this is an error CS0236).
10615 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
10616 argument, if the `IsFieldInitializer' flag is set, we must report and
10617 error CS0236 and not an error CS0120.
10619 2002-08-07 Martin Baulig <martin@gnome.org>
10621 * ecore.cs (IMemberExpr): New public interface.
10622 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
10623 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
10624 if the expression is an IMemberExpr.
10626 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
10627 to be null, implicitly default to `this' if we're non-static in
10628 this case. Simplified the code a lot by using the new IMemberExpr
10629 interface. Also fixed bug #28176 here.
10631 2002-08-06 Martin Baulig <martin@gnome.org>
10633 * cs-parser.jay (SimpleLookup): Removed. We need to create
10634 ParameterReferences during semantic analysis so that we can do a
10635 type-only search when resolving Cast, TypeOf and SizeOf.
10636 (block): Pass the `current_local_parameters' to the Block's
10639 * class.cs (ConstructorInitializer): Added `Parameters parameters'
10640 argument to the constructor.
10641 (ConstructorInitializer.Resolve): Create a temporary implicit
10642 block with the parameters.
10644 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
10645 references here if we aren't doing a type-only search.
10647 * statement.cs (Block): Added constructor which takes a
10648 `Parameters parameters' argument.
10649 (Block.Parameters): New public property.
10651 * support.cs (InternalParameters.Parameters): Renamed `parameters'
10652 to `Parameters' and made it public readonly.
10654 2002-08-06 Martin Baulig <martin@gnome.org>
10656 * ecore.cs (Expression.Warning): Made this public as well.
10658 * report.cs (Report.Debug): Print the contents of collections.
10660 2002-08-06 Martin Baulig <martin@gnome.org>
10662 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
10663 used to tell Resolve() which kinds of expressions it may return.
10664 (Expression.Resolve): Added overloaded version of this method which
10665 takes a `ResolveFlags flags' argument. This can be used to tell
10666 Resolve() which kinds of expressions it may return. Reports a
10668 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
10669 ResolveFlags.SimpleName.
10670 (Expression.Error118): Added overloaded version of this method which
10671 takes a `ResolveFlags flags' argument. It uses the flags to determine
10672 which kinds of expressions are allowed.
10674 * expression.cs (Argument.ResolveMethodGroup): New public method.
10675 Resolves an argument, but allows a MethodGroup to be returned.
10676 This is used when invoking a delegate.
10678 * TODO: Updated a bit.
10680 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10682 Fixed compilation with csc.
10684 * ecore.cs: Expression.Error made public. Is this correct? Should
10685 Warning be made public too?
10687 * expression.cs: use ea.Location instead of ea.loc.
10688 [FIXME: Filed as bug #28607: MCS must report these errors.]
10690 2002-08-06 Martin Baulig <martin@gnome.org>
10692 * ecore.cs (Expression.loc): Moved the location here instead of
10693 duplicating it in all derived classes.
10694 (Expression.Location): New public property.
10695 (Expression.Error, Expression.Warning): Made them non-static and
10696 removed the location argument.
10697 (Expression.Warning): Added overloaded version which takes an
10698 `int level' argument.
10699 (Expression.Error118): Make this non-static and removed the
10700 expression and location arguments.
10701 (TypeExpr): Added location argument to the constructor.
10703 * expression.cs (StaticCallExpr): Added location argument to
10705 (Indirection, PointerArithmetic): Likewise.
10706 (CheckedExpr, UnCheckedExpr): Likewise.
10707 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
10708 (StringPtr): Likewise.
10711 2002-08-05 Martin Baulig <martin@gnome.org>
10713 * expression.cs (BaseAccess.DoResolve): Actually report errors.
10715 * assign.cs (Assign.DoResolve): Check whether the source
10716 expression is a value or variable.
10718 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
10719 while resolving the corresponding blocks.
10721 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
10722 an error, don't silently return null.
10724 * statement.cs (Block.AddVariable): Do the error reporting here
10725 and distinguish between CS0128 and CS0136.
10726 (Block.DoResolve): Report all unused labels (warning CS0164).
10727 (LabeledStatement): Pass the location to the constructor.
10728 (LabeledStatement.HasBeenReferenced): New property.
10729 (LabeledStatement.Resolve): Set it to true here.
10731 * statement.cs (Return.Emit): Return success even after reporting
10732 a type mismatch error (CS0126 or CS0127), this is what csc does and
10733 it avoids confusing the users with any consecutive errors.
10735 2002-08-05 Martin Baulig <martin@gnome.org>
10737 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
10739 * const.cs (Const.LookupConstantValue): Catch circular definitions.
10741 * expression.cs (MemberAccess.DoResolve): Silently return if an
10742 error has already been reported.
10744 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
10745 error has already been reported.
10747 2002-08-05 Martin Baulig <martin@gnome.org>
10749 * statement.cs (UsageVector): Only initialize the `parameters'
10750 vector if we actually have any "out" parameters.
10752 2002-08-05 Martin Baulig <martin@gnome.org>
10754 * expression.cs (Binary.ResolveOperator): When combining delegates,
10755 they must have the same type.
10757 2002-08-05 Martin Baulig <martin@gnome.org>
10759 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
10760 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
10761 work with the ms runtime and we also don't need it: if we're a
10762 PropertyBuilder and not in the `indexer_arguments' hash, then we
10763 are a property and not an indexer.
10765 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
10766 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
10767 since the latter one doesn't work with the ms runtime.
10769 2002-08-03 Martin Baulig <martin@gnome.org>
10771 Fixed bugs #27998 and #22735.
10773 * class.cs (Method.IsOperator): New public field.
10774 (Method.CheckBase): Report CS0111 if there's already a method
10775 with the same parameters in the current class. Report CS0508 when
10776 attempting to change the return type of an inherited method.
10777 (MethodData.Emit): Report CS0179 if a method doesn't have a body
10778 and it's not marked abstract or extern.
10779 (PropertyBase): New abstract base class for Property and Indexer.
10780 (PropertyBase.CheckBase): Moved here from Property and made it work
10782 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
10783 the same so we can reuse it there.
10784 (Property, Indexer): Derive from PropertyBase.
10785 (MethodSignature.inheritable_property_signature_filter): New delegate
10786 to find properties and indexers.
10788 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
10789 argument and improved error reporting.
10791 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
10792 EmptyReadOnlyParameters and made it a property.
10794 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
10795 version of this method which takes a `PropertyInfo indexer'.
10796 (TypeManager.RegisterIndexer): New method.
10798 * class.cs: Added myself as author of this file :-)
10800 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10802 * class.cs: fixed compilation on windoze.
10804 2002-08-03 Martin Baulig <martin@gnome.org>
10806 * interface.cs (Interface.GetInterfaceBases): Check whether all
10807 base interfaces are at least as accessible than the current one.
10809 * class.cs (TypeContainer.GetClassBases): Check whether base types
10810 are at least as accessible than the current type.
10811 (TypeContainer.AsAccessible): Implemented and made non-static.
10812 (MemberBase.CheckParameters): Report errors if the accessibility
10815 * delegate.cs (Delegate.Delegate): The default visibility is
10816 internal for top-level types and private for nested types.
10817 (Delegate.Define): Report errors if the accessibility checks fail.
10819 * enum.cs (Enum.Enum): The default visibility is internal for
10820 top-level types and private for nested types.
10821 (Enum.DefineType): Compute the correct visibility.
10823 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
10824 function which takes a `bool is_toplevel' instead of a TypeContainer.
10826 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
10829 2002-08-02 Martin Baulig <martin@gnome.org>
10831 * expression.cs (LocalVariableReferenc): Added constructor which
10832 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
10833 (LocalVariableReference.IsReadOnly): New property.
10834 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
10835 variable is readonly, use our own readonly flag to do this; you can
10836 use the new constructor to get a writable reference to a read-only
10839 * cs-parser.jay (foreach_statement, using_statement): Get a writable
10840 reference to the local variable.
10842 2002-08-01 Miguel de Icaza <miguel@ximian.com>
10844 * rootcontext.cs (ResolveCore): Also include System.Exception
10846 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
10847 we reach an EmptyStatement.
10849 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
10852 * expression.cs (Binary.ResolveOperator): Check error result in
10855 use brtrue/brfalse directly and avoid compares to null.
10857 2002-08-02 Martin Baulig <martin@gnome.org>
10859 * class.cs (TypeContainer.Define): Define all nested interfaces here.
10860 Fixes bug #28407, added test-155.cs.
10862 2002-08-01 Martin Baulig <martin@gnome.org>
10864 * class.cs (Event.EmitDefaultMethod): Make this work with static
10865 events. Fixes #28311, added verify-3.cs.
10867 2002-08-01 Martin Baulig <martin@gnome.org>
10869 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
10870 `is_disposable' fields.
10871 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
10872 `hm.is_disposable' if we're using the collection pattern.
10873 (Foreach.EmitCollectionForeach): Use the correct type for the
10874 enumerator's local variable, only emit the try/finally block if
10875 necessary (fixes #27713).
10877 2002-08-01 Martin Baulig <martin@gnome.org>
10879 * ecore.cs (Expression.report118): Renamed to Error118 and made
10882 * statement.cs (Throw.Resolve): Check whether the expression is of
10883 the correct type (CS0118) and whether the type derives from
10884 System.Exception (CS0155).
10885 (Catch.Resolve): New method. Do the type lookup here and check
10886 whether it derives from System.Exception (CS0155).
10887 (Catch.CatchType, Catch.IsGeneral): New public properties.
10889 * typemanager.cs (TypeManager.exception_type): Added.
10891 2002-07-31 Miguel de Icaza <miguel@ximian.com>
10893 * driver.cs: Updated About function.
10895 2002-07-31 Martin Baulig <martin@gnome.org>
10897 Implemented Control Flow Analysis.
10899 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
10900 (EmitContext.CurrentBranching): Added.
10901 (EmitContext.StartFlowBranching): Added.
10902 (EmitContext.EndFlowBranching): Added.
10903 (EmitContext.KillFlowBranching): Added.
10904 (EmitContext.IsVariableAssigned): Added.
10905 (EmitContext.SetVariableAssigned): Added.
10906 (EmitContext.IsParameterAssigned): Added.
10907 (EmitContext.SetParameterAssigned): Added.
10908 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
10909 Added control flow analysis stuff here.
10911 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
10912 resolve the expression as lvalue.
10913 (LocalVariableReference.DoResolve): Check whether the variable has
10914 already been assigned.
10915 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
10916 the parameter as assigned here.
10917 (ParameterReference.DoResolve): Check whether the parameter has already
10919 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
10920 expression as lvalue.
10922 * statement.cs (FlowBranching): New class for the flow analysis code.
10923 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
10924 (LabeledStatement.IsDefined): New public property.
10925 (LabeledStatement.AddUsageVector): New public method to tell flow
10926 analyis that the label may be reached via a forward jump.
10927 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
10929 (VariableInfo.Number): New public field. This is used by flow analysis
10930 to number all locals of a block.
10931 (Block.CountVariables): New public property. This is the number of
10932 local variables in this block (including the locals from all parent
10934 (Block.EmitMeta): Number all the variables.
10936 * statement.cs: Added flow analysis support to all classes.
10938 2002-07-31 Martin Baulig <martin@gnome.org>
10940 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
10941 To get debugging messages, compile mcs with /define:MCS_DEBUG and
10942 then use this argument.
10944 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
10946 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
10947 use this to specify /define options.
10949 2002-07-29 Martin Baulig <martin@gnome.org>
10951 * statement.cs (Fixed): Moved all code that does variable lookups
10952 and resolvings from Emit to Resolve.
10954 * statement.cs (For): Moved all code that does variable lookups
10955 and resolvings from Emit to Resolve.
10957 * statement.cs (Using): Moved all code that does variable lookups
10958 and resolvings from Emit to Resolve.
10960 2002-07-29 Martin Baulig <martin@gnome.org>
10962 * attribute.cs (Attribute.Resolve): Explicitly catch a
10963 System.NullReferenceException when creating the
10964 CustromAttributeBuilder and report a different warning message.
10966 2002-07-29 Martin Baulig <martin@gnome.org>
10968 * support.cs (ParameterData.ParameterName): Added method to
10969 get the name of a parameter.
10971 * typemanager.cs (TypeManager.IsValueType): New public method.
10973 2002-07-29 Martin Baulig <martin@gnome.org>
10975 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
10976 is a flag which specifies that it's either ref or out.
10977 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
10978 the out parameter to `out Parameter.Modifier mod', also set the
10979 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
10981 * support.cs (InternalParameters.ParameterModifier): Distinguish
10982 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
10983 Parameter.Modifier.ISBYREF flag if it's either ref or out.
10985 * expression.cs (Argument.GetParameterModifier): Distinguish
10986 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
10987 Parameter.Modifier.ISBYREF flag if it's either ref or out.
10989 2002-07-29 Martin Baulig <martin@gnome.org>
10991 * expression.cs (ParameterReference.ParameterReference): Added
10992 `Location loc' argument to the constructor.
10994 * cs-parser.jay: Pass location to ParameterReference.
10996 2002-07-28 Miguel de Icaza <miguel@ximian.com>
10998 * statement.cs (Try): Initialize the location.
11000 * cs-parser.jay: pass location to Try.
11002 * expression.cs (Unary.Reduce): Change the prototype to return
11003 whether a constant fold could be performed or not. The result is
11004 returned in an out parameters. In the case of Indirection and
11005 AddressOf, we want to perform the full tests.
11007 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11009 * statement.cs (Statement.Emit): Flag dead code.
11011 2002-07-27 Andrew Birkett <andy@nobugs.org>
11013 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11015 2002-07-27 Martin Baulig <martin@gnome.org>
11017 * class.cs (MethodData.Define): Put back call to
11018 TypeManager.AddMethod(), accidentally commented this out.
11020 * report.cs (Debug): New public method to print debugging information,
11021 this is `[Conditional ("DEBUG")]'.
11023 2002-07-26 Martin Baulig <martin@gnome.org>
11025 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11026 (switch_statement): Push the current_block to the switch_stack and
11027 pop it again when we're done with the switch.
11028 (switch_section): The new block is a child of the current_block.
11029 Fixes bug #24007, added test-152.cs.
11031 2002-07-27 Martin Baulig <martin@gnome.org>
11033 * expression.cs (Invocation.EmitArguments): When calling a varargs
11034 function with only its fixed arguments, we need to pass an empty
11037 2002-07-27 Martin Baulig <martin@gnome.org>
11039 Mono 0.13 has been released.
11041 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11043 * driver.cs: Rename --resource to --linkres, because that is what
11044 we do currently, we dont support --resource yet.
11046 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11048 2002-07-25 Martin Baulig <martin@gnome.org>
11050 * class.cs (MethodData): New public class. This is a `method builder'
11051 class for a method or one accessor of a Property/Indexer/Event.
11052 (MethodData.GetMethodFlags): Moved here from MemberBase.
11053 (MethodData.ApplyAttributes): Likewise.
11054 (MethodData.ApplyObsoleteAttribute): Likewise.
11055 (MethodData.ApplyConditionalAttribute): Likewise.
11056 (MethodData.ApplyDllImportAttribute): Likewise.
11057 (MethodData.CheckAbstractAndExternal): Likewise.
11058 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11059 (MethodData.Emit): Formerly known as Method.Emit().
11060 (MemberBase): Moved everything which was specific to a single
11061 accessor/method to MethodData.
11062 (Method): Create a new MethodData and call Define() and Emit() on it.
11063 (Property, Indexer, Event): Create a new MethodData objects for each
11064 accessor and call Define() and Emit() on them.
11066 2002-07-25 Martin Baulig <martin@gnome.org>
11068 Made MethodCore derive from MemberBase to reuse the code from there.
11069 MemberBase now also checks for attributes.
11071 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11072 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11074 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11075 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11076 (MemberBase.ApplyAttributes): New virtual method; applies the
11077 attributes to a method or accessor.
11078 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11079 (MemberBase.ApplyConditionalAttribute): Likewise.
11080 (MemberBase.ApplyDllImportAttribute): Likewise.
11081 (MemberBase.CheckAbstractAndExternal): Likewise.
11082 (MethodCore.ParameterTypes): This is now a property instead of a
11083 method, it's initialized from DoDefineParameters().
11084 (MethodCore.ParameterInfo): Removed the set accessor.
11085 (MethodCore.DoDefineParameters): New protected virtual method to
11086 initialize ParameterTypes and ParameterInfo.
11087 (Method.GetReturnType): We can now simply return the MemberType.
11088 (Method.GetMethodFlags): Override the MemberBase version and add
11089 the conditional flags.
11090 (Method.CheckBase): Moved some code from Define() here, call
11091 DoDefineParameters() here.
11092 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11093 here to avoid some larger code duplication.
11094 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11095 ensure that abstract and external accessors don't declare a body.
11097 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11098 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11099 lookup in the attribute's parent classes, so we need to abort as soon
11100 as we found the first match.
11101 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11102 the attribute has no arguments.
11104 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11107 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11109 * cs-parser.jay: reverted previous patch.
11111 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11113 * cs-parser.jay: fixed bug #22119.
11115 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11117 * attribute.cs: fixed compilation. The error was:
11118 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11119 be assigned to before control leaves the current method."
11120 [FIXME: Filed as bug #28186: MCS must report this error.]
11122 2002-07-25 Martin Baulig <martin@gnome.org>
11124 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11125 method to pull the condition name ouf of a Conditional attribute.
11126 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11127 the obsolete message and error flag out of an Obsolete attribute.
11129 * class.cs (Method.GetMethodFlags): New public method to get the
11130 TypeManager.MethodFlags for this method.
11131 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11133 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11134 if we're overriding a virtual function, set the new private variable
11135 `parent_method'; call the new TypeManager.AddMethod().
11137 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11138 the MethodBuilder and the Method in a PtrHashtable.
11139 (TypeManager.builder_to_method): Added for this purpose.
11140 (TypeManager.MethodFlags): Added IsObsoleteError.
11141 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11142 Obsolete and Conditional arguments in MethodBuilders. If we discover
11143 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11144 the message from the attribute.
11146 2002-07-24 Martin Baulig <martin@gnome.org>
11148 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11149 preprocessor directives, ensure that the argument to #define/#undef is
11150 exactly one identifier and that it's actually an identifier.
11152 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11155 2002-07-24 Martin Baulig <martin@gnome.org>
11157 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11158 initialize it to TypeManager.object_type in the constructor.
11159 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11160 of the `hm.get_current' method if we're using the collection pattern.
11161 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11162 for the explicit conversion to make it work when we're using the collection
11163 pattern and the `Current' property has a different return type than `object'.
11166 2002-07-24 Martin Baulig <martin@gnome.org>
11168 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11169 does not match, but don't report any errors. This method is called in
11170 order for all methods in a MethodGroupExpr until a matching method is
11171 found, so we don't want to bail out if the first method doesn't match.
11172 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11173 matches, report the 123. Fixes #28070.
11175 2002-07-24 Martin Baulig <martin@gnome.org>
11177 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11178 TypeManager.TypeToCoreType() to the top of the method so the
11179 following equality checks will work. Fixes #28107.
11181 2002-07-24 Martin Baulig <martin@gnome.org>
11183 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11184 operand is of type uint, and the other operand is of type sbyte,
11185 short or int, the operands are converted to type long." -
11186 Actually do what this comment already told us. Fixes bug #28106,
11189 2002-07-24 Martin Baulig <martin@gnome.org>
11191 * class.cs (MethodBase): New abstract class. This is now a base
11192 class for Property, Indexer and Event to avoid some code duplication
11193 in their Define() and DefineMethods() methods.
11194 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11195 generic methods for Define() and DefineMethods().
11196 (FieldBase): Derive from MemberBase, not MemberCore.
11197 (Property): Derive from MemberBase, not MemberCore.
11198 (Property.DefineMethod): Moved all the code from this method to the
11199 new MethodBase.DefineAccessor(), just call it with appropriate
11201 (Property.Define): Call the new Property.DoDefine(), this does some
11202 sanity checks and we don't need to duplicate the code everywhere.
11203 (Event): Derive from MemberBase, not MemberCore.
11204 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11205 accessors, this will also make them work with interface events.
11206 (Indexer): Derive from MemberBase, not MemberCore.
11207 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11208 (Indexer.Define): Use the new MethodBase functions.
11210 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11211 argument to the constructor.
11212 (Interface.FindMembers): Added support for interface events.
11213 (Interface.PopluateEvent): Implemented.
11215 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11217 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11219 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11220 but this is required to check for a method name being the same as
11221 the containing class.
11225 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11227 * interface.cs: initialize variable.
11229 2002-07-23 Martin Baulig <martin@gnome.org>
11231 Implemented the IndexerName attribute in interfaces.
11233 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11234 name if this is an explicit interface implementation.
11235 (Indexer.InterfaceIndexerName): New public variable. If we're
11236 implementing an interface indexer, this is the IndexerName in that
11237 interface. Otherwise, it's the IndexerName.
11238 (Indexer.DefineMethod): If we're implementing interface indexer,
11239 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11240 and Pending.ImplementIndexer methods.
11241 (Indexer.Define): Also define the PropertyBuilder if we're
11242 implementing an interface indexer and this is neither an explicit
11243 interface implementation nor do the IndexerName match the one in
11246 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11247 If a method is defined here, then we always need to create a proxy
11248 for it. This is used when implementing interface indexers.
11249 (Pending.IsInterfaceIndexer): New public method.
11250 (Pending.ImplementIndexer): New public method.
11251 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11252 This is used when implementing interface indexers to define a proxy
11254 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11255 define a proxy if necessary.
11257 * interface.cs (Interface.IndexerName): New public variable.
11258 (Interface.PopulateIndexer): Set the IndexerName.
11259 (Interface.DefineIndexers): New private method. Populate all the
11260 indexers and make sure their IndexerNames match.
11262 * typemanager.cs (IndexerPropertyName): Added support for interface
11265 2002-07-22 Martin Baulig <martin@gnome.org>
11267 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11268 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11269 ret if HasReturnLabel.
11270 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11273 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11274 and set the ec.LoopBeginTryCatchLevel.
11275 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11276 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11277 the current ec.TryCatchLevel, the branch goes out of an exception
11278 block. In this case, we need to use Leave and not Br.
11280 2002-07-22 Martin Baulig <martin@gnome.org>
11282 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11283 block unless the block does not always return or it is contained in
11284 another try { ... } catch { ... } block. Fixes bug #26506.
11285 Added verify-1.cs to the test suite.
11287 2002-07-22 Martin Baulig <martin@gnome.org>
11289 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11290 then we do not always return. Fixes bug #24985.
11292 2002-07-22 Martin Baulig <martin@gnome.org>
11294 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11295 lookup on a per-class level; ie. walk up the class hierarchy until we
11296 found at least one applicable method, then choose the best among them.
11297 Fixes bug #24463 and test-29.cs.
11299 2002-07-22 Martin Baulig <martin@gnome.org>
11301 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11302 return types of the methods. The return type is not part of the
11303 signature and we must not check it to make the `new' modifier work.
11304 Fixes bug #27999, also added test-147.cs.
11305 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11307 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11308 on the method's return type.
11310 2002-07-21 Martin Baulig <martin@gnome.org>
11312 * assign.cs: Make this work if the rightmost source is a constant and
11313 we need to do an implicit type conversion. Also adding a few more tests
11314 to test-38.cs which should have caught this.
11316 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11317 target in the makefile for this. The makefile.gnu is primarily intended
11318 for end-users who don't want to debug the compiler.
11320 2002-07-21 Martin Baulig <martin@gnome.org>
11322 * assign.cs: Improved the Assign class so it can now handle embedded
11323 assignments (X = Y = Z = something). As a side-effect this'll now also
11324 consume less local variables. test-38.cs now passes with MCS, added
11325 a few new test cases to that test.
11327 2002-07-20 Martin Baulig <martin@gnome.org>
11329 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11330 instructions. Fixes bug #27977, also added test-146.cs.
11332 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11334 * cs-tokenizer.cs: fixed getHex ().
11336 2002-07-19 Martin Baulig <martin@gnome.org>
11338 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11339 not Type.GetType() to lookup the array type. This is needed when
11340 we're constructing an array of a user-defined type.
11341 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11342 single-dimensional arrays, but also for single-dimensial arrays of
11345 2002-07-19 Martin Baulig <martin@gnome.org>
11347 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11348 this function is called, it's not allowed to share LocalBuilders
11349 among ILGenerators.
11351 2002-07-19 Martin Baulig <martin@gnome.org>
11353 * expression.cs (Argument.Resolve): Report an error 118 when trying
11354 to pass a type as argument.
11356 2002-07-18 Martin Baulig <martin@gnome.org>
11358 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11359 Conv_R_Un for the signed `long' type.
11361 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11363 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11364 `expr' for the temporary result, as that will fail if we do
11365 multiple resolves on the same expression.
11367 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11369 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
11370 ec.TypeContainer for looking up aliases.
11372 * class.cs (TypeContainer): Remove LookupAlias from here.
11374 * decl.cs (DeclSpace); Move here.
11376 2002-07-01 Miguel de Icaza <miguel@ximian.com>
11378 * class.cs (FindMembers): Only call filter if the constructor
11379 bulider is not null.
11381 Also handle delegates in `NestedTypes' now. Now we will perform
11382 type lookups using the standard resolution process. This also
11385 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
11386 This uses Expressions (the limited kind that can be parsed by the
11387 tree) instead of strings.
11389 * expression.cs (ComposedCast.ToString): Implement, used to flag
11390 errors since now we have to render expressions.
11392 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
11395 * ecore.cs (SimpleName.ToString): ditto.
11397 * cs-parser.jay: Instead of using strings to assemble types, use
11398 Expressions to assemble the type (using SimpleName, ComposedCast,
11399 MemberAccess). This should fix the type lookups in declarations,
11400 because we were using a different code path for this.
11402 * statement.cs (Block.Resolve): Continue processing statements
11403 even when there is an error.
11405 2002-07-17 Miguel de Icaza <miguel@ximian.com>
11407 * class.cs (Event.Define): Also remove the `remove' method from
11408 the list of pending items.
11410 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
11411 generate more compact code.
11413 2002-07-17 Martin Baulig <martin@gnome.org>
11415 * const.cs (Const.LookupConstantValue): Add support for constant
11416 `unchecked' and `checked' expressions.
11417 Also adding test case test-140.cs for this.
11419 2002-07-17 Martin Baulig <martin@gnome.org>
11421 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
11422 check whether mi.ReturnType implements the IEnumerator interface; the
11423 `==' and the IsAssignableFrom() will fail in this situation.
11425 2002-07-16 Ravi Pratap <ravi@ximian.com>
11427 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
11430 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11432 * expression.cs: fixed bug #27811.
11434 2002-07-14 Miguel de Icaza <miguel@ximian.com>
11436 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
11437 Molaro: when we are a ref, the value already contains a pointer
11438 value, do not take the address of it.
11440 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
11441 * removed mb-parser.jay and mb-tokenizer.cs
11443 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11445 * expression.cs: check against the building corlib void type.
11447 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
11449 * ecore.cs: fix for valuetype static readonly fields: when
11450 initializing them, we need their address, not the address of a copy.
11452 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
11454 * typemanager.cs: register also enum_type in corlib.
11456 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11458 * class.cs: allow calling this (but not base) initializers in structs.
11460 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
11462 * ecore.cs: make sure we compare against the building base types
11465 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
11467 * typemanager.cs: fix TypeToCoreType() to handle void and object
11468 (corlib gets no more typerefs after this change).
11470 2002-07-12 Miguel de Icaza <miguel@ximian.com>
11472 * expression.cs (ArrayCreation.EmitArrayArguments): use
11473 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
11475 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
11476 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
11477 array indexes, the runtime actually forbids them.
11479 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
11480 for array arguments here.
11482 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
11483 instead of the default for ValueTypes.
11485 (New.DoEmit): Use IsValueType instead of
11486 IsSubclassOf (value_type)
11487 (New.DoResolve): ditto.
11488 (Invocation.EmitCall): ditto.
11490 * assign.cs (Assign): ditto.
11492 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
11493 Statements *are* currently doing part of their resolution during
11496 Expressions do always resolve during resolve, but statements are
11497 only required to propagate resolution to their children.
11499 2002-07-11 Miguel de Icaza <miguel@ximian.com>
11501 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
11503 (LoadAssembly): Do not add the dll if it is already specified
11505 (MainDriver): Add the System directory to the link path at the end,
11506 after all the other -L arguments.
11508 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
11509 wrong opcode for loading bytes and bools (ldelem.i1 instead of
11510 ldelem.u1) and using the opposite for sbytes.
11512 This fixes Digger, and we can finally run it.
11514 * driver.cs (UnixParseOption): Move the option parsing here.
11515 (CSCParseOption): Implement CSC-like parsing of options.
11517 We now support both modes of operation, the old Unix way, and the
11518 new CSC-like way. This should help those who wanted to make cross
11519 platform makefiles.
11521 The only thing broken is that /r:, /reference: and /lib: are not
11522 implemented, because I want to make those have the same semantics
11523 as the CSC compiler has, and kill once and for all the confussion
11524 around this. Will be doing this tomorrow.
11526 * statement.cs (Unsafe.Resolve): The state is checked during
11527 resolve, not emit, so we have to set the flags for IsUnsfe here.
11529 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11531 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
11532 not catch the Error_ObjectRefRequired in SimpleName (as it is
11533 possible to have a class/instance variable name that later gets
11534 deambiguated), we have to check this here.
11536 2002-07-10 Ravi Pratap <ravi@ximian.com>
11538 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
11539 make static and put into Expression.
11541 (Event.Define): Register the private field of the event with the
11542 TypeManager so that GetFieldFromEvent can get at it.
11544 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
11545 keep track of the private field associated with an event which
11548 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
11551 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
11553 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11555 * expression.cs (Binary.EmitBranchable): this routine emits the
11556 Binary expression in a branchable context. This basically means:
11557 we need to branch somewhere, not just get the value on the stack.
11559 This works together with Statement.EmitBoolExpression.
11561 * statement.cs (Statement.EmitBoolExpression): Use
11564 2002-07-09 Miguel de Icaza <miguel@ximian.com>
11566 * statement.cs (For): Reduce the number of jumps in loops.
11568 (For): Implement loop inversion for the For statement.
11570 (Break): We can be breaking out of a Try/Catch controlled section
11571 (foreach might have an implicit try/catch clause), so we need to
11572 use Leave instead of Br.
11574 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
11575 now). If the instace expression supports IMemoryLocation, we use
11576 the AddressOf method from the IMemoryLocation to extract the
11577 address instead of emitting the instance.
11579 This showed up with `This', as we were emitting the instance
11580 always (Emit) instead of the Address of This. Particularly
11581 interesting when This is a value type, as we dont want the Emit
11582 effect (which was to load the object).
11584 2002-07-08 Miguel de Icaza <miguel@ximian.com>
11586 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
11588 * statement.cs (Checked): Set the CheckedState during the resolve
11589 process too, as the ConvCast operations track the checked state on
11590 the resolve process, and not emit.
11592 * cs-parser.jay (namespace_member_declaration): Flag that we have
11593 found a declaration when we do. This is used to flag error 1529
11595 * driver.cs: Report ok when we display the help only.
11597 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
11599 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
11601 2002-07-04 Miguel de Icaza <miguel@ximian.com>
11603 * cs-tokenizer.cs (define): We also have to track locally the
11604 defines. AllDefines is just used for the Conditional Attribute,
11605 but we also need the local defines for the current source code.
11607 2002-07-03 Miguel de Icaza <miguel@ximian.com>
11609 * statement.cs (While, For, Do): These loops can exit through a
11610 Break statement, use this information to tell whether the
11611 statement is the last piece of code.
11613 (Break): Flag that we break.
11615 * codegen.cs (EmitContexts): New `Breaks' state variable.
11617 2002-07-03 Martin Baulig <martin@gnome.org>
11619 * class.cs (TypeContainer.MethodModifiersValid): Allow override
11620 modifiers in method declarations in structs. Otherwise, you won't
11621 be able to override things like Object.Equals().
11623 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11625 * class.cs (Method, Property, Indexer): Do not allow the public
11626 modifier to be used in explicit interface implementations.
11628 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
11629 override modifiers in method declarations in structs
11631 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
11633 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
11634 integer or real overflow, report an error
11636 2002-07-02 Martin Baulig <martin@gnome.org>
11638 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
11639 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
11640 to tell the runtime about our newly created System.Object and
11641 System.ValueType types.
11643 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11645 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
11646 struct instead of Ldarg/Starg.
11648 2002-07-02 Martin Baulig <martin@gnome.org>
11650 * expression.cs (Indirection.Indirection): Call
11651 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
11653 2002-07-02 Martin Baulig <martin@gnome.org>
11655 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
11656 ValueType, call TypeManager.TypeToCoreType() on it.
11657 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
11658 the OpCodes.Newarr argument.
11660 2002-07-02 Martin Baulig <martin@gnome.org>
11662 * expression.cs (Invocation.EmitCall): When compiling corlib,
11663 replace all calls to the system's System.Array type to calls to
11664 the newly created one.
11666 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
11667 System.Array methods.
11668 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
11669 from the system's System.Array type which must be replaced.
11671 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
11673 * typemanager.cs: load unverifiable_code_ctor so we can build
11674 corlib using the correct type. Avoid using GetTypeCode() with
11676 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
11677 TypeManager.object_type to allow building corlib.
11679 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
11681 * ecore.cs: handle System.Enum separately in LoadFromPtr().
11683 2002-07-01 Martin Baulig <martin@gnome.org>
11685 * class.cs: Make the last change actually work, we need to check
11686 whether `ifaces != null' to avoid a crash.
11688 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11690 * class.cs: when we build structs without fields that implement
11691 interfaces, we need to add the interfaces separately, since there is
11692 no API to both set the size and add the interfaces at type creation
11695 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11697 * expression.cs: the dimension arguments to the array constructors
11698 need to be converted if they are a long.
11700 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
11702 * class.cs: don't emit ldarg.0 if there is no parent constructor
11703 (fixes showstopper for corlib).
11705 2002-06-29 Martin Baulig <martin@gnome.org>
11707 MCS now compiles corlib on GNU/Linux :-)
11709 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
11710 ie. check for MethodImplOptions.InternalCall.
11712 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
11713 and TypeManager.attribute_type are null, so we must explicitly check
11714 whether parent is not null to find out whether it's an attribute type.
11715 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
11716 and SetBuilder, not only if the property is neither abstract nor external.
11717 This is necessary to set the MethodImplOptions on the accessor methods.
11718 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
11719 SetBuilder, see Property.Emit().
11721 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
11722 populate "System.Object", "System.ValueType" and "System.Attribute" since
11723 they've already been populated from BootCorlib_PopulateCoreTypes().
11725 2002-06-29 Martin Baulig <martin@gnome.org>
11727 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
11728 is the NullLiteral, we also need to make sure that target_type is not
11731 2002-06-29 Martin Baulig <martin@gnome.org>
11733 * rootcontext.cs (RootContext.ResolveCore): We must initialize
11734 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
11735 before calling BootstrapCorlib_ResolveDelegate ().
11737 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11739 * statement.cs: fixed build-breaker. All tests passed ok.
11741 2002-06-27 Martin Baulig <martin@gnome.org>
11743 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
11744 for System.Decimal when compiling corlib.
11746 2002-06-27 Martin Baulig <martin@gnome.org>
11748 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
11749 switch blocks which contain nothing but a default clause.
11751 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
11753 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
11755 2002-06-27 Martin Baulig <martin@gnome.org>
11757 * ecore.cs (PropertyExpr.PropertyExpr): Call
11758 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
11760 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
11761 is already a TypeBuilder.
11763 2002-06-27 Martin Baulig <martin@gnome.org>
11765 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
11766 `target_type == TypeManager.array_type', not IsAssignableFrom() in
11767 the "from an array-type to System.Array" case. This makes it work
11768 when compiling corlib.
11770 2002-06-27 Martin Baulig <martin@gnome.org>
11772 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
11773 non-static PropertyExpr, set its InstanceExpression. This makes
11774 the `ICollection.Count' property work in System/Array.cs.
11776 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
11778 * driver.cs: Made error handling more consistent. Errors now
11779 tracked by Report class, so many methods which used to return int
11780 now return void. Main() now prints success/failure and
11781 errors/warnings message.
11783 Renamed '--probe' compiler argument to '--expect-error'. Removed
11784 the magic number return values (123 and 124). Now, if the
11785 expected error occurs, the compiler exits with success (exit value
11786 0). If the compilation completes without seeing that particular
11787 error, the compiler exits with failure (exit value 1). The
11788 makefile in mcs/errors has been changed to handle the new behaviour.
11790 * report.cs: Made 'expected error' number a property and renamed
11791 it from 'Probe' to 'ExpectedError'.
11793 * genericparser.cs: Removed error handling support, since it is
11794 now all done by Report class.
11796 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
11797 class, so parse() no longer returns an int.
11799 * namespace.cs: Use Report.Error instead of GenericParser.error
11801 2002-06-22 Miguel de Icaza <miguel@ximian.com>
11803 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
11804 TypeContainer.AddOperator): At the front of the list put the
11805 explicit implementations, so they get resolved/defined first.
11807 2002-06-21 Miguel de Icaza <miguel@ximian.com>
11809 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
11810 interface type is implemented by this TypeContainer. Used during
11811 explicit interface implementation.
11813 (Property.Define, Indexer.Define, Method.Define): Validate that
11814 the given interface in the explicit implementation is one of the
11815 base classes for the containing type.
11817 Also if we are explicitly implementing an interface, but there is
11818 no match in the pending implementation table, report an error.
11820 (Property.Define): Only define the property if we are
11821 not explicitly implementing a property from an interface. Use the
11822 correct name also for those properties (the same CSC uses,
11823 although that is really not needed).
11825 (Property.Emit): Do not emit attributes for explicitly implemented
11826 properties, as there is no TypeBuilder.
11828 (Indexer.Emit): ditto.
11830 Hiding then means that we do not really *implement* a pending
11831 implementation, which makes code fail.
11833 2002-06-22 Martin Baulig <martin@gnome.org>
11835 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
11836 the return value of Object.GetType(). [FIXME: we need to do this whenever
11837 we get a type back from the reflection library].
11839 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
11841 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
11843 2002-06-20 Miguel de Icaza <miguel@ximian.com>
11845 * attribute.cs: Return null if we can not look up the type.
11847 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
11848 the interface types found.
11850 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
11851 interface types found.
11853 * typemanager.cs (GetInterfaces): Make this routine returns alll
11854 the interfaces and work around the lame differences between
11855 System.Type and System.Reflection.Emit.TypeBuilder in the results
11856 result for GetInterfaces.
11858 (ExpandInterfaces): Given an array of interface types, expand and
11859 eliminate repeated ocurrences of an interface. This expands in
11860 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
11863 2002-06-21 Martin Baulig <martin@gnome.org>
11865 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
11868 2002-06-21 Martin Baulig <martin@gnome.org>
11870 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
11871 and called with one of the core types, return the corresponding typebuilder for
11874 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
11877 2002-06-21 Martin Baulig <martin@gnome.org>
11879 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
11880 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
11881 (Expression.ConvertReferenceExplicit): Likewise.
11883 * expression.cs (ElementAccess.DoResolve): Likewise.
11884 (ElementAccess.DoResolveLValue): Likewise.
11886 2002-06-10 Martin Baulig <martin@gnome.org>
11888 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
11889 add the "value" parameter to the parameter list.
11891 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
11894 2002-06-19 Miguel de Icaza <miguel@ximian.com>
11896 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
11897 the argument to an int, uint, long or ulong, per the spec. Also
11898 catch negative constants in array creation.
11900 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
11902 * class.cs: do not allow the same interface to appear twice in
11903 the definition list.
11905 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
11907 * ecore.cs: don't use ldlen with System.Array.
11909 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
11911 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
11913 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
11915 * modifiers.cs: produce correct field attributes for protected
11916 internal. Easy fix so miguel can work on ther harder stuff:-)
11918 2002-06-18 Miguel de Icaza <miguel@ximian.com>
11920 * pending.cs: New file. Move the code from class.cs here.
11921 Support clearning the pending flag for all methods (when not doing
11922 explicit interface implementation).
11924 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
11926 * rootcontext.cs: added a couple more types needed to bootstrap.
11928 2002-06-17 Miguel de Icaza <miguel@ximian.com>
11930 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
11931 constructor in the type, instead of any constructor in the type
11932 hierarchy. Thanks to Paolo for finding this bug (it showed up as
11933 a bug in the Mono runtime when applying the params attribute).
11935 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
11936 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
11938 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
11940 * expression.cs (Unary.ResolveOperator): Use TypeManager
11941 to resolve the type.
11943 2002-06-13 Ravi Pratap <ravi@ximian.com>
11945 * cs-parser.jay (enum_member_declaration): Pass in the attributes
11948 * enum.cs (AddEnumMember): Add support to store the attributes associated
11949 with each member too.
11951 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
11952 field builders too - this takes care of the enum member case.
11954 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
11956 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
11957 address-of operator on both value types and pointers.
11959 2002-06-10 Martin Baulig <martin@gnome.org>
11961 * interface.cs (Interface.PopulateIndexer): Add the indexer's
11962 PropertyBuilder to the `property_builders' list.
11964 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
11965 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
11966 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
11967 find any indexers which are inherited from an interface.
11969 2002-06-09 Martin Baulig <martin@gnome.org>
11971 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
11972 the same type as the constant if necessary. There's also a test-130.cs
11975 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
11977 * typemanager.cs (TypeManager.ChangeType): Previously known as
11978 Enum.ChangeEnumType().
11980 2002-06-09 Martin Baulig <martin@gnome.org>
11982 * expression.cs (Cast.TryReduce): Added support for consts.
11984 2002-06-08 Ravi Pratap <ravi@ximian.com>
11986 * class.cs (Accessor): Hold attributes information so we can pass
11989 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
11990 Modify to pass in attributes attached to the methods.
11992 (add_accessor_declaration, remove_accessor_declaration): Ditto.
11994 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
11995 to handle the Accessor kind :-)
11997 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
11999 2002-06-08 Martin Baulig <martin@gnome.org>
12001 * expression.cs (Unary.TryReduceNegative): Added support for
12004 2002-06-08 Martin Baulig <martin@gnome.org>
12006 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12007 name can't be found in the `defined_names' - the caller will do a
12008 MemberLookup in this case and thus find methods in System.Enum
12009 such as Enum.IsDefined().
12011 2002-06-08 Martin Baulig <martin@gnome.org>
12013 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12014 Convert.ChangeType() which works with TypeBuilder created types.
12015 (Enum.LookupEnumValue, Enum.Define): Use it here.
12017 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12018 `TypeBuilder.BaseType != null' check.
12019 (TypeContainer.FindMembers): Only lookup parent members if we
12020 actually have a parent.
12021 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12022 (ConstructorInitializer.Resolve): Likewise.
12024 * interface.cs (Interface.FindMembers): Added
12025 `TypeBuilder.BaseType != null' check.
12027 * rootcontext.cs (RootContext.ResolveCore): Added
12028 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12029 classes_second_stage.
12031 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12032 debug_type and trace_type when compiling with --nostdlib.
12034 2002-06-07 Martin Baulig <martin@gnome.org>
12036 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12037 (AddField): Set it to true when adding a non-static field.
12038 (DefineType): Use `have_nonstatic_fields' to find out whether we
12039 have non-static fields, not `Fields != null'.
12041 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12043 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12044 dereferencing a null on the static-field code path)
12046 2002-05-30 Martin Baulig <martin@gnome.org>
12048 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12049 to take command line arguments. Use reflection to call the new
12050 custom `Initialize' function on the symbol writer and pass it the
12051 command line arguments.
12053 * driver.cs (--debug-args): New command line argument to pass command
12054 line arguments to the symbol writer.
12056 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12058 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12059 the target type for indexers and properties. Thanks to Joe for
12062 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12064 * typemanager.cs (MethodFlags): returns the method flags
12065 (Obsolete/ShouldIgnore) that control warning emission and whether
12066 the invocation should be made, or ignored.
12068 * expression.cs (Invocation.Emit): Remove previous hack, we should
12069 not do this on matching a base type, we should do this based on an attribute
12071 Only emit calls to System.Diagnostics.Debug and
12072 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12073 on the command line.
12075 * rootcontext.cs: Global settings for tracing and debugging.
12077 * cs-tokenizer.cs (define): New utility function to track
12078 defines. Set the global settings for TRACE and DEBUG if found.
12080 2002-05-25 Ravi Pratap <ravi@ximian.com>
12082 * interface.cs (Populate*): Pass in the TypeContainer as well as
12083 the DeclSpace as parameters so that we can create EmitContexts and
12084 then use that to apply attributes etc.
12086 (PopulateMethod, PopulateEvent, PopulateProperty)
12087 (PopulateIndexer): Apply attributes everywhere.
12089 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12092 (ApplyAttributes): Update accordingly.
12094 We now apply interface attributes for all members too.
12096 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12098 * class.cs (Indexer.Define); Correctly check if we are explicit
12099 implementation (instead of checking the Name for a ".", we
12100 directly look up if the InterfaceType was specified).
12102 Delay the creation of the PropertyBuilder.
12104 Only create the PropertyBuilder if we are not an explicit
12105 interface implementation. This means that explicit interface
12106 implementation members do not participate in regular function
12107 lookups, and hence fixes another major ambiguity problem in
12108 overload resolution (that was the visible effect).
12110 (DefineMethod): Return whether we are doing an interface
12113 * typemanager.cs: Temporary hack until we get attributes in
12114 interfaces (Ravi is working on that) and we get IndexerName
12115 support in interfaces.
12117 * interface.cs: Register the indexers as properties.
12119 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12120 warning, I have verified that this is a bug in the .NET runtime
12121 (JavaScript suffers of the same problem).
12123 * typemanager.cs (MemberLookup): When looking up members for
12124 interfaces, the parent of an interface is the implicit
12125 System.Object (so we succeed in searches of Object methods in an
12126 interface method invocation. Example: IEnumerable x; x.ToString
12129 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12131 * class.cs (Event): Events should also register if they do
12132 implement the methods that an interface requires.
12134 * typemanager.cs (MemberLookup); use the new GetInterfaces
12137 (GetInterfaces): The code used to lookup interfaces for a type is
12138 used in more than one place, factor it here.
12140 * driver.cs: Track the errors at the bottom of the file, we kept
12143 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12144 instance if the method we are calling is static!
12146 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12148 * attribute.cs (ApplyAttributes): Make this function filter out
12149 the IndexerName attribute (as that attribute in reality is never
12150 applied) and return the string constant for the IndexerName
12153 * class.cs (TypeContainer.Emit): Validate that all the indexers
12154 have the same IndexerName attribute, and if so, set the
12155 DefaultName attribute on the class.
12157 * typemanager.cs: The return value might contain other stuff (not
12158 only methods). For instance, consider a method with an "Item"
12159 property and an Item method.
12161 * class.cs: If there is a problem with the parameter types,
12164 2002-05-24 Ravi Pratap <ravi@ximian.com>
12166 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12167 looks at user defined conversion after making a call to
12168 StandardConversionExists - we need this for overload resolution.
12170 * expression.cs : Update accordingly the various method calls.
12172 This fixes 2 bugs filed against implicit user defined conversions
12174 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12176 * statement.cs: Track the result of the assignment.
12178 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12180 * expression.cs (MemberAccess): Improved error reporting for
12181 inaccessible members.
12183 2002-05-22 Martin Baulig <martin@gnome.org>
12185 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12186 itself with debugging support.
12188 2002-05-22 Martin Baulig <martin@gnome.org>
12190 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12191 Removed, this isn't needed anymore.
12193 2002-05-20 Martin Baulig <martin@gnome.org>
12195 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12196 be underlying type for an enum.
12198 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12200 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12201 that splits out the loading of just the core types.
12203 * rootcontext.cs (ResolveCore): Split the struct resolution in
12204 two, so we can load the enumeration underlying types before any
12207 * expression.cs (Is): Bandaid until we fix properly Switch (see
12208 bug #24985 for details).
12210 * typemanager.cs (ImplementsInterface): The hashtable will contain
12211 a null if there are no interfaces implemented.
12213 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12215 * cs-parser.jay (indexer_declarator): It is fine to have array
12218 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12220 * typemanager.cs: (RegisterBuilder): New function used to register
12221 TypeBuilders that implement interfaces. Since
12222 TypeBuilder.GetInterfaces (as usual) does not work with lame
12224 (AddUserType): register interfaces.
12226 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12227 dealing with TypeBuilder. Also, arrays are showing up as
12228 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12229 methods can not be invoked on them!
12231 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12232 (ImplicitReferenceConversionExists): Split out from
12233 StandardConversionExists.
12235 * expression.cs (As): We were only implementing one of the three
12236 cases for the as operator. We now implement them all.
12237 (Is): Implement the various other cases for Is as well.
12239 * typemanager.cs (CACHE): New define used to control if we want or
12240 not the FindMembers cache. Seems to have a negative impact on
12241 performance currently
12243 (MemberLookup): Nested types have full acess to
12244 enclosing type members
12246 Remove code that coped with instance/static returns for events, we
12247 now catch this in RealFindMembers.
12249 (RealFindMembers): only perform static lookup if the instance
12250 lookup did not return a type or an event.
12252 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12254 * assign.cs (CompoundAssign): We pass more semantic information
12255 now to Compound Assignments than we did before: now we have all
12256 the information at hand, and now we resolve the target *before* we
12257 do the expression expansion, which allows the "CacheValue" method
12258 to have the effect we intended (before, a [x] += 1 would generate
12259 two differen ArrayAccess expressions from the ElementAccess,
12260 during the resolution process).
12262 (CompoundAssign.DoResolve): Resolve target and original_source here.
12264 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12266 * expression.cs (ArrayAccess): dropped debugging information.
12268 * typemanager.cs: Small bug fix: I was always returning i_members,
12269 instead of one of i_members or s_members (depending on which had
12272 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12273 method is invoked before any code generation takes place, and it
12274 is a mechanism to inform that the expression will be invoked more
12275 than once, and that the method should use temporary values to
12276 avoid having side effects
12278 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12280 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12283 * expression.cs (Indirection, ArrayAccess): Add support for
12284 CacheTemporaries in these two bad boys.
12286 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12287 ldobj or ldind_ref.
12288 (StoreFromPtr): Handle stobj as well.
12290 * expression.cs (UnaryMutator): Share more code.
12292 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12293 down: I was not tracking the Filter function as well, which
12294 was affecting the results of the cache.
12296 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12298 * attribute.cs: Remove the hack to handle the CharSet property on
12301 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12303 * attribute.cs (DoResolve): More uglyness, we now only try to
12304 resolve the attribute partially, to extract the CharSet
12305 information (only if we are a StructLayout attribute). Otherwise
12307 (GetExtraTypeInfo): Add some code to conditionally kill in the
12308 future this. I am more and more convinced that the .NET
12309 framework has special code to handle the attribute setting on
12312 * expression.cs (IsParamsMethodApplicable): Revert my previous
12313 foreach change here, it was wrong.
12315 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12317 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12318 (pp_expr): do not abort on unknown input, just return.
12319 (eval): abort if there are pending chars.
12321 * attribute.cs (Attribute.Resolve): Positional parameters are
12322 optional. Deal with that case.
12324 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12325 the Ansi/Unicode/Auto information for the type.
12327 (TypeContainer.DefineType): instantiate the EmitContext here, as
12328 we will be using it during the type definition (to resolve
12329 attributes) and during the emit phase.
12331 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12332 to pull type information out of the attributes
12334 (Attribute.Resolve): track the constructor builder, and allow for
12335 multiple invocations (structs and classes will use this).
12337 * ecore.cs (MemberLookupFinal): new version with all the
12338 parameters customizable.
12340 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12341 constructors. Return if the result value is null (as the error
12342 would have been flagged already by MemberLookupFinal)
12344 Do not allow instances of abstract classes or interfaces to be
12347 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12348 We have to compare the assembly property here when dealing with
12349 FamANDAssem and Assembly access modifiers, because we might be
12350 creating an assembly from *modules* (that means that we are not
12351 getting TypeBuilders for types defined in other modules that are
12352 part of this assembly).
12354 (Method.Emit): If the method is marked abstract and has a body,
12357 (TypeContainer.DefineMembers): If both the defined member and the
12358 parent name match are methods, then do not emit any warnings: let
12359 the Method.Define routine take care of flagging warnings. But if
12360 there is a mismatch (method overrides something else, or method is
12361 overriwritten by something, then emit warning).
12363 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12364 set to null, this means `do not check for the return type on the
12367 (Method.Define): set the return type for the method signature to
12368 null, so that we get methods with the same name and parameters and
12369 different return types. This is used to flag warning 114 (you are
12370 hiding a method, and you probably want to use the new/override
12373 * typemanager.cs (MemberLookup): Implemented proper access
12374 control, closing a long standing set of bug reports. The problem
12375 was that the Framework only has two bits: Public and NonPublic,
12376 and NonPublic includes private and protected methods, but we need
12377 to enforce the FamANDAssem, FamOrAssem and Family.
12379 2002-05-11 Miguel de Icaza <miguel@ximian.com>
12381 * statement.cs (GotoCase): Return true: Ammounts to giving up
12382 knowledge on whether we return or not, and letting the other case
12383 be responsible for it.
12385 2002-05-10 Miguel de Icaza <miguel@ximian.com>
12387 * driver.cs: Do not load directories for each file processed, only
12388 do it if there is a pattern.
12390 * ecore.cs: Report readonly assigns here as well, as we might have
12391 been resolved only by MemberAccess.
12393 (SimpleName.SimpleNameResolve): Also be useful for LValue
12394 resolution. We need this to propagate assign to local readonly variables
12396 * typemanager.cs: Use a ptrhashtable for the criteria, because we
12397 do not want to reuse potential criteria memory.
12399 * class.cs (MyEventBuilder): Set reflected_type;
12401 * ecore.cs (Constantify): Added support for constifying bools.
12403 (RootContext.LookupType): Added a cache for values looked up in
12404 the declaration space.
12406 * typemanager.cs (FindMembers): Now is a front-end to
12407 RealFindMembers, and provides a two-level hashtable-based cache to
12410 15% performance improvement: from 22.5 to 19.2 seconds.
12412 * expression.cs (IsParamsMethodApplicable): use foreach.
12413 (Invocation.DoResolve): ditto.
12414 (New.DoResolve): ditto.
12415 (ArrayCreation.DoResolve): ditto.
12417 * ecore.cs (FindMostEncompassingType): use foreach.
12419 * delegate.cs (NewDelegate.DoResolve): Use foreach
12421 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
12422 (RemoveMethods): use foreach.
12424 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
12425 nested foreach statements instead of for, and also break out of
12426 the inner loop once a match is found.
12428 (Invocation.OverloadResolve): Use foreach, simplify the code.
12430 2002-05-08 Miguel de Icaza <miguel@ximian.com>
12432 * cfold.cs (BinaryFold): During an enumeration evaluation context,
12433 we actually unwrap the expression to allow for extra information
12436 * expression.cs: Use Shr_Un on unsigned operations.
12438 2002-05-08 Ravi Pratap <ravi@ximian.com>
12440 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
12441 applicable operators was not being considered correctly. This closes
12442 the bug Miguel reported.
12444 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
12446 * attribute.cs: check that the type derives from System.Attribute
12447 and report the correct error in that case (moved the duplicate code to
12448 its own method, too).
12450 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
12452 * attribute.cs: lookup attribute type name as the spec says: first the
12453 bare attribute name and then name + "Attribute" (nant compiles with
12454 mcs after this fix).
12456 2002-05-07 Miguel de Icaza <miguel@ximian.com>
12458 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
12459 Because of the way we parse things, we should try to see if a
12460 UIntConstant can fit in an integer.
12462 2002-05-07 Ravi Pratap <ravi@ximian.com>
12464 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
12465 when we are in an explicit context.
12467 (ConvertReferenceExplicit): When converting from Iface type S to Class
12468 T make sure the rules are implemented as an OR.
12470 * parameter.cs (ParameterType): Make it a property for now although the
12471 purpose really isn't anything immediate.
12473 * expression.cs (Is*Applicable): Do better checking on the parameter type
12474 of a ref/out parameter. The ones from the system assemblies are already
12475 marked with the correct type so we don't need to do any correction.
12477 * ecore.cs (StandardConversionExists): Conversion from Interface types to
12478 the object type is standard too so include that.
12480 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12482 * ecore.cs (StandardConversionExists): Augment with missing code:
12483 deal with IntConstant, LongConstants and Enumerations.
12485 * assign.cs: Report the error, instead of failing silently
12487 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
12488 typecontainer that they are declared, because the
12489 typecontainer/namespace will have the list of using clauses that
12490 need to be applied.
12492 Assembly Attributes were escaping the normal registration
12495 (EmitCode): Apply attributes within an EmitContext that represents
12496 the container they were declared on.
12498 * cs-parser.jay: Track bases for structs. How did I get this wrong?
12500 2002-05-06 Ravi Pratap <ravi@ximian.com>
12502 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
12503 Revamp completely - make much cleaner as we now operate only
12506 (FindMostSpecificSource, FindMostSpecificTarget): New methods
12507 to implement the logic detailed in the spec more correctly.
12509 (UserDefinedConversion): Update accordingly.
12511 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12513 * statement.cs: Return flow analysis information up.
12515 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
12518 (token): Do not consume an extra character before calling
12521 2002-05-06 Piers Haken <piersh@friskit.com>
12523 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
12525 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12527 * class.cs (Constructor.Emit): Set the IsStatic flag in the
12528 EmitContext during the instance constructor initializer
12529 resolution, to stop access to instance variables.
12531 This is mandated by the spec, last paragraph of the `constructor
12532 initializers' section.
12534 2002-05-05 Miguel de Icaza <miguel@ximian.com>
12536 * cs-parser.jay, class.cs (Accessor): new class used to represent
12537 an accessor (get or set). In the past we used `null' to represent
12538 a missing accessor. But this is ambiguous because there was no
12539 way to tell in abstract indexers/properties if one of them was
12542 Now there is a way of addressing that.
12544 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
12545 instead of FindMembers.
12547 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
12548 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
12550 * attribute.cs: Treat indexers and properties as the same in terms
12551 of applying attributes
12553 * ecore.cs (FindMostEncompassedType): Use statically initialized
12554 EmptyExpressions()s like we do elsewhere to avoid creating useless
12555 objects (and we take this out of the tight loop).
12557 (GetConversionOperators): Move the code to extract the actual
12558 operators to a separate routine to clean things up.
12560 2002-05-04 Miguel de Icaza <miguel@ximian.com>
12562 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
12563 events are always registered FieldBuilders.
12565 * class.cs (FieldBase): New class shared by Fields
12567 * delegate.cs: If we are a toplevel delegate, use our full name.
12568 If we are a nested delegate, then only use our tail name.
12570 2002-05-02 Ravi Pratap <ravi@ximian.com>
12572 * expression.cs (IsApplicable): Ensure that we add the "&" to
12573 ref/out types before comparing it with the type of the argument.
12575 (IsParamsMethodApplicable): Ditto.
12577 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
12580 * delegate.cs : Handle the case when we have more than one applicable
12581 method. Flag an error only when we finish checking all.
12583 2002-05-02 Miguel de Icaza <miguel@ximian.com>
12585 * expression.cs: Add support for boolean static initializers.
12587 2002-05-01 Miguel de Icaza <miguel@ximian.com>
12589 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
12591 * parameter.cs (ComputeParameterTypes,
12592 ComputeAndDefineParameterTypes): Better error handling: now we
12593 clear the `types' cache if we fail during any of the type lookups.
12594 We also return the status code correctly to our caller
12596 * delegate.cs: If we fail to define a delegate, abort the extra
12599 * expression.cs (Binary.ResolveOperator): for
12600 operator==(object,object) and operator !=(object, object) we also
12601 have to verify that there is an implicit conversion from one to
12604 (ArrayAccess.DoResolve): Array Access can operate on
12607 2002-04-30 Miguel de Icaza <miguel@ximian.com>
12609 * assign.cs (CompoundAssign): A new class used as a "flag" that
12610 the assignment actually is happening as part of a compound
12611 assignment operator.
12613 During compound assignment, a few new rules exist to enable things
12620 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
12621 to the type of x) if y is implicitly convertible to the type of x,
12622 and the operator is a builtin operator and the return type of the
12623 operator is explicitly convertible to the type of x.
12625 * rootcontext.cs: Reset warning level to 2. 4 catches various
12626 "interesting" features in mcs, we must clean this up at some
12627 point, but currently am trying to kill other bugs ;-)
12629 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
12630 in container classes as well.
12632 * expression.cs (Binary.ResolveOperator): Handle string case
12633 before anything else (as operator overloading does emit an error
12634 before doing anything else).
12636 This code could go away when we move to a table driven model, but
12637 i could not come up with a good plan last night.
12639 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
12641 * typemanager.cs (CSharpName): reimplementation using regex.
12642 * class.cs: added null check for fields in Emit
12643 * rootcontext.cs: set warninglevel to 4
12645 2002-04-29 Miguel de Icaza <miguel@ximian.com>
12647 * typemanager.cs (CSharpName): reimplemented with Lupus
12650 2002-04-28 Miguel de Icaza <miguel@ximian.com>
12652 * statement.cs (If): correclty implement Resolve, because we were
12653 not catching sem errors in there. The same process is needed
12655 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
12658 (Statement.Warning_DeadCodeFound): Factorize code.
12659 (While): Report dead code here too.
12661 (Statement): Added Resolve virtual method to allow
12662 for resolution split from the emit code.
12664 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12666 * statement.cs (EmitBoolExpression): No longer try to resolve the
12668 (MakeBoolean): New utility function that resolve, implicitly
12669 converts to boolean and tags the expression.
12672 (If, Do): Implement dead code elimination.
12673 (While): Implement loop inversion
12675 (Do, While, For, If): Resolve the expression prior to calling our
12678 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
12681 - added method Report28 (warning: program has more than one entry point)
12682 - added method IsEntryPoint, implements paragraph 10.1 of the spec
12683 - modified method Method.Define, the part at the end of the method
12685 * rootcontext.cs: added static public Location EntryPointLocation;
12687 * ../errors/cs0028.cs : Add test case for the above warning.
12690 - modified method CSharpName to allow arrays of primitive type to
12691 be printed nicely (e.g. instead of System.Int32[][] it now prints
12693 - added method CSharpSignature: returns the signature of a method
12694 in string format to be used in reporting errors, warnings, etc.
12696 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
12699 2002-04-26 Ravi Pratap <ravi@ximian.com>
12701 * delegate.cs (Define): Fix extremely silly bug where I was
12702 setting the type of the 'object' parameter of the BeginInvoke
12703 method to System.IAsyncResult instead of System.Object ;-)
12705 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12707 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
12710 (Constructor.Emit): return if we fail to initialize the
12711 constructor. Another door closed!
12713 * expression.cs (New.DoResolve): Improve error message (from -6 to
12714 1501). Use DeclaredOnly lookup to find the exact constructor.
12716 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
12717 loop. This is useful.
12719 * cs-parser.jay: Adjust the default parameters so that destructors
12720 have the proper signature.
12722 2002-04-26 Martin Baulig <martin@gnome.org>
12724 * driver.cs (LoadAssembly): If `assembly' contains any characters
12725 which are only valid in path names and not in assembly names
12726 (currently slash, backslash and point), use Assembly.LoadFrom ()
12727 instead of Assembly.Load () on the `assembly' (before iteration
12728 over the link_paths).
12730 2002-04-26 Martin Baulig <martin@gnome.org>
12732 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
12734 2002-04-25 Miguel de Icaza <miguel@ximian.com>
12736 * class.cs (Property): use the new typemanager.MemberLookup
12738 (TypeContainer.MemberLookup): Implement using the
12739 TypeManager.MemberLookup now.
12741 * typemanager.cs: Make MemberLookup a function of the TypeManager,
12742 and return MemberInfos, so that these can be used without an
12743 EmitContext (what we had before).
12745 2002-04-24 Miguel de Icaza <miguel@ximian.com>
12747 * expression.cs: Fix the case where the argument to params if the
12748 type of the params. I omitted handling this before. Fixed
12750 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12752 * driver.cs: Call BootCorlib_PopulateCoreType
12754 * class.cs (Property.CheckBase): Check for properties only, not
12757 * interface.cs: Temporary hack: try/catch around the
12758 CustomAttributeBuilder, because I am getting an exception that I
12761 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
12762 types whose definitions are required to be there (attributes are
12763 defined before standard types).
12765 Compute definitions as we boot the various types, as they are used
12766 immediately (value_type class will need object_type, but if we do
12767 not initialize object_type, we will pass a null, which will let
12768 the runtime pick the System.Object from the existing corlib, which
12769 is not what we want).
12771 2002-04-22 Patrik Torstensson <totte@labs2.com>
12773 * cs-tokenizer.cs: fixed a number of trim() issues.
12775 2002-04-22 Ravi Pratap <ravi@ximian.com>
12777 * expression.cs (Argument.Type): Ensure that we return the correct
12778 type when we have out or ref parameters [in which case we
12781 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12783 * class.cs (Property, Indexer): Allow extern modifier in there.
12785 * typemanager.cs (InitBaseTypes): Initializes object_type and
12786 value_type, since those will be used early on during the bootstrap
12787 process to compile corlib.
12789 (InitCoreTypes): Move code from here to InitBaseTypes.
12791 2002-04-21 Miguel de Icaza <miguel@ximian.com>
12793 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
12794 single-dimension arrays as using the ldlen opcode.
12796 Daniel Lewis discovered this optimization.
12798 * typemanager.cs: Add signature for System.Array::get_Length
12800 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12802 * statement.cs: report the error when the foreach does not apply to an
12803 array nor a collection.
12805 2002-04-19 Miguel de Icaza <miguel@ximian.com>
12807 * expression.cs: Add implicit conversions to the operator ~.
12809 * constant.cs (DecimalConstant.Emit): Emit decimal value.
12811 * typemanager.cs: Locate the decimal constructor.
12813 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12815 * attribute.cs: use the new property of TypeOf.
12816 * expression.cs: added 'get' property around typearg.
12818 These changes fix a build breaker reported by NickD. Is this the
12819 correct way to fix? If not, please, revert my changes and make it
12822 2002-04-17 Miguel de Icaza <miguel@ximian.com>
12824 * attribute.cs: Add support for typeof in attribute invocations.
12825 I am not sure that this is right though.
12827 2002-04-14 Duncan Mak <duncan@ximian.com>
12829 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
12830 Binary.Operator.Division case.
12832 2002-04-13 Ravi Pratap <ravi@ximian.com>
12834 * class.cs (DefineType): Ensure that we do a proper check on
12835 attribute types and also register it with the TypeManager.
12837 (TypeContainer.Targets): The default for attribute types is
12838 AttributeTargets.All.
12840 * attribute.cs (ApplyAttributes): Registering the attribute type
12841 is done elsewhere, not when we discover we have a Usage attribute.
12843 2002-04-12 Ravi Pratap <ravi@ximian.com>
12845 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
12846 and get rid of is_delegate parameter.
12848 * everywhere : update.
12850 2002-04-12 Ravi Pratap <ravi@ximian.com>
12852 * cs-parser.jay (compilation_unit): Revamp completely to use
12853 some new ideas that I got from Rhys' grammar to solve the problems
12854 with assembly level attributes.
12856 (outer_declaration): New grammar production.
12858 (attribute_sections): Add.
12860 (opt_attributes): Base on attribute_sections
12862 (namespace_declaration): Allow opt_attributes to tackle the case
12863 when we have assembly level attributes - we are clever in this
12866 * attribute.cs (ApplyAttributes): Do not worry about assembly
12867 attributes in the non-global context.
12869 * rootcontext.cs (AddGlobalAttributes): Go back to using this
12870 instead of SetGlobalAttributes.
12872 * class.cs, rootcontext.cs : Ensure we define and generate
12873 attribute types before anything else.
12875 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
12876 and flag the new error -20 for the case when the attribute type
12877 does not have valid targets specified. csc does not catch this.
12879 * ../errors/errors.txt : update for error # -20
12881 2002-04-11 Ravi Pratap <ravi@ximian.com>
12883 * support.cs (InternalParameters.ParameterModifier): Do some null
12884 checking and return sane values.
12886 * class.cs (Method.Define): If we are a PInvoke method, ensure
12887 that we are static and extern. Report error # 601
12889 * ../errors/cs0601.cs : Add test case for the above error.
12891 2002-04-07 Ravi Pratap <ravi@ximian.com>
12893 * rootcontext.cs (attribute_types): We need to keep type of
12894 all attribute types separately and emit code for them first.
12896 (RegisterAttribute) : Implement.
12898 * class.cs (DefineType): Check if the current Type is a custom
12899 attribute type and register it accordingly.
12901 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
12902 adding the first attribute twice and rename to
12904 (SetGlobalAttributes): this.
12906 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
12909 * attribute.cs (ApplyAttributes): Take an additional argument telling us
12910 if we are processing global arguments. Hmm, I am unsure of this.
12912 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12914 * expression.cs: added static array of strings to avoid calling
12915 Enum.ToString () for Operator in Binary. Significant recover of
12918 2002-04-10 Miguel de Icaza <miguel@ximian.com>
12920 * class.cs (FindMembers): Allow the Builders of the various
12921 members to be null. If they are skip them. This only happens
12922 during the PInvoke declaration.
12924 2002-04-09 Miguel de Icaza <miguel@ximian.com>
12926 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
12927 failure, so we do not keep going afterwards.
12929 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
12930 wanted to pass `false' as the `is_delegate' argument. If this is
12931 the case, why not use delegate_type == null to mean `is_delegate =
12932 false' and anything else as is_delegate = true.
12934 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
12936 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
12937 code for the section, not the beginning of the tests.
12939 2002-04-08 Miguel de Icaza <miguel@ximian.com>
12941 * cfold.cs: Handle operator + (Enum x, Underlying x)
12943 * expression.cs (Binary): same. Warn about errors where we have
12944 Enum/Enum in operator + as well.
12946 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
12949 - added support for switch(bool)
12950 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
12951 - add TableSwitchEmit() to handle table-based switch statements
12953 2002-04-05 Ravi Pratap <ravi@ximian.com>
12955 * expression.cs (Invocation.OverloadResolve): Factor out code which
12956 does parameter compatibility checking with arguments so that we can
12957 re-use the code even from Delegate.VerifyApplicability
12959 (VerifyArgumentsCompat): Move above code here.
12961 * delegate.cs (VerifyApplicability): Get rid of duplicate code
12962 and instead make a call to the above method.
12964 2002-03-31 Ravi Pratap <ravi@ximian.com>
12966 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
12967 We use it to keep track of classes which are attribute types.
12969 2002-04-02 Miguel de Icaza <miguel@ximian.com>
12971 * delegate.cs (Delegate.Define): Correctly define the types in the
12972 presence of fixed and array parameters.
12974 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
12977 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
12978 include NonPublic after the first iteration.
12980 * class.cs (Indexer.CheckBase): Only check if both parents are
12983 * cs-parser.jay (accessor_body): If empty, set to null.
12985 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
12986 same code path here to resolve constants names that we did have in
12987 MemberAccess.DoResolve. There is too much code duplicated here.
12989 2002-04-01 Miguel de Icaza <miguel@ximian.com>
12991 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
12993 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
12996 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
12997 tokens, numbers and strings.
12999 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13002 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13003 asyncronous parameters and the regular parameters.
13005 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13006 specify the target directory.
13008 * expression.cs: (This.DoResolve): Simplify
13009 (As.Emit): Optimize, do not generate IsInst if the expression is
13010 always of the given type.
13012 (Is.DoResolve): Bug fix, we were reporting both always/never for
13015 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13016 creating too many unnecessary arrays.
13018 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13020 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13021 fields instead of rolling our own initializer. Takes care of all
13022 implicit conversions, and drops unnecessary static checks/argument.
13024 2002-03-31 Dick Porter <dick@ximian.com>
13026 * driver.cs: use the GetDirectories() return values properly, and
13027 use "/" as path separator.
13029 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13031 * expression.cs (Unary): Optimize - - expr into expr.
13032 (Binary): Optimize a + (-b) into a -b.
13034 * codegen.cs (CodeGen): Made all methods static.
13036 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13040 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13041 TypeBuilder property.
13043 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13046 * tree.cs: Removed the various RecordXXXX, and replaced with a
13047 single RecordDecl. Removed all the accessor methods, and just
13048 left a single access point Type
13050 * enum.cs: Rename DefineEnum to DefineType.
13052 * decl.cs: New abstract method `DefineType' used to unify the
13053 Defines for Enumerations, Interfaces, TypeContainers and
13056 (FindType): Moved LookupInterfaceOrClass here. Moved the
13057 LookupBaseClasses method that used to live in class.cs and
13058 interface.cs here, and renamed to FindType.
13060 * delegate.cs: Implement DefineType. Take advantage of the
13061 refactored pattern for locating the parent builder without taking
13062 the parent_builder argument (which we know does not work if we are
13063 nested, and triggering a toplevel definition).
13065 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13067 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13068 accessibility of a member has changed during override and report
13071 * class.cs (Method.Define, Property.Define): Only complain on
13072 overrides if the method is private, any other accessibility is
13073 fine (and since we just checked the permission is the same, we are
13076 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13077 and elif are processed always. The other pre-processing
13078 directives are only processed if we are "taking" the path
13080 2002-03-29 Martin Baulig <martin@gnome.org>
13082 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13083 current location is not Null.
13085 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13086 a separate method so we can profile it.
13088 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13089 `span.Seconds' are just seconds, but no minutes or hours.
13090 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13092 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13094 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13095 Remove the gratuitous set of Final:
13097 // If an interface implementation, then we can set Final.
13098 if (((flags & MethodAttributes.Abstract) == 0) &&
13099 implementing.DeclaringType.IsInterface)
13100 flags |= MethodAttributes.Final;
13102 I do not know what I was smoking when I used that.
13105 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13106 step into fixing the name resolution issues for delegates and
13107 unifying the toplevel name resolution.
13109 2002-03-28 Martin Baulig <martin@gnome.org>
13111 * class.cs (Method.Emit): If we have a symbol writer, call its
13112 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13113 tell it about the current method.
13115 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13116 writer that we're going to emit the first byte of IL code for a new
13117 statement (a new source line).
13118 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13119 EmitContext.Mark() before emitting any code.
13121 * location.cs (SymbolDocument): Return null when we're Null.
13123 * statement.cs (Statement): Moved the `Location loc' variable here.
13124 (Statement.EmitBoolExpression): If we have a symbol writer, call
13125 ec.Mark() before emitting any code to tell it that we're at the
13126 beginning of a new statement.
13127 (StatementExpression): Added `Location' argument to the constructor.
13128 (Block): Added public readonly variable `StartLocation' and public
13129 variable `EndLocation'. The latter is to be set using SetEndLocation().
13130 (Block): Added constructor which takes a start and end location.
13131 (Block.SetEndLocation): New method. This sets the end location.
13132 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13133 local variables we create.
13134 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13135 each statement and do also mark the begin and end of the block.
13137 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13138 tell it the current lexer.Location, use Location.Null for the end of the
13140 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13141 current block, set its end location using SetEndLocation().
13142 (statement_expression): StatementExpression constructor now takes the
13143 lexer.Location as additional argument.
13144 (for_statement, declare_local_variables): Likewise.
13145 (declare_local_variables): When creating a new implicit block, use the
13146 new Block constructor and pass it the lexer.Location.
13148 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13150 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13151 members also on the parent interfaces recursively.
13153 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13155 * report.cs: Use new formats, since Gonzalo finished the missing
13158 * expression.cs (Binary.ResolveOperator): added missing operator|
13159 operator& and operator^ for bool/bool.
13161 * cs-parser.jay: CheckDef now takes a Location argument that is
13162 used to report errors more precisly (instead of reporting the end
13163 of a definition, we try to track something which is a lot closer
13164 to the source of the problem).
13166 * cs-tokenizer.cs: Track global token use, so we can properly flag
13167 the use of #define/#undef after the first token has been seen.
13169 Also, rename the reportXXXX to Error_DescriptiveName
13171 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13172 TypeContainer, so that Enum and Interface can use this too.
13174 * class.cs (TypeContainer.LookupInterfaceOrClass,
13175 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13176 `builder' argument. Typically this was used to pass the parent
13177 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13180 The problem is that a nested class could trigger the definition of
13181 a toplevel class, and the builder would be obviously wrong in that
13184 So we drop this argument, and we compute dynamically the
13185 TypeBuilder/ModuleBuilder (the correct information was available
13186 to us anyways from DeclSpace.Parent)
13188 * interface.cs (Interface.DefineInterface): Drop builder
13189 parameter cleanup like class.cs
13191 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13194 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13197 (Try.Emit): Propagate the returns value from the statement.
13199 (Return.Emit): Even if we are leavning
13201 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13203 * modifiers.cs: Fix the computation of MethodAttributes flags.
13205 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13207 * driver.cs: allow compilation of files that start with '/'.
13208 Add a default case when checking the argument of --target.
13210 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13212 * interface.cs: Implement the same search algorithm for types in
13213 the interface code.
13215 * delegate.cs: Do not allow multiple definition.
13217 * Recovered ChangeLog that got accidentally amputated
13219 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13221 * rootcontext.cs: Load manually enum to allow core classes to
13222 contain enumerations.
13224 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13225 Update to new static methods in TypeManager.
13227 * typemanager.cs (GetMethod, GetConstructor): Use our
13228 implementation of FindMembers to find the members, since during
13229 corlib compilation, the types are TypeBuilders and GetMethod and
13230 GetConstructor do not work.
13232 Make all methods in TypeManager static.
13234 (InitCodeHelpers): Split the functionality from
13235 the InitCodeTypes function.
13237 * driver.cs: Call InitCodeHelpers after we have populated the
13240 * cs-parser.jay (delegate_declaration): we did not used to compute
13241 the delegate name correctly for void delegates.
13243 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13245 * rootcontext.cs (RootContext): Init the interface_resolve_order
13246 and type_container_resolve_order always.
13248 (ResolveCore, BootstrapCorlib_ResolveClass,
13249 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13250 compiler when compiling with --nostdlib
13252 * class.cs (TypeContainer.DefineType): Check that our parent is
13253 not null. This test is most important when we are bootstraping
13256 * codegen.cs: Split out the symbol writing code.
13258 2002-03-25 Martin Baulig <martin@gnome.org>
13260 * driver.cs (-g): Made -g an alias for --debug.
13262 2002-03-24 Martin Baulig <martin@gnome.org>
13264 * codegen.cs (SymbolWriter): New public variable. Returns the
13265 current symbol writer.
13266 (CodeGen): Added `bool want_debugging_support' argument to the
13267 constructor. If true, tell the ModuleBuild that we want debugging
13268 support and ask it for the ISymbolWriter.
13269 (Save): If we have a symbol writer, call it's Close() method after
13270 saving the assembly.
13272 * driver.c (--debug): New command line argument to create a
13273 debugger information file.
13275 * location.cs (SymbolDocument): New public property. Returns an
13276 ISymbolDocumentWriter object for the current source file or null
13277 if we don't have a symbol writer.
13279 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13281 * driver.cs (LoadAssembly): Correctly return when all the paths
13282 have been tried and not before.
13284 * statement.cs (Switch.Emit): return the actual coverage for this
13285 statement (returns/not-returns)
13287 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13288 switch of the statement if we are the last switch section. That
13289 kills two problems: try/catch problems (we used to emit an empty
13290 nop at the end) and switch statements where all branches would
13293 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13295 * driver.cs: Add default assemblies (the equivalent to the
13296 Microsoft CSC.RSP file)
13298 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13299 also update tokens_seen and set it to false.
13301 * driver.cs: Implement --recurse for Mike.
13303 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13304 correctly splitting out the paths.
13306 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13308 * interface.cs (Interface.PopulateProperty): Instead of using
13309 `parent' as the declaration space for the set parameters, use
13312 * support.cs (InternalParameters): InternalParameters constructor
13313 takes a DeclSpace instead of a TypeContainer.
13315 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13316 types are being initialized, load the address of it before calling
13319 (New): Provide a mechanism to disable the generation of local
13320 value type temporaries when the caller will be providing us with
13321 an address to store it.
13323 (ArrayCreation.EmitDynamicInitializers): Use it.
13325 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13327 * expression.cs (Invocation.EmitArguments): Only probe for array
13328 property if there is more than one argument. Sorry about that.
13330 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13331 empty param arrays.
13333 * class.cs (Method.LabelParameters): Fix incorrect code path that
13334 prevented the `ParamArrayAttribute' from being applied to the
13337 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13339 * support.cs (ReflectionParameters): Correctly compute whether the
13340 last argument is a params array. Fixes the problem with
13343 * typemanager.cs: Make the assemblies array always be non-null
13344 (empty, but non-null)
13346 * tree.cs (RecordDecl): New function that abstracts the recording
13347 of names. This reports error 101, and provides a pointer to the
13348 previous declaration. Fixes a crash in the compiler.
13350 * cs-parser.jay (constructor_declaration): Update to new grammar,
13351 and provide a constructor_body that can be empty.
13353 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13355 * driver.cs: Add support for --resources.
13357 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13358 Make all types for the various array helper methods be integer.
13360 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13361 CheckState to ConvCast.
13363 (ConvCast): Now it takes a `checked' state argument, to avoid
13364 depending on the emit context for the conversion, and just using
13365 the resolve time setting.
13367 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13368 instead of Invocation.EmitArguments. We do not emit the original
13369 arguments, instead we emit those which have been converted to
13370 unsigned int expressions.
13372 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
13374 * codegen.cs: ditto.
13376 * expression.cs (LocalVariableReference): Drop the use of the
13377 Store function that depended on the variable index.
13379 * statement.cs (VariableInfo): Drop the `Idx' property from this
13380 class, as this is not taking into account the indexes for
13381 temporaries tat we generate during the execution, getting the
13384 * class.cs: First emit class initializers, then call the parent
13387 * expression.cs (Binary): Fix opcode emision.
13388 (UnaryMutator.EmitCode): Support checked code generation
13390 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
13391 matches for events for both the Static and Instance scans,
13392 pointing to the same element. Fix that.
13394 2002-03-14 Miguel de Icaza <miguel@ximian.com>
13396 * rootcontext.cs (ResolveTree): Always set the
13397 interface_resolve_order, because nested interfaces will be calling
13400 * class.cs (GetInterfaceOrClass): Track the same resolution
13401 process used by TypeManager.LookupType. This fixes the nested
13402 type lookups in class declarations (separate path from
13405 (TypeContainer.DefineType): Also define nested interfaces.
13406 (TypeContainer.RegisterOrder): New public function used to
13407 register the order in which child interfaces need to be closed.
13409 Nested interfaces need to be closed after their parents have been
13412 * interface.cs (InterfaceAttr): Put all the logic for computing
13413 the interface attribute here.
13415 (DefineInterface): Register our interface order with the
13416 RootContext or with the TypeContainer depending on the case.
13418 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13420 * cs-parser.jay: rework foreach statement to work with the new
13421 changes to the policy on SimpleNames.
13423 * report.cs: support Stacktrace on warnings as well.
13425 * makefile: drop --unsafe and /unsafe from the compile.
13427 2002-03-13 Ravi Pratap <ravi@ximian.com>
13429 * ecore.cs (StandardConversionExists): Modify to take an Expression
13430 as the first parameter. Ensure we do null -> reference type conversion
13433 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
13434 temporary Expression objects.
13436 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
13438 * interface.cs: workaround bug in method overloading resolution
13439 (there is already a bugzilla bug for it).
13441 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13443 We could also solve this problem by having a separate path for
13444 performing type lookups, instead of DoResolve, we could have a
13445 ResolveType entry point, and only participating pieces of the
13446 production (simplename, deref, array) would implement this.
13448 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
13449 signal SimpleName to only resolve type names and not attempt to
13450 resolve anything else.
13452 * expression.cs (Cast): Set the flag.
13454 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
13456 * class.cs: Only report 108 if there is no `new' modifier.
13458 * cs-parser.jay: rework foreach statement to work with the new
13459 changes to the policy on SimpleNames.
13461 * report.cs: support Stacktrace on warnings as well.
13463 * makefile: drop --unsafe and /unsafe from the compile.
13465 2002-03-11 Miguel de Icaza <miguel@ximian.com>
13467 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13468 lookups here, instead of doing that at parse time. This means
13469 that our grammar will not introduce `LocalVariableReferences' as
13470 expressions at this point. That solves the problem of code like
13474 static void Main ()
13478 This is only half the fix. The full fix requires parameters to
13479 also be handled in this way.
13481 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
13482 makes the use more obvious of the DeclSpace. The
13483 ec.TypeContainer.TypeBuilder is now only used to pull the
13484 TypeBuilder for it.
13486 My theory is that I can get rid of the TypeBuilder completely from
13487 the EmitContext, and have typecasts where it is used (from
13488 DeclSpace to where it matters).
13490 The only pending problem is that the code that implements Aliases
13491 is on TypeContainer, and probably should go in DeclSpace.
13493 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13494 lookups here, instead of doing that at parse time. This means
13495 that our grammar will not introduce `LocalVariableReferences' as
13496 expressions at this point. That solves the problem of code like
13500 static void Main ()
13504 This is only half the fix. The full fix requires parameters to
13505 also be handled in this way.
13507 * class.cs (Property.DefineMethod): When implementing an interface
13508 method, set newslot, when implementing an abstract method, do not
13509 set the flag (before we tried never setting it, or always setting
13510 it, which is the difference).
13511 (Indexer.DefineMethod): same.
13512 (Method.DefineMethod): same.
13514 * ecore.cs: Only set the status used flag if we get back a Field.
13516 * attribute.cs: Temporary hack, so Paolo can keep working.
13518 2002-03-08 Ravi Pratap <ravi@ximian.com>
13520 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
13521 the unmanaged type in the case we have a MarshalAs attribute.
13523 (Resolve): Handle the case when we are parsing the special MarshalAs
13524 attribute [we need to store the unmanaged type to use later]
13526 * typemanager.cs (marshal_as_attr_type): Built in type for the
13527 MarshalAs Attribute.
13529 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
13530 on parameters and accordingly set the marshalling info.
13532 2002-03-09 Miguel de Icaza <miguel@ximian.com>
13534 * class.cs: Optimizing slightly by removing redundant code after
13535 we switched to the `NoTypes' return value.
13536 (Property.DefineMethod): use NoTypes here too.
13538 This fixes the bug I introduced in my last batch of changes.
13540 2002-03-05 Ravi Pratap <ravi@ximian.com>
13542 * tree.cs (RecordEnum): Add. We now keep track of enums too.
13544 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
13545 Enums since those are types too.
13547 * cs-parser.jay (enum_declaration): Record enums as we parse them.
13549 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
13550 thanks to a call during the lookup process.
13552 2002-03-07 Miguel de Icaza <miguel@ximian.com>
13554 * statement.cs (Foreach): Lots of work to accomodate a particular
13555 kind of foreach statement that I had not kept in mind. It is
13556 possible to have foreachs on classes that provide a GetEnumerator
13557 method that return objects that implement the "pattern" for using
13558 a foreach, there is no need to support GetEnumerator
13561 This is needed to compile nant.
13563 * decl.cs: Only report 114 if the member is not `Finalize' and if
13564 the warning level is at least 2.
13566 * class.cs: Moved the compare function from Method to
13569 (MethodSignature.InheritableMemberSignatureCompare): Add new
13570 filter function that is used to extract inheritable methods from a
13573 (Method.Define): Use the new `inheritable_method_signature_filter'
13576 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
13579 2002-03-06 Miguel de Icaza <miguel@ximian.com>
13581 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
13583 * cs-parser.jay: Add opt_semicolon to the interface declaration.
13585 * expression.cs: Pass location information to
13586 ConvertImplicitStandard.
13588 * class.cs: Added debugging code to track return values from
13591 2002-03-05 Miguel de Icaza <miguel@ximian.com>
13593 * expression.cs (Is.DoResolve): If either side of the `is' is an
13594 interface, do not flag the warning.
13596 * ecore.cs (ImplicitReferenceConversion): We need a separate test
13599 * report.cs: Allow for --fatal to be used with --probe.
13601 * typemanager.cs (NoTypes): Move the definition for the empty Type
13604 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
13606 (TypeContainer.DefineProxy): New function used to proxy to parent
13607 implementations when implementing interfaces.
13608 (TypeContainer.ParentImplements): used to lookup if our parent
13609 implements a public function that is required by an interface.
13610 (TypeContainer.VerifyPendingMethods): Hook this up.
13612 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
13613 `modules' and `assemblies' arraylists into arrays. We only grow
13614 these are the very early start up of the program, so this improves
13615 the speedof LookupType (nicely measured).
13617 * expression.cs (MakeByteBlob): Replaced unsafe code with
13618 BitConverter, as suggested by Paolo.
13620 * cfold.cs (ConstantFold.Binary): Special case: perform constant
13621 folding of string concatenation, but if either side is a string,
13622 and the other is not, then return null, and let the runtime use
13623 the concatenation on the string plus the object (using
13624 `Object.ToString').
13626 2002-03-04 Miguel de Icaza <miguel@ximian.com>
13628 Constant Folding has been implemented now.
13630 * expression.cs (Unary.Reduce): Do not throw an exception, catch
13631 the error instead on types that are not supported in one's
13634 * constant.cs (Constant and all children): New set of functions to
13635 perform implict and explicit conversions.
13637 * ecore.cs (EnumConstant): Implement the new functions to perform
13638 conversion by proxying to the child expression.
13640 * codegen.cs: (ConstantCheckState): Constant evaluation has its
13641 own separate setting that can not be turned off from the command
13642 line using --unchecked or --checked and is only controlled using
13643 the checked/unchecked statements and expressions. This setting is
13644 used by the constant folder to flag errors.
13646 * expression.cs (CheckedExpr, UncheckedExpr): Set the
13647 ConstantCheckState as well.
13649 During Resolve, they also have to flag the state, because the
13650 constant folder runs completely in the Resolve phase.
13652 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
13655 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13657 * cfold.cs: New file, this file contains the constant folder.
13659 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
13660 argument to track whether we are using the resulting address to
13661 load or store a value and provide better error messages.
13663 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
13664 new AddressOf arguments.
13666 * statement.cs (Foreach.EmitCollectionForeach): Update
13668 * expression.cs (Argument.Emit): Call AddressOf with proper
13669 arguments to track usage.
13671 (New.DoEmit): Call AddressOf with new arguments.
13673 (Unary.Emit): Adjust AddressOf call.
13675 2002-03-01 Ravi Pratap <ravi@ximian.com>
13677 * cs-parser.jay (member_access): Change the case for pre-defined types
13678 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
13681 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
13684 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
13685 essentially like methods and apply attributes like MethodImplOptions to them too.
13687 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
13690 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
13691 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
13694 * Update code everywhere accordingly.
13696 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
13698 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
13700 2002-02-28 Ravi Pratap <ravi@ximian.com>
13702 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
13703 try performing lookups against those instead of jumping straight into using
13704 the 'using' clauses.
13706 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
13708 (LookupType): Perform lookups in implicit parents too.
13710 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
13711 sequence as RootContext.LookupType.
13713 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
13714 the various cases of namespace lookups into this method.
13716 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13718 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
13719 in positional arguments)
13721 * class.cs (Operator): Update the AllowedModifiers to contain
13724 * cs-parser.jay: Update operator declaration to allow for the
13725 operator body to be empty.
13727 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
13730 2002-02-27 Miguel de Icaza <miguel@ximian.com>
13732 * class.cs (Method.Emit): Label parameters.
13734 * driver.cs: Return 1 or 0 as the program exit code.
13736 2002-02-26 Miguel de Icaza <miguel@ximian.com>
13738 * expression.cs: Special case the `null' object when trying to
13739 auto-compute the type, as anything can be explicitly converted to
13742 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
13743 spotting this Paolo.
13745 (Expression.ImplicitNumericConversion): Perform comparissions of
13746 the type using the underlying type in the case of an enumeration
13747 rather than using the enumeration type for the compare.
13749 Cope with the underlying == type case, which is not possible to
13752 (Expression.ConvertNumericExplicit): Perform comparissions of
13753 the type using the underlying type in the case of an enumeration
13754 rather than using the enumeration type for the compare.
13756 * driver.cs: If the user does not supply an extension, assume .exe
13758 * cs-parser.jay (if_statement): Rewrote so that we can track the
13759 location for the if statement.
13761 * expression.cs (Binary.ConstantFold): Only concat strings when
13762 the operation is "+", not everything ;-)
13764 * statement.cs (Statement.EmitBoolExpression): Take a location
13766 (If, While, Do): Track location.
13768 * expression.cs (Binary.ResolveOperator): In the object + string
13769 case, I was missing a call to ConvertImplicit
13771 2002-02-25 Ravi Pratap <ravi@ximian.com>
13773 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
13774 Location arguments. Ensure we use RootContext.LookupType to do our work
13775 and not try to do a direct Type.GetType and ModuleBuilder.GetType
13777 * interface.cs (PopulateMethod): Handle the type of the parameter being
13780 * expression.cs (Invocation.BetterFunction): Handle the case when we
13781 have a params method with no fixed arguments and a call is made with no
13784 2002-02-25 Miguel de Icaza <miguel@ximian.com>
13786 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
13787 the verbatim-string-literal
13789 * support.cs (InternalParameters.ParameterModifier): handle null
13791 (InternalParameters.ParameterType): ditto.
13793 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
13794 duplicating the name of the variable parameter.
13795 (GetParameterByName): Fix bug where we were not looking up array
13796 paramters if they were the only present (thanks Paolo!).
13797 (GetParameterInfo): We only have an empty set of types if both
13798 fixed and array are set to null.
13799 (GetParameterInfo-idx): Handle FixedParameter == null
13801 * cs-parser.jay: Handle the case where there is no catch
13802 statements (missing null test).
13804 2002-02-22 Miguel de Icaza <miguel@ximian.com>
13806 * driver.cs (MainDriver): Be conservative on our command line
13809 Catch DirectoryNotFoundException when calling GetFiles.
13811 (SplitPathAndPattern): Used to split the input specification into
13812 a path and a pattern that we can feed to Directory.GetFiles.
13814 2002-02-21 Miguel de Icaza <miguel@ximian.com>
13816 * statement.cs (Fixed): Implement the last case of the Fixed
13817 statement (string handling).
13819 * expression.cs (StringPtr): New class used to return a char * to
13820 a string; Used by the Fixed statement.
13822 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
13824 * expression.cs (Binary.ResolveOperator): Remove redundant
13825 MemberLookup pn parent type.
13826 Optimize union call, we do not need a union if the types are the same.
13827 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
13830 Specialize the use of MemberLookup everywhere, instead of using
13831 the default settings.
13833 (StackAlloc): Implement stackalloc keyword.
13835 * cs-parser.jay: Add rule to parse stackalloc.
13837 * driver.cs: Handle /h, /help, /?
13839 * expression.cs (MakeByteBlob): Removed the hacks we had in place
13840 before we supported unsafe code.
13842 * makefile: add --unsafe to the self compilation of mcs.
13844 2002-02-20 Miguel de Icaza <miguel@ximian.com>
13846 * expression.cs (PointerArithmetic): New class that is used to
13847 perform pointer arithmetic.
13848 (Binary.Resolve): Handle pointer arithmetic
13849 Handle pointer comparission.
13850 (ArrayPtr): Utility expression class that is used to take the
13851 address of an array.
13853 (ElementAccess): Implement array access for pointers
13855 * statement.cs (Fixed): Implement fixed statement for arrays, we
13856 are missing one more case before we are done.
13858 * expression.cs (Indirection): Implement EmitAssign and set the
13859 ExprClass to Variable. This allows pointer dereferences to be
13860 treated as variables, and to have values assigned to them.
13862 * ecore.cs (Expression.StoreFromPtr): New utility function to
13863 store values dereferencing.
13865 2002-02-20 Ravi Pratap <ravi@ximian.com>
13867 * expression.cs (Binary.ResolveOperator): Ensure that we are
13868 not trying to operate on a void type - this fixes the reported
13871 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
13872 the parent implementation is sealed.
13874 * ../errors/cs0239.cs : Add.
13876 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
13878 * typemanager.cs (unverifiable_code_type): Corresponds to
13879 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
13880 which have unsafe code in them.
13882 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
13885 2002-02-19 Miguel de Icaza <miguel@ximian.com>
13887 * cs-tokenizer.cs: Add support for @"litreal strings"
13889 Make tokenizer accept pre-processor directives
13890 on any column (remove the old C-like limitation).
13892 * rootcontext.cs (EmitCode): Emit any global attributes.
13893 (AddGlobalAttributes): Used to keep track of assembly attributes.
13895 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
13897 * cs-parser.jay: Add support for global attributes.
13899 2002-02-17 Miguel de Icaza <miguel@ximian.com>
13901 * expression.cs (Indirection): New helper class. Unary will
13902 create Indirection classes to be able to implement the
13903 IMemoryLocation interface on it.
13905 2002-02-16 Miguel de Icaza <miguel@ximian.com>
13907 * cs-parser.jay (fixed_statement): reference the right statement.
13909 * statement.cs (Fixed.Emit): Finish implementing the fixed
13910 statement for the &x case.
13912 2002-02-14 Miguel de Icaza <miguel@ximian.com>
13914 * class.cs (Property.Define, Method.Define): Remove newslot when
13917 * modifiers.cs: My use of NewSlot when `Abstract' was set was
13918 wrong. NewSlot should only be used if the `new' keyword is present.
13920 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
13921 locating our system dir. Sorry about this.
13923 2002-02-13 Miguel de Icaza <miguel@ximian.com>
13925 * driver.cs (GetSystemDir): Compute correctly the location of our
13926 system assemblies. I was using the compiler directory instead of
13927 the library directory.
13929 2002-02-13 Ravi Pratap <ravi@ximian.com>
13931 * expression.cs (BetterFunction): Put back in what Miguel commented out
13932 since it is the correct fix. The problem is elsewhere ;-)
13934 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
13935 parameters of the parms method are themselves compatible or not !
13937 (StandardConversionExists): Fix very dangerous bug where we were forgetting
13938 to check that a class implements an interface before saying that an implicit
13939 conversion was allowed. Use ImplementsInterface to do the checking.
13941 2002-02-13 Miguel de Icaza <miguel@ximian.com>
13943 * class.cs (Method.Define): Track whether we are an explicit
13944 implementation or not. And only call DefineMethodOverride if we
13945 are an explicit implementation.
13947 (Property.DefineMethod): Ditto.
13949 2002-02-11 Ravi Pratap <ravi@ximian.com>
13951 * expression.cs (BetterFunction): Catch hideous bug which was
13952 preventing us from detecting ambiguous calls due to implicit casts i.e
13955 2002-01-29 Miguel de Icaza <miguel@ximian.com>
13957 * support.cs (Pair): Remove un-needed method. I figured why I was
13958 getting the error in cs-parser.jay, the variable in a foreach loop
13959 is readonly, and the compiler does not really treat this as a variable.
13961 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
13962 instead of EQUALS in grammar.
13964 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
13966 * expression.cs (Unary.DoResolve): Check whether the argument is
13969 2002-01-28 Miguel de Icaza <miguel@ximian.com>
13971 * support.cs: Api for Pair to set a value. Despite the fact that
13972 the variables are public the MS C# compiler refuses to compile
13973 code that accesses the field if the variable is part of a foreach
13976 * statement.cs (Fixed): Begin implementation of the fixed
13979 (Block.AddVariable): Return the VariableInfo on success and null
13980 on failure instead of true/false.
13982 * cs-parser.jay (foreach): Catch errors on variables already
13983 defined (we were ignoring this value before) and properly unwind
13984 the block hierarchy
13986 (fixed_statement): grammar for the fixed statement.
13988 2002-01-25 Miguel de Icaza <miguel@ximian.com>
13990 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
13991 pointer types to be incretemented.
13993 (SizeOf): Implement.
13995 * cs-parser.jay (pointer_member_access): Implement
13996 expr->IDENTIFIER production.
13998 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
13999 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14002 (Unary): Implement indirection.
14004 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14005 use in non-unsafe context).
14007 (SimpleName.DoResolve): Check for pointers in field access on safe
14010 (Expression.LoadFromPtr): Factor the load-indirect code in this
14011 function. This was duplicated in UnboxCast and ParameterReference
14013 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14015 * expression.cs (ComposedCast): report an error if a pointer cast
14016 is used in a safe region.
14018 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14019 pointer type casts in unsafe context.
14021 * codegen.cs (EmitContext): Set up IsUnsafe.
14023 * cs-parser.jay (non_expression_type): Add productions for pointer
14026 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14027 code. We should not use force into static mode if the method is
14028 not virtual. Fixes bug in MIS
14030 * statement.cs (Do.Emit, While.Emit, For.Emit,
14031 Statement.EmitBoolExpression): Add support to Do and While to
14032 propagate infinite loop as `I do return' semantics.
14034 Improve the For case to also test for boolean constants.
14036 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14037 to the list of attributes we can add.
14039 Remove `EmitContext' argument.
14041 * class.cs (Method.Define): Apply parameter attributes.
14042 (Constructor.Define): Apply parameter attributes.
14043 (MethodCore.LabelParameters): Move here the core of labeling
14046 * support.cs (ReflectionParameters.ParameterModifier,
14047 InternalParameters.ParameterModifier): Use IsByRef on the type and
14048 only return the OUT bit for these parameters instead of in/out/ref
14051 This is because I miss-understood things. The ParameterInfo.IsIn
14052 and IsOut represent whether the parameter has the [In] and [Out]
14055 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14057 * ecore.cs (FieldExpr.Emit): Release temporaries.
14059 * assign.cs (LocalTemporary.Release): new function.
14061 * codegen.cs (EmitContext.GetTemporaryStorage,
14062 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14063 temporary storage. Now we can "put back" localbuilders when we
14066 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14068 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14069 need to make a copy of the variable to generate verifiable code.
14071 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14073 * driver.cs: Compute dynamically the system directory.
14075 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14076 Slower, but more generally useful. Used by the abstract
14077 registering implementation.
14079 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14080 the rules for the special rule on Type/instances. First check if
14081 we have the same name, and if so, try that special static path
14082 rather than the instance path.
14084 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14086 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14089 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14090 Enum, ValueType, Delegate or Array for non-corlib compiles.
14092 * cs-tokenizer.cs: Catch long identifiers (645)
14094 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14097 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14098 fix, we were returning too early, so we were not registering
14099 pending methods from abstract classes.
14101 Do not register pending methods if the class is abstract.
14103 * expression.cs (Conditional.DoResolve): Report circular implicit
14104 conversions when we neecd to compute it for conditional
14107 (Is.DoResolve): If the expression is always of the provided type,
14108 flag warning 183. If the expression can not ever be of the
14109 provided type flag warning 184.
14111 * class.cs: Catch 169 as well.
14113 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14116 2002-01-18 Nick Drochak <ndrochak@gol.com>
14118 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14120 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14122 * interface.cs: (PopulateMethod): Check for pointers being defined
14123 only if the unsafe context is active.
14124 (PopulateProperty): ditto.
14125 (PopulateIndexer): ditto.
14127 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14128 specified. If pointers are present, make sure that they are
14129 present in an unsafe context.
14130 (Constructor, Constructor.Define): ditto.
14131 (Field, Field.Define): ditto.
14132 (Property, Property.Define): ditto.
14133 (Event, Event.Define): ditto.
14135 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14136 hashtable if there are classes or structs defined.
14138 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14139 code, as the constant resolution moved.
14141 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14142 the metadata, so we can flag error 133.
14144 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14145 pointer is being declared in an unsafe context.
14147 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14149 * modifiers.cs (Modifiers.Check): Require a Location argument.
14150 Report error 227 for Unsafe use.
14152 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14154 * statement.cs (For.Emit): If the test is null, then report that
14155 we do `return', as we wont reach anything afterwards.
14157 (Switch.SwitchGoverningType): Track the expression that matched
14160 * driver.cs: Allow negative numbers as an error code to flag.
14162 * cs-parser.jay: Handle 1551.
14164 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14166 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14168 * cs-parser.jay: Report 1518 (type declaration can only contain
14169 class, struct, interface, enum or delegate)
14171 (switch_label): Report 1523 (keywords `case' or `default' must
14174 (opt_switch_sections): Report 1522 (empty switch)
14176 * driver.cs: Report 1515 (response file specified multiple times)
14177 Report 1516 (Source file specified multiple times).
14179 * expression.cs (Argument.Resolve): Signal 1510
14181 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14182 access not allowed in static code)
14184 2002-01-11 Ravi Pratap <ravi@ximian.com>
14186 * typemanager.cs (IsPointerType): Utility method which we are going
14189 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14190 the object type, so we take care of that.
14192 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14194 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14195 added to non-params parameters :-)
14197 * typemanager.cs (CSharpName): Include 'void' type too.
14199 (void_ptr_type): Include in the set of core types.
14201 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14204 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14207 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14208 completely forgotten about it.
14210 2002-01-10 Ravi Pratap <ravi@ximian.com>
14212 * cs-parser.jay (pointer_type): Add. This begins our implementation
14213 of parsing rules for unsafe code.
14215 (unsafe_statement): Implement.
14217 (embedded_statement): Modify to include the above.
14219 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14221 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14222 if the current context is an unsafe one.
14224 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14225 are handled differently, we need separate rules for them.
14227 (local_variable_declaration): Update to use local_variable_pointer_type
14228 to allow variable declarations of unmanaged pointer types.
14230 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14231 in unsafe contexts.
14233 * ../errors/cs0214.cs : Add.
14235 2002-01-16 Nick Drochak <ndrochak@gol.com>
14237 * makefile: remove 'response' file when cleaning.
14239 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14241 * cs-parser.jay: Report 1524.
14243 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14245 * typemanager.cs (RegisterMethod): drop checking if we have
14246 registered this from here
14248 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14250 * class.cs (Method.EmitDestructor): Implement calling our base
14253 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14254 value of InFinally.
14256 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14257 this routine and will wrap the call in a try/catch block. Deal
14260 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14262 * ecore.cs (Expression.MemberLookup): instead of taking a
14263 parameter `same_type' that was used to tell whether we could
14264 access private members we compute our containing type from the
14267 (FieldExpr): Added partial support for volatile fields. This does
14268 not work for volatile fields exposed from assemblies, as I can not
14269 figure out how to extract the modreq from it.
14271 Updated all the source files to use this.
14273 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14274 because it is referenced by MemberLookup very often.
14276 2002-01-09 Ravi Pratap <ravi@ximian.com>
14278 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14279 TypeBuilder.GetCustomAttributes to retrieve what we need.
14281 Get rid of redundant default_member_attr_type as this is the same as
14282 default_member_type which already exists.
14284 * interface.cs, attribute.cs : Update accordingly.
14286 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14288 * typemanager.cs: Enable IndexerPropertyName again. It does not
14289 work for TYpeBuilders though. Ravi, can you please fix this?
14291 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14293 * expression.cs (Argument.Emit): Handle the case of ref objects
14294 being passed to ref functions;
14296 (ParameterReference.EmitLoad): Loads the content of the pointer
14297 without dereferencing.
14299 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14301 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14303 2002-01-08 Ravi Pratap <ravi@ximian.com>
14305 * class.cs (Indexer.DefineMethod): Incorporate the interface
14306 type in the name of the method if we are doing explicit interface
14309 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14311 (BetterConversion): Fix extremely trivial bug where we were referring to
14312 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14315 * ../errors/bug16.cs : Add although we have fixed it.
14317 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14319 * expression.cs (BaseIndexer): Begin implementation.
14321 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14323 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14324 production directly to remove a shift/reduce, and implement
14325 explicit interface implementation.
14327 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14328 after a floating point suffix.
14330 * expression.cs (DoNumericPromotions): Improved the conversion for
14331 uint/uint. If we have a constant, we avoid doing a typecast to a
14334 * class.cs (Indexer): Implement explicit interface implementation
14337 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14339 * class.cs: make the default instance constructor public and hidebysig.
14341 2001-01-03 Ravi Pratap <ravi@ximian.com>
14343 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14344 so we can call it from elsewhere.
14346 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14347 we emit it internally if the class has a defined indexer; otherwise the user
14348 emits it by decorating the class definition with the DefaultMemberAttribute.
14350 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14351 attribute is not used on a type which defines an indexer.
14353 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14354 character when we skip whitespace.
14356 * ../errors/cs0646.cs : Add.
14358 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14360 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14363 * makefile: Add practical target `mcs3.exe' which builds the third
14364 generation compiler.
14366 * expression.cs (New): Fix structures constructor calling.
14368 * class.cs (Property, Method, Indexer): Emit Final flag on the
14369 method if we are an interface implementation and we are not
14372 * ecore.cs (PropertyExpr): New public field `IsBase', tells
14373 whether this property is referencing a `base' method.
14375 * expression.cs (Invocation.EmitCall): take an extra argument:
14376 is_base, this is used to determine whether the `call' or
14377 `callvirt' opcode should be used.
14380 * delegate.cs: update EmitCall.
14382 * class.cs (Method.Define): Set NewSlot for the cases where we are
14383 not implementing an interface method.
14385 (Property.Define): ditto.
14387 2002-01-02 Miguel de Icaza <miguel@ximian.com>
14389 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
14390 'r'. Allows mcs to parse itself fully.
14392 2002-01-02 Ravi Pratap <ravi@ximian.com>
14394 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
14395 of the number of initializers that require the InitializeArray method.
14397 (CheckIndices): Store the Expression in all cases - not the plain value. Also
14398 update the above field where necessary.
14400 (MakeByteBlob): Update accordingly.
14402 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
14405 (EmitDynamicInitializers): Update in accordance with the new optimization.
14407 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
14408 same OpCode applies.
14410 * cs-parser.jay : Fix some glaring errors I introduced.
14412 2002-01-01 Ravi Pratap <ravi@ximian.com>
14414 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
14415 so that we can check for name clashes there too.
14417 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
14418 for interface indexers.
14420 * interfaces.cs (Define): Emit the default member attribute.
14422 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
14423 variable was being referred to while setting the value ;-)
14425 2002-01-01 Miguel de Icaza <miguel@ximian.com>
14427 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
14428 byte-by-byte information when we know the data is zero.
14430 Make the block always a multiple of 4, because
14431 DefineInitializedData has a bug.
14433 * assign.cs: Fix, we should assign from the temporary, not from
14436 * expression.cs (MakeByteBlob): Fix my incorrect code.
14438 2001-12-31 Miguel de Icaza <miguel@ximian.com>
14440 * typemanager.cs (EnumToUnderlying): This function is used to get
14441 the underlying type from an enumeration, because it does not
14444 * constant.cs: Use the I4_S form for values between -128 and 127.
14446 * statement.cs (Block.LookupLabel): Looks up a label.
14447 (Block): Drop support for labeled blocks.
14449 (LabeledStatement): New kind of statement that represents a label
14452 (Goto): Finally implement this bad boy.
14454 * cs-parser.jay: Update to reflect new mechanism to implement
14457 2001-12-30 Miguel de Icaza <miguel@ximian.com>
14459 * codegen.cs (EmitContext.This): a codegen property that keeps the
14460 a single instance of this instead of creating many different this
14463 * delegate.cs (Delegate.DoResolve): Update to use the property;
14465 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
14467 * expression.cs (BaseAccess.DoResolve): Ditto.
14469 2001-12-29 Ravi Pratap <ravi@ximian.com>
14471 * typemanager.cs (methodimpl_attr_type): Add to hold the type
14472 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
14474 (InitCoreTypes): Update accordingly.
14476 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
14477 so we can quickly store the state.
14479 (ApplyAttributes): Set the correct implementation flags
14480 for InternalCall methods.
14482 2001-12-29 Miguel de Icaza <miguel@ximian.com>
14484 * expression.cs (EmitCall): if a method is not virtual, then do
14485 not use callvirt on it.
14487 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
14488 user defined stuff) requires the use of stobj, which takes an
14489 address on the stack instead of an array and an index. So emit
14490 the Ldelema operation for it.
14492 (EmitStoreOpcode): Use stobj for valuetypes.
14494 (UnaryMutator.EmitCode): Use the right 1 value depending on
14495 whether we are dealing with int64/uint64, float or doubles.
14497 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
14498 constructors that I implemented last night.
14500 (Constructor.IsDefault): Fix to work properly for static
14503 * cs-parser.jay (CheckDef): report method signature errors.
14504 Update error number 103 to be 132.
14506 * decl.cs: New AdditionResult enumeration value: MethodExists.
14507 Although we do this check for methods later on in the semantic
14508 analysis, catching repeated default constructors is so easy that
14509 we catch these here.
14511 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
14514 (ParameterReference.EmitAssign, Emit): handle
14517 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
14518 (ArrayAccess.EmitStoreOpcode): ditto.
14520 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
14522 * expression.cs (MakeByteBlob): Complete all the missing types
14523 (uint, short, ushort, byte, sbyte)
14525 * class.cs: Only init instance field initializers on instance
14528 Rename `constructors' to instance_constructors.
14530 (TypeContainer.AddConstructor): Only add constructors to the list
14531 if it is not static.
14533 Make sure that we handle default_static_constructor independently
14534 everywhere where we handle instance_constructors
14536 2001-12-28 Miguel de Icaza <miguel@ximian.com>
14538 * class.cs: Do not lookup or create a base initializer for a
14539 static constructor.
14541 (ConstructorInitializer.Resolve): use the proper type to lookup
14544 * cs-parser.jay: Report error 1585 (modifiers between type and name).
14546 * enum.cs, interface.cs: Remove CloseType, this is taken care by
14549 * decl.cs: CloseType is now an virtual method, the default
14550 implementation just closes this type.
14552 2001-12-28 Ravi Pratap <ravi@ximian.com>
14554 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
14555 to PreserveSig by default. Also emit HideBySig on such methods.
14557 Basically, set the defaults to standard values.
14559 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
14560 argument, if candidate is better, it can't be worse than the best !
14562 (Invocation): Re-write bits to differentiate between methods being
14563 applicable in their expanded form and their normal form - for params
14566 Get rid of use_standard everywhere as only standard conversions are allowed
14567 in overload resolution.
14569 More spec conformance.
14571 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14573 * driver.cs: Add --timestamp, to see where the compiler spends
14576 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
14577 `this' in static code.
14579 (SimpleName.DoResolve): Implement in terms of a helper function
14580 that allows static-references to be passed upstream to
14583 (Expression.ResolveWithSimpleName): Resolve specially simple
14584 names when called by MemberAccess to implement the special
14587 (Expression.ImplicitReferenceConversion): Handle conversions from
14588 Null to reference types before others, as Null's type is
14591 * expression.cs (Invocation.EmitCall): Handle the special case of
14592 calling methods declared on a reference type from a ValueType
14593 (Base classes System.Object and System.Enum)
14595 (MemberAccess.Resolve): Only perform lookups on Enumerations if
14596 the left hand side is a TypeExpr, not on every enumeration.
14598 (Binary.Resolve): If types are reference types, then do a cast to
14599 object on operators != and == of both arguments.
14601 * typemanager.cs (FindMembers): Extract instance and static
14602 members if requested.
14604 * interface.cs (PopulateProperty): Use void_type instead of null
14605 as the return type for the setter method.
14607 (PopulateIndexer): ditto.
14609 2001-12-27 Ravi Pratap <ravi@ximian.com>
14611 * support.cs (ReflectionParameters): Fix minor bug where we
14612 were examining the wrong parameter for the ParamArray attribute.
14614 Cope with requests for the type of the parameter at position
14615 greater than the params parameter's. We now return the element
14616 type of the params array as that makes more sense.
14618 * expression.cs (Invocation.IsParamsMethodApplicable): Update
14619 accordingly as we no longer have to extract the element type
14622 (Invocation.OverloadResolve): Update.
14624 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14626 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
14627 against IEnumerator, test whether the return value is a descendant
14628 of the IEnumerator interface.
14630 * class.cs (Indexer.Define): Use an auxiliary method to implement
14631 the other bits of the method definition. Begin support for
14632 explicit interface implementation.
14634 (Property.DefineMethod): Use TypeManager.void_type instead of null
14635 for an empty return value.
14637 2001-12-26 Miguel de Icaza <miguel@ximian.com>
14639 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
14640 dealing with a FieldExpr which is composed of a FieldBuilder, in
14641 the code path we did extract the constant, but we should have
14642 obtained the underlying value to be able to cast it (otherwise we
14643 end up in an infinite loop, this is what Ravi was running into).
14645 (ArrayCreation.UpdateIndices): Arrays might be empty.
14647 (MemberAccess.ResolveMemberAccess): Add support for section
14648 14.5.4.1 that deals with the special case of E.I when E is a type
14649 and something else, that I can be a reference to a static member.
14651 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
14652 handle a particular array type to create byte blobs, it is just
14653 something we dont generate byteblobs for.
14655 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
14658 * location.cs (Push): remove the key from the hashtable that we
14659 are about to add. This happens for empty files.
14661 * driver.cs: Dispose files after we have parsed them.
14663 (tokenize): new function that only runs the tokenizer on its
14664 input, for speed testing.
14666 2001-12-26 Ravi Pratap <ravi@ximian.com>
14668 * class.cs (Event.Define): Define the private field only if there
14669 are no accessors defined.
14671 * expression.cs (ResolveMemberAccess): If there is no associated
14672 field with the event, that means we have an event defined with its
14673 own accessors and we should flag error cs0070 since transforming
14674 ourselves into a field is not valid in that case.
14676 * ecore.cs (SimpleName.DoResolve): Same as above.
14678 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
14679 and charset to sane values.
14681 2001-12-25 Ravi Pratap <ravi@ximian.com>
14683 * assign.cs (DoResolve): Perform check on events only if they
14684 are being accessed outside the declaring type.
14686 * cs-parser.jay (event_declarations): Update rules to correctly
14687 set the type of the implicit parameter etc.
14689 (add_accessor, remove_accessor): Set current local parameters.
14691 * expression.cs (Binary): For delegate addition and subtraction,
14692 cast the return value from the method into the appropriate delegate
14695 2001-12-24 Ravi Pratap <ravi@ximian.com>
14697 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
14698 of these as the workaround is unnecessary.
14700 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
14701 delegate data - none of that is needed at all.
14703 Re-write bits to extract the instance expression and the delegate method
14706 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
14709 * attribute.cs (ApplyAttributes): New method to take care of common tasks
14710 of attaching attributes instead of duplicating code everywhere.
14712 * everywhere : Update code to do attribute emission using the above method.
14714 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14716 * expression.cs (IsParamsMethodApplicable): if there are not
14717 parameters, return immediately.
14719 * ecore.cs: The 0 literal can be implicity converted to an enum
14722 (SimpleName.DoResolve): First lookup the type, then lookup the
14725 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
14726 want to get its address. If the InstanceExpression is not
14727 addressable, store the result in a temporary variable, then get
14730 * codegen.cs: Only display 219 errors on warning level or above.
14732 * expression.cs (ArrayAccess): Make it implement the
14733 IMemoryLocation interface.
14735 (Binary.DoResolve): handle the operator == (object a, object b)
14736 and operator != (object a, object b) without incurring into a
14737 BoxedCast (because 5 != o should never be performed).
14739 Handle binary enumerator operators.
14741 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
14742 value type, otherwise use Ldelem_ref.
14744 Use precomputed names;
14746 (AddressOf): Implement address of
14748 * cs-parser.jay (labeled_statement): Fix recursive block
14749 addition by reworking the production.
14751 * expression.cs (New.DoEmit): New has a special case:
14753 If we are dealing with a ValueType, we have a few
14754 situations to deal with:
14756 * The target of New is a ValueType variable, that is
14757 easy, we just pass this as the variable reference
14759 * The target of New is being passed as an argument,
14760 to a boxing operation or a function that takes a
14763 In this case, we need to create a temporary variable
14764 that is the argument of New.
14767 2001-12-23 Ravi Pratap <ravi@ximian.com>
14769 * rootcontext.cs (LookupType): Check that current_type is not null before
14770 going about looking at nested types.
14772 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
14773 not implement the IAssignMethod interface any more.
14775 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
14776 where we tranform them into FieldExprs if they are being resolved from within
14777 the declaring type.
14779 * ecore.cs (SimpleName.DoResolve): Do the same here.
14781 * assign.cs (DoResolve, Emit): Clean up code considerably.
14783 * ../errors/bug10.cs : Add.
14785 * ../errors/cs0070.cs : Add.
14787 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
14789 * assign.cs : Get rid of EventIsLocal everywhere.
14791 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14793 * ecore.cs (ConvertIntLiteral): finished the implementation.
14795 * statement.cs (SwitchLabel): Convert the value we are using as a
14796 key before looking up the table.
14798 2001-12-22 Miguel de Icaza <miguel@ximian.com>
14800 * codegen.cs (EmitTopBlock): Require a Location argument now.
14802 * cs-parser.jay (constructor_declarator): We need to setup
14803 current_local_parameters before we parse the
14804 opt_constructor_initializer, to allow the variables to be bound
14805 to the constructor arguments.
14807 * rootcontext.cs (LookupType): First lookup nested classes in our
14808 class and our parents before we go looking outside our class.
14810 * expression.cs (ConstantFold): Extract/debox the values at the
14813 * rootcontext.cs (EmitCode): Resolve the constants first before we
14814 resolve the types. This is not really needed, but it helps debugging.
14816 * statement.cs: report location.
14818 * cs-parser.jay: pass location to throw statement.
14820 * driver.cs: Small bug fix.
14822 * report.cs: Updated format to be 4-zero filled digits.
14824 2001-12-22 Ravi Pratap <ravi@ximian.com>
14826 * expression.cs (CheckIndices): Fix minor bug where the wrong
14827 variable was being referred to ;-)
14829 (DoEmit): Do not call EmitStaticInitializers when the
14830 underlying type is System.Object.
14832 2001-12-21 Ravi Pratap <ravi@ximian.com>
14834 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
14835 and do the usual workaround for SRE.
14837 * class.cs (MyEventBuilder.EventType): New member to get at the type
14838 of the event, quickly.
14840 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
14842 * assign.cs (Assign.DoResolve): Handle the case when the target
14843 is an EventExpr and perform the necessary checks.
14845 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
14848 (SimpleName.MemberStaticCheck): Include check for EventExpr.
14850 (EventExpr): Set the type in the constructor itself since we
14851 are meant to be born fully resolved.
14853 (EventExpr.Define): Revert code I wrote earlier.
14855 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
14856 instance expression is null. The instance expression is a This in that case
14857 or a null, depending on whether it is a static method or not.
14859 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
14860 refers to more than one method.
14862 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
14863 and accordingly flag errors.
14865 2001-12-21 Miguel de Icaza <miguel@ximian.com>
14867 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
14869 2001-12-22 Miguel de Icaza <miguel@ximian.com>
14871 * location.cs (ToString): Provide useful rutine.
14873 2001-12-21 Miguel de Icaza <miguel@ximian.com>
14875 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
14876 objects, return the actual integral boxed.
14878 * statement.cs (SwitchLabel): define an ILLabel for each
14881 (Switch.CheckSwitch): If the value is a Literal, extract
14882 the underlying literal.
14884 Also in the unused hashtable we had, add the SwitchLabel so we can
14885 quickly look this value up.
14887 * constant.cs: Implement a bunch of new constants. Rewrite
14888 Literal based on this. Made changes everywhere to adapt to this.
14890 * expression.cs (Expression.MakeByteBlob): Optimize routine by
14891 dereferencing array only once, and also copes with enumrations.
14893 bytes are two bytes wide, not one.
14895 (Cast): Perform constant conversions.
14897 * ecore.cs (TryImplicitIntConversion): Return literals instead of
14898 wrappers to the literals here.
14900 * expression.cs (DoNumericPromotions): long literals can converted
14901 to ulong implicity (this is taken care of elsewhere, but I was
14902 missing this spot).
14904 * ecore.cs (Expression.Literalize): Make the return type Literal,
14905 to improve type checking.
14907 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
14909 2001-12-20 Miguel de Icaza <miguel@ximian.com>
14911 * literal.cs: Revert code from ravi that checked the bounds. The
14912 bounds are sane by the definition of the type itself.
14914 * typemanager.cs: Fix implementation of ImplementsInterface. We
14915 need to actually look up in our parent hierarchy for interfaces
14918 * const.cs: Use the underlying type for enumerations
14920 * delegate.cs: Compute the basename for the delegate creation,
14921 that should fix the delegate test case, and restore the correct
14922 Type Lookup semantics in rootcontext
14924 * rootcontext.cs: Revert Ravi's last patch. The correct way of
14925 referencing a nested type with the Reflection API is using the "+"
14928 * cs-parser.jay: Do not require EOF token at the end.
14930 2001-12-20 Ravi Pratap <ravi@ximian.com>
14932 * rootcontext.cs (LookupType): Concatenate type names with
14933 a '.' instead of a '+' The test suite passes again.
14935 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
14936 field of the enumeration.
14938 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
14939 the case when the member is an EventExpr.
14941 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
14942 static has an associated instance expression.
14944 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
14946 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
14948 * class.cs (Event.Define): Register event and perform appropriate checks
14951 We define the Add and Remove methods even if the use provides none because
14952 in that case, we provide default implementations ourselves.
14954 Define a private field of the type of the event. This is done by the CSC compiler
14955 and we should be doing it too ;-)
14957 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
14958 More methods we use in code we generate.
14960 (multicast_delegate_type, delegate_type): Two separate types since the distinction
14963 (InitCoreTypes): Update accordingly for the above.
14965 * class.cs (Event.Emit): Generate code for default accessors that we provide
14967 (EmitDefaultMethod): Do the job in the above.
14969 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
14972 2001-12-20 Miguel de Icaza <miguel@ximian.com>
14974 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
14975 builders even if we were missing one.
14977 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
14978 pass the Basename as our class name instead of the Name. The
14979 basename will be correctly composed for us.
14981 * parameter.cs (Paramters): Now takes a Location argument.
14983 * decl.cs (DeclSpace.LookupType): Removed convenience function and
14984 make all the code call directly LookupType in RootContext and take
14985 this chance to pass the Location information everywhere.
14987 * Everywhere: pass Location information.
14989 2001-12-19 Miguel de Icaza <miguel@ximian.com>
14991 * class.cs (Constructor.Define): Updated way of detecting the
14992 length of the parameters.
14994 (TypeContainer.DefineType): Use basename as the type name for
14997 (TypeContainer.Define): Do not recursively define types here, as
14998 definition is taken care in order by the RootContext.
15000 * tree.cs: Keep track of namespaces in a per-file basis.
15002 * parameter.cs (Parameter.ComputeSignature): Update to use
15005 (Parameters.GetSignature): ditto.
15007 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15008 instead of a TypeContainer.
15010 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15011 resolve names. Because we need to be resolve in our context, not
15014 * driver.cs: Implement response files.
15016 * class.cs (TypeContainer.DefineType): If we are defined, do not
15017 redefine ourselves.
15019 (Event.Emit): Emit the code for add/remove handlers.
15020 (Event.Define): Save the MethodBuilders for add/remove.
15022 * typemanager.cs: Use pair here too.
15024 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15025 DictionaryEntry requires the first argument to be non-null.
15027 (enum_declaration): Compute full name for registering the
15030 (delegate_declaration): Instead of using
15031 formal_parameter_list, use opt_formal_parameter_list as the list
15034 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15035 (EventParsing): New property that controls whether `add' and
15036 `remove' are returned as tokens or identifiers (for events);
15038 2001-12-19 Ravi Pratap <ravi@ximian.com>
15040 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15041 use MyEventBuilder only and let it wrap the real builder for us.
15043 (MyEventBuilder): Revamp constructor etc.
15045 Implement all operations that we perform on EventBuilder in precisely the same
15048 (FindMembers): Update to use the EventBuilder member.
15050 (Event.Emit): Update accordingly.
15052 2001-12-18 Ravi Pratap <ravi@ximian.com>
15054 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15055 by calling the appropriate methods.
15057 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15060 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15062 2001-12-17 Ravi Pratap <ravi@ximian.com>
15064 * delegate.cs (Delegate.Populate): Check that the return type
15065 and various parameters types are indeed accessible.
15067 * class.cs (Constructor.Define): Same here.
15069 (Field.Define): Ditto.
15071 (Event.Define): Ditto.
15073 (Operator.Define): Check that the underlying Method defined itself
15074 correctly - so it's MethodBuilder should not be null.
15076 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15077 expression happens to be null.
15079 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15080 members but as of now we don't seem to be able to do anything really useful with it.
15082 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15083 not the EventBuilder.
15085 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15087 * cs-tokenizer.cs: Add support for defines.
15088 Add support for #if, #elif, #else, #endif
15090 (eval_var): evaluates a variable.
15091 (eval): stubbed for evaluating functions.
15093 * cs-parser.jay: Pass the defines information
15095 * driver.cs: Add --define command line option.
15097 * decl.cs: Move MemberCore here.
15099 Make it the base class for DeclSpace. This allows us to catch and
15100 report 108 and 109 for everything now.
15102 * class.cs (TypeContainer.Define): Extract all the members
15103 before populating and emit the warning 108 (new keyword required
15104 to override) instead of having each member implement this.
15106 (MemberCore.Define): New abstract method, we will be using this in
15107 the warning reporting engine in Populate.
15109 (Operator.Define): Adjust to new MemberCore protocol.
15111 * const.cs (Const): This does not derive from Expression, it is a
15112 temporary object we use to create fields, it is a MemberCore.
15114 * class.cs (Method.Define): Allow the entry point to be in a
15117 * driver.cs: Rewrite the argument handler to clean it up a bit.
15119 * rootcontext.cs: Made it just an auxiliary namespace feature by
15120 making everything static.
15122 * driver.cs: Adapt code to use RootContext type name instead of
15125 * delegate.cs: Remove RootContext argument.
15127 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15130 * class.cs (Event.Define): The lookup can fail.
15132 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15134 * expression.cs: Resolve the this instance before invoking the code.
15136 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15138 * cs-parser.jay: Add a production in element_access that allows
15139 the thing to become a "type" reference. This way we can parse
15140 things like "(string [])" as a type.
15142 Note that this still does not handle the more complex rules of
15146 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15148 * ecore.cs: (CopyNewMethods): new utility function used to
15149 assemble the list of methods from running FindMembers.
15151 (MemberLookup): Rework FindMembers so that
15153 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15155 * class.cs (TypeContainer): Remove Delegates who fail to be
15158 * delegate.cs (Populate): Verify that we dont get null return
15159 values. TODO: Check for AsAccessible.
15161 * cs-parser.jay: Use basename to emit error 574 (destructor should
15162 have the same name as container class), not the full name.
15164 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15165 possible representation.
15167 Also implements integer type suffixes U and L.
15169 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15171 * expression.cs (ArrayCreation.DoResolve): We need to do the
15172 argument resolution *always*.
15174 * decl.cs: Make this hold the namespace. Hold the root context as
15176 (LookupType): Move here.
15178 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15180 * location.cs (Row, Name): Fixed the code, it was always returning
15181 references to the first file.
15183 * interface.cs: Register properties defined through interfaces.
15185 * driver.cs: Add support for globbing on the command line
15187 * class.cs (Field): Make it derive from MemberCore as well.
15190 2001-12-15 Ravi Pratap <ravi@ximian.com>
15192 * class.cs (Event::Define): Check that the type of the event is a delegate
15193 type else flag error #66.
15195 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15198 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15199 values of EntryPoint, CharSet etc etc.
15201 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15203 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15204 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15205 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15206 which needs this to do its work.
15208 * ../errors/cs0066.cs : Add.
15210 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15212 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15215 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15216 clears out the parameters field.
15217 (MemberSignatureCompare): Cleanup
15219 (MemberCore): New base class used to share code between MethodCore
15222 (RegisterRequiredImplementations) BindingFlags.Public requires
15223 either BindingFlags.Instace or Static. Use instance here.
15225 (Property): Refactored code to cope better with the full spec.
15227 * parameter.cs (GetParameterInfo): Return an empty array instead
15230 * class.cs (Property): Abstract or extern properties have no bodies.
15232 * parameter.cs (GetParameterInfo): return a zero-sized array.
15234 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15235 method modifier validation to the typecontainer so we can reuse
15236 this on properties.
15238 (MethodCore.ParameterTypes): return an empty sized array of types.
15240 (Property.Define): Test property modifier validity.
15242 Add tests for sealed/override too.
15244 (Method.Emit): abstract or extern methods have no bodies.
15246 2001-12-14 Ravi Pratap <ravi@ximian.com>
15248 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15251 (Method::Define, ::Emit): Modify accordingly.
15253 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15255 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15257 * makefile: Pass in /unsafe.
15259 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15261 * class.cs (MakeKey): Kill routine.
15263 * class.cs (TypeContainer.Define): Correctly define explicit
15264 method implementations (they require the full interface name plus
15267 * typemanager.cs: Deply the PtrHashtable here and stop using the
15268 lame keys. Things work so much better.
15270 This of course broke everyone who depended on `RegisterMethod' to
15271 do the `test for existance' test. This has to be done elsewhere.
15273 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15274 the object stupid Equals method (because, that like fails all over
15275 the place). We still do not use it.
15277 * class.cs (TypeContainer.SetRequiredInterface,
15278 TypeContainer.RequireMethods): Killed these two routines and moved
15279 all the functionality to RegisterRequiredImplementations.
15281 (TypeContainer.RegisterRequiredImplementations): This routine now
15282 registers all the implementations required in an array for the
15283 interfaces and abstract methods. We use an array of structures
15284 which can be computed ahead of time to reduce memory usage and we
15285 also assume that lookups are cheap as most classes will not
15286 implement too many interfaces.
15288 We also avoid creating too many MethodSignatures.
15290 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15291 clear the "pending" bit if we find that there are problems with
15294 (TypeContainer.VerifyPendingMethods): Update to report errors of
15295 methods that look like implementations but are not.
15297 (TypeContainer.Define): Add support for explicit interface method
15300 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15302 * typemanager.cs: Keep track of the parameters here instead of
15303 being a feature of the TypeContainer.
15305 * class.cs: Drop the registration of parameters here, as
15306 InterfaceMethods are also interface declarations.
15308 * delegate.cs: Register methods with the TypeManager not only with
15309 the TypeContainer. This code was buggy.
15311 * interface.cs: Full registation here.
15313 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15315 * expression.cs: Remove reducer for binary expressions, it can not
15318 * const.cs: Put here the code that used to go into constant.cs
15320 * constant.cs: Put here the code for constants, this is a new base
15321 class for Literals.
15323 * literal.cs: Make Literal derive from Constant.
15325 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15327 * statement.cs (Return.Emit): Report error 157 if the user
15328 attempts to return from a finally block.
15330 (Return.Emit): Instead of emitting a return, jump to the end of
15333 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15334 LocalBuilder to store the result of the function. ReturnLabel is
15335 the target where we jump.
15338 2001-12-09 Radek Doulik <rodo@ximian.com>
15340 * cs-parser.jay: remember alias in current namespace
15342 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15345 * class.cs (LookupAlias): lookup alias in my_namespace
15347 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15349 (LookupAlias): lookup alias in this and if needed in parent
15352 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15356 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15357 making things static. I need this to avoid passing the
15358 TypeContainer when calling ParameterType.
15360 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15361 that did string manipulation to compute the type and then call
15362 GetType. Use Parameter.ParameterType instead.
15364 * cs-tokenizer.cs: Consume the suffix for floating values.
15366 * expression.cs (ParameterReference): figure out whether this is a
15367 reference parameter or not. Kill an extra variable by computing
15368 the arg_idx during emission.
15370 * parameter.cs (Parameters.GetParameterInfo): New overloaded
15371 function that returns whether a parameter is an out/ref value or not.
15373 (Parameter.ParameterType): The type of the parameter (base,
15374 without ref/out applied).
15376 (Parameter.Resolve): Perform resolution here.
15377 (Parameter.ExternalType): The full type (with ref/out applied).
15379 * statement.cs (Using.Emit, Using.EmitExpression): Implement
15380 support for expressions on the using statement.
15382 2001-12-07 Miguel de Icaza <miguel@ximian.com>
15384 * statement.cs (Using.EmitLocalVariableDecls): Split the
15385 localvariable handling of the using statement.
15387 (Block.EmitMeta): Keep track of variable count across blocks. We
15388 were reusing slots on separate branches of blocks.
15390 (Try.Emit): Emit the general code block, we were not emitting it.
15392 Check the type of the declaration to be an IDisposable or
15393 something that can be implicity converted to it.
15395 Emit conversions if required.
15397 * ecore.cs (EmptyExpression): New utility class.
15398 (Expression.ImplicitConversionExists): New utility function.
15400 2001-12-06 Miguel de Icaza <miguel@ximian.com>
15402 * statement.cs (Using): Implement.
15404 * expression.cs (LocalVariableReference): Support read only variables.
15406 * statement.cs: Remove the explicit emit for the Leave opcode.
15407 (VariableInfo): Add a readonly field.
15409 2001-12-05 Miguel de Icaza <miguel@ximian.com>
15411 * ecore.cs (ConvCast): new class used to encapsulate the various
15412 explicit integer conversions that works in both checked and
15413 unchecked contexts.
15415 (Expression.ConvertNumericExplicit): Use new ConvCast class to
15416 properly generate the overflow opcodes.
15418 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15420 * statement.cs: The correct type for the EmptyExpression is the
15421 element_type, not the variable type. Ravi pointed this out.
15423 2001-12-04 Ravi Pratap <ravi@ximian.com>
15425 * class.cs (Method::Define): Handle PInvoke methods specially
15426 by using DefinePInvokeMethod instead of the usual one.
15428 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
15429 above to do the task of extracting information and defining the method.
15431 2001-12-04 Ravi Pratap <ravi@ximian.com>
15433 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
15434 of the condition for string type.
15436 (Emit): Move that here.
15438 (ArrayCreation::CheckIndices): Keep string literals in their expression
15441 (EmitDynamicInitializers): Handle strings appropriately.
15443 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15445 * codegen.cs (EmitContext): Replace multiple variables with a
15446 single pointer to the current Switch statement.
15448 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
15451 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15455 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
15458 (Foreach.Emit): Foreach on arrays was not setting
15459 up the loop variables (for break/continue).
15461 (GotoCase): Semi-implented.
15463 2001-12-03 Ravi Pratap <ravi@ximian.com>
15465 * attribute.cs (CheckAttribute): Handle system attributes by using
15466 Attribute.GetAttributes to examine information we need.
15468 (GetValidPlaces): Same here.
15470 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
15472 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
15474 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
15476 (Method::Define): Set appropriate flags if we have a DllImport attribute.
15478 (Method::Emit): Handle the case when we are a PInvoke method.
15480 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15482 * expression.cs: Use ResolveWithSimpleName on compound names.
15484 2001-12-02 Ravi Pratap <ravi@ximian.com>
15486 * constant.cs (EmitConstant): Make sure we resolve the associated expression
15487 before trying to reduce it.
15489 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
15491 * constant.cs (LookupConstantValue): Implement.
15493 (EmitConstant): Use the above in emitting the constant.
15495 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
15496 that are user-defined by doing a LookupConstantValue on them.
15498 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
15501 2001-11-29 Miguel de Icaza <miguel@ximian.com>
15503 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
15505 (BaseAccess.DoResolve): Implement.
15507 (MemberAccess.DoResolve): Split this routine into a
15508 ResolveMemberAccess routine that can be used independently
15510 2001-11-28 Miguel de Icaza <miguel@ximian.com>
15512 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
15513 As that share bits of the implementation. Is returns a boolean,
15514 while As returns the Type that is being probed.
15516 2001-12-01 Ravi Pratap <ravi@ximian.com>
15518 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
15519 instead of a Literal - much easier.
15521 (EnumInTransit): Remove - utterly useless :-)
15523 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
15525 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
15527 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
15528 chain when we have no associated expression.
15530 2001-11-30 Ravi Pratap <ravi@ximian.com>
15532 * constant.cs (Define): Use Location while reporting the errror.
15534 Also emit a warning when 'new' is used and there is no inherited
15537 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
15540 (LookupEnumValue): Implement to lookup an enum member's value and define it
15543 (Populate): Re-write accordingly to use the above routine.
15545 2001-11-27 Miguel de Icaza <miguel@ximian.com>
15547 * expression.cs (This): Fix prototype for DoResolveLValue to
15548 override the base class DoResolveLValue.
15550 * cs-parser.cs: Report errors cs574 and cs575 (destructor
15553 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
15554 (we need to load the address of the field here). This fixes
15557 (FieldExpr.DoResolveLValue): Call the DoResolve
15558 function to initialize the Instance expression.
15560 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
15561 correctly the GetEnumerator operation on a value type.
15563 * cs-parser.jay: Add more simple parsing error catches.
15565 * statement.cs (Switch): Add support for string switches.
15566 Handle null specially.
15568 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
15570 2001-11-28 Ravi Pratap <ravi@ximian.com>
15572 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
15574 (declare_local_constant): New helper function.
15576 * statement.cs (AddConstant): Keep a separate record of constants
15578 (IsConstant): Implement to determine if a variable is a constant.
15580 (GetConstantExpression): Implement.
15582 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
15584 * statement.cs (IsVariableDefined): Re-write.
15586 2001-11-27 Ravi Pratap <ravi@ximian.com>
15588 * class.cs (TypeContainer::FindMembers): Look for constants
15589 in the case when we are looking for MemberTypes.Field
15591 * expression.cs (MemberAccess::DoResolve): Check that in the
15592 case we are a FieldExpr and a Literal, we are not being accessed
15593 by an instance reference.
15595 * cs-parser.jay (local_constant_declaration): Implement.
15597 (declaration_statement): Implement for constant declarations.
15599 2001-11-26 Miguel de Icaza <miguel@ximian.com>
15601 * statement.cs (Switch): Catch double defaults.
15603 (Switch): More work on the switch() statement
15604 implementation. It works for integral values now, need to finish
15608 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15610 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
15611 integer literals into other integer literals. To be used by
15614 2001-11-24 Ravi Pratap <ravi@ximian.com>
15616 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
15619 (EmitDynamicInitializers): Cope with the above since we extract data
15620 directly from ArrayData now.
15622 (ExpectInitializers): Keep track of whether initializers are mandatory
15625 (Bounds): Make it a hashtable to prevent the same dimension being
15626 recorded for every element in that dimension.
15628 (EmitDynamicInitializers): Fix bug which prevented the Set array method
15631 Also fix bug which was causing the indices to be emitted in the reverse
15634 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15636 * expression.cs (ArrayCreation): Implement the bits that Ravi left
15637 unfinished. They do not work, because the underlying code is
15640 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15642 * cs-parser.jay: Remove bogus fixme.
15644 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
15645 on Switch statement.
15647 2001-11-23 Ravi Pratap <ravi@ximian.com>
15649 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
15652 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
15653 parameter. Apparently, any expression is allowed.
15655 (ValidateInitializers): Update accordingly.
15657 (CheckIndices): Fix some tricky bugs thanks to recursion.
15659 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
15660 I was being completely brain-dead.
15662 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
15663 and re-write acordingly.
15665 (DelegateInvocation): Re-write accordingly.
15667 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
15669 (MakeByteBlob): Handle types more correctly.
15671 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
15672 initialization from expressions but it is incomplete because I am a complete
15675 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15677 * statement.cs (If.Emit): Fix a bug that generated incorrect code
15678 on If. Basically, we have to return `true' (ie, we do return to
15679 our caller) only if both branches of the if return.
15681 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
15682 short-circuit operators, handle them as short circuit operators.
15684 (Cast.DoResolve): Resolve type.
15685 (Cast.Cast): Take an expression as the target type.
15687 * cs-parser.jay (cast_expression): Remove old hack that only
15688 allowed a limited set of types to be handled. Now we take a
15689 unary_expression and we resolve to a type during semantic
15692 Use the grammar productions from Rhys to handle casts (this is
15693 not complete like Rhys syntax yet, we fail to handle that corner
15694 case that C# has regarding (-x), but we will get there.
15696 2001-11-22 Ravi Pratap <ravi@ximian.com>
15698 * class.cs (EmitFieldInitializer): Take care of the case when we have a
15699 field which is an array type.
15701 * cs-parser.jay (declare_local_variables): Support array initialization too.
15703 * typemanager.cs (MakeKey): Implement.
15705 (everywhere): Use the above appropriately.
15707 * cs-parser.jay (for_statement): Update for array initialization while
15708 declaring variables.
15710 * ecore.cs : The error message was correct, it's the variable's names that
15711 were misleading ;-) Make the code more readable.
15713 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
15714 the correct type etc.
15716 (ConvertExplicit): Handle Enum types by examining the underlying type.
15718 2001-11-21 Ravi Pratap <ravi@ximian.com>
15720 * parameter.cs (GetCallingConvention): Always return
15721 CallingConventions.Standard for now.
15723 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15725 * expression.cs (Binary.ResolveOperator): Update the values of `l'
15726 and `r' after calling DoNumericPromotions.
15728 * ecore.cs: Fix error message (the types were in the wrong order).
15730 * statement.cs (Foreach.ProbeCollectionType): Need to pass
15731 BindingFlags.Instance as well
15733 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
15734 implicit int literal conversion in an empty cast so that we
15735 propagate the right type upstream.
15737 (UnboxCast): new class used to unbox value types.
15738 (Expression.ConvertExplicit): Add explicit type conversions done
15741 (Expression.ImplicitNumericConversion): Oops, forgot to test for
15742 the target type before applying the implicit LongLiterals to ULong
15745 2001-11-21 Miguel de Icaza <miguel@ximian.com>
15747 * cs-parser.jay (for_statement): Reworked the way For works: now
15748 we declare manually any variables that are introduced in
15749 for_initializer to solve the problem of having out-of-band code
15750 emition (that is what got for broken).
15752 (declaration_statement): Perform the actual variable declaration
15753 that used to be done in local_variable_declaration here.
15755 (local_variable_declaration): Do not declare anything, just pass
15756 the information on a DictionaryEntry
15758 2001-11-20 Ravi Pratap <ravi@ximian.com>
15760 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
15761 re-write of the logic to now make it recursive.
15763 (UpdateIndices): Re-write accordingly.
15765 Store element data in a separate ArrayData list in the above methods.
15767 (MakeByteBlob): Implement to dump the array data into a byte array.
15769 2001-11-19 Ravi Pratap <ravi@ximian.com>
15771 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
15774 * constant.cs (Define): Implement.
15776 (EmitConstant): Re-write fully.
15778 Pass in location info.
15780 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
15783 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
15784 DictionaryEntry since we need location info too.
15786 (constant_declaration): Update accordingly.
15788 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
15789 code into another method : UpdateIndices.
15791 2001-11-18 Ravi Pratap <ravi@ximian.com>
15793 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
15794 some type checking etc.
15796 2001-11-17 Ravi Pratap <ravi@ximian.com>
15798 * expression.cs (ArrayCreation::ValidateInitializers): Implement
15799 bits to provide dimension info if the user skips doing that.
15801 Update second constructor to store the rank correctly.
15803 2001-11-16 Ravi Pratap <ravi@ximian.com>
15805 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
15806 and try to implement.
15808 * ../errors/cs0150.cs : Add.
15810 * ../errors/cs0178.cs : Add.
15812 2001-11-16 Miguel de Icaza <miguel@ximian.com>
15814 * statement.cs: Implement foreach on multi-dimensional arrays.
15816 * parameter.cs (Parameters.GetParameterByName): Also lookup the
15817 name of the params argument.
15819 * expression.cs: Use EmitStoreOpcode to get the right opcode while
15820 initializing the array.
15822 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
15823 we can use this elsewhere.
15825 * statement.cs: Finish implementation of foreach for single
15828 * cs-parser.jay: Use an out-of-band stack to pass information
15829 around, I wonder why I need this.
15831 foreach_block: Make the new foreach_block the current_block.
15833 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
15834 function used to return a static Parameters structure. Used for
15835 empty parameters, as those are created very frequently.
15837 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
15839 2001-11-15 Ravi Pratap <ravi@ximian.com>
15841 * interface.cs : Default modifier is private, not public. The
15842 make verify test passes again.
15844 2001-11-15 Ravi Pratap <ravi@ximian.com>
15846 * support.cs (ReflectionParameters): Fix logic to determine
15847 whether the last parameter is a params one. Test 9 passes again.
15849 * delegate.cs (Populate): Register the builders we define with
15850 RegisterParameterForBuilder. Test 19 passes again.
15852 * cs-parser.jay (property_declaration): Reference $6 instead
15853 of $$ to get at the location.
15855 (indexer_declaration): Similar stuff.
15857 (attribute): Ditto.
15859 * class.cs (Property): Register parameters for the Get and Set methods
15860 if they exist. Test 23 passes again.
15862 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
15863 call to EmitArguments as we are sure there aren't any params arguments.
15864 Test 32 passes again.
15866 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
15867 IndexOutOfRangeException.
15869 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
15870 Test 33 now passes again.
15872 2001-11-15 Miguel de Icaza <miguel@ximian.com>
15874 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
15875 broke a bunch of things. Will have to come up with a better way
15876 of tracking locations.
15878 * statement.cs: Implemented foreach for single dimension arrays.
15880 2001-11-09 Miguel de Icaza <miguel@ximian.com>
15882 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
15883 an error. This removes the lookup from the critical path.
15885 * cs-parser.jay: Removed use of temporary_loc, which is completely
15888 2001-11-14 Miguel de Icaza <miguel@ximian.com>
15890 * support.cs (ReflectionParameters.ParameterModifier): Report
15891 whether the argument is a PARAMS argument or not.
15893 * class.cs: Set the attribute `ParamArrayAttribute' on the
15894 parameter argument.
15896 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
15897 and cons_param_array_attribute (ConstructorInfo for
15898 ParamArrayAttribute).,
15900 * codegen.cs: Emit the return using the `Return' statement, that
15901 way we can report the error correctly for missing return values.
15903 * class.cs (Method.Emit): Clean up.
15905 * expression.cs (Argument.Resolve): Take another argument: the
15906 location where this argument is used. Notice that this is not
15907 part of the "Argument" class as to reduce the size of the
15908 structure (we know the approximate location anyways).
15910 Test if the argument is a variable-reference, if not, then
15911 complain with a 206.
15913 (Argument.Emit): Emit addresses of variables.
15915 (Argument.FullDesc): Simplify.
15917 (Invocation.DoResolve): Update for Argument.Resolve.
15919 (ElementAccess.DoResolve): ditto.
15921 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
15922 method should be virtual, as this method is always virtual.
15924 (NewDelegate.DoResolve): Update for Argument.Resolve.
15926 * class.cs (ConstructorInitializer.DoResolve): ditto.
15928 * attribute.cs (Attribute.Resolve): ditto.
15930 2001-11-13 Miguel de Icaza <miguel@ximian.com>
15932 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
15934 * expression.cs (ParameterReference): Drop IStackStorage and implement
15935 IAssignMethod instead.
15937 (LocalVariableReference): ditto.
15939 * ecore.cs (FieldExpr): Drop IStackStorage and implement
15940 IAssignMethod instead.
15942 2001-11-13 Miguel de Icaza <miguel@ximian.com>
15944 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
15945 enumerations that are used in heavily used structures derive from
15946 byte in a laughable and pathetic attempt to reduce memory usage.
15947 This is the kind of pre-optimzations that you should not do at
15948 home without adult supervision.
15950 * expression.cs (UnaryMutator): New class, used to handle ++ and
15951 -- separatedly from the other unary operators. Cleans up the
15952 code, and kills the ExpressionStatement dependency in Unary.
15954 (Unary): Removed `method' and `Arguments' from this class, making
15955 it smaller, and moving it all to SimpleCall, so I can reuse this
15956 code in other locations and avoid creating a lot of transient data
15957 strucutres when not required.
15959 * cs-parser.jay: Adjust for new changes.
15961 2001-11-11 Miguel de Icaza <miguel@ximian.com>
15963 * enum.cs (Enum.Populate): If there is a failure during
15966 * cs-parser.jay (opt_enum_base): we used to catch type errors
15967 here, but this is really incorrect. The type error should be
15968 catched during semantic analysis.
15970 2001-12-11 Ravi Pratap <ravi@ximian.com>
15972 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
15973 current_local_parameters as expected since I, in my stupidity, had forgotten
15976 * attribute.cs (GetValidPlaces): Fix stupid bug.
15978 * class.cs (Method::Emit): Perform check on applicability of attributes.
15980 (Constructor::Emit): Ditto.
15982 (Field::Emit): Ditto.
15984 (Field.Location): Store location information.
15986 (Property, Event, Indexer, Operator): Ditto.
15988 * cs-parser.jay (field_declaration): Pass in location for each field.
15990 * ../errors/cs0592.cs : Add.
15992 2001-11-12 Ravi Pratap <ravi@ximian.com>
15994 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
15996 (InitCoreTypes): Update accordingly.
15998 (RegisterAttrType, LookupAttr): Implement.
16000 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16001 info about the same.
16003 (Resolve): Update to populate the above as necessary.
16005 (Error592): Helper.
16007 (GetValidPlaces): Helper to the above.
16009 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16011 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16013 2001-11-12 Ravi Pratap <ravi@ximian.com>
16015 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16017 * ../errors/cs0617.cs : Add.
16019 2001-11-11 Ravi Pratap <ravi@ximian.com>
16021 * enum.cs (Emit): Rename to Populate to be more consistent with what
16022 we expect it to do and when exactly it is called.
16024 * class.cs, rootcontext.cs : Update accordingly.
16026 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16027 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16029 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16031 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16032 of a fieldinfo using the above, when dealing with a FieldBuilder.
16034 2001-11-10 Ravi Pratap <ravi@ximian.com>
16036 * ../errors/cs0031.cs : Add.
16038 * ../errors/cs1008.cs : Add.
16040 * ../errrors/cs0543.cs : Add.
16042 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16045 (FindMembers): Implement.
16047 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16048 enums and delegates too.
16050 (enum_types): Rename to builder_to_enum.
16052 (delegate_types): Rename to builder_to_delegate.
16054 * delegate.cs (FindMembers): Implement.
16056 2001-11-09 Ravi Pratap <ravi@ximian.com>
16058 * typemanager.cs (IsEnumType): Implement.
16060 * enum.cs (Emit): Re-write parts to account for the underlying type
16061 better and perform checking etc.
16063 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16064 of the underlying type.
16066 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16069 * enum.cs (error31): Helper to report error #31.
16071 * cs-parser.jay (enum_declaration): Store location of each member too.
16073 * enum.cs (member_to_location): New hashtable.
16075 (AddEnumMember): Update location hashtable.
16077 (Emit): Use the location of each member while reporting errors.
16079 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16081 * cs-parser.jay: A for_initializer if is a
16082 local_variable_declaration really ammount to have an implicit
16083 block with the variable declaration and no initializer for for.
16085 * statement.cs (For.Emit): Cope with null initializers.
16087 This fixes the infinite loop on for initializers.
16089 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16091 * enum.cs: More cleanup.
16093 * ecore.cs: Remove dead code.
16095 * class.cs (Property.Emit): More simplification.
16096 (Event.Emit): ditto.
16098 Reworked to have less levels of indentation.
16100 2001-11-08 Ravi Pratap <ravi@ximian.com>
16102 * class.cs (Property): Emit attributes.
16112 * enum.cs (Emit): Ditto.
16114 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16117 * class.cs (Field, Event, etc.): Move attribute generation into the
16118 Emit method everywhere.
16120 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16121 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16122 as we had no way of defining nested enums !
16124 * rootcontext.cs : Adjust code accordingly.
16126 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16128 2001-11-07 Ravi Pratap <ravi@ximian.com>
16130 * expression.cs (EvalConstantExpression): Move into ecore.cs
16132 * enum.cs (Enum): Rename some members and make them public and readonly
16133 according to our convention.
16135 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16138 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16140 (Enum::Emit): Write a simple version for now which doesn't try to compute
16141 expressions. I shall modify this to be more robust in just a while.
16143 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16145 (TypeContainer::CloseType): Create the Enum types too.
16147 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16149 * expression.cs (EvalConstantExpression): Get rid of completely.
16151 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16152 user-defined values and other cases.
16154 (IsValidEnumLiteral): Helper function.
16156 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16157 out there in the case we had a literal FieldExpr.
16159 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16161 (Literalize): Revamp a bit to take two arguments.
16163 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16165 2001-11-06 Ravi Pratap <ravi@ximian.com>
16167 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16169 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16171 (Resolve): Use the above to ensure we have proper initializers.
16173 2001-11-05 Ravi Pratap <ravi@ximian.com>
16175 * expression.cs (Expression::EvalConstantExpression): New method to
16176 evaluate constant expressions.
16178 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16180 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16182 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16185 (Binary.ResolveOperator): Handle operator != (object a, object b)
16186 and operator == (object a, object b);
16188 (Binary.DoNumericPromotions): Indicate whether the numeric
16189 promotion was possible.
16191 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16194 Made the ArrayAccess implement interface IAssignMethod instead of
16195 IStackStore as the order in which arguments are passed reflects
16198 * assign.cs: Instead of using expr.ExprClass to select the way of
16199 assinging, probe for the IStackStore/IAssignMethod interfaces.
16201 * typemanager.cs: Load InitializeArray definition.
16203 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16204 static data that can be used to initialize arrays.
16206 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16208 * expression.cs: Handle operator== and operator!= for booleans.
16210 (Conditioal.Reduce): Implement reducer for the ?: operator.
16212 (Conditional.Resolve): Implement dead code elimination.
16214 (Binary.Resolve): Catch string literals and return a new
16215 concatenated string.
16217 (Unary.Reduce): Implement reduction of unary expressions.
16219 * ecore.cs: Split out the expression core handling here.
16221 (Expression.Reduce): New method used to perform constant folding
16222 and CSE. This is needed to support constant-expressions.
16224 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16225 targets, and optimize for !x.
16227 2001-11-04 Ravi Pratap <ravi@ximian.com>
16229 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16230 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16231 set custom atttributes.
16233 * literal.cs (Literal::GetValue): New abstract method to return the actual
16234 value of the literal, cast as an object.
16236 (*Literal): Implement GetValue method.
16238 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16239 expressions to the arraylist but objects of type Argument.
16241 * class.cs (TypeContainer::Emit): Emit our attributes too.
16243 (Method::Emit, Constructor::Emit): Ditto.
16245 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16246 to be ignoring earlier.
16248 2001-11-03 Ravi Pratap <ravi@ximian.com>
16250 * attribute.cs (AttributeSection::Define): Implement to do the business
16251 of constructing a CustomAttributeBuilder.
16253 (Attribute): New trivial class. Increases readability of code.
16255 * cs-parser.jay : Update accordingly.
16257 (positional_argument_list, named_argument_list, named_argument): New rules
16259 (attribute_arguments): Use the above so that we are more correct.
16261 2001-11-02 Ravi Pratap <ravi@ximian.com>
16263 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16264 to perform all checks for a method with a params parameter.
16266 (Invocation::OverloadResolve): Update to use the above method and therefore
16267 cope correctly with params method invocations.
16269 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16272 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16273 constructors in our parent too because we can't afford to miss out on
16276 * attribute.cs (AttributeSection): New name for the class Attribute
16278 Other trivial changes to improve readability.
16280 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16281 use the new class names.
16283 2001-11-01 Ravi Pratap <ravi@ximian.com>
16285 * class.cs (Method::Define): Complete definition for params types too
16287 (Indexer::Define): Ditto.
16289 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16290 Cope everywhere with a request for info about the array parameter.
16292 2001-11-01 Ravi Pratap <ravi@ximian.com>
16294 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16296 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16297 local_variable_type to extract the string corresponding to the type.
16299 (local_variable_type): Fixup the action to use the new helper method.
16301 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16304 * expression.cs : Clean out code which uses the above.
16306 2001-10-31 Ravi Pratap <ravi@ximian.com>
16308 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16309 and bale out if necessary by returning a false.
16311 (RegisterProperty): Ditto.
16313 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16314 and print out appropriate error messages.
16316 * interface.cs (everywhere): Ditto.
16318 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16319 location to constructor.
16321 * class.cs (Property, Event, Indexer): Update accordingly.
16323 * ../errors/cs111.cs : Added.
16325 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16326 of a method, as laid down by the spec.
16328 (Invocation::OverloadResolve): Use the above method.
16330 2001-10-31 Ravi Pratap <ravi@ximian.com>
16332 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16333 now take a TypeContainer and a Parameters object.
16335 (ParameterData): Modify return type of ParameterModifier method to be
16336 Parameter.Modifier and not a string.
16338 (ReflectionParameters, InternalParameters): Update accordingly.
16340 * expression.cs (Argument::GetParameterModifier): Same here.
16342 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16343 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16344 symbol in it at all so maybe this is only for now.
16346 2001-10-30 Ravi Pratap <ravi@ximian.com>
16348 * support.cs (InternalParameters): Constructor now takes an extra argument
16349 which is the actual Parameters class.
16351 (ParameterDesc): Update to provide info on ref/out modifiers.
16353 * class.cs (everywhere): Update call to InternalParameters to pass in
16354 the second argument too.
16356 * support.cs (ParameterData): Add ParameterModifier, which is a method
16357 to return the modifier info [ref/out etc]
16359 (InternalParameters, ReflectionParameters): Implement the above.
16361 * expression.cs (Argument::ParameterModifier): Similar function to return
16362 info about the argument's modifiers.
16364 (Invocation::OverloadResolve): Update to take into account matching modifiers
16367 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16368 a new SetFormalParameters object which we pass to InternalParameters.
16370 2001-10-30 Ravi Pratap <ravi@ximian.com>
16372 * expression.cs (NewArray): Merge into the ArrayCreation class.
16374 2001-10-29 Ravi Pratap <ravi@ximian.com>
16376 * expression.cs (NewArray): Merge classes NewBuiltinArray and
16377 NewUserdefinedArray into one as there wasn't much of a use in having
16380 * expression.cs (Argument): Change field's name to ArgType from Type.
16382 (Type): New readonly property which returns the proper type, taking into
16383 account ref/out modifiers.
16385 (everywhere): Adjust code accordingly for the above.
16387 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
16388 whether we are emitting for a ref or out parameter.
16390 * expression.cs (Argument::Emit): Use the above field to set the state.
16392 (LocalVariableReference::Emit): Update to honour the flag and emit the
16395 * parameter.cs (Attributes): Set the correct flags for ref parameters.
16397 * expression.cs (Argument::FullDesc): New function to provide a full desc.
16399 * support.cs (ParameterData): Add method ParameterDesc to the interface.
16401 (ReflectionParameters, InternalParameters): Implement the above method.
16403 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
16406 (Invocation::FullMethodDesc): Ditto.
16408 2001-10-29 Miguel de Icaza <miguel@ximian.com>
16410 * cs-parser.jay: Add extra production for the second form of array
16413 * expression.cs (ArrayCreation): Update to reflect the above
16416 * Small changes to prepare for Array initialization.
16418 2001-10-28 Miguel de Icaza <miguel@ximian.com>
16420 * typemanager.cs (ImplementsInterface): interface might be null;
16421 Deal with this problem;
16423 Also, we do store negative hits on the cache (null values), so use
16424 this instead of calling t.GetInterfaces on the type everytime.
16426 2001-10-28 Ravi Pratap <ravi@ximian.com>
16428 * typemanager.cs (IsBuiltinType): New method to help determine the same.
16430 * expression.cs (New::DoResolve): Get rid of array creation code and instead
16431 split functionality out into different classes.
16433 (New::FormArrayType): Move into NewBuiltinArray.
16435 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
16438 (NewBuiltinArray): New class to handle creation of built-in arrays.
16440 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
16441 account creation of one-dimensional arrays.
16443 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
16445 (NewUserdefinedArray::DoResolve): Implement.
16447 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
16449 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
16450 we maintain inside the TypeManager. This is necessary to perform lookups on the
16453 (LookupType): Update to perform GetType on the module builders too.
16455 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
16457 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
16459 2001-10-23 Ravi Pratap <ravi@ximian.com>
16461 * expression.cs (New::DoResolve): Implement guts of array creation.
16463 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
16465 2001-10-27 Miguel de Icaza <miguel@ximian.com>
16467 * expression.cs: Fix bug I introduced lsat night that broke
16470 (Expression.Resolve): Report a 246 error (can not resolve name)
16471 if we find a SimpleName in the stream.
16473 (Expression.ResolveLValue): Ditto.
16475 (Expression.ResolveWithSimpleName): This function is a variant of
16476 ResolveName, this one allows SimpleNames to be returned without a
16477 warning. The only consumer of SimpleNames is MemberAccess
16479 2001-10-26 Miguel de Icaza <miguel@ximian.com>
16481 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
16482 might arrive here. I have my doubts that this is correct.
16484 * statement.cs (Lock): Implement lock statement.
16486 * cs-parser.jay: Small fixes to support `lock' and `using'
16488 * cs-tokenizer.cs: Remove extra space
16490 * driver.cs: New flag --checked, allows to turn on integer math
16493 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
16494 Threading.Monitor.Exit
16496 2001-10-23 Miguel de Icaza <miguel@ximian.com>
16498 * expression.cs (IndexerAccess::DoResolveLValue): Set the
16499 Expression Class to be IndexerAccess.
16501 Notice that Indexer::DoResolve sets the eclass to Value.
16503 2001-10-22 Miguel de Icaza <miguel@ximian.com>
16505 * class.cs (TypeContainer::Emit): Emit code for indexers.
16507 * assign.cs (IAssignMethod): New interface implemented by Indexers
16508 and Properties for handling assignment.
16510 (Assign::Emit): Simplify and reuse code.
16512 * expression.cs (IndexerAccess, PropertyExpr): Implement
16513 IAssignMethod, clean up old code.
16515 2001-10-22 Ravi Pratap <ravi@ximian.com>
16517 * typemanager.cs (ImplementsInterface): New method to determine if a type
16518 implements a given interface. Provides a nice cache too.
16520 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
16523 (ConvertReferenceExplicit): Ditto.
16525 * delegate.cs (Delegate::Populate): Update to define the parameters on the
16526 various methods, with correct names etc.
16528 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
16529 Operator.UnaryNegation.
16531 * cs-parser.jay (operator_declarator): Be a little clever in the case where
16532 we have a unary plus or minus operator.
16534 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
16537 * everywhere : update accordingly.
16539 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
16542 * class.cs (Method::Define): For the case where we are implementing a method
16543 inherited from an interface, we need to set the MethodAttributes.Final flag too.
16544 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
16546 2001-10-21 Ravi Pratap <ravi@ximian.com>
16548 * interface.cs (FindMembers): Implement to work around S.R.E
16551 * typemanager.cs (IsInterfaceType): Implement.
16553 (FindMembers): Update to handle interface types too.
16555 * expression.cs (ImplicitReferenceConversion): Re-write bits which
16556 use IsAssignableFrom as that is not correct - it doesn't work.
16558 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
16559 and accordingly override EmitStatement.
16561 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
16562 using the correct logic :-)
16564 2001-10-19 Ravi Pratap <ravi@ximian.com>
16566 * ../errors/cs-11.cs : Add to demonstrate error -11
16568 2001-10-17 Miguel de Icaza <miguel@ximian.com>
16570 * assign.cs (Assign::Resolve): Resolve right hand side first, and
16571 then pass this as a hint to ResolveLValue.
16573 * expression.cs (FieldExpr): Add Location information
16575 (FieldExpr::LValueResolve): Report assignment to readonly
16578 (Expression::ExprClassFromMemberInfo): Pass location information.
16580 (Expression::ResolveLValue): Add new method that resolves an
16583 (Expression::DoResolveLValue): Default invocation calls
16586 (Indexers): New class used to keep track of indexers in a given
16589 (IStackStore): Renamed from LValue, as it did not really describe
16590 what this did. Also ResolveLValue is gone from this interface and
16591 now is part of Expression.
16593 (ElementAccess): Depending on the element access type
16595 * typemanager.cs: Add `indexer_name_type' as a Core type
16596 (System.Runtime.CompilerServices.IndexerNameAttribute)
16598 * statement.cs (Goto): Take a location.
16600 2001-10-18 Ravi Pratap <ravi@ximian.com>
16602 * delegate.cs (Delegate::VerifyDelegate): New method to verify
16603 if two delegates are compatible.
16605 (NewDelegate::DoResolve): Update to take care of the case when
16606 we instantiate a delegate from another delegate.
16608 * typemanager.cs (FindMembers): Don't even try to look up members
16609 of Delegate types for now.
16611 2001-10-18 Ravi Pratap <ravi@ximian.com>
16613 * delegate.cs (NewDelegate): New class to take care of delegate
16616 * expression.cs (New): Split the delegate related code out into
16617 the NewDelegate class.
16619 * delegate.cs (DelegateInvocation): New class to handle delegate
16622 * expression.cs (Invocation): Split out delegate related code into
16623 the DelegateInvocation class.
16625 2001-10-17 Ravi Pratap <ravi@ximian.com>
16627 * expression.cs (New::DoResolve): Implement delegate creation fully
16628 and according to the spec.
16630 (New::DoEmit): Update to handle delegates differently.
16632 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
16633 because of which we were printing out arguments in reverse order !
16635 * delegate.cs (VerifyMethod): Implement to check if the given method
16636 matches the delegate.
16638 (FullDelegateDesc): Implement.
16640 (VerifyApplicability): Implement.
16642 * expression.cs (Invocation::DoResolve): Update to accordingly handle
16643 delegate invocations too.
16645 (Invocation::Emit): Ditto.
16647 * ../errors/cs1593.cs : Added.
16649 * ../errors/cs1594.cs : Added.
16651 * delegate.cs (InstanceExpression, TargetMethod): New properties.
16653 2001-10-16 Ravi Pratap <ravi@ximian.com>
16655 * typemanager.cs (intptr_type): Core type for System.IntPtr
16657 (InitCoreTypes): Update for the same.
16659 (iasyncresult_type, asynccallback_type): Ditto.
16661 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
16664 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
16667 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
16668 the builders for the 4 members of a delegate type :-)
16670 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
16673 * expression.cs (New::DoResolve): Implement guts for delegate creation.
16675 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
16677 2001-10-15 Miguel de Icaza <miguel@ximian.com>
16679 * statement.cs (Break::Emit): Implement.
16680 (Continue::Emit): Implement.
16682 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
16683 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
16684 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
16685 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
16688 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
16689 properties that track the label for the current loop (begin of the
16690 loop and end of the loop).
16692 2001-10-15 Ravi Pratap <ravi@ximian.com>
16694 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
16695 use of emitting anything at all.
16697 * class.cs, rootcontext.cs : Get rid of calls to the same.
16699 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
16701 (Populate): Define the constructor correctly and set the implementation
16704 * typemanager.cs (delegate_types): New hashtable to hold delegates that
16707 (AddDelegateType): Implement.
16709 (IsDelegateType): Implement helper method.
16711 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
16713 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
16714 and accordingly handle it.
16716 * delegate.cs (Populate): Take TypeContainer argument.
16717 Implement bits to define the Invoke method. However, I still haven't figured out
16718 how to take care of the native int bit :-(
16720 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
16721 Qualify the name of the delegate, not its return type !
16723 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
16726 (StandardConversionExists): Checking for array types turns out to be recursive.
16728 (ConvertReferenceExplicit): Implement array conversion.
16730 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
16732 2001-10-12 Ravi Pratap <ravi@ximian.com>
16734 * cs-parser.jay (delegate_declaration): Store the fully qualified
16735 name as it is a type declaration.
16737 * delegate.cs (ReturnType, Name): Rename members to these. Make them
16740 (DefineDelegate): Renamed from Define. Does the same thing essentially,
16741 as TypeContainer::DefineType.
16743 (Populate): Method in which all the definition of the various methods (Invoke)
16746 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
16749 (CloseDelegate): Finally creates the delegate.
16751 * class.cs (TypeContainer::DefineType): Update to define delegates.
16752 (Populate, Emit and CloseType): Do the same thing here too.
16754 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
16755 delegates in all these operations.
16757 2001-10-14 Miguel de Icaza <miguel@ximian.com>
16759 * expression.cs: LocalTemporary: a new expression used to
16760 reference a temporary that has been created.
16762 * assign.cs: Handle PropertyAccess back here, so that we can
16763 provide the proper semantic access to properties.
16765 * expression.cs (Expression::ConvertReferenceExplicit): Implement
16766 a few more explicit conversions.
16768 * modifiers.cs: `NEW' modifier maps to HideBySig.
16770 * expression.cs (PropertyExpr): Make this into an
16771 ExpressionStatement, and support the EmitStatement code path.
16773 Perform get/set error checking, clean up the interface.
16775 * assign.cs: recognize PropertyExprs as targets, and if so, turn
16776 them into toplevel access objects.
16778 2001-10-12 Miguel de Icaza <miguel@ximian.com>
16780 * expression.cs: PropertyExpr::PropertyExpr: use work around the
16783 * typemanager.cs: Keep track here of our PropertyBuilders again to
16784 work around lameness in SRE.
16786 2001-10-11 Miguel de Icaza <miguel@ximian.com>
16788 * expression.cs (LValue::LValueResolve): New method in the
16789 interface, used to perform a second resolution pass for LValues.
16791 (This::DoResolve): Catch the use of this in static methods.
16793 (This::LValueResolve): Implement.
16795 (This::Store): Remove warning, assigning to `this' in structures
16798 (Invocation::Emit): Deal with invocation of
16799 methods on value types. We need to pass the address to structure
16800 methods rather than the object itself. (The equivalent code to
16801 emit "this" for structures leaves the entire structure on the
16802 stack instead of a pointer to it).
16804 (ParameterReference::DoResolve): Compute the real index for the
16805 argument based on whether the method takes or not a `this' pointer
16806 (ie, the method is static).
16808 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
16809 value types returned from functions when we need to invoke a
16810 method on the sturcture.
16813 2001-10-11 Ravi Pratap <ravi@ximian.com>
16815 * class.cs (TypeContainer::DefineType): Method to actually do the business of
16816 defining the type in the Modulebuilder or Typebuilder. This is to take
16817 care of nested types which need to be defined on the TypeBuilder using
16818 DefineNestedMethod.
16820 (TypeContainer::GetClassBases): Implement. Essentially the code from the
16821 methods in RootContext, only ported to be part of TypeContainer.
16823 (TypeContainer::GetInterfaceOrClass): Ditto.
16825 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
16827 * interface.cs (Interface::DefineInterface): New method. Does exactly
16828 what RootContext.CreateInterface did earlier, only it takes care of nested types
16831 (Interface::GetInterfaces): Move from RootContext here and port.
16833 (Interface::GetInterfaceByName): Same here.
16835 * rootcontext.cs (ResolveTree): Re-write.
16837 (PopulateTypes): Re-write.
16839 * class.cs (TypeContainer::Populate): Populate nested types too.
16840 (TypeContainer::Emit): Emit nested members too.
16842 * typemanager.cs (AddUserType): Do not make use of the FullName property,
16843 instead just use the name argument passed in as it is already fully
16846 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
16847 to TypeContainer mapping to see if a type is user-defined.
16849 * class.cs (TypeContainer::CloseType): Implement.
16851 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
16852 the default constructor.
16854 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
16857 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
16859 * interface.cs (CloseType): Create the type here.
16861 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
16864 Remove all the methods which are now in TypeContainer.
16866 2001-10-10 Ravi Pratap <ravi@ximian.com>
16868 * delegate.cs (Define): Re-write bits to define the delegate
16871 2001-10-10 Miguel de Icaza <miguel@ximian.com>
16873 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
16875 * expression.cs (ImplicitReferenceConversion): handle null as well
16876 as a source to convert to any reference type.
16878 * statement.cs (Return): Perform any implicit conversions to
16879 expected return type.
16881 Validate use of return statement.
16883 * codegen.cs (EmitContext): Pass the expected return type here.
16885 * class.cs (Method, Constructor, Property): Pass expected return
16886 type to EmitContext.
16888 2001-10-09 Miguel de Icaza <miguel@ximian.com>
16890 * expression.cs: Make DoResolve take an EmitContext instead of a
16893 Replaced `l' and `location' for `loc', for consistency.
16895 (Error, Warning): Remove unneeded Tc argument.
16897 * assign.cs, literal.cs, constant.cs: Update to new calling
16900 * codegen.cs: EmitContext now contains a flag indicating whether
16901 code is being generated in a static method or not.
16903 * cs-parser.jay: DecomposeQI, new function that replaces the old
16904 QualifiedIdentifier. Now we always decompose the assembled
16905 strings from qualified_identifier productions into a group of
16908 2001-10-08 Miguel de Icaza <miguel@ximian.com>
16910 * rootcontext.cs: Deal with field-less struct types correctly now
16911 by passing the size option to Define Type.
16913 * class.cs: Removed hack that created one static field.
16915 2001-10-07 Miguel de Icaza <miguel@ximian.com>
16917 * statement.cs: Moved most of the code generation here.
16919 2001-10-09 Ravi Pratap <ravi@ximian.com>
16921 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
16924 (ElementAccess): Remove useless bits for now - keep checks as the spec
16927 2001-10-08 Ravi Pratap <ravi@ximian.com>
16929 * expression.cs (ElementAccess::DoResolve): Remove my crap code
16930 and start performing checks according to the spec.
16932 2001-10-07 Ravi Pratap <ravi@ximian.com>
16934 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
16935 rank_specifiers instead.
16937 (rank_specifiers): Change the order in which the rank specifiers are stored
16939 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
16941 * expression.cs (ElementAccess): Implement the LValue interface too.
16943 2001-10-06 Ravi Pratap <ravi@ximian.com>
16945 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
16946 except that user defined conversions are not included.
16948 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
16949 perform the conversion of the return type, if necessary.
16951 (New::DoResolve): Check whether we are creating an array or an object
16952 and accordingly do the needful.
16954 (New::Emit): Same here.
16956 (New::DoResolve): Implement guts of array creation.
16958 (New::FormLookupType): Helper function.
16960 2001-10-07 Miguel de Icaza <miguel@ximian.com>
16962 * codegen.cs: Removed most of the code generation here, and move the
16963 corresponding code generation bits to the statement classes.
16965 Added support for try/catch/finalize and throw.
16967 * cs-parser.jay: Added support for try/catch/finalize.
16969 * class.cs: Catch static methods having the flags override,
16970 virtual or abstract.
16972 * expression.cs (UserCast): This user cast was not really doing
16973 what it was supposed to do. Which is to be born in fully resolved
16974 state. Parts of the resolution were being performed at Emit time!
16978 2001-10-05 Miguel de Icaza <miguel@ximian.com>
16980 * expression.cs: Implicity convert the result from UserCast.
16982 2001-10-05 Ravi Pratap <ravi@ximian.com>
16984 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
16985 prevented it from working correctly.
16987 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
16988 merely ConvertImplicit.
16990 2001-10-05 Miguel de Icaza <miguel@ximian.com>
16992 * typemanager.cs: Make the LookupTypeContainer function static,
16993 and not per-instance.
16995 * class.cs: Make static FindMembers (the one that takes a Type
16998 * codegen.cs: Add EmitForeach here.
17000 * cs-parser.jay: Make foreach a toplevel object instead of the
17001 inline expansion, as we need to perform semantic analysis on it.
17003 2001-10-05 Ravi Pratap <ravi@ximian.com>
17005 * expression.cs (Expression::ImplicitUserConversion): Rename to
17006 UserDefinedConversion.
17008 (Expression::UserDefinedConversion): Take an extra argument specifying
17009 whether we look for explicit user conversions too.
17011 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17013 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17015 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17016 with the appropriate arguments.
17018 * cs-parser.jay (cast_expression): Record location too.
17020 * expression.cs (Cast): Record location info.
17022 (Expression::ConvertExplicit): Take location argument.
17024 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17025 to determine if we are doing explicit conversions.
17027 (UserCast::Emit): Update accordingly.
17029 (Expression::ConvertExplicit): Report an error if everything fails.
17031 * ../errors/cs0030.cs : Add.
17033 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17035 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17036 virtual and newslot bits.
17038 * class.cs (TypeContainer::RegisterRequiredImplementations):
17039 Record methods we need.
17041 (TypeContainer::MakeKey): Helper function to make keys for
17042 MethodBases, since the Methodbase key is useless.
17044 (TypeContainer::Populate): Call RegisterRequiredImplementations
17045 before defining the methods.
17047 Create a mapping for method_builders_to_methods ahead of time
17048 instead of inside a tight loop.
17050 (::RequireMethods): Accept an object as the data to set into the
17051 hashtable so we can report interface vs abstract method mismatch.
17053 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17055 * report.cs: Make all of it static.
17057 * rootcontext.cs: Drop object_type and value_type computations, as
17058 we have those in the TypeManager anyways.
17060 Drop report instance variable too, now it is a global.
17062 * driver.cs: Use try/catch on command line handling.
17064 Add --probe option to debug the error reporting system with a test
17067 * report.cs: Add support for exiting program when a probe
17068 condition is reached.
17070 2001-10-03 Ravi Pratap <ravi@ximian.com>
17072 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17073 we do a forcible conversion regardless of type, to check if
17074 ForceConversion returns a null.
17076 (Binary::error19): Use location to report error.
17078 (Unary::error23): Use location here too.
17080 * ../errors/cs0019.cs : Check in.
17082 * ../errors/cs0023.cs : Check in.
17084 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17085 case of a non-null MethodInfo object with a length of 0 !
17087 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17088 an applicable member - according to the spec :-)
17089 Also fix logic to find members in base types.
17091 (Unary::ResolveOperator): Same here.
17093 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17094 as I was getting thoroughly confused between this and error19 :-)
17096 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17097 (::FindMostEncompassedType): Implement.
17098 (::FindMostEncompassingType): Implement.
17099 (::StandardConversionExists): Implement.
17101 (UserImplicitCast): Re-vamp. We now need info about most specific
17102 source and target types so that we can do the necessary conversions.
17104 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17105 mathematical union with no duplicates.
17107 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17109 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17110 in order from base classes to child classes, so that we can in
17111 child classes look up in our parent for method names and
17112 attributes (required for handling abstract, virtual, new, override
17113 constructs: we need to instrospect our base class, and if we dont
17114 populate the classes in order, the introspection might be
17115 incorrect. For example, a method could query its parent before
17116 the parent has any methods and would determine that the parent has
17117 no abstract methods (while it could have had them)).
17119 (RootContext::CreateType): Record the order in which we define the
17122 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17124 * class.cs (TypeContainer::Populate): Also method definitions can
17125 fail now, keep track of this.
17127 (TypeContainer::FindMembers): Implement support for
17128 DeclaredOnly/noDeclaredOnly flag.
17130 (Constructor::Emit) Return the ConstructorBuilder.
17132 (Method::Emit) Return the MethodBuilder.
17133 Check for abstract or virtual methods to be public.
17135 * rootcontext.cs (RootContext::CreateType): Register all the
17136 abstract methods required for the class to be complete and the
17137 interface methods that must be implemented.
17139 * cs-parser.jay: Report error 501 (method requires body if it is
17140 not marked abstract or extern).
17142 * expression.cs (TypeOf::Emit): Implement.
17144 * typemanager.cs: runtime_handle_type, new global type.
17146 * class.cs (Property::Emit): Generate code for properties.
17148 2001-10-02 Ravi Pratap <ravi@ximian.com>
17150 * expression.cs (Unary::ResolveOperator): Find operators on base type
17151 too - we now conform exactly to the spec.
17153 (Binary::ResolveOperator): Same here.
17155 * class.cs (Operator::Define): Fix minor quirk in the tests.
17157 * ../errors/cs0215.cs : Added.
17159 * ../errors/cs0556.cs : Added.
17161 * ../errors/cs0555.cs : Added.
17163 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17165 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17166 single integer which is really efficient
17168 2001-10-01 Ravi Pratap <ravi@ximian.com>
17170 * expression.cs (Expression::ImplicitUserConversion): Use location
17171 even in the case when we are examining True operators.
17173 * class.cs (Operator::Define): Perform extensive checks to conform
17174 with the rules for operator overloading in the spec.
17176 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17177 some of the other conversions mentioned in the spec.
17179 * typemanager.cs (array_type): New static member for the System.Array built-in
17182 (cloneable_interface): For System.ICloneable interface.
17184 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17185 we start resolving the tree and populating types.
17187 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17189 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17191 * expression.cs (Expression::ExprClassFromMemberInfo,
17192 Expression::Literalize): Create literal expressions from
17193 FieldInfos which are literals.
17195 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17196 type casts, because they were wrong. The test suite in tests
17199 (ImplicitNumericConversion): ushort to ulong requires a widening
17202 Int32 constant to long requires widening cast as well.
17204 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17205 for integers because the type on the stack is not i4.
17207 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17209 * expression.cs (report118): require location argument.
17211 * parameter.cs: Do not dereference potential null value.
17213 * class.cs: Catch methods that lack the `new' keyword when
17214 overriding a name. Report warnings when `new' is used without
17215 anything being there to override.
17217 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17219 * class.cs: Only add constructor to hashtable if it is non-null
17220 (as now constructors can fail on define).
17222 (TypeManager, Class, Struct): Take location arguments.
17224 Catch field instance initialization in structs as errors.
17226 accepting_filter: a new filter for FindMembers that is static so
17227 that we dont create an instance per invocation.
17229 (Constructor::Define): Catch errors where a struct constructor is
17232 * cs-parser.jay: Pass location information for various new
17235 * delegate.cs (Delegate): take a location argument.
17237 * driver.cs: Do not call EmitCode if there were problesm in the
17238 Definition of the types, as many Builders wont be there.
17240 * decl.cs (Decl::Decl): Require a location argument.
17242 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17243 into integers, and find the most appropiate integer for it.
17245 * literal.cs: Implement ULongLiteral.
17247 * rootcontext.cs: Provide better information about the location of
17248 failure when CreateType fails.
17250 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17252 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17255 * expression.cs (Binary::CheckShiftArguments): Add missing type
17257 (Binary::ResolveOperator): Add type to the logical and and logical
17258 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17261 (Binary::DoNumericPromotions): In the case where either argument
17262 is ulong (and most signed types combined with ulong cause an
17263 error) perform implicit integer constant conversions as well.
17265 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17267 * expression.cs (UserImplicitCast): Method should always be
17269 (Invocation::BetterConversion): Simplified test for IntLiteral.
17271 (Expression::ImplicitNumericConversion): Split this routine out.
17272 Put the code that performs implicit constant integer conversions
17275 (Expression::Resolve): Become a wrapper around DoResolve so we can
17276 check eclass and type being set after resolve.
17278 (Invocation::Badness): Remove this dead function
17280 (Binary::ResolveOperator): Do not compute the expensive argumnets
17281 unless we have a union for it.
17283 (Probe::Emit): Is needs to do an isinst and then
17284 compare against null.
17286 (::CanConvert): Added Location argument. If the Location argument
17287 is null (Location.Null), then we do not report errors. This is
17288 used by the `probe' mechanism of the Explicit conversion. We do
17289 not want to generate an error for something that the user
17290 explicitly requested to be casted. But the pipeline for an
17291 explicit cast first tests for potential implicit casts.
17293 So for now, if the Location is null, it means `Probe only' to
17294 avoid adding another argument. Might have to revise this
17297 (ClassCast): New class used to type cast objects into arbitrary
17298 classes (used in Explicit Reference Conversions).
17300 Implement `as' as well.
17302 Reverted all the patches from Ravi below: they were broken:
17304 * The use of `level' as a mechanism to stop recursive
17305 invocations is wrong. That was there just to catch the
17306 bug with a strack trace but not as a way of addressing
17309 To fix the problem we have to *understand* what is going
17310 on and the interactions and come up with a plan, not
17311 just get things going.
17313 * The use of the type conversion cache that I proposed
17314 last night had an open topic: How does this work across
17315 protection domains. A user defined conversion might not
17316 be public in the location where we are applying the
17317 conversion, a different conversion might be selected
17318 (ie, private A->B (better) but public B->A (worse),
17319 inside A, A->B applies, but outside it, B->A will
17322 * On top of that (ie, even if the above is solved),
17323 conversions in a cache need to be abstract. Ie, `To
17324 convert from an Int to a Short use an OpcodeCast', not
17325 `To convert from an Int to a Short use the OpcodeCast on
17326 the variable 5' (which is what this patch was doing).
17328 2001-09-28 Ravi Pratap <ravi@ximian.com>
17330 * expression.cs (Invocation::ConversionExists): Re-write to use
17331 the conversion cache
17333 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17334 cache all conversions done, not just user-defined ones.
17336 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17337 to determine if a conversion exists instead of acutually trying to
17338 perform the conversion. It's faster too.
17340 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17341 and only then attempt the implicit conversion.
17343 2001-09-28 Ravi Pratap <ravi@ximian.com>
17345 * expression.cs (ConvertImplicit): Use a cache for conversions
17346 already found. Check level of recursion and bail out if necessary.
17348 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17350 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17351 Export standard methods that we expect for string operations.
17353 * statement.cs (Block::UsageWarning): Track usage of variables and
17354 report the errors for not used variables.
17356 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17359 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17361 * codegen.cs: remove unnneded code
17363 * expression.cs: Removed BuiltinTypeAccess class
17365 Fix the order in which implicit conversions are
17368 The previous fixed dropped support for boxed conversions (adding a
17369 test to the test suite now)
17371 (UserImplicitCast::CanConvert): Remove test for source being null,
17372 that code is broken. We should not feed a null to begin with, if
17373 we do, then we should track the bug where the problem originates
17374 and not try to cover it up here.
17376 Return a resolved expression of type UserImplicitCast on success
17377 rather than true/false. Ravi: this is what I was talking about,
17378 the pattern is to use a static method as a "constructor" for
17381 Also, do not create arguments until the very last minute,
17382 otherwise we always create the arguments even for lookups that
17383 will never be performed.
17385 (UserImplicitCast::Resolve): Eliminate, objects of type
17386 UserImplicitCast are born in a fully resolved state.
17388 * typemanager.cs (InitCoreTypes): Init also value_type
17389 (System.ValueType).
17391 * expression.cs (Cast::Resolve): First resolve the child expression.
17393 (LValue): Add new method AddressOf to be used by
17396 Change the argument of Store to take an EmitContext instead of an
17397 ILGenerator, because things like FieldExpr need to be able to call
17398 their children expression to generate the instance code.
17400 (Expression::Error, Expression::Warning): Sugar functions for
17403 (Expression::MemberLookup): Accept a TypeContainer instead of a
17404 Report as the first argument.
17406 (Expression::ResolvePrimary): Killed. I still want to improve
17407 this as currently the code is just not right.
17409 (Expression::ResolveMemberAccess): Simplify, but it is still
17412 (Unary::Resolve): Catch errors in AddressOf operators.
17414 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
17415 index to a byte for the short-version, or the compiler will choose
17416 the wrong Emit call, which generates the wrong data.
17418 (ParameterReference::Emit, ::Store): same.
17420 (FieldExpr::AddressOf): Implement.
17422 * typemanager.cs: TypeManager: made public variable instead of
17425 * driver.cs: document --fatal.
17427 * report.cs (ErrorMessage, WarningMessage): new names for the old
17428 Error and Warning classes.
17430 * cs-parser.jay (member_access): Turn built-in access to types
17431 into a normal simplename
17433 2001-09-27 Ravi Pratap <ravi@ximian.com>
17435 * expression.cs (Invocation::BetterConversion): Fix to cope
17436 with q being null, since this was introducing a bug.
17438 * expression.cs (ConvertImplicit): Do built-in conversions first.
17440 2001-09-27 Ravi Pratap <ravi@ximian.com>
17442 * expression.cs (UserImplicitCast::Resolve): Fix bug.
17444 2001-09-27 Ravi Pratap <ravi@ximian.com>
17446 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
17447 I had introduced long ago (what's new ?).
17449 * expression.cs (UserImplicitCast::CanConvert): Static method to do
17450 the work of all the checking.
17451 (ConvertImplicit): Call CanConvert and only then create object if necessary.
17452 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
17454 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
17455 that is the right way.
17457 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
17458 overloading resolution. Use everywhere instead of cutting and pasting code.
17460 (Binary::ResolveOperator): Use MakeUnionSet.
17462 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
17463 we have to convert to bool types. Not complete yet.
17465 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17467 * typemanager.cs (TypeManager::CSharpName): support ushort.
17469 * expression.cs (Expression::TryImplicitIntConversion): Attempts
17470 to provide an expression that performsn an implicit constant int
17471 conversion (section 6.1.6).
17472 (Expression::ConvertImplicitRequired): Reworked to include
17473 implicit constant expression conversions.
17475 (Expression::ConvertNumericExplicit): Finished.
17477 (Invocation::Emit): If InstanceExpression is null, then it means
17478 that we perform a call on this.
17480 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17482 * expression.cs (Unary::Emit): Remove some dead code.
17483 (Probe): Implement Resolve and Emit for `is'.
17484 (Expression::ConvertImplicitRequired): Attempt to do constant
17485 expression conversions here. Maybe should be moved to
17486 ConvertImplicit, but I am not sure.
17487 (Expression::ImplicitLongConstantConversionPossible,
17488 Expression::ImplicitIntConstantConversionPossible): New functions
17489 that tell whether is it possible to apply an implicit constant
17490 expression conversion.
17492 (ConvertNumericExplicit): Started work on explicit numeric
17495 * cs-parser.jay: Update operator constants.
17497 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
17498 (Parameters::GetSignature): Hook up VerifyArgs here.
17499 (Parameters::VerifyArgs): Verifies that no two arguments have the
17502 * class.cs (Operator): Update the operator names to reflect the
17503 ones that the spec expects (as we are just stringizing the
17506 * expression.cs (Unary::ResolveOperator): Fix bug: Use
17507 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
17508 previous usage did only work for our methods.
17509 (Expression::ConvertImplicit): Handle decimal implicit numeric
17510 conversions as well.
17511 (Expression::InternalTypeConstructor): Used to invoke constructors
17512 on internal types for default promotions.
17514 (Unary::Emit): Implement special handling for the pre/post
17515 increment/decrement for overloaded operators, as they need to have
17516 the same semantics as the other operators.
17518 (Binary::ResolveOperator): ditto.
17519 (Invocation::ConversionExists): ditto.
17520 (UserImplicitCast::Resolve): ditto.
17522 2001-09-26 Ravi Pratap <ravi@ximian.com>
17524 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
17525 operator, return after emitting body. Regression tests pass again !
17527 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
17528 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
17529 (Invocation::OverloadResolve): Ditto.
17530 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
17532 * everywhere : update calls to the above methods accordingly.
17534 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17536 * assign.cs (Assign): Make it inherit from ExpressionStatement.
17538 * expression.cs (ExpressionStatement): New base class used for
17539 expressions that can appear in statements, so that we can provide
17540 an alternate path to generate expression that do not leave a value
17543 (Expression::Emit, and all the derivatives): We no longer return
17544 whether a value is left on the stack or not. Every expression
17545 after being emitted leaves a single value on the stack.
17547 * codegen.cs (EmitContext::EmitStatementExpression): Use the
17548 facilties of ExpressionStatement if possible.
17550 * cs-parser.jay: Update statement_expression.
17552 2001-09-25 Miguel de Icaza <miguel@ximian.com>
17554 * driver.cs: Change the wording of message
17556 2001-09-25 Ravi Pratap <ravi@ximian.com>
17558 * expression.cs (Binary::ResolveOperator): Had forgottten to set
17559 the type of the expression to the return type of the method if
17560 we have an overloaded operator match ! The regression tests pass again !
17561 (Unary::ResolveOperator): Ditto.
17563 * expression.cs (Invocation::ConversionExists): Correct the member lookup
17564 to find "op_Implicit", not "implicit" ;-)
17565 (UserImplicitCast): New class to take care of user-defined implicit conversions.
17566 (ConvertImplicit, ForceConversion): Take TypeContainer argument
17568 * everywhere : Correct calls to the above accordingly.
17570 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
17571 (ConvertImplicit): Do user-defined conversion if it exists.
17573 2001-09-24 Miguel de Icaza <miguel@ximian.com>
17575 * assign.cs: track location.
17576 (Resolve): Use implicit conversions on assignment.
17578 * literal.cs: Oops. Not good, Emit of short access values should
17579 pass (Bytes) or the wrong argument will be selected.
17581 * expression.cs (Unary::Emit): Emit code for -expr.
17583 (Unary::ResolveOperator): Handle `Substract' for non-constants
17584 (substract from zero from the non-constants).
17585 Deal with Doubles as well.
17587 (Expression::ConvertImplicitRequired): New routine that reports an
17588 error if no implicit conversion exists.
17590 (Invocation::OverloadResolve): Store the converted implicit
17591 expressions if we make them
17593 2001-09-24 Ravi Pratap <ravi@ximian.com>
17595 * class.cs (ConstructorInitializer): Take a Location argument.
17596 (ConstructorBaseInitializer): Same here.
17597 (ConstructorThisInitializer): Same here.
17599 * cs-parser.jay : Update all calls accordingly.
17601 * expression.cs (Unary, Binary, New): Take location argument.
17602 Update accordingly everywhere.
17604 * cs-parser.jay : Update all calls to the above to take a location
17607 * class.cs : Ditto.
17609 2001-09-24 Ravi Pratap <ravi@ximian.com>
17611 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
17612 (Invocation::BetterConversion): Same here
17613 (Invocation::ConversionExists): Ditto.
17615 (Invocation::ConversionExists): Implement.
17617 2001-09-22 Ravi Pratap <ravi@ximian.com>
17619 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
17620 Also take an additional TypeContainer argument.
17622 * All over : Pass in TypeContainer as argument to OverloadResolve.
17624 * typemanager.cs (CSharpName): Update to check for the string type and return
17627 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
17630 2001-09-21 Ravi Pratap <ravi@ximian.com>
17632 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
17633 (Invocation::BetterFunction): Implement.
17634 (Invocation::BetterConversion): Implement.
17635 (Invocation::ConversionExists): Skeleton, no implementation yet.
17637 Okay, things work fine !
17639 2001-09-21 Miguel de Icaza <miguel@ximian.com>
17641 * typemanager.cs: declare and load enum_type, delegate_type and
17644 * expression.cs (Expression::Emit): Now emit returns a value that
17645 tells whether a value is left on the stack or not. This strategy
17646 might be reveted tomorrow with a mechanism that would address
17647 multiple assignments.
17648 (Expression::report118): Utility routine to report mismatches on
17651 (Unary::Report23): Report impossible type/operator combination
17654 (Unary::IsIncrementableNumber): Whether the type can be
17655 incremented or decremented with add.
17656 (Unary::ResolveOperator): Also allow enumerations to be bitwise
17658 (Unary::ResolveOperator): Implement ++, !, ~,
17660 (Invocation::Emit): Deal with new Emit convetion.
17662 * All Expression derivatives: Updated their Emit method to return
17663 whether they leave values on the stack or not.
17665 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
17666 stack for expressions that are statements.
17668 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17670 * expression.cs (LValue): New interface. Must be implemented by
17672 (LocalVariableReference, ParameterReference, FieldExpr): Implement
17675 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
17676 interface for generating code, simplifies the code.
17678 2001-09-20 Ravi Pratap <ravi@ximian.com>
17680 * expression.cs (everywhere): Comment out return statements in ::Resolve
17681 methods to avoid the warnings.
17683 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17685 * driver.cs (parse): Report error 2001 if we can not open the
17688 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
17691 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
17694 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
17695 otherwise nested blocks end up with the same index.
17697 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
17699 * expression.cs: Instead of having FIXMEs in the Resolve
17700 functions, throw exceptions so it is obvious that we are facing a
17703 * cs-parser.jay (invocation_expression): Pass Location information.
17705 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
17706 Use a basename for those routines because .NET does not like paths
17709 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
17712 2001-09-19 Miguel de Icaza <miguel@ximian.com>
17714 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
17715 are loading the correct data types (throws an exception if not).
17716 (TypeManager::InitCoreTypes): Use CoreLookupType
17718 * expression.cs (Unary::ResolveOperator): return the child
17719 expression for expressions which are just +expr.
17720 (Unary::ResolveOperator): Return negative literals for -LITERAL
17721 expressions (otherwise they are Unary {Literal}).
17722 (Invocation::Badness): Take into account `Implicit constant
17723 expression conversions'.
17725 * literal.cs (LongLiteral): Implement long literal class.
17726 (IntLiteral): export the `Value' of the intliteral.
17728 2001-09-19 Ravi Pratap <ravi@ximian.com>
17730 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
17732 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
17733 instead of 'Operator'
17735 * expression.cs (Binary::ResolveOperator): Update accordingly.
17736 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
17739 * cs-parser.jay (unary_expression): Update to use the new names.
17741 * gen-treedump.cs (GetUnary): Same here.
17743 * expression.cs (Unary::Resolve): Implement.
17744 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
17745 operators are found instead of making noise ;-)
17746 (Unary::ResolveOperator): New method to do precisely the same thing which
17747 Binary::ResolveOperator does for Binary expressions.
17748 (Unary.method, .Arguments): Add.
17749 (Unary::OperName): Implement.
17750 (Unary::ForceConversion): Copy and Paste !
17752 * class.cs (Operator::Define): Fix a small bug for the case when we have
17755 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
17756 for the inbuilt operators. Only overloading works for now ;-)
17758 2001-09-18 Miguel de Icaza <miguel@ximian.com>
17760 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
17761 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
17763 * expression.cs (This::Emit): Implement.
17764 (This::Resolve): Implement.
17765 (TypeOf:Resolve): Implement.
17766 (Expression::ResolveSimpleName): Add an implicit this to instance
17768 (MemberAccess::Resolve): Deal with Parameters and Fields.
17769 Bind instance variable to Field expressions.
17770 (FieldExpr::Instance): New field used to track the expression that
17771 represents the object instance.
17772 (FieldExpr::Resolve): Track potential errors from MemberLookup not
17774 (FieldExpr::Emit): Implement.
17776 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
17777 the last instruction contains a return opcode to avoid generating
17778 the last `ret' instruction (this generates correct code, and it is
17779 nice to pass the peverify output).
17781 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
17782 initializer for static and instance variables.
17783 (Constructor::Emit): Allow initializer to be null in the case of
17784 static constructors. Only emit initializer for instance
17787 (TypeContainer::FindMembers): Return a null array if there are no
17790 Also fix the code for the MemberTypes.Method branch, as it was not
17791 scanning that for operators (or tried to access null variables before).
17793 * assign.cs (Assign::Emit): Handle instance and static fields.
17797 * driver.cs: Stop compilation if there are parse errors.
17799 * cs-parser.jay (constructor_declaration): Provide default base
17800 initializer for non-static constructors.
17801 (constructor_declarator): Do not provide a default base
17802 initializers if none was specified.
17803 Catch the fact that constructors should not have parameters.
17805 * class.cs: Do not emit parent class initializers for static
17806 constructors, that should be flagged as an error.
17808 2001-09-18 Ravi Pratap <ravi@ximian.com>
17810 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
17811 Move back code into TypeContainer::Populate.
17813 2001-09-18 Ravi Pratap <ravi@ximian.com>
17815 * class.cs (TypeContainer::AddConstructor): Fix the check to
17816 compare against Name, not Basename.
17817 (Operator::OpType): Change Plus and Minus to Add and Subtract.
17819 * cs-parser.jay : Update accordingly.
17821 * class.cs (TypeContainer::FindMembers): For the case where we are searching
17822 for methods, don't forget to look into the operators too.
17823 (RegisterMethodBuilder): Helper method to take care of this for
17824 methods, constructors and operators.
17825 (Operator::Define): Completely revamp.
17826 (Operator.OperatorMethod, MethodName): New fields.
17827 (TypeContainer::Populate): Move the registering of builders into
17828 RegisterMethodBuilder.
17829 (Operator::Emit): Re-write.
17831 * expression.cs (Binary::Emit): Comment out code path to emit method
17832 invocation stuff for the case when we have a user defined operator. I am
17833 just not able to get it right !
17835 2001-09-17 Miguel de Icaza <miguel@ximian.com>
17837 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
17840 (Expression::MemberLookup): Provide a version that allows to
17841 specify the MemberTypes and BindingFlags.
17843 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
17844 so it was not fetching variable information from outer blocks.
17846 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
17847 Beforefieldinit as it was buggy.
17849 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
17850 that Ravi put here.
17852 * class.cs (Constructor::Emit): Only emit if block is not null.
17853 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
17854 deal with this by semantically definining it as if the user had
17857 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
17858 constructors as we now "emit" them at a higher level.
17860 (TypeContainer::DefineDefaultConstructor): Used to define the
17861 default constructors if none was provided.
17863 (ConstructorInitializer): Add methods Resolve and Emit.
17865 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
17867 2001-09-17 Ravi Pratap <ravi@ximian.com>
17869 * class.cs (TypeContainer::EmitDefaultConstructor): Register
17870 the default constructor builder with our hashtable for methodbuilders
17873 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
17874 and argument_count is 0 in which case we have a match.
17875 (Binary::ResolveOperator): More null checking and miscellaneous coding
17878 2001-09-17 Ravi Pratap <ravi@ximian.com>
17880 * rootcontext.cs (IsNameSpace): Compare against null.
17882 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
17884 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
17885 and Unary::Operator.
17887 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
17890 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
17891 we have overloaded operators.
17892 (Binary::ResolveOperator): Implement the part which does the operator overload
17895 * class.cs (Operator::Emit): Implement.
17896 (TypeContainer::Emit): Emit the operators we have too.
17898 * expression.cs (Binary::Emit): Update to emit the appropriate code for
17899 the case when we have a user-defined operator.
17901 2001-09-17 Miguel de Icaza <miguel@ximian.com>
17903 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
17905 2001-09-16 Ravi Pratap <ravi@ximian.com>
17907 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
17908 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
17909 (Constructor::Emit): Implement.
17910 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
17911 if we have no work to do.
17912 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
17915 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
17916 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
17918 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
17921 2001-09-15 Ravi Pratap <ravi@ximian.com>
17923 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
17925 (Tree::RecordNamespace): Method to do what the name says ;-)
17926 (Tree::Namespaces): Property to get at the namespaces hashtable.
17928 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
17931 * rootcontext.cs (IsNamespace): Fixed it :-)
17933 2001-09-14 Miguel de Icaza <miguel@ximian.com>
17935 * class.cs (TypeContainer::FindMembers): Add support for
17937 (MethodCore): New class that encapsulates both the shared aspects
17938 of a Constructor and a Method.
17939 (Method, Constructor): Factored pieces into MethodCore.
17941 * driver.cs: Added --fatal which makes errors throw exceptions.
17942 Load System assembly as well as part of the standard library.
17944 * report.cs: Allow throwing exceptions on errors for debugging.
17946 * modifiers.cs: Do not use `parent', instead use the real type
17947 container to evaluate permission settings.
17949 * class.cs: Put Ravi's patch back in. He is right, and we will
17950 have to cope with the
17952 2001-09-14 Ravi Pratap <ravi@ximian.com>
17954 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
17955 FamORAssem, not FamANDAssem.
17957 2001-09-14 Miguel de Icaza <miguel@ximian.com>
17959 * driver.cs: Added --parse option that only parses its input files
17962 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
17963 incorrect. IsTopLevel is not used to tell whether an object is
17964 root_types or not (that can be achieved by testing this ==
17965 root_types). But to see if this is a top-level *class* (not
17966 necessarly our "toplevel" container).
17968 2001-09-14 Ravi Pratap <ravi@ximian.com>
17970 * enum.cs (Enum::Define): Modify to call the Lookup method on the
17971 parent instead of a direct call to GetType.
17973 2001-09-14 Ravi Pratap <ravi@ximian.com>
17975 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
17976 Modifiers.TypeAttr. This should just be a call to that method.
17978 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
17979 object so that we can determine if we are top-level or not.
17981 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
17984 * enum.cs (Enum::Define): Ditto.
17986 * modifiers.cs (FieldAttr): Re-write.
17988 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
17989 (TypeContainer::HaveStaticConstructor): New property to provide access
17990 to precisely that info.
17992 * modifiers.cs (MethodAttr): Re-write.
17993 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
17995 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
17996 of top-level types as claimed.
17998 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18000 * expression.cs (MemberLookup): Fruitless attempt to lookup
18001 constructors. Maybe I need to emit default constructors? That
18002 might be it (currently .NET emits this for me automatically).
18003 (Invocation::OverloadResolve): Cope with Arguments == null.
18004 (Invocation::EmitArguments): new function, shared by the new
18005 constructor and us.
18006 (Invocation::Emit): Handle static and instance methods. Emit
18007 proper call instruction for virtual or non-virtual invocations.
18008 (New::Emit): Implement.
18009 (New::Resolve): Implement.
18010 (MemberAccess:Resolve): Implement.
18011 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18012 to track instances.
18013 (FieldExpr::Resolve): Set type.
18015 * support.cs: Handle empty arguments.
18017 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18018 SimpleLookup): Auxiliary routines to help parse a qualifier
18021 Update qualifier_identifier rule.
18023 * codegen.cs: Removed debugging messages.
18025 * class.cs: Make this a global thing, this acts just as a "key" to
18026 objects that we might have around.
18028 (Populate): Only initialize method_builders_to_methods once.
18030 * expression.cs (PropertyExpr): Initialize type from the
18033 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18034 Resolve pattern. Attempt to implicitly convert value to boolean.
18037 * expression.cs: Set the type for the int32/int32 argument case.
18038 (Binary::ResolveOperator): Set the return type to boolean for
18039 comparission operators
18041 * typemanager.cs: Remove debugging print code.
18043 (Invocation::Resolve): resolve type.
18045 * class.cs: Allocate a MemberInfo of the correct size, as the code
18046 elsewhere depends on the test to reflect the correct contents.
18048 (Method::) Keep track of parameters, due to System.Reflection holes
18050 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18053 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18054 of the exact size and return that.
18056 (Class::LookupMethodByBuilder): New function that maps
18057 MethodBuilders to its methods. Required to locate the information
18058 on methods because System.Reflection bit us again.
18060 * support.cs: New file, contains an interface ParameterData and
18061 two implementations: ReflectionParameters and InternalParameters
18062 used to access Parameter information. We will need to grow this
18065 * expression.cs (Invocation::GetParameterData): implement a cache
18066 and a wrapper around the ParameterData creation for methods.
18067 (Invocation::OverloadResolve): Use new code.
18069 2001-09-13 Ravi Pratap <ravi@ximian.com>
18071 * class.cs (TypeContainer::EmitField): Remove and move into
18072 (Field::Define): here and modify accordingly.
18073 (Field.FieldBuilder): New member.
18074 (TypeContainer::Populate): Update accordingly.
18075 (TypeContainer::FindMembers): Implement.
18077 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18079 * statement.cs: (VariableInfo::VariableType): New field to be
18080 initialized with the full type once it is resolved.
18082 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18084 * parameter.cs (GetParameterInfo): Use a type cache to compute
18085 things only once, and to reuse this information
18087 * expression.cs (LocalVariableReference::Emit): Implement.
18088 (OpcodeCast::Emit): fix.
18090 (ParameterReference::Resolve): Implement.
18091 (ParameterReference::Emit): Implement.
18093 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18094 that are expressions need to stay as Expressions.
18096 * typemanager.cs (CSharpName): Returns the C# name of a type if
18099 * expression.cs (Expression::ConvertImplicit): New function that
18100 implements implicit type conversions.
18102 (Expression::ImplicitReferenceConversion): Implements implicit
18103 reference conversions.
18105 (EmptyCast): New type for transparent casts.
18107 (OpcodeCast): New type for casts of types that are performed with
18108 a sequence of bytecodes.
18110 (BoxedCast): New type used for casting value types into reference
18111 types. Emits a box opcode.
18113 (Binary::DoNumericPromotions): Implements numeric promotions of
18114 and computation of the Binary::Type.
18116 (Binary::EmitBranchable): Optimization.
18118 (Binary::Emit): Implement code emission for expressions.
18120 * typemanager.cs (TypeManager): Added two new core types: sbyte
18123 2001-09-12 Ravi Pratap <ravi@ximian.com>
18125 * class.cs (TypeContainer::FindMembers): Method which does exactly
18126 what Type.FindMembers does, only we don't have to use reflection. No
18127 implementation yet.
18129 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18130 typecontainer objects as we need to get at them.
18131 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18133 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18134 typecontainer object.
18136 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18137 of just a Report object.
18139 2001-09-11 Ravi Pratap <ravi@ximian.com>
18141 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18143 (TypeContainer::Populate): Now define the delegates of the type too.
18144 (TypeContainer.Delegates): Property to access the list of delegates defined
18147 * delegates.cs (Delegate::Define): Implement partially.
18149 * modifiers.cs (TypeAttr): Handle more flags.
18151 2001-09-11 Ravi Pratap <ravi@ximian.com>
18153 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18155 (Operator::Define): Re-write logic to get types by using the LookupType method
18156 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18157 (Indexer::Define): Ditto.
18158 (Event::Define): Ditto.
18159 (Property::Define): Ditto.
18161 2001-09-10 Ravi Pratap <ravi@ximian.com>
18163 * class.cs (TypeContainer::Populate): Now define operators too.
18164 (TypeContainer.Operators): New property to access the list of operators
18166 (Operator.OperatorMethodBuilder): New member to hold the method builder
18167 for the operator we are defining.
18168 (Operator::Define): Implement.
18170 2001-09-10 Ravi Pratap <ravi@ximian.com>
18172 * class.cs (Event::Define): Make the prefixes of the accessor methods
18173 addOn_ and removeOn_
18175 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18176 of the location being passed in too. Ideally, this should go later since all
18177 error reporting should be done through the Report object.
18179 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18180 (Populate): Iterate thru the indexers we have and define them too.
18181 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18182 for the get and set accessors.
18183 (Indexer::Define): Implement.
18185 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18187 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18188 my previous implementation, did not work.
18190 * typemanager.cs: Add a couple of missing types (the longs).
18192 * literal.cs: Use TypeManager.bool_type instead of getting it.
18194 * expression.cs (EventExpr): New kind of expressions.
18195 (Expressio::ExprClassFromMemberInfo): finish
18197 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18199 * assign.cs: Emit stores to static fields differently.
18201 2001-09-08 Ravi Pratap <ravi@ximian.com>
18203 * Merge in changes and adjust code to tackle conflicts. Backed out my
18204 code in Assign::Resolve ;-)
18206 2001-09-08 Ravi Pratap <ravi@ximian.com>
18208 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18209 instead Report.Error and also pass in the location.
18210 (CSharpParser::Lexer): New readonly property to return the reference
18211 to the Tokenizer object.
18212 (declare_local_variables): Use Report.Error with location instead of plain
18216 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18217 (Operator.CheckBinaryOperator): Ditto.
18219 * cs-parser.jay (operator_declarator): Update accordingly.
18221 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18222 (CheckBinaryOperator): Same here.
18224 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18225 on the name without any prefixes of namespace names etc. This is because we
18226 already might have something already fully qualified like
18227 'System.Console.WriteLine'
18229 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18231 2001-09-07 Ravi Pratap <ravi@ximian.com>
18233 * cs-tokenizer.cs (location): Return a string which also contains
18236 * expression.cs (ElementAccess): New class for expressions of the
18237 type 'element access.'
18238 (BaseAccess): New class for expressions of the type 'base access.'
18239 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18242 * cs-parser.jay (element_access): Implement action.
18243 (base_access): Implement actions.
18244 (checked_expression, unchecked_expression): Implement.
18246 * cs-parser.jay (local_variable_type): Correct and implement.
18247 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18249 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18251 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18252 name and the specifiers.
18254 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18256 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18257 making them all public ;-)
18259 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18262 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18264 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18266 (FieldExpr, PropertyExprs): New resolved expressions.
18267 (SimpleName::MemberStaticCheck): Perform static checks for access
18268 to non-static fields on static methods. Maybe this should be
18269 generalized for MemberAccesses.
18270 (SimpleName::ResolveSimpleName): More work on simple name
18273 * cs-parser.jay (primary_expression/qualified_identifier): track
18274 the parameter index.
18276 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18277 (EmitContext::EmitBoolExpression): Chain to expression generation
18278 instead of temporary hack.
18279 (::EmitStatementExpression): Put generic expression code generation.
18281 * assign.cs (Assign::Emit): Implement variable assignments to
18282 local variables, parameters and fields.
18284 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18286 * statement.cs (Block::GetVariableInfo): New method, returns the
18287 VariableInfo for a variable name in a block.
18288 (Block::GetVariableType): Implement in terms of GetVariableInfo
18290 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18291 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18293 2001-09-06 Ravi Pratap <ravi@ximian.com>
18295 * cs-parser.jay (operator_declaration): Continue on my quest : update
18296 to take attributes argument.
18297 (event_declaration): Ditto.
18298 (enum_declaration): Ditto.
18299 (indexer_declaration): Ditto.
18301 * class.cs (Operator::Operator): Update constructor accordingly.
18302 (Event::Event): Ditto.
18304 * delegate.cs (Delegate::Delegate): Same here.
18306 * enum.cs (Enum::Enum): Same here.
18308 2001-09-05 Ravi Pratap <ravi@ximian.com>
18310 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18312 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18314 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18315 being passed around as an arraylist.
18316 (Attributes::AddAttribute): Method to add attribute sections.
18318 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18319 (struct_declaration): Update accordingly.
18320 (constant_declaration): Update.
18321 (field_declaration): Update.
18322 (method_header): Update.
18323 (fixed_parameter): Update.
18324 (parameter_array): Ditto.
18325 (property_declaration): Ditto.
18326 (destructor_declaration): Ditto.
18328 * class.cs (Struct::Struct): Update constructors accordingly.
18329 (Class::Class): Ditto.
18330 (Field::Field): Ditto.
18331 (Method::Method): Ditto.
18332 (Property::Property): Ditto.
18333 (TypeContainer::OptAttribute): update property's return type.
18335 * interface.cs (Interface.opt_attributes): New member.
18336 (Interface::Interface): Update to take the extra Attributes argument.
18338 * parameter.cs (Parameter::Parameter): Ditto.
18340 * constant.cs (Constant::Constant): Ditto.
18342 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18343 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18344 the attributes as a parameter.
18345 (InterfaceProperty): Update constructor call.
18346 (InterfaceEvent): Ditto.
18347 (InterfaceMethod): Ditto.
18348 (InterfaceIndexer): Ditto.
18350 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18351 pass the attributes too.
18352 (interface_event_declaration): Ditto.
18353 (interface_property_declaration): Ditto.
18354 (interface_method_declaration): Ditto.
18355 (interface_declaration): Ditto.
18357 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18359 * class.cs (Method::Define): Track the "static Main" definition to
18360 create an entry point.
18362 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18363 EntryPoint if we find it.
18365 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18366 (EmitContext::ig): Make this variable public.
18368 * driver.cs: Make the default output file be the first file name
18369 with the .exe extension.
18371 Detect empty compilations
18373 Handle various kinds of output targets. Handle --target and
18374 rename -t to --dumper.
18376 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
18377 methods inherited from Expression return now an Expression. This
18378 will is used during the tree rewriting as we resolve them during
18381 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
18382 the spec. Missing entirely is the information about
18383 accessability of elements of it.
18385 (Expression::ExprClassFromMemberInfo): New constructor for
18386 Expressions that creates a fully initialized Expression based on
18387 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
18390 (Invocation::Resolve): Begin implementing resolution of invocations.
18392 * literal.cs (StringLiteral): Implement Emit.
18394 2001-09-05 Ravi Pratap <ravi@ximian.com>
18396 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
18399 2001-09-04 Ravi Pratap <ravi@ximian.com>
18401 * cs-parser.jay (attribute_arguments): Implement actions.
18402 (attribute): Fix bug in production. Implement action.
18403 (attribute_list): Implement.
18404 (attribute_target): Implement.
18405 (attribute_target_specifier, opt_target_specifier): Implement
18406 (CheckAttributeTarget): New method to check if the attribute target
18408 (attribute_section): Implement.
18409 (opt_attributes): Implement.
18411 * attribute.cs : New file to handle attributes.
18412 (Attribute): Class to hold attribute info.
18414 * cs-parser.jay (opt_attribute_target_specifier): Remove production
18415 (attribute_section): Modify production to use 2 different rules to
18416 achieve the same thing. 1 s/r conflict down !
18417 Clean out commented, useless, non-reducing dimension_separator rules.
18419 * class.cs (TypeContainer.attributes): New member to hold list
18420 of attributes for a type.
18421 (Struct::Struct): Modify to take one more argument, the attribute list.
18422 (Class::Class): Ditto.
18423 (Field::Field): Ditto.
18424 (Method::Method): Ditto.
18425 (Property::Property): Ditto.
18427 * cs-parser.jay (struct_declaration): Update constructor call to
18428 pass in the attributes too.
18429 (class_declaration): Ditto.
18430 (constant_declaration): Ditto.
18431 (field_declaration): Ditto.
18432 (method_header): Ditto.
18433 (fixed_parameter): Ditto.
18434 (parameter_array): Ditto.
18435 (property_declaration): Ditto.
18437 * constant.cs (Constant::Constant): Update constructor similarly.
18438 Use System.Collections.
18440 * parameter.cs (Parameter::Parameter): Update as above.
18442 2001-09-02 Ravi Pratap <ravi@ximian.com>
18444 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
18445 (TypeContainer.delegates): New member to hold list of delegates.
18447 * cs-parser.jay (delegate_declaration): Implement the action correctly
18448 this time as I seem to be on crack ;-)
18450 2001-09-02 Miguel de Icaza <miguel@ximian.com>
18452 * rootcontext.cs (RootContext::IsNamespace): new function, used to
18453 tell whether an identifier represents a namespace.
18455 * expression.cs (NamespaceExpr): A namespace expression, used only
18456 temporarly during expression resolution.
18457 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
18458 utility functions to resolve names on expressions.
18460 2001-09-01 Miguel de Icaza <miguel@ximian.com>
18462 * codegen.cs: Add hook for StatementExpressions.
18464 * class.cs: Fix inverted test for static flag in methods.
18466 2001-09-02 Ravi Pratap <ravi@ximian.com>
18468 * class.cs (Operator::CheckUnaryOperator): Correct error number used
18469 to make it coincide with MS' number.
18470 (Operator::CheckBinaryOperator): Ditto.
18472 * ../errors/errors.txt : Remove error numbers added earlier.
18474 * ../errors/cs1019.cs : Test case for error # 1019
18476 * ../errros/cs1020.cs : Test case for error # 1020
18478 * cs-parser.jay : Clean out commented cruft.
18479 (dimension_separators, dimension_separator): Comment out. Ostensibly not
18480 used anywhere - non-reducing rule.
18481 (namespace_declarations): Non-reducing rule - comment out.
18483 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
18484 with TypeContainer::AddEnum.
18486 * delegate.cs : New file for delegate handling classes.
18487 (Delegate): Class for declaring delegates.
18489 * makefile : Update.
18491 * cs-parser.jay (delegate_declaration): Implement.
18493 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
18495 * class.cs (Event::Define): Implement.
18496 (Event.EventBuilder): New member.
18498 * class.cs (TypeContainer::Populate): Update to define all enums and events
18500 (Events): New property for the events arraylist we hold. Shouldn't we move to using
18501 readonly fields for all these cases ?
18503 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18505 * class.cs (Property): Revamp to use the convention of making fields readonly.
18506 Accordingly modify code elsewhere.
18508 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
18509 the Define method of the Property class.
18511 * class.cs : Clean up applied patch and update references to variables etc. Fix
18513 (TypeContainer::Populate): Update to define all the properties we have. Also
18514 define all enumerations.
18516 * enum.cs (Define): Implement.
18518 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18520 * cs-parser.jay (overloadable_operator): The semantic value is an
18521 enum of the Operator class.
18522 (operator_declarator): Implement actions.
18523 (operator_declaration): Implement.
18525 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
18526 validity of definitions.
18527 (Operator::CheckBinaryOperator): Static method to check for binary operators
18528 (TypeContainer::AddOperator): New method to add an operator to a type.
18530 * cs-parser.jay (indexer_declaration): Added line to actually call the
18531 AddIndexer method so it gets added ;-)
18533 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
18534 already taken care of by the MS compiler ?
18536 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18538 * class.cs (Operator): New class for operator declarations.
18539 (Operator::OpType): Enum for the various operators.
18541 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18543 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
18544 ostensibly handle this in semantic analysis.
18546 * cs-parser.jay (general_catch_clause): Comment out
18547 (specific_catch_clauses, specific_catch_clause): Ditto.
18548 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
18549 (catch_args, opt_catch_args): New productions.
18550 (catch_clause): Rewrite to use the new productions above
18551 (catch_clauses): Modify accordingly.
18552 (opt_catch_clauses): New production to use in try_statement
18553 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
18554 and re-write the code in the actions to extract the specific and
18555 general catch clauses by being a little smart ;-)
18557 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
18558 Hooray, try and catch statements parse fine !
18560 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18562 * statement.cs (Block::GetVariableType): Fix logic to extract the type
18563 string from the hashtable of variables.
18565 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
18566 I end up making that mistake ;-)
18567 (catch_clauses): Fixed gross error which made Key and Value of the
18568 DictionaryEntry the same : $1 !!
18570 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18572 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
18574 * cs-parser.jay (event_declaration): Correct to remove the semicolon
18575 when the add and remove accessors are specified.
18577 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18579 * cs-parser.jay (IndexerDeclaration): New helper class to hold
18580 information about indexer_declarator.
18581 (indexer_declarator): Implement actions.
18582 (parsing_indexer): New local boolean used to keep track of whether
18583 we are parsing indexers or properties. This is necessary because
18584 implicit_parameters come into picture even for the get accessor in the
18585 case of an indexer.
18586 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
18588 * class.cs (Indexer): New class for indexer declarations.
18589 (TypeContainer::AddIndexer): New method to add an indexer to a type.
18590 (TypeContainer::indexers): New member to hold list of indexers for the
18593 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18595 * cs-parser.jay (add_accessor_declaration): Implement action.
18596 (remove_accessor_declaration): Implement action.
18597 (event_accessors_declaration): Implement
18598 (variable_declarators): swap statements for first rule - trivial.
18600 * class.cs (Event): New class to hold information about event
18602 (TypeContainer::AddEvent): New method to add an event to a type
18603 (TypeContainer::events): New member to hold list of events.
18605 * cs-parser.jay (event_declaration): Implement actions.
18607 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18609 * cs-parser.jay (dim_separators): Implement. Make it a string
18610 concatenating all the commas together, just as they appear.
18611 (opt_dim_separators): Modify accordingly
18612 (rank_specifiers): Update accordingly. Basically do the same
18613 thing - instead, collect the brackets here.
18614 (opt_rank_sepcifiers): Modify accordingly.
18615 (array_type): Modify to actually return the complete type string
18616 instead of ignoring the rank_specifiers.
18617 (expression_list): Implement to collect the expressions
18618 (variable_initializer): Implement. We make it a list of expressions
18619 essentially so that we can handle the array_initializer case neatly too.
18620 (variable_initializer_list): Implement.
18621 (array_initializer): Make it a list of variable_initializers
18622 (opt_array_initializer): Modify accordingly.
18624 * expression.cs (New::NType): Add enumeration to help us
18625 keep track of whether we have an object/delegate creation
18626 or an array creation.
18627 (New:NewType, New::Rank, New::Indices, New::Initializers): New
18628 members to hold data about array creation.
18629 (New:New): Modify to update NewType
18630 (New:New): New Overloaded contructor for the array creation
18633 * cs-parser.jay (array_creation_expression): Implement to call
18634 the overloaded New constructor.
18636 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
18638 * class.cs (TypeContainer::Constructors): Return member
18639 constructors instead of returning null.
18641 2001-08-26 Miguel de Icaza <miguel@ximian.com>
18643 * typemanager.cs (InitCoreTypes): Initialize the various core
18644 types after we have populated the type manager with the user
18645 defined types (this distinction will be important later while
18646 compiling corlib.dll)
18648 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
18649 on Expression Classification. Now all expressions have a method
18650 `Resolve' and a method `Emit'.
18652 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
18653 generation from working. Also add some temporary debugging
18656 2001-08-24 Miguel de Icaza <miguel@ximian.com>
18658 * codegen.cs: Lots of code generation pieces. This is only the
18659 beginning, will continue tomorrow with more touches of polish. We
18660 handle the fundamentals of if, while, do, for, return. Others are
18661 trickier and I need to start working on invocations soon.
18663 * gen-treedump.cs: Bug fix, use s.Increment here instead of
18666 * codegen.cs (EmitContext): New struct, used during code
18667 emission to keep a context. Most of the code generation will be
18670 * cs-parser.jay: Add embedded blocks to the list of statements of
18671 this block. So code generation proceeds in a top down fashion.
18673 2001-08-23 Miguel de Icaza <miguel@ximian.com>
18675 * statement.cs: Add support for multiple child blocks.
18677 2001-08-22 Miguel de Icaza <miguel@ximian.com>
18679 * codegen.cs (EmitCode): New function, will emit the code for a
18680 Block of code given a TypeContainer and its ILGenerator.
18682 * statement.cs (Block): Standard public readonly optimization.
18683 (Block::Block constructors): Link children.
18684 (Block::Child): Child Linker.
18685 (Block::EmitVariables): Emits IL variable declarations.
18687 * class.cs: Drop support for MethodGroups here, delay until
18689 (Method::): Applied the same simplification that I did before, and
18690 move from Properties to public readonly fields.
18691 (Method::ParameterTypes): Returns the parameter types for the
18692 function, and implements a cache that will be useful later when I
18693 do error checking and the semantic analysis on the methods is
18695 (Constructor::GetCallingConvention): Renamed from CallingConvetion
18696 and made a method, optional argument tells whether this is a class
18697 or a structure to apply the `has-this' bit.
18698 (Method::GetCallingConvention): Implement, returns the calling
18700 (Method::Define): Defines the type, a second pass is performed
18701 later to populate the methods.
18703 (Constructor::ParameterTypes): implement a cache similar to the
18704 one on Method::ParameterTypes, useful later when we do semantic
18707 (TypeContainer::EmitMethod): New method. Emits methods.
18709 * expression.cs: Removed MethodGroup class from here.
18711 * parameter.cs (Parameters::GetCallingConvention): new method.
18713 2001-08-21 Miguel de Icaza <miguel@ximian.com>
18715 * class.cs (TypeContainer::Populate): Drop RootContext from the
18718 (Constructor::CallingConvention): Returns the calling convention.
18719 (Constructor::ParameterTypes): Returns the constructor parameter
18722 (TypeContainer::AddConstructor): Keep track of default constructor
18723 and the default static constructor.
18725 (Constructor::) Another class that starts using `public readonly'
18726 instead of properties.
18728 (Constructor::IsDefault): Whether this is a default constructor.
18730 (Field::) use readonly public fields instead of properties also.
18732 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
18733 track of static constructors; If none is used, turn on
18734 BeforeFieldInit in the TypeAttributes.
18736 * cs-parser.jay (opt_argument_list): now the return can be null
18737 for the cases where there are no arguments.
18739 (constructor_declarator): If there is no implicit `base' or
18740 `this', then invoke the default parent constructor.
18742 * modifiers.cs (MethodAttr): New static function maps a set of
18743 modifiers flags into a MethodAttributes enum
18744 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
18745 MethodAttr, TypeAttr to represent the various mappings where the
18746 modifiers are used.
18747 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
18749 2001-08-19 Miguel de Icaza <miguel@ximian.com>
18751 * parameter.cs (GetParameterInfo): Fix bug where there would be no
18754 * interface.cs (PopulateIndexer): Implemented the code generator
18755 for interface indexers.
18757 2001-08-17 Miguel de Icaza <miguel@ximian.com>
18759 * interface.cs (InterfaceMemberBase): Now we track the new status
18762 (PopulateProperty): Implement property population. Woohoo! Got
18763 Methods and Properties going today.
18765 Removed all the properties for interfaces, and replaced them with
18766 `public readonly' fields.
18768 2001-08-16 Miguel de Icaza <miguel@ximian.com>
18770 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
18771 initialize their hashtables/arraylists only when they are needed
18772 instead of doing this always.
18774 * parameter.cs: Handle refs and out parameters.
18776 * cs-parser.jay: Use an ArrayList to construct the arguments
18777 instead of the ParameterCollection, and then cast that to a
18780 * parameter.cs: Drop the use of ParameterCollection and use
18781 instead arrays of Parameters.
18783 (GetParameterInfo): Use the Type, not the Name when resolving
18786 2001-08-13 Miguel de Icaza <miguel@ximian.com>
18788 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
18789 and instead use public readonly fields.
18791 * class.cs: Put back walking code for type containers.
18793 2001-08-11 Miguel de Icaza <miguel@ximian.com>
18795 * class.cs (MakeConstant): Code to define constants.
18797 * rootcontext.cs (LookupType): New function. Used to locate types
18800 2001-08-08 Miguel de Icaza <miguel@ximian.com>
18802 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
18803 this System.Reflection code is. Kudos to Microsoft
18805 * typemanager.cs: Implement a type cache and avoid loading all
18806 types at boot time. Wrap in LookupType the internals. This made
18807 the compiler so much faster. Wow. I rule!
18809 * driver.cs: Make sure we always load mscorlib first (for
18810 debugging purposes, nothing really important).
18812 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
18813 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
18815 * rootcontext.cs: Lookup types on their namespace; Lookup types
18816 on namespaces that have been imported using the `using' keyword.
18818 * class.cs (TypeContainer::TypeAttr): Virtualize.
18819 (Class::TypeAttr): Return attributes suitable for this bad boy.
18820 (Struct::TypeAttr): ditto.
18821 Handle nested classes.
18822 (TypeContainer::) Remove all the type visiting code, it is now
18823 replaced with the rootcontext.cs code
18825 * rootcontext.cs (GetClassBases): Added support for structs.
18827 2001-08-06 Miguel de Icaza <miguel@ximian.com>
18829 * interface.cs, statement.cs, class.cs, parameter.cs,
18830 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
18831 Drop use of TypeRefs, and use strings instead.
18833 2001-08-04 Miguel de Icaza <miguel@ximian.com>
18837 * class.cs (Struct::Struct): set the SEALED flags after
18838 checking the modifiers.
18839 (TypeContainer::TypeAttr): new property, returns the
18840 TypeAttributes for a class.
18842 * cs-parser.jay (type_list): Oops, list production was creating a
18843 new list of base types.
18845 * rootcontext.cs (StdLib): New property.
18846 (GetInterfaceTypeByName): returns an interface by type name, and
18847 encapsulates error handling here.
18848 (GetInterfaces): simplified.
18849 (ResolveTree): Encapsulated all the tree resolution here.
18850 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
18853 * driver.cs: Add support for --nostdlib, to avoid loading the
18854 default assemblies.
18855 (Main): Do not put tree resolution here.
18857 * rootcontext.cs: Beginning of the class resolution.
18859 2001-08-03 Miguel de Icaza <miguel@ximian.com>
18861 * rootcontext.cs: Provide better error reporting.
18863 * cs-parser.jay (interface_base): set our $$ to be interfaces.
18865 * rootcontext.cs (CreateInterface): Handle the case where there
18866 are no parent interfaces.
18868 (CloseTypes): Routine to flush types at the end.
18869 (CreateInterface): Track types.
18870 (GetInterfaces): Returns an array of Types from the list of
18871 defined interfaces.
18873 * typemanager.c (AddUserType): Mechanism to track user types (puts
18874 the type on the global type hash, and allows us to close it at the
18877 2001-08-02 Miguel de Icaza <miguel@ximian.com>
18879 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
18880 RecordInterface instead.
18882 * cs-parser.jay: Updated to reflect changes above.
18884 * decl.cs (Definition): Keep track of the TypeBuilder type that
18885 represents this type here. Not sure we will use it in the long
18886 run, but wont hurt for now.
18888 * driver.cs: Smaller changes to accomodate the new code.
18890 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
18893 * rootcontext.cs (CreateInterface): New method, used to create
18894 the System.TypeBuilder type for interfaces.
18895 (ResolveInterfaces): new entry point to resolve the interface
18897 (CodeGen): Property, used to keep track of the code generator.
18899 2001-07-26 Miguel de Icaza <miguel@ximian.com>
18901 * cs-parser.jay: Add a second production for delegate_declaration
18904 (enum_body): Put an opt_comma here instead of putting it on
18905 enum_body or enum_member_declarations so we can handle trailing
18906 commas on enumeration members. Gets rid of a shift/reduce.
18908 (type_list): Need a COMMA in the middle.
18910 (indexer_declaration): Tell tokenizer to recognize get/set
18912 * Remove old targets.
18914 * Re-add the parser target.
18916 2001-07-13 Simon Cozens <simon@simon-cozens.org>
18918 * cs-parser.jay: Add precendence rules for a number of operators
18919 ot reduce the number of shift/reduce conflicts in the grammar.
18921 2001-07-17 Miguel de Icaza <miguel@ximian.com>
18923 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
18926 Get rid of old crufty code.
18928 * rootcontext.cs: Use this to keep track of the parsed
18929 representation and the defined types available to the program.
18931 * gen-treedump.cs: adjust for new convention.
18933 * type.cs: Split out the type manager, and the assembly builder
18936 * typemanager.cs: the type manager will live here now.
18938 * cil-codegen.cs: And the code generator here.
18940 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
18942 * makefile: Fixed up for easy making.
18944 2001-07-13 Simon Cozens <simon@simon-cozens.org>
18946 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
18949 (unary_expression): Expand pre_increment_expression and
18950 post_decrement_expression to reduce a shift/reduce.
18952 2001-07-11 Simon Cozens
18954 * cs-tokenizer.cs: Hex numbers should begin with a 0.
18956 Improve allow_keyword_as_indent name.
18958 2001-06-19 Miguel de Icaza <miguel@ximian.com>
18960 * Adjustments for Beta2.
18962 2001-06-13 Miguel de Icaza <miguel@ximian.com>
18964 * decl.cs: Added `Define' abstract method.
18965 (InTransit): new property, used to catch recursive definitions.
18967 * interface.cs: Implement `Define'.
18969 * modifiers.cs: Map Modifiers.constants to
18970 System.Reflection.TypeAttribute flags.
18972 * class.cs: Keep track of types and user-defined types.
18973 (BuilderInit): New method for creating an assembly
18974 (ResolveType): New function to launch the resolution process, only
18975 used by interfaces for now.
18977 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
18978 that are inserted into the name space.
18980 2001-06-08 Miguel de Icaza <miguel@ximian.com>
18982 * ARGH. I have screwed up my tree so many times due to the use of
18983 rsync rather than using CVS. Going to fix this at once.
18985 * driver.cs: Objetify driver. Load assemblies, use assemblies to
18988 2001-06-07 Miguel de Icaza <miguel@ximian.com>
18990 * Experiment successful: Use System.Type rather that our own
18993 2001-05-25 Miguel de Icaza <miguel@ximian.com>
18995 * cs-parser.jay: Removed nsAliases from here.
18997 Use new namespaces, handle `using XXX;'
18999 * namespace.cs: Reimplemented namespace handling, use a recursive
19000 definition of the class. Now we can keep track of using clauses
19001 and catch invalid using clauses.
19003 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19005 * gen-treedump.cs: Adapted for all the renaming.
19007 * expression.cs (Expression): this class now has a Type property
19008 which returns an expression Type.
19010 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19011 `Type', as this has a different meaning now in the base
19013 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19015 * interface.cs, class.cs: Removed from all the sources the
19016 references to signature computation, as we can not do method
19017 signature computation during the parsing time, as we are not
19018 trying to solve at that point distinguishing:
19022 void a (NS.Blah x) {}
19025 Which depending on the context might be valid or not, as we do not
19026 know if Blah is the same thing as NS.Blah at that point.
19028 * Redid everything so the code uses TypeRefs now instead of
19029 Types. TypeRefs are just temporary type placeholders, that need
19030 to be resolved. They initially have a pointer to a string and the
19031 current scope in which they are used. This is used later by the
19032 compiler to resolve the reference to an actual Type.
19034 * DeclSpace is no longer a CIR.Type, and neither are
19035 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19036 are all DeclSpaces, but no Types.
19038 * type.cs (TypeRefManager): This implements the TypeRef manager,
19039 which keeps track of all the types that need to be resolved after
19040 the parsing has finished.
19042 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19044 * ARGH. We are going to have to store `foreach' as a class rather
19045 than resolving it, as we need to verify error 1579 after name
19046 resolution. *OR* we could keep a flag that says `This request to
19047 IEnumerator comes from a foreach statement' which we can then use
19048 to generate the error.
19050 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19052 * class.cs (TypeContainer.AddMethod): we now add methods to the
19053 MethodGroup instead of the method hashtable.
19055 * expression.cs: Add MethodGroup abstraction, which gets us one
19056 step closer to the specification in the way we handle method
19059 * cs-parser.jay (primary_expression): qualified_identifier now
19060 tried to match up an identifier to a local variable reference or
19061 to a parameter reference.
19063 current_local_parameters is now a parser global variable that
19064 points to the current parameters for the block, used during name
19067 (property_declaration): Now creates an implicit `value' argument to
19070 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19072 * parameter.cs: Do not use `param' arguments as part of the
19073 signature, per the spec.
19075 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19077 * decl.cs: Base class for classes, structs and interfaces. This
19078 is the "Declaration Space"
19080 * cs-parser.jay: Use CheckDef for checking declaration errors
19081 instead of having one on each function.
19083 * class.cs: Factor out some code for handling error handling in
19084 accordance to the "Declarations" section in the "Basic Concepts"
19085 chapter in the ECMA C# spec.
19087 * interface.cs: Make all interface member classes derive from
19088 InterfaceMemberBase.
19090 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19092 * Many things: all interfaces are parsed and generated in
19093 gen-treedump. Support for member variables, constructors,
19094 destructors, properties, constants is there.
19096 Beginning of the IL backend, but very little done, just there for
19099 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19101 * cs-parser.jay: Fix labeled statement.
19103 * cs-tokenizer.cs (escape): Escape " and ' always.
19104 ref_line, ref_name: keep track of the line/filename as instructed
19105 by #line by the compiler.
19108 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19110 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19111 to match the values in System.CodeDOM.
19113 Divid renamed to Divide.
19115 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19117 (Statements.set): remove.
19119 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19122 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19123 falseStatements always have valid values.
19125 * cs-parser.jay: Use System.CodeDOM now.