1 2005-03-26 Raja R Harinath <harinath@acm.org>
4 * assign.cs (Assign.DoResolve): When the RHS of an assignment
5 fails to resolve, ensure that the LHS is still resolved as an
8 2005-03-25 Raja R Harinath <harinath@acm.org>
10 * enum.cs (Enum.DefineType): Set ec.InEnumContext and
12 (Enum.current_ec): Remove.
13 (Enum.LookupEnumValue): Remove EmitContext argument.
14 Just uses the one created during DefineType.
15 (Enum.FindMembers): Update.
16 * expression.cs (MemberAccess.DoResolve): Update.
18 2005-03-22 Marek Safar <marek.safar@seznam.cz>
20 * assign.cs (Assign.DoResolve): Check for CS1717 when
21 source and target are same (uses Equals).
23 * expression.cs (LocalVariableReference, ParameterReference,
24 This): Implemented Equals, GetHashCode.
26 * statement.cs (Block.GetParameterReference): Removed useless
29 2005-03-22 Raja R Harinath <rharinath@novell.com>
32 * statement.cs (Block.AddVariable): Ensure that we skip implicit
33 blocks before deciding whether the error is cs0136 or cs0128.
35 * cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
36 (using_alias_directive, using_namespace_directive): Pass
37 MemberName, not an expression to Namespace.UsingAlias and
39 (MakeName): Use the MemberName of the namespace.
40 * namespace.cs (Namespace.MemberName): New.
41 (UsingEntry.UsingEntry): Take a MemberName, not an expression.
42 (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
44 * decl.cs (MemberName.Name): Make readonly.
45 (MemberName.FromDotted): New "constructor".
46 (MemberName.Equals, MemberName.GetHashCode): Implement overrides.
47 (MemberCore.Name): Compute from MemberName on demand.
48 (MemberCore.SetMemberName): Provide a way to change the
50 (MemberCore.AddToContainer): Don't take a fullname parameter.
51 * class.cs (TypeContainer.AddToMemberContainer): Don't add the
52 fully qualified name of the container to the member name.
53 (TypeContainer.AddToTypeContainer): Use a fully qualified name
54 only if the type is a member of the root container.
55 (TypeContainer.AddMethod, TypeContainer.AddProperty): Use
56 MemberName.Left rather than searching for an embedded ".".
57 (PartialContainer.CreatePart): Update to changes in RootContext.
58 (MemberBase.ShortName): Turn into a property. Use
59 MemberCore.SetMemberName.
60 (MemberBase.ExplicitInterfaceName): Remove.
61 (MemberBase.UpdateMemberName): Remove.
62 (AbstractPropertyEventMethod.UpdateName): Use SetMemberName.
63 (PropertyBase.SetMemberName): New override.
64 * tree.cs (Tree.RecordDecl): Take a MemberName and use it as hash key.
66 (Tree.AllDecls): Rename from Decls.
67 * attribute.cs, enum.cs, report.cs: Update to changes.
68 * driver.cs (MainDriver): Use MemberName.FromDotted on
69 RootContext.MainClass.
71 2005-03-21 Marek Safar <marek.safar@seznam.cz>
73 * class.cs (FixedField.Define): Check for CS1664 and more sanity
76 * expression.cs (ElementAccess.DoResolveLValue): Check for CS1708.
78 2005-03-18 Marek Safar <marek.safar@seznam.cz>
80 * modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
81 property accessor modifiers.
83 * class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
84 fixed buffer attribute (CS1716).
85 (PropertyMethod.HasCustomAccessModifier): When property accessor
88 * ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
90 (PropertyExpr.DoResolveLValue): Add CS0272.
92 2005-03-17 Miguel de Icaza <miguel@novell.com>
94 * convert.cs: When converting to a pointer, use the proper Conv.U
95 or Conv.I depending on the source data type.
97 * cs-tokenizer.cs: Make the size for large decimal constants,
100 2005-03-17 Martin Baulig <martin@ximian.com>
102 * anonymous.cs (AnonymousMethod.method_modifiers): Change default
103 from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
105 2005-03-17 Martin Baulig <martin@ximian.com>
107 * anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
108 to bool so we can return an error condition.
109 (AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
112 2005-03-16 Zoltan Varga <vargaz@freemail.hu>
114 * attribute.cs: Encode ThrowOnUnmappableChar and BestFitMapping
117 2005-03-16 Raja R Harinath <rharinath@novell.com>
119 Remove TypeManager.LookupType and TypeManager.LookupTypeDirect.
120 Refactor to avoid traversing the list of assemblies, and to avoid
121 string concatenation.
122 * typemanager.cs (guid_attr_type): Remove.
123 (negative_hits, pointers, references): Remove hashes.
125 (GetConstructedType): New. Uses type_hash to handle constructed
126 types (arrays, references, pointers).
127 (GetReferenceType, GetPointerType): Use it.
128 (GetNestedType): New. Uses type_hash to handle nested types of
130 (LookupType, LookupTypeDirect): Remove.
131 (CoreLookupType): Inline parts of old LookupTypeDirect code. Use
132 'types' hash and LookupTypeReflection directly.
133 (params_string, params_object): Use GetConstructedType.
134 * namespace.cs (Namespace.cached_types): New. Cache of reflected
136 (Namespace.Lookup): Use cached_types.
137 (NamespaceEntry.LookupNamespaceOrType): Inline the functionality
138 provided by old TypeManager.LookupType.
139 * rootcontext.cs (MakeFQN): Remove.
140 * decl.cs (DeclSpace.MakeFQN): Likewise.
141 (DeclSpace.LookupType): Use TypeManager.GetNestedType.
142 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
143 TypeManager.GetConstructedType.
144 * tree.cs (decl_ns_hash, LookupByNamespace): Remove.
146 2005-03-15 Marek Safar <marek.safar@seznam.cz>
148 * class.cs (TypeContainer.CircularDepException) New nested
149 (MethodCore.CheckBase): Report CS1715 for properties and indexers.
151 * cs-parser.jay: Reports CS1527 for any namespace element.
153 * delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
156 * expression.cs (ParameterReference.IsAssigned): Changed error to
158 (Error_WrongNumArguments): Moved CS0245 detection here.
160 * statement.cs (Return.Resolve): Add CS1622 report.
162 2005-03-11 Marek Safar <marek.safar@seznam.cz>
164 * class.cs (StaticClass.DefineContainerMembers): Added CS0720.
166 2005-03-11 Zoltan Varga <vargaz@freemail.hu>
168 * attribute.cs expression.cs: Get rid of some allocations.
170 2004-03-11 Atsushi Enomoto <atsushi@ximian.com>
172 * doc.cs : just eliminate the latest change.
174 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
176 * doc.cs : commented out the latest change. It breaks xml-030.cs
178 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
180 * doc.cs : When TypeBuilder did not create Type yet, GetEvents() will
181 fail. So invoke CreateType() in FindDocumentedType().
183 2004-03-10 Atsushi Enomoto <atsushi@ximian.com>
185 * cs-tokenizer.cs : added IsKeyword().
186 * doc.cs : Detect keyword incorrectly used as identifier.
187 Allow identifiers prefixed by @.
189 2005-03-10 Marek Safar <marek.safar@seznam.cz>
191 * attributes.cs (Attributes.Emit): Continue after CheckTargets.
192 It caused exception in namespace resolving (again!).
194 * class.cs (Class.ctor): Removed exit.
195 (PropertyMethod.ctor): ditto.
197 * codegen.cs (Codegen.Reset): Reset static data.
198 (Codegen.ResolveTopBlock): Forward error status from ResolveMeta.
200 * cs-tokenizer.cs (Cleanup): Removed.
202 * driver.cs (GetSystemDir): Rewrote to one line command.
203 It caused problem with unloaded dynamic modules.
204 (UnixParseOption): Removed Exit.
205 (CompilerCallableEntryPoint.InvokeCompiler): Make static.
206 (CompilerCallableEntryPoint.Reset): Reset suitable static data.
207 Now can be mcs used as library.
209 * ecore.cs (Expression.ResolveBoolean): Use Location.Null for
212 * location.cs (Reset): Reset static data.
214 * namespace.cs (Reset): Reset static data.
216 * report.cs (Report.Reset): Reset static data.
218 * rootcontext.cs (RootContext.Reset): Reset static data.
220 * tree.cs (RootTypes.ctor): Use Location.Null
222 * typemanager.cs (TypeManager.Reset): Reset static data.
223 (CoreLookupType): Removed Exit.
224 (TypeHandle.Reset): Reset static data.
226 2005-03-10 Raja R Harinath <rharinath@novell.com>
229 * typemanager.cs (ComputeNamespaces): Import namespaces from
230 referenced modules too.
232 2005-03-09 Raja R Harinath <rharinath@novell.com>
234 * class.cs (TypeContainer.AddToMemberContainer): Use "." rather
237 2005-03-09 Raja R Harinath <rharinath@novell.com>
239 * decl.cs (DeclSpace.LookupType): Don't loop but recurse into
240 enclosing DeclSpace. This ensures that a name-lookup populates
241 more caches and there are fewer 'TypeExpression's. Carve out
242 nested type lookup into ...
243 (LookupNestedTypeInHierarchy): ... this.
245 2005-03-09 Raja R Harinath <rharinath@novell.com>
247 Clean up a few partial-class semantics.
248 Fixes test-357.cs and cs1618-2.cs.
249 * cs-parser.jay (struct_declaration): Use 'current_class' as
250 parent of newly-created struct. Remove call to Register ().
251 Use 'pop_current_class' to complete handing the current struct.
252 (interface_declaration): Likewise.
253 (class_declaration): Likewise.
254 (enum_declaration): Use 'current_class' as parent of newly created
256 (delegate_declaration): Likewise.
257 (pop_current_class): New function. This is used to handle closing
258 up the 'current_class' and 'current_container', and pointing them
259 to the enclosing class/container.
260 (CSharpParser): Initialize 'current_class' too.
261 * decl.cs (MemberCore): Add check for invariant: a partial
262 container is not a parsed entity, and thus does not enclose any
264 (DeclSpace.TypeResolveEmitContext): Expose 'type_resolve_ec'.
265 (DeclSpace.BaseTypeExpr): Use it.
266 (DeclSpace.LookupType): Add check for invariant.
267 * class.cs (TypeContainer): Add check for invariant: a nested
268 class should have the same NamespaceEntry as its enclosing class.
269 (TypeContainer.EmitFieldInitializers): Make virtual.
270 (TypeContainer.DefineDefaultConstructor): Adhere to invariant in
272 (TypeContainer.Register): Remove.
273 (TypeContainer.DefineType): Set the 'ec' of a PartialContainer to
274 null. Use TypeResolveEmitContext for resolving base types and
275 interfaces. Move initialization of Parts.TypeBuilder here from
277 (TypeContainer.DefineNestedTypes): ... here.
278 (PartialContainer): Take a Namespace not a NamespaceEntry.
279 (PartialContainer.Create): Don't use Register. Call the
280 appropriate Add... function directly.
281 (ClassPart): Take both the PartialContainer and the enclosing
282 class as constructor arguments.
283 (ClassPart.EmitFieldInitializers): Override.
284 (ClassPart.PartFindNestedTypes): Remove.
285 (FieldBase.GetInitializerExpression): Resolve the initializer
286 expression in the emit context of the enclosing class.
287 * tree.cs (RootTypes): Remove Register ().
289 2005-03-08 Marek Safar <marek.safar@seznam.cz>
291 * cs-parser.jay: Removed CS0134.
293 * driver.cs: Removed CS1901.
295 * expression.cs (SizeOf.DoResolve): Don't report CS0233
296 for predefined types.
298 2005-03-07 Duncan Mak <duncan@novell.com>
300 * codegen.cs (Save): Catch UnauthorizedAccessException as
301 well. Fixes bug #73454.
303 2005-03-07 Marek Safar <marek.safar@seznam.cz>
305 * cs-tokenizer.cs (xtoken): Add CS1035.
307 * class.cs (MethodData.Define): Add CS0683.
308 (FieldMember.ctor): Add CS0681.
310 2005-03-07 Raja R Harinath <rharinath@novell.com>
312 * ecore.cs (SimpleName.DoResolve): Rename from
313 SimpleName.DoResolveAllowStatic.
314 (SimpleName.DoSimpleNameResolve): Remove 'allow_static' argument.
315 Pass 'intermediate' flag to MemberStaticCheck.
316 (SimpleName.MemberStaticCheck): Skip "static check" only in case
317 of "intermediate" lookups via MemberAccess.
318 (SimpleName.IdenticalNameAndTypeName): New. Carved out of ...
319 * expression.cs (MemberAccess.IdenticalNameAndTypeName): ... this.
321 2005-03-07 Raja R Harinath <rharinath@novell.com>
324 * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
325 slipped in because of variable names that are identical to a
326 builtin type's BCL equivalent ('string String;', 'int Int32;').
327 (PropertyExpr.EmitInstance): Likewise.
329 2005-03-04 Marek Safar <marek.safar@seznam.cz>
331 * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.
333 * report.cs (warning_ignore_table): Made public.
335 2005-03-04 Raja R Harinath <rharinath@novell.com>
338 * class.cs (MethodData.Emit): Pass 'container' to
339 container.GetObsoleteAttribute instead of 'container.Parent'.
341 2005-03-03 Marek Safar <marek.safar@seznam.cz>
343 * cs-parser.jay: Add 1534 error test.
345 * iterators.cs (Yield.CheckContext): Add error 1629.
346 (Iterator.ctor): Save unsafe modifier.
347 (MoveNextMethod.DoEmit): Restore unsafe context.
349 * namespace.cs (UsingAlias): Better error message.
351 2005-03-03 Dan Winship <danw@novell.com>
353 * convert.cs (Error_CannotImplicitConversion): fix two bugs in
354 the warning message [#73219]
356 2005-03-03 Raja R Harinath <rharinath@novell.com>
358 Fix compile with MCS 1.0.0.0.
359 * cs-tokenizer.cs (PreProcessPragma): Simplify w_disable and
360 w_restore to not depend on string constant folding.
362 2005-03-03 Raja R Harinath <rharinath@novell.com>
364 * decl.cs (DeclSpace.LookupType): Remove 'silent' argument. Move
365 CS0246 check to users who passed 'silent = false'.
366 * ecore.cs (TypeLookupExpression.DoResolveAsTypeStep): Add CS0246
368 (SimpleName.SimpleNameResolve): Update.
369 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add CS0246 check.
370 (MemberAccess.IdenticalNameAndTypeName): Update.
371 * doc.cs (FindDocumentedTypeNonArray): Update.
373 2005-03-03 Raja R Harinath <rharinath@novell.com>
375 * codegen.cs (EmitContext): Remove ResolvingTypeTree.
376 * parameters.cs (ComputeAndDefineParameters): Remove.
377 * decl.cs (ResolveBaseTypeExpr): Don't set ResolvingTypeTree.
378 * delegate.cs (Define): Don't invoke ComputeAndDefineParameters.
379 Use GetParameterInfo.
381 2005-03-02 Marek Safar <marek.safar@seznam.cz>
383 * report.cs (StaticClass.DefineContainerMembers): Add warning 628.
385 2005-03-02 Raja R Harinath <rharinath@novell.com>
387 Unify DeclSpace.LookupType and DeclSpace.FindType.
388 * decl.cs (DeclSpace.FindNestedType): New virtual function. This
389 is in charge of defining nested types on demand.
390 (DeclSpace.LookupType): Use it when the current_type is a
391 TypeBuilder. Use LookupTypeDirect for reflected types.
392 (DeclSpace.FindType): Remove.
393 (DeclSpace.LookupInterfaceOrClass): Likewise.
394 (DeclSpace.DefineTypeAndParents): Likewise.
395 * ecore.cs (SimpleName.ResolveAsTypeStep): Just call
396 DeclSpace.LookupType.
397 * doc.cs (FindDocumentedTypeNonArray): Use DeclSpace.LookupType.
398 * typemanager.cs (LookupType): Simplify.
399 (AddUserType): Remove type from negative_hits.
400 * namespace.cs (Namespace.Lookup): Use TypeManager.LookupTypeDirect.
401 * class.cs (TypeContainer.FindMembers): Move handling of nested
403 (TypeContainer.FindMembers_NestedTypes): ... here.
404 (TypeContainer.FindNestedType): Implement override.
405 (ClassPart.FindNestedType): Delegate to PartialContainer.
406 (ClassPart.PartFindNestedType): Looks up the nested types of the
409 2005-03-02 Martin Baulig <martin@ximian.com>
411 * class.cs (TypeContainer.DoDefineMembers): We also need a default
412 static constructor in static classes.
414 2005-03-01 Zoltan Varga <vargaz@freemail.hu>
416 * attribute.cs: Pass -1 to DefineLPArrayInternal if sizeConst or
417 sizeParamIndex is not specified.
419 2005-03-01 Marek Safar <marek.safar@seznam.cz>
422 * report.cs (WarningMessage.IsEnabled): Missing null check.
424 2005-02-28 Marek Safar <marek.safar@seznam.cz>
426 * attribute.cs (DefinePInvokeMethod): Fix, all data are stored
427 in the fields and not in the properties.
429 2005-02-28 Zoltan Varga <vargaz@freemail.hu>
431 * attribute.cs (GetMarshal): Marshal SizeConst and SizeParamIndex
434 2005-02-28 Marek Safar <marek.safar@seznam.cz>
436 * attribute.cs: Small refactoring (improved robustness).
437 (ImplOptions, UnmanagedType, UsageAttribute): Removed members.
438 (ValidateGuid): Removed.
439 (Resolve): Removed referenced to above mentioned.
440 (GetAttributeUsage): Made private and changed to work without
442 (GetIndexerAttributeValue): Don't crash.
443 (GetConditionalAttributeValue): Ditto.
444 (GetClsCompliantAttributeValue): Ditto.
445 (ExtractSecurityPermissionSet): All attributes exceptions are
447 (GetPropertyValue): New helper.
448 (GetMethodImplOptions): New method.
449 (DefinePInvokeMethod): Reuse common code. Implemented handling of
450 some missing properties.
452 * class.cs (ClassOrStruct.ApplyAttributeBuilder): Updated.
453 (Method.ApplyAttributeBuilder): Updated.
455 * decl.cs (DeclSpace.ApplyAttributeBuilder): Don't catch shared
458 2005-02-28 Raja R Harinath <rharinath@novell.com>
461 * report.cs (Report.SymbolRelatedToPreviousError): Handle
462 non-simple types (array, pointer, reference).
464 2005-02-28 Marek Safar <marek.safar@seznam.cz>
466 * cs-parser.jay: Add errors 1617, 650, 1007, 531, 547, 548
468 * class.cs (MethodCore.IsDuplicateImplementation): Special error
470 (Method.CheckBase): Catch wrong destructor here.
471 (MethodData.Define): Add errors 550, 668.
473 * cs-tokenizer.cs (PreProcessPragma): Add warning 1634.
475 * ecore.cs (PropertyExpr.DoResolveLValue): Fixed wrong error code.
477 * pending.cs (VerifyPendingMethods): Add error 551.
479 * typemanager.cs (CSharpName): Next error report helper.
481 2005-02-25 Marek Safar <marek.safar@seznam.cz>
483 * attribute.cs (Atttribute.Resolve): Add cache for parameter-less
484 attributes. Removed useless attribute double check.
485 It saves almost 2MBs for corlib.
487 2005-02-25 Raja R Harinath <rharinath@novell.com>
490 * statement.cs (ExpressionStatement.Resolve): Make robust to being
491 called twice in case of error.
493 2005-02-23 Chris Toshok <toshok@ximian.com>
495 Fix compiler portions of #72827.
496 * statement.cs (Block.Emit): call Begin/EndScope on the
497 EmitContext instead of the ILGenerator.
499 * codegen.cs (EmitContext.BeginScope): new method, call
500 ILGenerator.BeginScope as well as the SymbolWriter's OpenScope (if
502 (EmitContext.BeginScope): same, but EndScope and CloseScope
504 * symbolwriter.cs (SymbolWriter.OpenScope): get the current il
505 offset and call the superclass's OpenScope(int) with it.
506 (SymbolWriter.CloseScope): get the current il
507 offset and call superclass's CloseScope(int) with it.
509 2005-02-23 Marek Safar <marek.safar@seznam.cz>
511 * anonymous.cs (AnonymousMethod.Compatible): Fixed to report
512 CS1677 for out and ref as well.
514 * class.cs (Method.Define): Add error CS1599 detection.
516 * cs-parser.jay: Add CS1609, CS1670, CS1627 detection.
518 * cs-tokenizer.cs (xtoken): Add error CS1646 detection.
520 * delegate.cs (Delegate.Define): Add error CS1599 detection.
522 * support.cs.cs (ModifierDesc): New helper method.
524 2005-02-23 Raja R Harinath <rharinath@novell.com>
525 Abin Thomas <projectmonokochi@rediffmail.com>
526 Anoob V E <projectmonokochi@rediffmail.com>
527 Harilal P R <projectmonokochi@rediffmail.com>
530 * class.cs (ConstructorBuilder.Resolve): Make sure that the second
531 MemberLookup (used for error reporting) actually returns a result.
532 Fix error report number (122, not 112).
534 2005-02-22 Abin Thomas <projectmonokochi@rediffmail.com>
535 Anoob V E <projectmonokochi@rediffmail.com>
536 Harilal P R <projectmonokochi@rediffmail.com>
539 * pending.cs (PendingImplementation.GetAbstractMethods):
540 Find NonPublic members too.
542 2005-02-22 Marek Safar <marek.safar@seznam.cz>
544 * expression.cs.cs (ConditionalLogicalOperator.DoResolve):
547 * class.cs (MethodCore.CheckMethodAgainstBase):
548 Add error 239 report.
550 2005-02-21 Raja R Harinath <rharinath@novell.com>
553 * expression.cs (Invocation.IsApplicable): Make public.
554 (Invocation.IsParamsMethodApplicable): Likewise.
555 * delegate.cs (Delegate.VerifyApplicability): Don't use
556 Invocation.VerifyArgumentCompat for parameter applicability
557 testing. Use Invocation.IsApplicable and
558 Invocation.IsParamsMethodApplicable.
560 2005-02-21 Marek Safar <marek.safar@seznam.cz>
562 * ecore.cs (PropertyExpr.DoResolve): Add error 214 report.
564 * class.cs (Operator.Define): Add error 217 report.
566 2005-02-21 Raja R Harinath <rharinath@novell.com>
568 * namespace.cs (UsingEntry.Resolve): Undo change below.
570 2005-02-21 Raja R Harinath <rharinath@novell.com>
573 * ecore.cs (Expression.MemberLookupFailed): Add argument to
574 disable the error message when the extended MemberLookup also
576 (Expression.MemberLookupFinal): Update.
577 (SimpleName.DoSimpleNameResolve): Update.
578 * expression.cs (MemberAccess.ResolveNamespaceOrType):
579 Don't use MemberLookupFinal.
580 (New.DoResolve): Update.
581 (BaseAccess.CommonResolve): Update.
583 2005-02-21 Raja R Harinath <rharinath@novell.com>
586 * attribute.cs (Attribute.ResolveType): If a 'resolve_error' had
587 occured previously, don't resolve again.
589 2005-02-21 Marek Safar <marek.safar@seznam.cz>
592 * attribute.cs (Attribute.GetAttributeUsage): Add EmitContext
593 argument. Call ResolveAttributeUsage for unresolved.
594 when types doesn't match ctor arguments.
596 * class.cs (DoDefineMembers.TypeContainer): Removed safety check
597 for nested attribute classes.
598 (Class.attribute_usage): Removed.
599 (Class.ResolveAttributeUsage): Resolves AttributeUsageAttribute
602 * ecore.cs (IsAttribute): Removed.
604 * namespace.cs (UsingEntry.Resolve): Don't destroy NamespaceEntry.
606 * rootcontext.cs (RegisterAttribute): Removed, attributes are
608 (attribute_types): Removed.
609 (EmitCode): Global attributes are emited as the latest.
611 2005-02-18 Marek Safar <marek.safar@seznam.cz>
613 * class.cs (EmitFieldInitializers): Don't emit field initializer
614 for default values when optimilization is on.
616 * constant.cs (Constant.IsDefaultValue): New property.
618 * driver.cs: Add /optimize handling.
622 * literal.cs: Implement new IsDefaultValue property.
624 * rootcontext.cs (Optimize): New field, holds /optimize option.
626 2005-02-18 Raja R Harinath <rharinath@novell.com>
628 Fix crasher in re-opened #72347.
629 * namespace.cs (Namespace.Lookup): Return null if
630 DeclSpace.DefineType returns null.
633 * expression.cs (Argument.Resolve): Handle a case of CS0120 here.
635 2005-02-18 Raja R Harinath <rharinath@novell.com>
637 Fix remainder of #63202. Change semantics of DoResolveLValue: it
638 now returns null if it cannot resolve to an lvalue.
639 * ecore.cs (Expression.DoResolveLValue): Return 'null' by default.
640 (Expression.ResolveLValue): Emit CS0131 error if DoResolveLValue
641 returned null. Remove check for SimpleName.
642 (EventExpr.DoResolveLValue): New.
643 * iterators.cs (Iterator.FieldExpression.DoResolveLValue): New.
644 * expression.cs (Argument.Error_LValueRequired): New. Move CS1510
646 (Argument.Resolve): ... here. Use it. Use DoResolveLValue to
648 (Unary.ResolveOperator): Move CS0211 check ...
649 (Unary.DoResolve): ... here. Use DoResolveLValue to avoid
651 (Unary.DoResolveLValue): Simplify.
652 (AddressOf.DoResolveLValue): New.
653 (ArrayAccess.DoResolveLValue): New.
655 2005-02-16 Marek Safar <marek.safar@seznam.cz>
657 * attribute.cs (Attribute.Resolve): Add arguments casting for
658 when types doesn't match ctor arguments.
660 2005-02-16 Raja R Harinath <rharinath@novell.com>
663 * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
664 lookup of operator in base type. Ensure that all checks happen
665 when the operator resolves to an "op_..." method.
667 2005-02-15 Raja R Harinath <rharinath@novell.com>
670 * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
671 'ignore_cs0104' parameter. Pass it to ...
672 (NamespaceEntry.Lookup): ... this.
673 * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
674 * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
675 (TypeLookupExpression.DoResolveAsTypeStep): Update.
676 * expression.cs (MemberAccess.IdenticalNameAndTypeName):
677 Update. Request that cs0104 errors be ignored.
678 (ComposedCast.ResolveAsTypeStep): Update.
680 2005-02-14 Raja R Harinath <rharinath@novell.com>
683 * expression.cs (Invocation.BetterFunction): Remove support for
684 comparing virtual functions and their overrides.
685 (Invocation.IsOverride): New.
686 (Invocation.OverloadResolve): Don't consider 'override' functions
687 during candidate selection. Store them in a lookaside list.
688 If the selected method is a 'virtual' function, use the list to
689 find any overrides that are closer to the LHS type.
691 2005-02-14 Marek Safar <marek.safar@seznam.cz>
693 * expression.cs (New.DoResolve): Add complex core type reduction.
694 (New.Constantify): Converts complex core type syntax like 'new int ()'
697 2005-02-14 Raja R Harinath <rharinath@novell.com>
699 * decl.cs (EntryType.EntryType): New constructor to create an
700 updated copy of a cache entry.
701 (MemberCache.AddMethods): Use it.
702 (MemberCache.ClearDeclaredOnly): Remove.
703 (MemberCache.MemberCache): Update.
705 2005-02-11 Miguel de Icaza <miguel@novell.com>
707 * codegen.cs (EmitContext): Introduce the `MethodIsStatic'
708 variable. This one is represents the actual low-level declaration
709 of the method, as opposed to the semantic level `IsStatic'.
711 An anonymous method which is hosted into a static method might be
712 actually an instance method. IsStatic would reflect the
713 container, while MethodIsStatic represents the actual code
716 * expression.cs (ParameterReference): Use the new MethodIsStatic
719 * anonymous.cs (AnonymousMethod.Compatible): Pass the
720 Modifiers.STATIC to the Anonymous' Method EmitContext if static is
721 set on the current EmitContext.
723 * expression.cs (Cast): Overload DoResolveLValue so we can pass
724 resolve our casted expression as an LValue. This triggers the
725 proper LValue processing that is later required by Assign.
729 * cs-tokenizer.cs (pp_and): recurse on pp_and, fixes #61903.
731 2005-02-11 Marek Safar <marek.safar@seznam.cz>
733 C# 2.0 Fixed buffer implementation
735 * anonymous.cs: Update after RegisterHelperClass renaming.
737 * attribute.cs (AttributeTester.fixed_buffer_cache):
738 Cache of external fixed buffers.
739 (AttributeTester.GetFixedBuffer): Returns IFixedBuffer
740 implementation if field is fixed buffer else null.
743 (TypeContainer.AddField): Accept FieldMember instead of Field.
744 (FieldBase.IsFieldClsCompliant): Extracted code from
745 VerifyClsCompliance descendant customization.
746 (FixedField): New class handles fixed buffer fields.
747 (FixedFieldExternal): Keeps information about imported fixed
749 (IFixedField): Make access to internal or external fixed buffer
752 * cs-parser.jay: Add fixed buffer parsing.
754 * ecore.cs (FieldExpr.Emit): Add special emit case for fixed
757 * expression.cs (Indirection): Extended implementation to accept
759 (PointerArithmetic.Emit): Get element from fixed buffer as well.
760 (ElementAccess.MakePointerAccess): Get type as parameter.
761 (DoResolve): Add fixed buffer field expression conversion.
762 (DoResolveLValue): Ditto.
763 (FixedBufferPtr): New class. Moved most of original ArrayPtr.
764 (ArrayPtr): Derives from FixedBufferPtr.
765 (ArrayPtr.Emit): Add extra emit for array elements.
767 * flowanalysis.cs.cs (StructInfo): Use FieldMember.
769 * rootcontext.cs (CloseTypes): Emit CompilerGenerated attribute
770 for compiler generated types.
771 (RegisterCompilerGeneratedType): Renamed from RegisterHelperClass.
773 * statement.cs (Fixed): Refactored to be easier add fixed buffer
774 and consume less memory.
775 (Fixed.Resolve): Add fixed buffer case.
777 * typemanager.cs (compiler_generated_attr_ctor,
778 fixed_buffer_attr_ctor): Add new 2.0 compiler attributes.
779 (HasElementType): Add our own implementation to work on every
782 2005-02-11 Miguel de Icaza <miguel@novell.com>
784 * anonymous.cs (CaptureContext): Track whether `this' has been
787 * expression.cs (This.ResolveBase): Call CaptureThis. Before we
788 only captured `this' if it was implicitly done (instance
789 methods/variables were used).
791 * codegen.cs (EmitContext.CaptureThis): New method to flag that
792 `this' must be captured.
794 2005-01-30 Miguel de Icaza <miguel@novell.com>
796 * anonymous.cs (CreateMethodHost): If there Scope.ScopeTypeBuilder
797 is null it means that there has been no need to capture anything,
798 so we just create a sibling.
800 Renamed `EmitHelperClasses' to `EmitAnonymousHelperClasses'
802 Just a partial fix. The other half is fairly elusive.
804 2005-02-10 Raja R Harinath <rharinath@novell.com>
806 Fix #52586, cs0121-4.cs.
807 * decl.cs (MemberCache.DeepCopy): Rename from SetupCache. Take
808 and return a hashtable.
809 (MemberCache.ClearDeclaredOnly): New.
810 (MemberCache.MemberCache): Update to change. Make a deep copy of
811 the method_hash of a base type too.
812 (MemberCache.AddMethods): Adapt to having a deep copy of the base
813 type methods. Overwrite entries with the same MethodHandle so
814 that the ReflectedType is correct. The process leaves in base
815 virtual functions and their overrides as distinct entries.
816 (CacheEntry): Now a class instead of a struct. It shouldn't alter
817 matters since it was boxed in a ArrayList before.
818 (CacheEntry.Member, CacheEntry.EntryType): Remove 'readonly'
820 * expression.cs (Invocation.BetterFunction): Simplify. Handle the
821 case of a virtual function and its override (choose the overload
823 (Invocation.OverloadResolve): Avoid 'override' members during
824 'applicable_type' calculation.
826 2005-02-09 Raja R Harinath <rharinath@novell.com>
828 Combine two near-redundant caches.
829 * typemanager.cs (method_params): Rename from method_internal_params.
830 (TypeManager.GetParameterData): New. Replace
831 Invocation.GetParameterData.
832 (TypeManager.LookupParametersByBuilder): Remove.
833 * expression.cs (Invocation.method_parameter_cache): Remove.
834 (Invocation.GetParameterData): Remove.
836 * anonymous.cs, attribute.cs, convert.cs, delegate.cs:
839 2005-02-08 Raja R Harinath <rharinath@novell.com>
842 * delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
843 TypeManager.multicast_delegate_type is null, resolve it by looking
844 up "System.MulticastDelegate".
845 * rootcontext.cs (RootContext.ResolveCore): Simplify.
847 2005-02-07 Abin Thomas (NOSIP) <projectmonokochi@rediffmail.com>
848 Anoob V.E (NOSIP) <projectmonokochi@rediffmail.com>
849 Harilal P.R (NOSIP) <projectmonokochi@rediffmail.com>
852 * statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
853 (LabeledStatement.AddReference): New. Set 'referenced'.
854 (Goto.Resolve): Use it.
856 2005-02-05 John Luke <john.luke@gmail.com>
858 * driver.cs: remove duplicate -doc line in Usage ()
860 2005-02-04 Raja R Harinath <rharinath@novell.com>
862 * location.cs (Location.AddFile): Fix CS2002 error report.
864 2005-02-02 Martin Baulig <martin@ximian.com>
866 * delegate.cs (Delegate.DefineType): Report an internal error if
867 TypeManager.multicast_delegate_type is null. See bug #72015 for
870 2005-02-02 Raja R Harinath <rharinath@novell.com>
872 Fix a crasher in a variant of #31984.
873 * const.cs (Constant.CheckBase): New override that defers the
874 new-or-override check in case the base type hasn't been populated
876 (Constant.Define): Ensure the new-or-override check is performed.
878 2005-02-01 Duncan Mak <duncan@ximian.com>
880 * const.cs (LookupConstantValue): Check that `ce' is not null
881 before calling GetValue ().
883 2005-02-01 Raja R Harinath <rharinath@novell.com>
885 Fix test-334.cs (#69519).
886 * cs-parser.jay (using_alias_directive): Pass in an expression to
887 NamespaceEntry.UsingAlias.
888 (using_namespace_directive): Pass in an expression to
889 NamespaceEntry.Using.
890 (namespace_name): Don't flatten to a string.
891 * namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
892 (NamespaceEntry.AliasEntry.Resolve): Lookup using
894 (NamespaceEntry.UsingEntry): Likewise.
895 (NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
897 (NamespaceEntry.LookupForUsing): Remove.
898 (NamespaceEntry.LookupNamespaceOrType): Add support for dotted
900 (NamespaceEntry.Lookup): Remove support for dotted names.
902 2005-02-01 Raja R Harinath <rharinath@novell.com>
904 * namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
906 (NamespaceEntry.ImplicitParent): Compute on demand.
907 (NamespaceEntry.Doppelganger): New implicit namespace-entry that
908 parallels the current.
909 (NamespaceEntry.LookupForUsing): Use it.
910 (NamespaceEntry.Lookup): If the current namespace-entry is
911 implicit, don't search aliases and using tables.
913 2005-02-01 Raja R Harinath <rharinath@novell.com>
916 * class.cs (TypeContainer.DoDefineMembers): Don't initialize
918 (TypeContainer.BaseCache): Compute on demand.
919 (TypeContainer.FindMembers): Define constants and types if they're
921 (FieldMember.Define): Move resetting of ec.InUnsafe before error
923 * const.cs (Constant.Define): Make idempotent.
925 2005-01-29 Miguel de Icaza <miguel@novell.com>
927 * pending.cs: Produce better code (no nops produced by using Ldarg
930 * pending.cs (PendingImplementation.DefineProxy): It was not `arg
931 i - 1' it should be arg + 1.
935 2005-01-28 Raja R Harinath <rharinath@novell.com>
937 * attribute.cs (Attribute.CheckAttributeType): Make private
939 (Attribute.ResolveType): Make virtual.
940 (GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
941 handling of RootContext.Tree.Types.
943 2005-01-27 Raja R Harinath <rharinath@novell.com>
945 Update attribute-handling to use the SimpleName/MemberAccess
947 * cs-parser.jay (attribute): Pass in an expression to the
948 constructors of Attribute and GlobalAttribute.
949 * attribute.cs (Attribute): Take an expression for the name.
950 (Attribute.ResolvePossibleAttributeTypes): New. Resolves the
951 passed in attribute name expression.
952 (Attribute.CheckAttributeType): Use it.
953 * ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
954 * expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
955 (MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
956 argument to prevent error messages if the lookup fails.
958 2005-01-27 Marek Safar <marek.safar@seznam.cz>
960 * expression.cs (Indirection): Implemented IVariable interface
961 to support indirection in AddressOf operator.
962 (PointerArithmetic.Emit): Add optimalization for case where
963 result can be precomputed.
965 2005-01-26 Martin Baulig <martin@ximian.com>
967 * class.cs (TypeContainer.AttributeTargets): Return the correct
968 AttributeTargets depending on our `Kind' instead of throwing an
969 exception; fixes #71632.
971 2005-01-26 Marek Safar <marek.safar@seznam.cz>
974 * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
977 2005-01-25 Raja R Harinath <rharinath@novell.com>
980 * expression.cs (MemberAccess.DoResolve): Don't complain with
981 cs0572 when the LHS of a member access has identical name and type
984 2005-01-25 Marek Safar <marek.safar@seznam.cz>
987 * attribute.cs (ExtractSecurityPermissionSet): Catch exceptions from
989 Create custom PermissionSet only for PermissionSetAttribute.
991 2005-01-24 Marek Safar <marek.safar@seznam.cz>
994 * class.cs (StaticClass.DefineContainerMembers): Enable enums and
995 delegates in static class.
997 2005-01-24 Martin Baulig <martin@ximian.com>
999 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1000 merging an implicit block, just use its reachability.
1002 * statement.cs (Block.Resolve): Make the unreachable code check
1003 work wrt. implicit blocks; see test-337 from #63842.
1005 2005-01-21 Alp Toker <alp@atoker.com>
1007 * cs-parser.jay: destructor_declaration's container is PartialContainer
1008 not Class when partial types are used, so use Kind prop instead of
1011 2005-01-22 Miguel de Icaza <miguel@ximian.com>
1013 * cs-parser.jay: Improve error reporting when an interface
1016 2005-01-20 Dick Porter <dick@ximian.com>
1018 * support.cs: SeekableStreamReader fix from Sandor Dobos
1019 (dobos_s@ibcnet.hu) to cope with Position setting when multibyte
1020 chars are read. Fixes bug 70369.
1022 2005-01-20 Raja R Harinath <rharinath@novell.com>
1024 * cs-parser.jay (catch_clause): Simplify current_block handling
1027 2005-01-17 Miguel de Icaza <miguel@ximian.com>
1029 * convert.cs (ImplicitStandardConversionExists): Synchronize the
1030 code with ImplicitStandardConversion to handle the implicit
1031 conversion of method groups into valid delegate invocations.
1033 The problem is that in parameter handling we were using this code
1034 path. Fixes bug #64698
1036 2005-01-19 Raja R Harinath <rharinath@novell.com>
1038 * cs-parser.jay: Fix several infelicities.
1039 - Avoid assigning to the parser value stack. Code like
1040 '$3 = null' is unclean. Synthesize a value for the code block
1042 - Avoid using oob_stack for storing location information. Use ...
1043 (_mark_): ... this. New (empty) rule. Saves the current location
1045 (foreach_statement): Avoid using oob_stack for current_block
1046 handling. Use technique used in for_statement and
1047 using_statement. Synthesize a value for the code block to store
1048 additional intermediate information.
1050 2005-01-13 Miguel de Icaza <miguel@ximian.com>
1052 * ecore.cs (IsAccessorAccessible): Accessibility to private fields
1053 of a different type is only allowed to private fields of a
1054 containing type, not on fields of a base class.
1056 See test-174.cs and error cs0122-9.cs
1058 2005-01-13 Raja R Harinath <rharinath@novell.com>
1060 Fix test-335.cs (bug #58126).
1061 * cs-parser.jay (argument): Split out non-expression parts of the
1062 rule into 'non_simple_argument'.
1063 (invocation_expression): Support parenthesized invocations with
1064 multiple arguments, and with single non-simple arguments.
1066 2005-01-13 Raja R Harinath <rharinath@novell.com>
1068 * cs-tokenizer.cs (xtoken): Reset 'comments_seen' in a couple more
1071 2005-01-12 Raja R Harinath <rharinath@novell.com>
1073 Fix cs0038-1.cs, cs1640-6.cs.
1074 * ecore.cs (Expression.Resolve): Remove special-case for
1075 SimpleName in error-handling.
1076 (Expression.almostMatchedMembers): Relax access permission to
1078 (Expression.MemberLookupFailed): Handle duplicates in
1079 almostMatchedMembers list.
1080 (SimpleName.DoSimpleNameResolve): Catch CS0038 errors earlier.
1081 * expression.cs (New.DoResolve): Report CS1540 for more cases.
1082 * typemanager.cs (GetFullNameSignature): Use the MethodBase
1083 overload if the passed in MemberInfo is a MethodBase.
1085 2005-01-12 Marek Safar <marek.safar@seznam.cz>
1088 * attribute.cs (ExtractSecurityPermissionSet): Don't report error
1089 for non-CAS & merge permission sets properly.
1091 2005-01-11 Raja R Harinath <rharinath@novell.com>
1093 Improve standard-compliance of simple name and member access
1094 resolution. Fixes bugs #52697, #57200, #67520, #69519.
1095 * ecore.cs (FullNamedExpression): New abstract base class
1096 for Namespaces and TypeExpressions.
1097 (ResolveFlags.SimpleName): Remove.
1098 (SimpleName): Remove support for dotted names.
1099 (SimpleName.ResolveAsTypeStep): Simplify. Now just a wrapper to
1100 DeclSpace.FindType and DeclSpace.LookupType.
1101 (SimpleName.DoSimpleNameResolve): Remove support for dotted names.
1102 (Expression.ExprClassName): Make member function.
1103 * expression.cs (MemberAccess.ResolveAsTypeStep): Support LHS being
1104 a namespace. Remove creation of dotted "SimpleName"s.
1105 (MemberAccess.DoResolve): Likewise.
1106 * decl.cs (DeclSpace.Cache): Make private.
1107 (DeclSpace.LookupInterfaceOrClass): Return a FullNamedExpression.
1108 (DeclSpace.FindType): Update.
1109 (DeclSpace.LookupType): Move here from RootContext. Return a
1110 FullNamedExpression.
1111 * namespace.cs (Namespace): Derive from FullNamedExpression
1112 so that it can be part of expression resolution.
1113 (Namespace.Lookup): Return an FullNamedExpression.
1114 (NamespaceEntry.LookupAlias): Lookup aliases only in current
1116 * rootcontext.cs (NamespaceLookup): Remove.
1117 (LookupType): Move to DeclSpace.
1118 * attribute.cs (CheckAttributeType): Update.
1119 * doc.cs (FindDocumentedType): Remove allowAlias argument.
1120 (FindDocumentedTypeNonArray): Likewise.
1122 2005-01-11 Raja R Harinath <rharinath@novell.com>
1124 Fix cs0509.cs, cs1632.cs.
1125 * class.cs (TypeContainer.GetNormalBases): Don't assume !IsClass
1126 is the same as IsInterface.
1127 (TypeContainer.GetClassBases): Likewise.
1128 * statement.cs (LabeledStatement.ig): New field.
1129 (LabeledStatement.LabelTarget): Save ILGenerator which created the
1131 (LabeledStatement.DoEmit): Check that the label was created with
1132 the same ILGenerator.
1134 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1137 * attribute.cs (GetMethodObsoleteAttribute): Need to transform
1138 accessors to its properties.
1140 * ecore.cs (PropertyExpr): Add AccessorTable to help track back
1141 from accessors to property.
1143 2005-01-10 Marek Safar <marek.safar@seznam.cz>
1146 * class.cs (MethodCore.CheckBase): Test base method obsoleteness
1149 2005-01-08 Miguel de Icaza <miguel@ximian.com>
1151 * attribute.cs: Check for null and empty strings.
1153 I have lost another battle to Paolo.
1155 2005-01-07 Marek Safar <marek.safar@seznam.cz>
1158 * class.cs (PropertyMethod): Set Parent field in ctors.
1159 (SetMethod.InternalParameters): Add unsafe switch hack.
1160 Override MarkForDuplicationCheck where it is appropriate.
1162 * decl.cs (MemberCore.MarkForDuplicationCheck): New method.
1163 It says whether container allows members with the same name.
1165 (DeclSpace.AddToContainer): Use MarkForDuplicationCheck.
1166 Removed is_method parameter.
1168 2005-01-06 Duncan Mak <duncan@ximian.com>
1170 * cs-tokenizer.cs (xtoken): Redo the work for signaling CS1040
1171 because the previous change led to incorrect reporting of CS1032
1172 ("Cannot define/undefine preprocessor symbols after first token in
1173 file"). Instead of using `tokens_seen' as the only flag that
1174 triggers CS1040, introduce `comments_seen'. This new flag is used
1175 to signify having seen comments on the current line, so it is
1176 unset after a newline.
1178 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1180 * doc.cs : When searching for a type, find nested type too.
1181 This fixes bug #71040.
1183 2005-01-06 Atsushi Enomoto <atsushi@ximian.com>
1186 - Warn missing member comment on those classes which also does not
1187 have doc comments. Fixed bug #71041.
1188 - Don't warn missing doc comment on default constructor.
1191 2005-01-06 Duncan Mak <duncan@ximian.com>
1193 * cs-tokenizer.cs (xtoken): After handling traditional C-style
1194 comments, set `tokens_seen' to true. This allows us to detect
1195 misplaced preprocessor directives (i.e. not at the beginning of
1196 the a line, nor after whitespaces). In that case, report error
1197 CS1040. This fixes bug #56460.
1199 * cs-parser.jay (interface_member_declaration): Add checks for
1200 IsExplicitImpl, and report CS0541 error if an interface member is
1201 defined as an explicit interface declaration.
1203 2005-01-06 Marek Safar <marek.safar@seznam.cz>
1206 * class.cs (PropertyMethod): Set Parent field in ctors.
1207 (SetMethod.InternalParameters): Add unsafe switch hack.
1209 * decl.cs (MemberCore.Parent): Cannot be readonly.
1211 2005-01-06 Raja R Harinath <rharinath@novell.com>
1213 * decl.cs (DeclSpace.ResolveType): Remove.
1214 (DeclSpace.ResolveBaseTypeExpr): Rename from ResolveTypeExpr.
1215 Merge in code from ...
1216 (DeclSpace.GetTypeResolvingEmitContext): ... here. Remove.
1217 * class.cs, enum.cs: Update to changes.
1219 2005-01-06 Miguel de Icaza <miguel@ximian.com>
1221 * anonymous.cs: Ensure that we init the scope of our parent if it
1222 has not been initialized yet.
1224 2004-12-30 Duncan Mak <duncan@ximian.com>
1226 * typemanager.cs (TypeManager.CheckStructCycles): Don't crash here
1227 if field.FieldBuilder is null. Fixes #70758.
1229 * convert.cs: Fixed some typos and updated some of the comments.
1230 (ImplicitStandardConversionExists):
1231 (TryImplicitIntConversion): If `target_type' is an interface and
1232 the type of `ic' implements this interface, return true or a new
1233 BoxedCast instead of null. This fixes #70468.
1235 2004-12-29 Duncan Mak <duncan@ximian.com>
1237 * expression.cs (Argument.Emit): Check that Expr is
1238 IMemoryLocation before casting to it, and report CS1510 otherwise.
1242 2004-12-21 Ben Maurer <bmaurer@ximian.com>
1244 * statement.cs (Block.ThisVariable): remove the recursion here, to
1245 make the --profile more sane.
1247 2004-12-17 Carlos Cortez <calberto.cortez@gmail.com>
1249 * driver.cs: Patch to handle a xsp bug that prevents to reference an .exe
1250 assembly, by JB Evain.
1252 2004-12-17 Raja R Harinath <rharinath@novell.com>
1254 * class.cs, decl.cs, ecore.cs, iterators.cs, pending.cs,
1255 rootcontext.cs, typemanager.cs: Make nomenclature consistent.
1256 "parent" refers to enclosing type/class. "base" refers to superclass.
1258 2004-12-17 Raja R Harinath <rharinath@novell.com>
1260 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1261 Ensure that we only have GlobalAttributes.
1262 * attribute.cs (Attribute.Emit): Make non-virtual.
1263 (GlobalAttribute.Emit): Remove.
1264 (Attribute.Resolve): Make virtual.
1265 (GlobalAttribute.Resolve): New. Set Rootcontext.Tree.Types.NamespaceEntry.
1266 (Attribute.GetConditionalAttributeValue): Take an EmitContext as
1267 the argument. Don't create one.
1268 (Attribute.GetObsoleteAttribute): Likewise.
1269 (Attribute.GetClsCompliantAttributeValue): Likewise.
1270 * class.cs, decl.cs: Update to changes.
1272 2004-12-17 Marek Safar <marek.safar@seznam.cz>
1274 * delegate.cs (NewDelegate.DoResolve): Add error 149 report.
1276 * ecore.cs (Expression.MemberLookupFailed): Fixed error 143.
1278 * statement.cs (Foreach.Resolve): Add error 186 report.
1280 2004-12-16 Marek Safar <marek.safar@seznam.cz>
1282 * expression.cs (Conditional.DoResolve): Add warning 429.
1284 * statement.cs (If.Resolve): Add warning 665.
1286 2004-12-16 Raja R Harinath <rharinath@novell.com>
1288 New invariant: RootContext.Tree.Types.NamespaceEntry == null
1289 except when in the parser, and in GlobalAttribute.
1290 * driver.cs (MainDriver): Reset RootContext.Tree.Types.NamespaceEntry.
1291 * attribute.cs (GlobalAttribute.CheckAttributeType): Reset
1292 RootContext.Tree.Types.NamespaceEntry once work is done.
1293 (GlobalAttribute.Emit): New. Wrapper for Attribute.Emit, but sets
1294 and resets RootContext.Tree.Types.NamespaceEntry.
1296 2004-12-15 Marek Safar <marek.safar@seznam.cz>
1298 * cs-parser.jay: Don't create a block for every variable.
1300 2004-12-14 Miguel de Icaza <miguel@ximian.com>
1302 * location.cs: Provide extra information.
1304 * statement.cs: The instance is not `ldarg_0.THIS' when accessing
1305 variables from the captured environment, it is the ldarg_0.
1307 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1309 * cs-parser.jay: Changed warning level for 642 to 4 until Miguel
1312 * class.cs: Changed warning level for 169 to avoid developer
1313 displeasure from warning flooding. It will be changed back when they
1314 fix most of current BCL warnings.
1316 * RootContext.cs: Pushed default WarningLevel to 3.
1318 * statement.cs: Removed unused variable.
1320 2004-12-14 Marek Safar <marek.safar@seznam.cz>
1322 * class.cs (TypeContainer.GetClassBases): Add error 1521 report.
1323 (TypeContainer.MethodModifiersValid): Refactored to use MemberCore.
1324 Add error 502 report.
1325 (StaticClass.DefineType): Add error 441 report.
1326 (Class.AllowedModifiersProp): New virtual property as temporary
1327 extension to AllowedModifiers.
1328 (Class.DefineType): Add error 418 report. Moved ModFlags check here
1329 to share implementation with StaticClass and don't call virtual
1332 * driver.cs (MainDriver): Add error 1558 test.
1334 * parameter.cs (Parameter.ApplyAttributeBuilder): Add error 662
1335 report. Moved error 36 test here.
1337 * statement.cs (Throw.Resolve): Add error 724 report.
1339 * typemanager.cs: Add out_attribute_type core type.
1341 2004-12-13 Marek Safar <marek.safar@seznam.cz>
1343 * class.cs (TypeContainer.VerifyClsCompliance): Add error
1345 (PropertyBase.VerifyClsCompliance): Add errror 3025 report.
1347 * codegen.cs (ModuleClass.ApplyAttributeBuilder): Add error
1350 * decl.cs (MemberCore.VerifyClsCompliance): Add warning 3021.
1352 * parameter.cs (ReturnParameter.ApplyAttributeBuilder):
1353 Add error 3023 report.
1354 (Parameter.ApplyAttributeBuilder): Add error 3022 report.
1356 * tree.cs (RootTypes.IsClsCompliaceRequired): Add fake
1359 2004-12-12 John Luke <john.luke@gmail.com>
1361 * driver.cs (AddArgs): take -- into account when
1362 adding arguments, fixes bug 65710
1364 2004-12-12 Martin Baulig <martin@ximian.com>
1366 * expression.cs (Unary.TryReduceNegative): Added support for
1367 SByteConstant and ByteConstant.
1368 (Unary.Reduce): Check error values from TryReduceNegative().
1370 2004-12-10 Marek Safar <marek.safar@seznam.cz>
1372 * attributes.cs (Attribute.Resolve): Avoid multiple error report
1373 and report exception as error 182.
1375 2004-12-10 Raja R Harinath <rharinath@novell.com>
1377 * driver.cs (Main): Fix message when there are warnings.
1379 2004-12-09 Miguel de Icaza <miguel@ximian.com>
1381 * delegate.cs: Fixed my fix from yesterday, sorry about that.
1383 2004-12-09 Marek Safar <marek.safar@seznam.cz>
1385 * anonymous.cs, class.cs, convert.cs, doc.cs, support.cs:
1386 Reduced number of warnings.
1388 * class.cs (TypeContainer.VerifyClsCompliance): One if is enough.
1390 2004-12-08 Miguel de Icaza <miguel@ximian.com>
1392 * driver.cs: Removed message.
1394 * delegate.cs: Fix bug introduced in 1.1.x: 70219.
1396 2004-12-08 <vargaz@freemail.hu>
1398 * cs-tokenizer.cs: Add workaround for NET 2.0 beta 1 csc bug.
1400 2004-12-08 Martin Baulig <martin@ximian.com>
1402 * class.cs (TypeContainer.VerifyClsCompliance): Report a CS3003
1403 instead of a CS3002 for properties and indexer.
1405 2004-12-08 Martin Baulig <martin@ximian.com>
1407 * decl.cs (MemberName.ToString): Make this work again.
1409 2004-12-08 Marek Safar <marek.safar@seznam.cz>
1411 * attribute.cs (Resolve): Add error 591 detection.
1413 * class.cs (FieldMember.Define): Add error 1547 detection.
1414 (Indexer.Define): Add error 620 detection.
1415 (Operator.Define): Add error 590 detection.
1417 * ecore.cs: Missing argument for error 79.
1419 * expression.cs (ComposedCast.DoResolveAsTypeStep): Add error 611
1422 2004-12-07 Marek Safar <marek.safar@seznam.cz>
1425 * assign.cs.cs (Assign.DoResolve): Reports error 1648 for value types
1428 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
1430 * cs-parser.jay : handle doc comments on implicit/explicit operators.
1431 Some operator comments were suppressed.
1432 * doc.cs : Implicit/explicit operator name in doc comments are like
1433 "op_Explicit(type)~returnType", so added suffix handling.
1435 2004-12-07 Martin Baulig <martin@ximian.com>
1438 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1439 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1440 (DeclSpace.ec): New protected field; store the EmitContext here.
1441 (DeclSpace.EmitContext): New public property; moved here from
1443 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1446 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1447 (Enum.Emit): Don't create a new EmitContext.
1449 * delegate.cs (Delegate.DefineType): Always create the
1452 * iterators.cs (Iterators.DefineIterator): Create a new
1453 EmitContext and store it in `ec'.
1455 2004-08-24 Martin Baulig <martin@ximian.com>
1458 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
1459 this for accessibility checks.
1460 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
1461 IsNestedFamilyAccessible.
1462 (TypeManager.IsSubclassOf): New method, do what the name actually
1465 2004-12-06 Raja R Harinath <rharinath@novell.com>
1467 Fix crash on cs0657-17.cs.
1468 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
1469 Use RootContext.Tree.Types, not 'new RootTypes ()'.
1470 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
1471 the case where the NamespaceEntry gets overwritten.
1473 2004-12-06 Marek Safar <marek.safar@seznam.cz>
1475 Fixed #69195, #56821
1476 * ecore.cs (ResolveBoolean): Tiny refactoring.
1478 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
1479 of right expression resolving when left is false constant and
1480 operator is LogicalAnd OR true constant and operator is LogicalOr.
1482 * statement.cs (ResolveUnreachable): Always reports warning.
1484 2004-12-05 Miguel de Icaza <miguel@ximian.com>
1486 * class.cs: Distinguish between 1721 and 1722 (just a little help
1487 for the programmer).
1489 2004-12-03 Miguel de Icaza <miguel@ximian.com>
1491 * delegate.cs: Only allow this on new versions of the language.
1493 2004-12-02 Duncan Mak <duncan@ximian.com>
1495 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
1497 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
1498 here as a static method. Take an additional bool out parameter
1499 `must_do_cs1540_check' for signaling to InstanceResolve.
1500 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
1501 member field from PropertyExpr class and made it an argument of
1503 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
1504 check for MarshalByRefObject, and report CS0122 instead of CS1540.
1505 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
1506 and `remove_accessor' as well as InstanceResolve: report CS0122
1511 2004-12-03 Raja R Harinath <rharinath@novell.com>
1513 Fix test-327.cs, test-328.cs, and put in early infrastructure
1514 for eventually fixing #52697.
1515 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
1516 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
1518 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
1519 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
1520 (VerifyUsing, error246): Update.
1521 * rootcontext.cs (RootContext.NamespaceLookup): Just use
1522 'NamespaceEntry.LookupNamespaceOrType'.
1524 2004-12-03 Martin Baulig <martin@ximian.com>
1526 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1527 method as our child, call AnonymousMethod.Compatible() on it.
1529 2004-12-03 Raja R Harinath <rharinath@novell.com>
1531 Disable XML documentation support in 'basic' profile.
1532 * decl.cs, class.cs [BOOTSTRAP_WITH_OLDLIB]: Don't import System.Xml.
1533 Redirect XmlElement to System.Object.
1534 * driver.cs, enum.cs, rootcontext.cs: Don't reference System.Xml.
1535 * doc.cs [BOOTSTRAP_WITH_OLDLIB]: Disable compile.
1536 * mcs.exe.sources: Add doc-bootstrap.cs.
1537 * doc-bootstrap.cs: New file. Contains empty stub implementation
1540 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
1542 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
1543 comments are allowed.
1545 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1547 * delegate.cs: Add checks for subtypes in paramaters and return values
1548 in VerifyMethod () to add support for Covariance/Contravariance
1551 2004-12-02 Miguel de Icaza <miguel@ximian.com>
1553 * report.cs: Remove extra closing parenthesis.
1555 * convert.cs (Error_CannotImplicitConversion): If the name of the
1556 types are the same, provide some extra information.
1558 * class.cs (FieldBase): Use an unused bit field from the field to
1559 encode the `has_offset' property from the FieldMember. This saves
1560 a couple of Ks on bootstrap compilation.
1562 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
1563 method as our child, return the AnonymousMethod resolved
1566 * expression.cs (New.DoResolve): Allow return values from
1567 NewDelegate to also include AnonymousMethods.
1571 2004-12-02 Marek Safar <marek.safar@seznam.cz>
1574 * attribute.cs (Resolve): Improved implementation of params
1575 attribute arguments.
1577 * support.cs (ParameterData): Add HasParams to be faster.
1579 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
1581 all things are for /doc support:
1583 * doc.cs: new file that supports XML documentation generation.
1584 * mcs.exe.sources: added doc.cs.
1586 Handle /doc command line option.
1587 Report error 2006 instead of 5 for missing file name for /doc.
1588 Generate XML documentation when required, after type resolution.
1590 Added support for picking up documentation (/// and /** ... */),
1591 including a new XmlCommentState enumeration.
1593 Added lines to fill Documentation element for field, constant,
1594 property, indexer, method, constructor, destructor, operator, event
1595 and class, struct, interface, delegate, enum.
1596 Added lines to warn incorrect comment.
1598 Added Documentation field (passed only when /doc was specified).
1600 Added DocComment, DocCommentHeader, GenerateDocComment() and
1601 OnGenerateDocComment() and some supporting private members for
1602 /doc feature to MemberCore.
1604 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
1606 Added overriden DocCommentHeader.
1608 Added overriden DocCommentHeader and GenerateDocComment().
1610 2004-12-01 Miguel de Icaza <miguel@ximian.com>
1612 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
1613 unwrapping the enumeration values, chain to
1614 DoConstantNumericPromotions again, so we can promote things to the
1615 fundamental types (takes care of enums that are bytes, sbytes).
1619 2004-12-01 Raja R Harinath <rharinath@novell.com>
1621 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
1622 Fix long-standing bug in type-lookup. Use FindType instead of
1623 LookupType when ec.ResolvingTypeTree.
1624 (Attribute.ResolveType, Attribute.Resolve)
1625 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
1627 (Attributes.Search): Remove internal version. Update.
1628 (Attributes.SearchMulti): Update.
1629 (Attributes.GetClsCompliantAttribute): Remove.
1630 (Attributes.GetIndexerNameAttribute): Remove.
1631 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
1632 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
1633 * class.cs (Indexer.Define): Likewise.
1635 2004-12-01 Marek Safar <marek.safar@seznam.cz>
1638 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
1639 MarshallByReference members access.
1641 * expression.cs: Use CheckMarshallByRefAccess;
1642 Better error CS0197 message.
1644 * report.cs: Print whole related error message.
1646 2004-11-30 Raja R Harinath <rharinath@novell.com>
1648 * Makefile (mcs.exe) [PROFILE=default]: Keep a copy of mcs.exe in
1649 the current directory to help debugging.
1651 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1653 * class (GetClassBases): Better error 60 report.
1654 (EventProperty): Disabled warning 67 detection.
1656 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1659 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
1661 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
1664 2004-11-29 Marek Safar <marek.safar@seznam.cz>
1667 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
1669 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
1671 2004-11-26 Miguel de Icaza <miguel@ximian.com>
1673 * attribute.cs (Attribute.Resolve): Refine error reporting and
1674 report a cs0117 if the identifier does not exist, to distinguish
1675 from 0617 which is a miss-use of the actual identifier.
1677 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
1678 between cs0070 and cs0079.
1680 * class.cs (MemberBase.DoDefine): When reporting a wrong
1681 accessibility level, we use MethodCore to compare instead of
1682 Method (this was a regression in some refactoring effort).
1684 So now we correctly report cs0056 again.
1686 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
1687 testing the target_type (which was known to be object_type) and
1688 not the source type (which is anonymous_method).
1690 Fixed reporting of error cs1660.
1692 * expression.cs (UserCast.Source): Expose the underlying cast.
1694 * statement.cs (Switch.SwitchGoverningType): Sort the list of
1695 allowed types to find a match to int32 first (most common).
1697 In addition, it ignores any ImplicitUserConversions that did an
1698 internal implicit conversion (as the switch statement allows only
1699 one integral conversion to exist).
1701 * class.cs (PartialContainer.Create): rename `name' to
1702 `member_name' for clarity. Then replace the string calls with a
1703 call to MemberName.GetPartialName, as now using
1704 MemberName.ToString is an error (this is due to the side effects
1705 it had, that were fixed in the past).
1707 This will restore the error reporting on a number of partial class
1708 errors that were missusing this (and getting an exception as a
1709 results, which is now just a plain textual warning, because
1710 yyparse debug output would crash otherwise).
1712 2004-11-26 Raja R Harinath <rharinath@novell.com>
1714 * Makefile (PROGRAM_INSTALL_DIR): Remove.
1716 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1718 * rootcontext.cs (LookupType): Make sure to cache lookups that
1719 don't give us a negative result. This saves about 5% of corlib
1722 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1724 * report.cs (AbstractMessage.Print): messages are sent to stderr
1726 * class.cs (TypeContainer.GetClassBases): It is an error to have a
1727 non-interface in the list of interfaces (at this point, either
1728 parent was properly set, or a base class is being listed in the
1729 interfaces section).
1731 This flags error 1722, and resolves the crash from bug 69259.
1733 2004-11-25 Ben Maurer <bmaurer@ximian.com>
1735 * statement.cs (Using.EmitExpressionFinally): make this work right
1736 for valuetypes. Fixes 69926.
1738 2004-11-25 Miguel de Icaza <miguel@ximian.com>
1740 * const.cs (Const.ChangeType): Cope with the "0 literal can be
1741 converted to an enum" here, before we try to change the underlying
1742 type. This code exists, but it is a different code path than the
1743 one used while encoding constants.
1745 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
1746 old bug: when converting from the null literal to a pointer,
1747 return an EmptyCast, not the NullLiteral.
1749 This fixes #69921, the recent null_type changes probably made this
1752 (ImplicitReferenceConversionExists): In addition, resynchronized
1753 the code here, so it matches the same code in
1754 ImplicitReferenceConversionExists for the `from any class-type S
1755 to any interface-type T'.
1758 2004-11-25 Marek Safar <marek.safar@seznam.cz>
1760 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
1762 2004-11-24 Miguel de Icaza <miguel@ximian.com>
1764 * cs-parser.jay: Use verbosity accordingly.
1766 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1768 * expression.cs (Unary.ResolveOperator): Do not report warning;
1769 AddressOf reads from variable.
1771 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
1773 2004-11-24 Marek Safar <marek.safar@seznam.cz>
1777 * attribute.cs (Attributable): Removed CheckTargets.
1778 (Attributes.Emit): Explicit attribute targets are tested here.
1780 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
1781 not enabled for interfaces.
1783 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
1784 (GetAssemblyName): Ouch next bug there.
1786 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
1788 * expression.cs: Error 275 added.
1790 2004-11-23 Marek Safar <marek.safar@seznam.cz>
1792 Fix bug #69177 (Implemented decimal constant support)
1794 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
1795 (BinaryFold): Add DecimalConstant.
1797 * const.cs (Define): Decimal constant
1799 (ChangeType): Add decimal type handling.
1800 (LookupConstantValue): Don't set value for decimal type but
1801 emit DecimalConstantAttribute. Needed for constant optimization.
1803 * constant.cs (ToDecimal): New method.
1804 (ConvertToDecimal): New method.
1805 (IntConstant): Implemented ConvertToDecimal.
1806 (DecimalConstant.Emit): Emit optimized version for decimals in
1809 * expression.cs (ResolveOperator): Changed order of constant
1810 reduction to work correctly with native types which have
1811 overloaded operators.
1812 (ResolveMemberAccess): Extract constant value from attribute
1815 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
1817 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
1818 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
1819 (ChangeType): Decimal is special.
1820 (TypeToCoreType): Add decimal type.
1822 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1824 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
1827 2004-11-22 Marek Safar <marek.safar@seznam.cz>
1829 * class.cs (EventField.ApplyAttributeBuilder): Fix error
1832 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1834 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
1836 * pending.cs (PendingImplementation): Grab only interfaces.
1838 2004-11-19 Marek Safar <marek.safar@seznam.cz>
1840 * statement.cs (ForeachHelperMethods): Add location member and
1841 error 202 detection.
1843 2004-11-19 Raja R Harinath <rharinath@novell.com>
1845 * Makefile (EXTRA_DISTFILES): Remove mcs.exe.config. It's
1846 automatically handled by executable.make.
1847 (PROGRAM): Make profile-specific.
1849 2004-11-18 Marek Safar <marek.safar@seznam.cz>
1851 * expression.cs (DoResolveBase): Fixed wrong warning for out
1854 2004-11-18 Martin Baulig <martin@ximian.com>
1856 Merged latest changes into gmcs. Please keep this comment in
1857 here, it makes it easier for me to see what changed in MCS since
1858 the last time I merged.
1860 2004-11-17 Raja R Harinath <rharinath@novell.com>
1862 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
1863 (TypeHandle.GetMemberCache): New.
1864 (TypeHandle.TypeHandle): Update.
1865 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
1866 (TypeManager.LookupParentInterfacesCache):
1867 Rename from LookupInterfaceCache. Optimize slightly.
1868 (TypeManager.MemberLookup_FindMembers): Update.
1869 * decl.cs (MemberCache.MemberCache): Set Container to null in the
1871 (AddCacheContents): Rename from AddHashtable.
1872 * class.cs (TypeContainer.parent_container): Remove.
1873 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
1874 (TypeContainer.DoDefineMembers): Don't initialize it.
1875 Update to name changes.
1877 2004-11-17 Miguel de Icaza <miguel@ximian.com>
1879 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
1880 that factors the code to check access modifiers on override.
1882 (PropertyBase): Use the code here.
1884 Patch from Lluis S'anchez, fixes bug #69361.
1886 2004-11-15 Miguel de Icaza <miguel@ximian.com>
1888 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
1889 routine that is used to report the use of a captured variable
1890 whose address has been taken.
1892 There are two checks: one when variables are being captured and
1893 the other check is when the address of a variable is taken.
1895 (because an anonymous methods might be resolved before *or* after
1896 the address has been taken) and
1898 * expression.cs (Conditional.DoResolve): Remove the special
1899 casing that Martin added to trueExpr and falseExpr being both
1900 NullLiteral. We get the right behavior now just by introducing
1901 the null_type into the compiler.
1903 * convert.cs (ExplicitConversion): Change the code to use
1904 null_type instead of testing `expr is NullLiteral'.
1905 (ImplicitConversionStandard): use null_type too.
1906 (ImplicitReferenceConversionExists): use null_type too.
1907 (ImplicitReferenceConversion): use null_type too.
1909 * literal.cs: The type of `NullLiteral' is now null_type instead
1911 (Resolve): Set the type here.
1913 * typemanager.cs: Introduce null_type.
1915 2004-11-17 Martin Baulig <martin@ximian.com>
1917 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
1918 direction, like FindMembers() does. Fixes #69546, testcase is in
1921 2004-11-16 Martin Baulig <martin@ximian.com>
1923 This is based on a patch from Marek Safar, see bug #69082.
1924 Fixes bugs #63705 and #67130.
1926 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
1927 method; create a MemberCache for an interface type and cache the
1930 * decl.cs (IMemberContainer.ParentContainer): Removed.
1931 (IMemberContainer.ParentCache): New property.
1932 (MemberCache.SetupCacheForInterface): Removed.
1933 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
1934 to create a cache for an interface's "parent".
1936 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
1939 2004-11-16 Martin Baulig <martin@ximian.com>
1941 Merged back from gmcs; these changes already went into gmcs a
1942 couple of weeks ago.
1945 (TypeManager.AddUserType): Removed the `ifaces' argument.
1946 (TypeManager.RegisterBuilder): Take a `Type []' instead of a
1948 (TypeManager.AddUserInterface): Removed.
1949 (TypeManager.ExpandInterfaces): Return a `Type []' instead of a
1951 (TypeManager.GetInterfaces): Likewise.
1952 (TypeManager.GetExplicitInterfaces): Likewise.
1954 * ecore.cs (TypeExpr.GetInterfaces): Removed.
1956 * class.cs (TypeContainer.base_class_type): Replaced with `ptype'.
1957 (TypeContainer.base_inteface_types): Replaced with `ifaces'.
1959 2004-11-14 Ben Maurer <bmaurer@ximian.com>
1961 * statement.cs: Avoid adding bools to a hashtable.
1963 2004-11-07 Miguel de Icaza <miguel@ximian.com>
1965 * expression.cs (Invocation.OverloadResolve): Flag error if we are
1966 calling an unsafe method from a safe location.
1968 2004-11-06 Marek Safar <marek.safar@seznam.cz>
1971 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
1973 2004-11-06 Miguel de Icaza <miguel@ximian.com>
1975 * namespace.cs (VerifyUsing): use GetPartialName instead of
1978 2004-11-05 Miguel de Icaza <miguel@ximian.com>
1980 * statement.cs (Return.Resolve): Fix regression in typo: if
1981 `in_exc', we have to request a NeedReturnLabel, this was a typo
1982 introduced in the anonymous method check-in. Fixes #69131.
1984 * Indexers were using the ShortName when defining themselves,
1985 causing a regression in the compiler bootstrap when applying the
1986 patch from 2004-11-02 (first part), now they use their full name
1987 and the bug is gone.
1989 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
1991 * driver.cs: Strip the path from the names of embedded resources. Fixes
1994 2004-11-04 Raja R Harinath <rharinath@novell.com>
1996 Fix error message regression: cs0104-2.cs.
1997 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
1998 (AliasEntry.Resolve): Update.
1999 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
2001 (RootContext.LookupType): Update.
2003 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
2005 * cs-parser.jay: Add support for handling accessor modifiers
2006 * class: Add support port accessor modifiers and error checking,
2007 define PropertyMethod.Define as virtual (not abstract anymore)
2008 * ecore.cs: Add checking for proeprties access with access modifiers
2009 * iterators.cs: Modify Accessor constructor call based in the modified
2011 2004-11-02 Ben Maurer <bmaurer@ximian.com>
2013 * expression.cs (StringConcat): Handle being called twice,
2014 as when we have a concat in a field init with more than two
2017 2004-11-02 Miguel de Icaza <miguel@ximian.com>
2019 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
2020 special case explicit implementations, we should always produce
2021 the .property or .event declaration.
2023 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
2024 since it will not return correct data if people use this
2025 unresolved in the presence of using statements (see test-313).
2027 * class.cs (MethodData.Define): If we are an explicit interface
2028 implementation, set the method name to the full name of the
2029 interface plus the name of the method.
2031 Notice that using the method.MethodName.GetFullName() does not
2032 work, as it will only contain the name as declared on the source
2033 file (it can be a shorthand in the presence of using statements)
2034 and not the fully qualifed type name, for example:
2038 class D : ICloneable {
2039 object ICloneable.Clone () {
2043 Would produce a method called `ICloneable.Clone' instead of
2044 `System.ICloneable.Clone'.
2046 * namespace.cs (Alias.Resolve): Use GetPartialName.
2048 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2050 * cs-parser.jay: Add error 1055 report.
2052 2004-11-01 Miguel de Icaza <miguel@ximian.com>
2054 * assign.cs (Assign.DoResolve): Only do the transform of
2055 assignment into a New if the types are compatible, if not, fall
2056 through and let the implicit code deal with the errors and with
2057 the necessary conversions.
2059 2004-11-01 Marek Safar <marek.safar@seznam.cz>
2061 * cs-parser.jay: Add error 1031 report.
2063 * cs-tokenizer.cs: Add location for error 1038.
2065 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2067 * cs-parser.jay: Add error 1016 report.
2069 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2071 * cs-parser.jay: Add errors 1575,1611 report.
2073 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2075 * cs-parser.jay: Add error 1001 report.
2077 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2080 * attribute.cs (GetMarshal): Add method argument for
2081 caller identification.
2083 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
2084 agument for GetMarshal and RuntimeMissingSupport.
2086 2004-10-31 Marek Safar <marek.safar@seznam.cz>
2088 * attribute.cs (ExtractSecurityPermissionSet): Removed
2089 TypeManager.code_access_permission_type.
2091 * typemanager.cs: Removed TypeManager.code_access_permission_type.
2093 2004-10-27 Miguel de Icaza <miguel@ximian.com>
2095 * expression.cs (LocalVariableReference.DoResolveLValue): Check
2096 for obsolete use of a variable here. Fixes regression on errors
2097 cs0619-25 and cs0619-26.
2099 2004-10-27 Marek Safar <marek.safar@seznam.cz>
2101 Fix #62358, implemented security attribute encoding.
2103 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
2104 Tests permitted SecurityAction for assembly or other types.
2105 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
2106 data from SecurityPermissionAttribute to PermisionSet class.
2108 * class.cs (ApplyAttributeBuilder): Added special handling
2109 for System.Security.Permissions.SecurityAttribute based types.
2111 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
2112 special handling for System.Security.Permissions.SecurityAttribute
2115 * enum.cs (ApplyAttributeBuilder): Added special handling
2116 for System.Security.Permissions.SecurityAttribute based types.
2118 * parameter.cs (ApplyAttributeBuilder): Added special handling
2119 for System.Security.Permissions.SecurityAttribute based types.
2121 * rootcontext.cs: Next 2 core types.
2123 * typemanager.cs (TypeManager.security_permission_attr_type):
2124 Built in type for the SecurityPermission Attribute.
2125 (code_access_permission_type): Build in type.
2127 2004-10-17 Miguel de Icaza <miguel@ximian.com>
2129 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
2130 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
2131 all of this information into
2132 EmitContext.EmitCapturedVariableInstance.
2134 * codegen.cs (EmitCapturedVariableInstance): move here the
2135 funcionality of emitting an ldarg.0 in the presence of a
2136 remapping. This centralizes the instance emit code.
2138 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
2139 then emit a load of this: it means that we have reached the
2140 topmost ScopeInfo: the one that contains the pointer to the
2141 instance of the class hosting the anonymous method.
2143 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
2144 captures to the topmost CaptureContext.
2146 2004-10-12 Miguel de Icaza <miguel@ximian.com>
2148 * expression.cs (LocalVariableReference): Move the knowledge about
2149 the iterators into codegen's EmitCapturedVariableInstance.
2151 2004-10-11 Miguel de Icaza <miguel@ximian.com>
2153 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
2154 all code paths return a value from an anonymous method (it is the
2155 same as the 161 error, but for anonymous methods).
2157 2004-10-08 Miguel de Icaza <miguel@ximian.com>
2159 The introduction of anonymous methods in the compiler changed
2160 various ways of doing things in the compiler. The most
2161 significant one is the hard split between the resolution phase
2162 and the emission phases of the compiler.
2164 For instance, routines that referenced local variables no
2165 longer can safely create temporary variables during the
2166 resolution phase: they must do so from the emission phase,
2167 since the variable might have been "captured", hence access to
2168 it can not be done with the local-variable operations from the runtime.
2172 (Block.Flags): New flag `IsTopLevel' to indicate that this block
2173 is a toplevel block.
2175 (ToplevelBlock): A new kind of Block, these are the blocks that
2176 are created by the parser for all toplevel method bodies. These
2177 include methods, accessors and anonymous methods.
2179 These contain some extra information not found in regular blocks:
2180 A pointer to an optional CaptureContext (for tracking captured
2181 local variables and parameters). A pointer to the parent
2184 (Return.Resolve): Catch missmatches when returning a value from an
2185 anonymous method (error 1662).
2186 Invoke NeedReturnLabel from the Resolve phase instead of the emit
2189 (Break.Resolve): ditto.
2191 (SwitchLabel): instead of defining the labels during the
2192 resolution phase, we now turned the public ILLabel and ILLabelCode
2193 labels into methods called GetILLabelCode() and GetILLabel() that
2194 only define the label during the Emit phase.
2196 (GotoCase): Track the SwitchLabel instead of the computed label
2197 (its contained therein). Emit the code by using
2198 SwitchLabel.GetILLabelCode ().
2200 (LocalInfo.Flags.Captured): A new flag has been introduce to track
2201 whether the Local has been captured or not.
2203 (LocalInfo.IsCaptured): New property, used to tell whether the
2204 local has been captured.
2206 * anonymous.cs: Vastly updated to contain the anonymous method
2209 The main classes here are: CaptureContext which tracks any
2210 captured information for a toplevel block and ScopeInfo used to
2211 track the activation frames for various local variables.
2213 Each toplevel block has an optional capture context associated
2214 with it. When a method contains an anonymous method both the
2215 toplevel method and the anonymous method will create a capture
2216 context. When variables or parameters are captured, they are
2217 recorded on the CaptureContext that owns them, for example:
2221 MyDelegate d = delegate {
2226 Here `a' will be recorded as captured on the toplevel
2227 CapturedContext, the inner captured context will not have anything
2228 (it will only have data if local variables or parameters from it
2229 are captured in a nested anonymous method.
2231 The ScopeInfo is used to track the activation frames for local
2232 variables, for example:
2234 for (int i = 0; i < 10; i++)
2235 for (int j = 0; j < 10; j++){
2236 MyDelegate d = delegate {
2241 At runtime this captures a single captured variable `i', but it
2242 captures 10 different versions of the variable `j'. The variable
2243 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
2244 recorded on a child.
2246 The toplevel ScopeInfo will also track information like the `this'
2247 pointer if instance variables were referenced (this is necessary
2248 as the anonymous method lives inside a nested class in the host
2249 type of the method).
2251 (AnonymousMethod): Expanded to track the Toplevel, implement
2252 `AnonymousMethod.Compatible' to tell whether an anonymous method
2253 can be converted to a target delegate type.
2255 The routine now also produces the anonymous method content
2257 (AnonymousDelegate): A helper class that derives from
2258 DelegateCreation, this is used to generate the code necessary to
2259 produce the delegate for the anonymous method that was created.
2261 * assign.cs: API adjustments for new changes in
2262 Convert.ImplicitStandardConversionExists.
2264 * class.cs: Adjustments to cope with the fact that now toplevel
2265 blocks are of type `ToplevelBlock'.
2267 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
2268 insteda of standard blocks.
2270 Flag errors if params arguments are passed to anonymous methods.
2272 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
2273 `CurrentAnonymousMethod' which points to the current Anonymous
2274 Method. The variable points to the AnonymousMethod class that
2275 holds the code being compiled. It is set in the new EmitContext
2276 created for the anonymous method.
2278 (EmitContext.Phase): Introduce a variable and an enumeration to
2279 assist in enforcing some rules about when and where we are allowed
2280 to invoke certain methods (EmitContext.NeedsReturnLabel is the
2281 only one that enfonces this right now).
2283 (EmitContext.HaveCaptureInfo): new helper method that returns
2284 whether we have a CapturedContext initialized.
2286 (EmitContext.CaptureVariable): New method used to register that a
2287 LocalInfo must be flagged for capturing.
2289 (EmitContext.CapturedParameter): New method used to register that a
2290 parameters must be flagged for capturing.
2292 (EmitContext.CapturedField): New method used to register that a
2293 field must be flagged for capturing.
2295 (EmitContext.HaveCapturedVariables,
2296 EmitContext.HaveCapturedFields): Return whether there are captured
2297 variables or fields.
2299 (EmitContext.EmitMethodHostInstance): This is used to emit the
2300 instance for the anonymous method. The instance might be null
2301 (static methods), this (for anonymous methods that capture nothing
2302 and happen to live side-by-side with the current method body) or a
2303 more complicated expression if the method has a CaptureContext.
2305 (EmitContext.EmitTopBlock): Routine that drives the emission of
2306 code: it will first resolve the top block, then emit any metadata
2307 and then emit the code. The split is done so that we can extract
2308 any anonymous methods and flag any captured variables/parameters.
2310 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
2311 during this phase, the ILGenerator should not be used as labels
2312 and local variables declared here might not be accessible to any
2313 code that is part of an anonymous method.
2315 Exceptions to this include the temporary variables that are
2316 created by some statements internally for holding temporary
2319 (EmitContext.EmitMeta): New routine, in charge of emitting all the
2322 (EmitContext.TemporaryReturn): This method is typically called
2323 from the Emit phase, and its the only place where we allow the
2324 ReturnLabel to be defined other than the EmitMeta. The reason is
2325 that otherwise we would have to duplicate a lot of logic in the
2326 Resolve phases of various methods that today is on the Emit
2329 (EmitContext.NeedReturnLabel): This no longer creates the label,
2330 as the ILGenerator is not valid during the resolve phase.
2332 (EmitContext.EmitThis): Extended the knowledge in this class to
2333 work in anonymous methods in addition to iterators.
2335 (EmitContext.EmitCapturedVariableInstance): This emits whatever
2336 code is necessary on the stack to access the instance to a local
2337 variable (the variable will be accessed as a field).
2339 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
2340 EmitContext.EmitAddressOfParameter): Routines to support
2341 parameters (not completed at this point).
2343 Removals: Removed RemapLocal and RemapLocalLValue. We probably
2344 will also remove the parameters.
2346 * convert.cs (Convert): Define a `ConstantEC' which points to a
2347 null. This is just to prefity some code that uses
2348 ImplicitStandardConversion code and do not have an EmitContext
2351 The idea is to flag explicitly that at that point in time, it is
2352 known that the conversion will not trigger the delegate checking
2353 code in implicit conversions (which requires a valid
2356 Everywhere: pass new EmitContext parameter since
2357 ImplicitStandardConversionExists now requires it to check for
2358 anonymous method conversions.
2360 (Convert.ImplicitStandardConversionExists): If the type of an
2361 expression is the anonymous_method_type, and the type is a
2362 delegate, we invoke the AnonymousMethod.Compatible method to check
2363 whether an implicit conversion is possible.
2365 (Convert.ImplicitConversionStandard): Only do implicit method
2366 group conversions if the language level is not ISO_1.
2368 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
2369 MethodInfo for the Invoke method. used by Delegate and
2372 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
2373 method conversions if the target type is a delegate.
2375 Removed extra debugging nops.
2377 (LocalVariableReference): Turn the `local_info' into a public
2380 Add `prepared' field, the same hack used for FieldExprs to cope
2381 with composed assignments, as Local variables do not necessarily
2382 operate purely on the stack as they used to: they can be captured
2385 Add `temp' for a temporary result, like fields.
2387 Refactor DoResolve and DoResolveLValue into DoResolveBase.
2389 It now copes with Local variables that are captured and emits the
2390 proper instance variable to load it from a field in the captured
2393 (ParameterReference.DoResolveBase): During the resolve phase,
2394 capture parameters if we are in an anonymous method.
2396 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
2397 anonymous method, use the EmitContext helper routines to emit the
2398 parameter reference.
2400 * iterators.cs: Set RemapToProxy to true/false during the
2403 * parameters.cs (GetParameterByName): New helper method.
2405 * typemanager.cs (anonymous_method_type) a new type that
2406 represents an anonyous method. This is always an internal type,
2407 used as a fencepost to test against the anonymous-methodness of an
2410 2004-10-20 Marek Safar <marek.safar@seznam.cz>
2412 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
2414 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
2416 2004-10-18 Martin Baulig <martin@ximian.com>
2418 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
2419 `Type' directly, but call ResolveType() on it.
2420 (Catch.Resolve): Likewise.
2421 (Foreach.Resolve): Likewise.
2423 2004-10-18 Martin Baulig <martin@ximian.com>
2425 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
2426 `Type' directly, but call ResolveType() on it.
2427 (Probe.DoResolve): Likewise.
2428 (ArrayCreation.LookupType): Likewise.
2429 (TypeOf.DoResolve): Likewise.
2430 (SizeOf.DoResolve): Likewise.
2432 2004-10-18 Martin Baulig <martin@ximian.com>
2434 * expression.cs (Invocation.BetterFunction): Put back
2435 TypeManager.TypeToCoreType().
2437 2004-10-18 Raja R Harinath <rharinath@novell.com>
2439 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
2442 2004-10-18 Martin Baulig <martin@ximian.com>
2444 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
2445 `Type' directly, but call ResolveType() on it.
2447 2004-10-18 Martin Baulig <martin@ximian.com>
2449 * class.cs (FieldMember.Define): Don't access the TypeExpr's
2450 `Type' directly, but call ResolveType() on it.
2451 (MemberBase.DoDefine): Likewise.
2453 * expression.cs (New.DoResolve): Don't access the TypeExpr's
2454 `Type' directly, but call ResolveType() on it.
2455 (ComposedCast.DoResolveAsTypeStep): Likewise.
2457 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
2458 `Type' directly, but call ResolveType() on it.
2460 2004-10-17 John Luke <john.luke@gmail.com>
2462 * class.cs (Operator.GetSignatureForError): use CSharpName
2464 * parameter.cs (Parameter.GetSignatureForError): Returns
2465 correct name even if was not defined.
2467 2004-10-13 Raja R Harinath <rharinath@novell.com>
2470 * class.cs (TypeContainer.EmitContext): New property.
2471 (DefineNestedTypes): Create an emitcontext for each part.
2472 (MethodCore.DoDefineParameters): Use container's emitcontext.
2473 Pass type array to InternalParameters.
2474 (MemberBase.DoDefine): Use container's emitcontext.
2475 (FieldMember.Define): Likewise.
2476 (Event.Define): Likewise.
2477 (SetMethod.GetParameterInfo): Change argument to EmitContext.
2478 Pass type array to InternalParameters.
2479 (SetIndexerMethod.GetParameterInfo): Likewise.
2480 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
2481 * delegate.cs (Define): Pass emitcontext to
2482 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
2483 array to InternalParameters.
2484 * expression.cs (ParameterReference.DoResolveBase): Pass
2485 emitcontext to GetParameterInfo.
2486 (ComposedCast.DoResolveAsTypeStep): Remove check on
2487 ec.ResolvingTypeTree.
2488 * parameter.cs (Parameter.Resolve): Change argument to
2489 EmitContext. Use ResolveAsTypeTerminal.
2490 (Parameter.GetSignature): Change argument to EmitContext.
2491 (Parameters.ComputeSignature): Likewise.
2492 (Parameters.ComputeParameterTypes): Likewise.
2493 (Parameters.GetParameterInfo): Likewise.
2494 (Parameters.ComputeAndDefineParameterTypes): Likewise.
2495 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
2496 * support.cs (InternalParameters..ctor): Remove variant that takes
2498 * typemanager.cs (system_intptr_expr): New.
2499 (InitExpressionTypes): Initialize it.
2501 2004-10-12 Chris Toshok <toshok@ximian.com>
2503 * cs-parser.jay: fix location for try_statement and catch_clause.
2505 2004-10-11 Martin Baulig <martin@ximian.com>
2507 * report.cs: Don't make --fatal abort on warnings, we have
2508 -warnaserror for that.
2510 2004-10-07 Raja R Harinath <rharinath@novell.com>
2512 More DeclSpace.ResolveType avoidance.
2513 * decl.cs (MemberCore.InUnsafe): New property.
2514 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
2515 with newly created EmitContext.
2516 (FieldMember.Define): Likewise.
2517 * delegate.cs (Delegate.Define): Likewise.
2518 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
2519 only if normal name-lookup fails.
2520 (TypeExpr.DoResolve): Enable error-checking.
2521 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
2522 (SizeOf.DoResolve): Likewise.
2523 (ComposedCast.DoResolveAsTypeStep): Likewise.
2524 (StackAlloc.DoResolve): Likewise.
2525 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
2526 (Block.Unsafe): New property.
2527 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
2528 (Unsafe): Set 'unsafe' flag of contained block.
2529 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
2530 (Fixed.Resolve): Likewise.
2531 (Catch.Resolve): Likewise.
2532 (Using.ResolveLocalVariableDecls): Likewise.
2533 (Foreach.Resolve): Likewise.
2535 2004-10-05 John Luke <john.luke@gmail.com>
2537 * cs-parser.jay: add location to error CS0175
2539 2004-10-04 Miguel de Icaza <miguel@ximian.com>
2541 * ecore.cs (Expression.Constantity): Add support for turning null
2544 * const.cs (Const.Define): Allow constants to be reference types
2545 as long as the value is Null.
2547 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
2549 * namespace.cs (NamespaceEntry.Using): No matter which warning
2550 level is set, check if this namespace name has already been added.
2552 2004-10-03 Ben Maurer <bmaurer@ximian.com>
2554 * expression.cs: reftype [!=]= null should always use br[true,false].
2557 2004-10-03 Marek Safar <marek.safar@seznam.cz>
2560 * attribute.cs: Enum conversion moved to
2561 GetAttributeArgumentExpression to be applied to the all
2564 2004-10-01 Raja R Harinath <rharinath@novell.com>
2566 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
2567 * class.c (TypeContainer.DefineType): Flag error if
2568 base types aren't accessible due to access permissions.
2569 * decl.cs (DeclSpace.ResolveType): Move logic to
2570 Expression.ResolveAsTypeTerminal.
2571 (DeclSpace.ResolveTypeExpr): Thin layer over
2572 Expression.ResolveAsTypeTerminal.
2573 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
2574 Refactor code into NestedAccess. Use it.
2575 (DeclSpace.NestedAccess): New.
2576 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
2577 argument to silence errors. Check access permissions.
2578 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
2579 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
2580 (Cast.DoResolve): Likewise.
2581 (New.DoResolve): Likewise.
2582 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
2583 (TypeOf.DoResolve): Likewise.
2585 * expression.cs (Invocation.BetterConversion): Return the Type of
2586 the better conversion. Implement section 14.4.2.3 more faithfully.
2587 (Invocation.BetterFunction): Make boolean. Make correspondence to
2588 section 14.4.2.2 explicit.
2589 (Invocation.OverloadResolve): Update.
2590 (Invocation): Remove is_base field.
2591 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
2592 (Invocation.Emit): Likewise.
2594 2004-09-27 Raja R Harinath <rharinath@novell.com>
2596 * README: Update to changes.
2598 2004-09-24 Marek Safar <marek.safar@seznam.cz>
2600 * cs-parser.jay: Reverted 642 warning fix.
2602 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2605 * decl.cs (FindMemberWithSameName): Indexer can have more than
2608 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2610 * expression.cs (LocalVariableReference.DoResolveLValue):
2611 Do not report warning 219 for out values.
2612 (EmptyExpression.Null): New member to avoid extra allocations.
2614 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2616 * cs-parser.jay: Fix wrong warning 642 report.
2618 * cs-tokenizer.cs (CheckNextToken): New helper;
2619 Inspect next character if is same as expected.
2621 2004-09-23 Martin Baulig <martin@ximian.com>
2623 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
2624 (Convert.ImplicitReferenceConversionExists): Likewise.
2626 2004-09-23 Marek Safar <marek.safar@seznam.cz>
2628 * class.cs (Operator.Define): Add error 448 and 559 report.
2630 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2632 * class.cs (MemberBase.IsTypePermitted): New protected
2633 method for checking error CS0610.
2635 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2637 * class.cs (TypeContainer.HasExplicitLayout): New property
2638 Returns whether container has StructLayout attribute set Explicit.
2639 (FieldMember): New abstract class for consts and fields.
2640 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
2641 (Field): Reuse FieldMember.
2643 * const.cs (Const): Reuse FieldMember.
2645 * rootcontext.cs: EmitConstants call moved to class.
2647 2004-09-22 Martin Baulig <martin@ximian.com>
2649 Thanks to Peter Sestoft for this bug report.
2651 * expression.cs (Conditional): If both the `trueExpr' and the
2652 `falseExpr' is a NullLiteral, return a NullLiteral.
2654 2004-09-22 Martin Baulig <martin@ximian.com>
2656 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
2657 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
2658 for the "get_Current" call.
2660 2004-09-22 Martin Baulig <martin@ximian.com>
2662 Marek and me just fixed one of our oldest bugs: #28562 :-)
2664 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
2666 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
2667 we're an EnumConstant, just return that.
2668 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
2669 an EnumConstant. In this case, we need to use GetValueAsEnumType()
2670 to get the value which'll actually be written into the attribute.
2671 However, we have to use GetValue() to access the attribute's value
2674 2004-09-22 Marek Safar <marek.safar@seznam.cz>
2676 * constant.cs (Constant.IsNegative): New abstract property
2679 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
2680 (StackAlloc.DoResolve): Reused IsNegative.
2682 2004-09-21 Martin Baulig <martin@ximian.com>
2684 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
2685 if we're used in an iterator, we may be called from different
2688 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
2689 we actually have an exception block.
2691 2004-09-20 John Luke <jluke@cfl.rr.com>
2693 * class.cs, cs-parser.jay: Improve the error report for 1520:
2694 report the actual line where the error happens, not where the
2697 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
2698 Pass location information that was available elsewhere.
2700 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
2702 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
2703 runtime to delay sign assemblies.
2705 2004-09-19 Miguel de Icaza <miguel@ximian.com>
2707 * cs-parser.jay: Do not report the stack trace, this is barely
2710 2004-08-22 John Luke <john.luke@gmail.com>
2712 * driver.cs : check that a resource id is not already used
2713 before adding it, report CS1508 if it is, bug #63637
2715 2004-09-19 Miguel de Icaza <miguel@ximian.com>
2717 * ecore.cs: Removed dead code.
2719 2004-09-18 Marek Safar <marek.safar@seznam.cz>
2721 * class.cs: Do not report warning CS0067 on the interfaces.
2723 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2725 * cs-parser.jay: Add error 504 report.
2727 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2729 * rootcontext.cs: WarningLevel is 4 by default now.
2731 * statement.cs (Fixed.Resolve): Do not null
2734 2004-09-16 Marek Safar <marek.safar@seznam.cz>
2737 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
2738 deep search when property is not virtual.
2739 (PropertyExpr.ResolveAccessors): Make one call for both
2742 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2745 * statement.cs: Error 152 report constains also location.
2747 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2750 * const.cs: Explicitly set constant as static.
2752 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2755 * cs-parser.jay: Add error 1017 report.
2757 2004-09-15 Marek Safar <marek.safar@seznam.cz>
2759 Fixed bug #59980, #64224
2760 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
2762 * typemanager.cs (IsSpecialMethod): Simplified
2764 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2766 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
2767 condition with better params.
2769 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2772 * attribute.cs (Resolve): Property has to have both
2775 2004-09-14 Martin Baulig <martin@ximian.com>
2777 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
2779 2004-09-14 Marek Safar <marek.safar@seznam.cz>
2782 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
2783 called and is obsolete then this member suppress message
2784 when call is inside next [Obsolete] method or type.
2786 * expression.cs: Use TestObsoleteMethodUsage member.
2788 2004-09-14 Martin Baulig <martin@ximian.com>
2790 * cs-parser.jay: Sync a bit with the GMCS version.
2792 2004-09-14 Martin Baulig <martin@ximian.com>
2794 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
2795 (CSharpParser.yacc_verbose_flag): New public field.
2797 * genericparser.cs: Removed.
2799 2004-09-14 Raja R Harinath <rharinath@novell.com>
2801 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
2803 2004-09-13 Marek Safar <marek.safar@seznam.cz>
2805 * class.cs (MethodCore.CheckBase): Fix bug #65757.
2807 2004-09-10 Martin Baulig <martin@ximian.com>
2809 Backported my MemberName changes from GMCS into MCS.
2811 - we are now using a special `MemberName' class instead of using
2812 strings; in GMCS, the `MemberName' also contains the type
2815 - changed the grammar rules a bit:
2816 * the old `member_name' is now a `namespace_or_type_name':
2817 The rule is that we use `namespace_or_type_name' everywhere
2818 where we expect either a "member name" (GetEnumerator) or a
2819 "member name" with an explicit interface name
2820 (IEnumerable.GetEnumerator).
2821 In GMCS, the explicit interface name may include type arguments
2822 (IEnumerable<T>.GetEnumerator).
2823 * we use `member_name' instead of just `IDENTIFIER' for
2825 The rule is that we use `member_name' wherever a member may
2826 have type parameters in GMCS.
2828 * decl.cs (MemberName): New public class.
2829 (MemberCore.MemberName): New public readonly field.
2830 (MemberCore.ctor): Take a `MemberName' argument, not a string.
2831 (DeclSpace): Likewise.
2833 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
2834 * enum.cs (Enum.ctor): Likewise.
2836 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
2838 (AliasEntry.ctor): Take a MemberName, not an Expression.
2839 (AliasEntry.UsingAlias): Likewise.
2841 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
2842 (IMethodData.MemberName): Changed type from string to MemberName.
2843 (MemberBase.ExplicitInterfaceName): Likewise.
2844 (AbstractPropertyEventMethod.SetupName): Make this private.
2845 (AbstractPropertyEventMethod.ctor): Added `string prefix'
2846 argument; compute the member name here.
2847 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
2848 on the `member.MemberName' and the `prefix'.
2850 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
2852 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
2853 thus, we get a `MemberName' instead of a `string'. These
2854 declarations may have type parameters in GMCS.
2855 (interface_method_declaration, delegate_declaration): Likewise.
2856 (class_declaration, interface_declaration): Likewise.
2857 (method_header): Use `namespace_or_type_name' instead of
2858 `member_name'. We may be an explicit interface implementation.
2859 (property_declaration, event_declaration): Likewise.
2860 (member_name): This is now just an `IDENTIFIER', not a
2861 `namespace_or_type_name'.
2862 (type_name, interface_type): Removed.
2863 (namespace_or_type_name): Return a MemberName, not an Expression.
2864 (primary_expression): Use `member_name' instead of `IDENTIFIER';
2865 call GetTypeExpression() on the MemberName to get an expression.
2866 (IndexerDeclaration.interface_type): Changed type from string to
2868 (MakeName): Operate on MemberName's instead of string's.
2870 2004-09-13 Raja R Harinath <rharinath@novell.com>
2873 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
2874 (NamespaceEntry.Lookup): Add new argument to flag if we want the
2875 lookup to avoid symbols introduced by 'using'.
2876 * rootcontext.cs (NamespaceLookup): Update.
2878 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2880 * class.cs (TypeContainer.DoDefineMembers): Do not call
2881 DefineDefaultConstructor for static classes.
2883 2004-09-12 Marek Safar <marek.safar@seznam.cz>
2885 * attribute.cs (Attribute.Resolve): Add error 653 report.
2887 * class.cs (Class.ApplyAttributeBuilder): Add error 641
2889 (Method.ApplyAttributeBuilder): Add error 685 report.
2890 (Operator.Define): Add error 564 report.
2892 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
2894 * expression.cs (Invocation.DoResolve): Add error
2897 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
2900 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2902 * class.cs (ConstructorInitializer.Resolve):
2903 Wrong error number (515->516).
2905 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2907 * class.cs (Indexer.Define): Add error 631 report.
2909 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2911 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
2913 2004-09-11 Marek Safar <marek.safar@seznam.cz>
2915 * expression.cs (Probe.DoResolve): Add error CS0241 report.
2917 2004-09-10 Marek Safar <marek.safar@seznam.cz>
2919 * cs-parser.jay: Added error CS0241 report.
2921 2004-09-10 Raja R Harinath <rharinath@novell.com>
2923 * cs-parser.jay (fixed_statement): Introduce a scope for the
2924 declaration in the 'fixed' statement.
2926 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2928 * cs-parser.jay: Added CS0230 error report.
2930 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2932 * cs-parser.jay: Added errors CS0231 and CS0257 report.
2934 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2936 * expression.cs (Argument.Resolve): Added error CS0192 and
2939 2004-09-09 Marek Safar <marek.safar@seznam.cz>
2941 C# 2.0 #pragma warning feature
2943 * cs-tokenizer.cs (PreProcessPragma): New method;
2944 Handles #pragma directive.
2946 * report.cs (WarningRegions): New class; Support
2947 class for #pragma warning directive. It tests whether
2948 warning is enabled for a given line.
2950 2004-09-08 Miguel de Icaza <miguel@ximian.com>
2952 * const.cs: Add more descriptive error report, tahnks to
2955 2004-09-08 Marek Safar <marek.safar@seznam.cz>
2957 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
2959 2004-09-07 Miguel de Icaza <miguel@ximian.com>
2961 * expression.cs: Apply patch from Ben: Remove dead code from
2962 ArrayCreation, and remove the TurnintoConstant call in const.cs,
2963 as that code just threw an exception anwyays.
2965 * const.cs: Remove the call to the turnintoconstant, for details
2968 * literal.cs: The type of the null-literal is the null type; So
2969 we use a placeholder type (literal.cs:System.Null, defined here)
2972 * expression.cs (Conditional.DoResolve): Remove some old code that
2973 is no longer needed, conversions have been fixed.
2975 (ArrayCreationExpression.DoResolve): Return false if we fail to
2976 resolve the inner expression.
2978 2004-09-07 Raja R Harinath <rharinath@novell.com>
2981 * cs-parser.jay (delegate_declaration): Record a delegate
2982 declaration as a type declaration.
2983 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
2985 2004-09-06 Miguel de Icaza <miguel@ximian.com>
2987 * parameter.cs: Do not crash if the type can not be resolved.
2989 * expression.cs: Report errors with unsafe pointers, fixes #64896
2991 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
2993 * expression.cs: Pointer arith always needs to do a conv.i
2994 if the operand is a long. fix 65320
2996 2004-09-04 Marek Safar <marek.safar@seznam.cz>
2998 Fixed cs0619-37.cs, cs0619-38.cs
3000 * enum.cs (GetObsoleteAttribute): Removed.
3002 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
3003 on Enum member is double staged. The first is tested member
3006 2004-09-04 Marek Safar <marek.safar@seznam.cz>
3008 Fixed #56986, #63631, #65231
3010 * class.cs: (TypeContainer.AddToMemberContainer): New method,
3011 adds member to name container.
3012 (TypeContainer.AddToTypeContainer): New method, adds type to
3014 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
3015 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
3016 AddOperator): Simplified by reusing AddToMemberContainer.
3017 (TypeContainer.UserDefinedStaticConstructor): Changed to property
3019 (Method.CheckForDuplications): Fixed implementation to test all
3021 (MemberBase): Detection whether member is explicit interface
3022 implementation is now in constructor.
3023 (MemberBase.UpdateMemberName): Handles IndexerName.
3024 (Accessor): Changed to keep also location information.
3025 (AbstractPropertyEventMethod): Is derived from MemberCore.
3026 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
3027 will be emited or not.
3028 (PropertyBase.AreAccessorsDuplicateImplementation):
3029 Tests whether accessors are not in collision with some method.
3030 (Operator): Is derived from MethodCore to simplify common
3033 * decl.cs (Flags.TestMethodDuplication): Test for duplication
3035 (DeclSpace.AddToContainer): Adds the member to defined_names
3036 table. It tests for duplications and enclosing name conflicts.
3038 * enum.cs (EnumMember): Clean up to reuse the base structures
3040 2004-09-03 Martin Baulig <martin@ximian.com>
3042 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
3043 into TypeContainer, to make partial classes work again.
3045 2004-09-03 Martin Baulig <martin@ximian.com>
3047 * rootcontext.cs (RootContext.V2): Removed.
3049 2004-03-23 Martin Baulig <martin@ximian.com>
3051 * expression.cs (Invocation.OverloadResolve): Added `bool
3052 may_fail' argument and use it instead of the Location.IsNull() hack.
3054 2004-09-03 Martin Baulig <martin@ximian.com>
3056 Merged latest changes into gmcs. Please keep this comment in
3057 here, it makes it easier for me to see what changed in MCS since
3058 the last time I merged.
3060 2004-09-03 Raja R Harinath <rharinath@novell.com>
3063 * expression.cs (BetterConversion): Don't allow either conversion
3064 to be null. Remove redundant implicit conversion test when 'q ==
3065 null' -- when this function is invoked, we already know that the
3066 implicit conversion exists.
3067 (BetterFunction): Assume that 'best' is non-null. Remove
3068 redundant reimplementation of IsApplicable when 'best' is null.
3069 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
3070 number of arguments.
3071 (IsAncestralType): Extract from OverloadResolve.
3072 (OverloadResolve): Make robust to the MethodGroupExpr being
3073 unsorted. Implement all the logic of Section 14.5.5.1, and
3074 support overloading of methods from multiple applicable types.
3075 Clean up logic somewhat. Don't pass null methods to BetterFunction.
3077 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
3078 (RealError, Warning): Append type of report to related symbol.
3080 2004-09-03 Marek Safar <marek.safar@seznam.cz>
3082 * enum.cs: Fixed CLS-Compliance checks for enum members.
3083 Error tests cs3008-8.cs, cs3014-8.cs
3085 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3087 Fixed bug #62342, #63102
3088 * class.cs: ImplementIndexer uses member.IsExplicitImpl
3089 like ImplementMethod.
3091 2004-09-02 Marek Safar <marek.safar@seznam.cz>
3093 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3096 2004-09-02 Martin Baulig <martin@ximian.com>
3098 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
3099 TypeManager.GetArgumentTypes() rather than calling GetParameters()
3102 2004-09-01 Marek Safar <marek.safar@seznam.cz>
3104 C# 2.0 Static classes implemented
3106 * class.cs (TypeContainer): instance_constructors,
3107 initialized_fields, initialized_static_fields,
3108 default_constructor, base_inteface_types are protected to be
3109 accessible from StaticClass.
3110 (TypeContainer.DefineDefaultConstructor): New virtual method
3111 for custom default constructor generating
3112 (StaticClass): New class to handle "Static classes" feature.
3114 * cs-parser.jay: Handle static keyword on class like instance
3117 * driver.cs: Added "/langversion" command line switch with two
3118 options (iso-1, default).
3120 2004-08-31 Marek Safar <marek.safar@seznam.cz>
3122 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
3124 2004-08-31 Miguel de Icaza <miguel@ximian.com>
3126 * delegate.cs: Style.
3128 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
3130 * delegate.cs: Add seperate instance expr field for miguel.
3132 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3134 * PointerArithmetic (Resolve): make sure we are not doing
3135 pointer arith on void*. Also, make sure we are resolved
3136 by not setting eclass until resolve.
3138 All callers: Make sure that PointerArithmetic gets resolved.
3140 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
3142 * ArrayCreation (LookupType): If the type does not resolve
3143 to an array, give an error.
3145 2004-08-27 Marek Safar <marek.safar@seznam.cz>
3147 * statement.cs (Try.Resolve): Fixed bug #64222
3149 2004-08-27 Martin Baulig <martin@ximian.com>
3152 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
3155 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3157 * ecore.cs (Constantify): Get underlying type via
3158 System.Enum.GetUnderlyingType to avoid StackOverflow on the
3159 Windows in special cases.
3161 2004-08-26 Marek Safar <marek.safar@seznam.cz>
3163 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
3164 for obtaining also private methods.
3165 (GetRemoveMethod): Used GetRemoveMethod (true)
3166 for obtaining also private methods.
3168 2004-08-24 Martin Baulig <martin@ximian.com>
3170 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
3171 MethodAttributes.HideBySig for operators.
3173 2004-08-23 Martin Baulig <martin@ximian.com>
3175 Back to the old error reporting system :-)
3177 * report.cs (Message): Removed.
3178 (Report.MessageData, ErrorData, WarningData): Removed.
3179 (Report.Error, Warning): Back to the old system.
3181 2004-08-23 Martin Baulig <martin@ximian.com>
3183 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
3185 * class.cs (TypeContainer.ParentContainer): New public virtual
3186 method; replaces the explicit interface implementation.
3187 (ClassPart.ParentContainer): Override.
3189 2004-08-23 Martin Baulig <martin@ximian.com>
3191 * statement.cs (Switch): Added support for constant switches; see
3192 #59428 or test-285.cs.
3194 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3197 * statement.cs (GetEnumeratorFilter): Removed useless
3198 logic because C# specs is strict. GetEnumerator must be
3201 2004-08-22 Martin Baulig <martin@ximian.com>
3203 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3204 a switch and may break, reset the barrier. Fixes #59867.
3206 2004-08-22 Marek Safar <marek.safar@seznam.cz>
3208 CLS-Compliance speed up (~5% for corlib)
3210 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
3211 New method. Tests container for CLS-Compliant names
3213 * class.cs (TypeContainer.VerifyClsName): New method.
3214 Checks whether container name is CLS Compliant.
3215 (Constructor): Implements IMethodData.
3217 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
3218 low-case table for CLS Compliance test.
3219 (MemberCache.VerifyClsParameterConflict): New method.
3220 Checks method parameters for CS3006 error.
3222 * enum.cs (EnumMember): Is derived from MemberCore.
3223 (Enum.VerifyClsName): Optimized for better performance.
3225 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3227 * report.cs: Renamed Error_T to Error and changed all
3230 2004-08-06 Marek Safar <marek.safar@seznam.cz>
3232 * class.cs (TypeContainer.IndexerArrayList): New inner class
3233 container for indexers.
3234 (TypeContainer.DefaultIndexerName): New constant for default
3235 indexer name. Replaced all "Item" with this constant.
3236 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
3238 * typemanager.cs (TypeManager.default_member_ctor): Cache here
3239 DefaultMemberAttribute constructor.
3241 2004-08-05 Martin Baulig <martin@ximian.com>
3243 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
3246 2004-08-05 Marek Safar <marek.safar@seznam.cz>
3248 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
3249 multi platforms problem.
3251 * compiler.csproj: Included shared files.
3253 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3255 Fix bug 60333, 55971 in the more general way
3256 * attribute.cs (Attribute.GetAttributeArgumentExpression):
3257 Added arg_type argument for constant conversion.
3258 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
3260 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3263 * class.cs (TypeContainer ): New inner classes MethodArrayList,
3264 OperatorArrayList, MethodCoreArrayList for typecontainer
3265 containers. Changed class member types to these new types.
3266 (MethodArrayList.DefineMembers): Added test for CS0659.
3268 2004-08-04 Miguel de Icaza <miguel@ximian.com>
3270 * cfold.cs: Synchronize the folding with the code in expression.cs
3271 Binary.DoNumericPromotions for uint operands.
3273 * attribute.cs: Revert patch from Raja, it introduced a regression
3274 while building Blam-1.2.1 (hard to isolate a test case).
3276 2004-08-04 Marek Safar <marek.safar@seznam.cz>
3280 (TypeContainer.Define): Renamed to DefineContainerMembers because of
3282 (MethodCore.parent_method): New member. The method we're overriding
3283 if this is an override method.
3284 (MethodCore.CheckBase): Moved from Method class and made common.
3285 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
3287 (MethodCore.CheckForDuplications): New abstract method. For custom
3288 member duplication search in a container
3289 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
3290 method and its return type.
3291 (Event.conflict_symbol): New member. Symbol with same name in the
3295 (MemberCache.FindMemberWithSameName): New method. The method
3296 is looking for conflict with inherited symbols.
3298 2004-08-04 Martin Baulig <martin@ximian.com>
3300 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
3302 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
3304 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3306 * report.cs (Message): New enum for better error, warning reference in
3308 (MessageData): New inner abstract class. It generally handles printing of
3309 error and warning messages.
3310 Removed unused Error, Warning, Message methods.
3312 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3314 Fix for cs0592-8.cs test
3316 (Attributable.ValidAttributeTargets): Made public.
3317 (Attribute.ExplicitTarget): New member for explicit target value.
3318 (Attribute.CheckTargets): Now we translate explicit attribute
3319 target to Target here.
3321 2004-08-03 Ben Maurer <bmaurer@ximian.com>
3323 * ecore.cs (MethodGroupExpr): new IsBase property.
3325 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
3327 * delegate.cs (DelegateCreation): store a MethodGroupExpr
3328 rather than an instance expr.
3330 (DelegateCreation.Emit): Use the method group rather than
3331 the instance expression. Also, if you have base.Foo as the
3332 method for a delegate, make sure to emit ldftn, not ldftnvirt.
3334 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
3336 (NewDelegate.DoResolve): Only check for the existance of Invoke
3337 if the method is going to be needed. Use MethodGroupExpr.
3339 (NewDelegate.Emit): Remove, DelegateCreation implements this.
3341 * expression.cs: For pointer arith., make sure to use
3342 the size of the type, not the size of the pointer to
3345 2004-08-03 Marek Safar <marek.safar@seznam.cz>
3348 * class.cs (Class): Added error CS0502 test.
3350 2004-08-03 John Luke <jluke@cfl.rr.com>
3351 Raja R Harinath <rharinath@novell.com>
3354 * attribute.cs (Attribute.complained_before): New flag.
3355 (Attribute.ResolveType, Attribute.Resolve),
3356 (Attribute.DefinePInvokeMethod): Set it.
3357 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
3359 2004-08-03 Martin Baulig <martin@ximian.com>
3361 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
3362 use a user-defined operator; we still need to do numeric
3363 promotions in case one argument is a builtin type and the other
3364 one has an implicit conversion to that type. Fixes #62322.
3366 2004-08-02 Martin Baulig <martin@ximian.com>
3368 * statement.cs (LocalInfo.Flags): Added `IsThis'.
3369 (LocalInfo.IsThis): New public property.
3370 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
3372 2004-08-01 Martin Baulig <martin@ximian.com>
3374 * class.cs (TypeContainer.GetClassBases): Don't set the default
3375 here since we may get called from GetPartialBases().
3376 (TypeContainer.DefineType): If GetClassBases() didn't return a
3377 parent, use the default one.
3379 2004-07-30 Duncan Mak <duncan@ximian.com>
3381 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
3383 2004-07-30 Martin Baulig <martin@ximian.com>
3385 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
3387 * class.cs (SourceMethod): New public class, derive from the
3388 symbol writer's ISourceMethod.
3389 (Method): Use the new symbol writer API.
3391 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
3392 as argument and use the new symbol writer.
3395 (SourceFile): Implement the symbol writer's ISourceFile.
3396 (Location.SymbolDocument): Removed.
3397 (Location.SourceFile): New public property.
3399 * symbolwriter.cs: Use the new symbol writer API.
3401 2004-07-30 Raja R Harinath <rharinath@novell.com>
3403 * Makefile (install-local): Remove. Functionality moved to
3406 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
3408 * Makefile: Install mcs.exe.config file together with mcs.exe.
3409 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
3410 correct runtime version.
3412 2004-07-25 Martin Baulig <martin@ximian.com>
3415 (TypeContainer.RegisterOrder): Removed, this was unused.
3416 (TypeContainer, interface_order): Removed.
3417 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
3418 TypeContainer as argument since we can also be called with a
3419 `PartialContainer' for a partial class/struct/interface.
3420 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
3421 of checking whether we're an `Interface' - we could be a
3423 (PartialContainer.Register): Override; call
3424 AddClass()/AddStruct()/AddInterface() on our parent.
3426 * cs-parser.jay (interface_member_declaration): Add things to the
3427 `current_container', not the `current_class'.
3429 * rootcontext.cs (RegisterOrder): The overloaded version which
3430 takes an `Interface' was unused, removed.
3432 * typemanager.cs (TypeManager.LookupInterface): Return a
3433 `TypeContainer', not an `Interface'.
3434 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
3435 contain a `PartialContainer' for an interface, so check it's
3436 `Kind' to figure out what it is.
3438 2004-07-25 Martin Baulig <martin@ximian.com>
3440 * class.cs (Class.DefaultTypeAttributes): New public constant.
3441 (Struct.DefaultTypeAttributes): Likewise.
3442 (Interface.DefaultTypeAttributes): Likewise.
3443 (PartialContainer.TypeAttr): Override this and add the
3444 DefaultTypeAttributes.
3446 2004-07-25 Martin Baulig <martin@ximian.com>
3448 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
3449 we can just use the `Parent' field instead.
3451 2004-07-25 Martin Baulig <martin@ximian.com>
3453 * class.cs (TypeContainer.Emit): Renamed to EmitType().
3455 2004-07-25 Martin Baulig <martin@ximian.com>
3457 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
3458 our parts before defining any methods.
3459 (TypeContainer.VerifyImplements): Make this virtual.
3460 (ClassPart.VerifyImplements): Override and call VerifyImplements()
3461 on our PartialContainer.
3463 2004-07-25 Martin Baulig <martin@ximian.com>
3465 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
3467 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
3468 argument, we can just use the `Parent' field instead.
3471 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
3472 (MemberBase.DoDefine): Likewise.
3474 2004-07-24 Martin Baulig <martin@ximian.com>
3476 * decl.cs (MemberCore.Parent): New public field.
3477 (DeclSpace.Parent): Moved to MemberCore.
3479 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
3480 (MemberBase.ctor): Added TypeContainer argument, pass it to our
3482 (FieldBase, Field, Operator): Likewise.
3483 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
3484 (EventField, Event): Likewise.
3486 2004-07-23 Martin Baulig <martin@ximian.com>
3488 * class.cs (PartialContainer): New public class.
3489 (ClassPart): New public class.
3490 (TypeContainer): Added support for partial classes.
3491 (TypeContainer.GetClassBases): Splitted some of the functionality
3492 out into GetNormalBases() and GetPartialBases().
3494 * cs-tokenizer.cs (Token.PARTIAL): New token.
3495 (Tokenizer.consume_identifier): Added some hacks to recognize
3496 `partial', but only if it's immediately followed by `class',
3497 `struct' or `interface'.
3499 * cs-parser.jay: Added support for partial clases.
3501 2004-07-23 Martin Baulig <martin@ximian.com>
3503 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
3504 a `DeclSpace' and also made it readonly.
3505 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
3506 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
3507 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
3509 * cs-parser.jay: Pass the `current_class', not the
3510 `current_container' (at the moment, this is still the same thing)
3511 to a new Method, Property, Event, Indexer or Constructor.
3513 2004-07-23 Martin Baulig <martin@ximian.com>
3515 * cs-parser.jay (CSharpParser): Added a new `current_class' field
3516 and removed the `current_interface' one.
3517 (struct_declaration, class_declaration, interface_declaration):
3518 Set `current_class' to the newly created class/struct/interface;
3519 set their `Bases' and call Register() before parsing their body.
3521 2004-07-23 Martin Baulig <martin@ximian.com>
3523 * class.cs (Kind): New public enum.
3524 (TypeContainer): Made this class abstract.
3525 (TypeContainer.Kind): New public readonly field.
3526 (TypeContainer.CheckDef): New public method; moved here from
3528 (TypeContainer.Register): New public abstract method.
3529 (TypeContainer.GetPendingImplementations): New public abstract
3531 (TypeContainer.GetClassBases): Removed the `is_class' and
3532 `is_iface' parameters.
3533 (TypeContainer.DefineNestedTypes): Formerly known as
3535 (ClassOrStruct): Made this class abstract.
3537 * tree.cs (RootTypes): New public type.
3539 2004-07-20 Martin Baulig <martin@ximian.com>
3541 * tree.cs (Tree.RecordNamespace): Removed.
3542 (Tree.Namespaces): Removed.
3544 * rootcontext.cs (RootContext.IsNamespace): Removed.
3546 * cs-parser.jay (namespace_declaration): Just create a new
3547 NamespaceEntry here.
3549 2004-07-20 Martin Baulig <martin@ximian.com>
3551 * statement.cs (ExceptionStatement): New abstract class. This is
3552 now used as a base class for everyone who's using `finally'.
3553 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
3554 our local variables before using them.
3556 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
3557 virtual method. This is used by Yield.Resolve() to "steal" an
3558 outer block's `finally' clauses.
3559 (FlowBranchingException): The .ctor now takes an ExceptionStatement
3562 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
3563 version which takes an ExceptionStatement. This version must be
3564 used to create exception branchings.
3567 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
3568 (Iterator.EmitMoveNext): Added exception support; protect the
3569 block with a `fault' clause, properly handle 'finally' clauses.
3570 (Iterator.EmitDispose): Run all the `finally' clauses here.
3572 2004-07-20 Martin Baulig <martin@ximian.com>
3574 * iterator.cs: This is the first of a set of changes in the
3575 iterator code. Match the spec more closely: if we're an
3576 IEnumerable, then GetEnumerator() must be called. The first time
3577 GetEnumerator() is called, it returns the current instance; all
3578 subsequent invocations (if any) must create a copy.
3580 2004-07-19 Miguel de Icaza <miguel@ximian.com>
3582 * expression.cs: Resolve the constant expression before returning
3585 2004-07-19 Martin Baulig <martin@ximian.com>
3587 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
3588 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
3589 the return type of the new EmitContext.
3591 2004-07-18 Martin Baulig <martin@ximian.com>
3593 * class.cs (Property.Define): Fix iterators.
3595 * iterators.cs (Iterator.Define): Moved the
3596 `container.AddInterator (this)' call here from the .ctor; only do
3597 it if we resolved successfully.
3599 2004-07-17 Miguel de Icaza <miguel@ximian.com>
3601 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
3602 `true' for preprocessing directives that we parse. The return
3603 value indicates whether we should return to regular tokenizing or
3604 not, not whether it was parsed successfully.
3606 In the past if we were in: #if false ... #line #endif, we would
3607 resume parsing after `#line'. See bug 61604.
3609 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
3610 building: IsEnumType should return true only for enums, not for
3611 enums or System.Enum itself. This fixes #61593.
3613 Likely what happened is that corlib was wrong: mcs depended on
3614 this bug in some places. The bug got fixed, we had to add the
3615 hack, which caused bug 61593.
3617 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
3618 that was a workaround for the older conditions.
3620 2004-07-16 Ben Maurer <bmaurer@ximian.com>
3622 * assign.cs: IAssignMethod has a new interface, as documented
3623 inline. All assignment code now uses this new api.
3625 * ecore.cs, expression.cs: All classes which implement
3626 IAssignMethod now use the new interface.
3628 * expression.cs (Invocation): add a hack to EmitCall so that
3629 IndexerAccess can be the target of a compound assignment without
3630 evaluating its arguments twice.
3632 * statement.cs: Handle changes in Invocation api.
3634 2004-07-16 Martin Baulig <martin@ximian.com>
3636 * iterators.cs: Rewrote this. We're now using one single Proxy
3637 class for both the IEnumerable and the IEnumerator interface and
3638 `Iterator' derives from Class so we can use the high-level API.
3640 * class.cs (TypeContainer.AddIterator): New method.
3641 (TypeContainer.DoDefineType): New protected virtual method, which
3642 is called from DefineType().
3643 (TypeContainer.DoDefineMembers): Call DefineType() and
3644 DefineMembers() on all our iterators.
3645 (TypeContainer.Emit): Call Emit() on all our iterators.
3646 (TypeContainer.CloseType): Call CloseType() on all our iterators.
3648 * codegen.cs (EmitContext.CurrentIterator): New public field.
3650 2004-07-15 Martin Baulig <martin@ximian.com>
3653 (TypeManager.not_supported_exception_type): New type.
3655 2004-07-14 Martin Baulig <martin@ximian.com>
3657 * iterators.cs: Use real error numbers.
3659 2004-07-14 Martin Baulig <martin@ximian.com>
3661 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
3662 requires this to be a System.Collection.IEnumerable and not a
3663 class implementing that interface.
3664 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
3666 2004-07-13 Marek Safar <marek.safar@seznam.cz>
3668 * class.cs: Fixed previous fix, it broke some error tests.
3670 2004-07-12 Martin Baulig <martin@ximian.com>
3672 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
3675 2004-07-09 Miguel de Icaza <miguel@ximian.com>
3677 * assign.cs (LocalTemporary): Add new argument: is_address,If
3678 `is_address' is true, then the value that we store is the address
3679 to the real value, and not the value itself.
3681 * ecore.cs (PropertyExpr): use the new local temporary
3682 stuff to allow us to handle X.Y += z (where X is a struct)
3684 2004-07-08 Martin Baulig <martin@ximian.com>
3686 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
3687 not always return, just like we're doing in Using.Resolve().
3689 2004-07-07 Miguel de Icaza <miguel@ximian.com>
3691 * cs-parser.jay (fixed_statement): flag this as Pinned.
3693 2004-07-06 Miguel de Icaza <miguel@ximian.com>
3695 * typemanager.cs (TypeManager): Removed MakePinned method, this
3696 mechanism is replaced with the .NET 2.x compatible mechanism of
3697 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
3699 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
3700 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
3701 `IsFixed' property which has a different meaning.
3703 2004-07-02 Raja R Harinath <rharinath@novell.com>
3705 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
3706 visible from inside a nested class, not just the names of the
3707 immediately enclosing class.
3710 2004-06-24 Raja R Harinath <rharinath@novell.com>
3712 * expression.cs (BetterConversion): Remove buggy special-case
3713 handling of "implicit constant expression conversions". At this
3714 point, we already know that the conversion is possible -- we're
3715 only checking to see which is better.
3717 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3719 * cs-parser.jay: Added error CS0210 test.
3721 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3723 * cs-parser.jay: Added error CS0134 test.
3725 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3728 * cs-parser.jay: Added error CS0145 test.
3730 2004-06-24 Marek Safar <marek.safar@seznam.cz>
3732 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
3734 2004-06-23 Ben Maurer <bmaurer@ximian.com>
3736 * expression.cs (StackAlloc.Resolve): The argument may not
3737 be a constant; deal with this case.
3739 2004-06-23 Marek Safar <marek.safar@seznam.cz>
3741 * attribute.cs (IndexerName_GetIndexerName): Renamed to
3742 GetIndexerAttributeValue.
3743 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
3745 * class.cs (Indexer.Define): Added error tests for CS0415,
3748 2004-06-23 Miguel de Icaza <miguel@ximian.com>
3750 * attribute.cs (Attribute.Resolve): Keep field code in sync with
3753 2004-06-23 Martin Baulig <martin@ximian.com>
3755 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
3756 neither return nor throw, reset the barrier as well. Fixes #60457.
3758 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
3760 * class.cs : EventAttributes is now set to None by default.
3761 This fixes bug #60459.
3763 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3766 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
3767 Don't throw exception but return null (it's sufficient now).
3769 2004-06-18 Marek Safar <marek.safar@seznam.cz>
3771 * typemanager.cs (GetArgumentTypes): Faster implementation.
3773 2004-06-18 Martin Baulig <martin@ximian.com>
3775 * attribute.cs (Attribute.Resolve): Check whether we're an
3776 EmptyCast which a Constant child. Fixes #60333.
3778 2004-06-17 Ben Maurer <bmaurer@ximian.com>
3780 * statement.cs (EmitCollectionForeach): Account for the fact that
3781 not all valuetypes are in areas which we can take the address of.
3782 For these variables, we store to a temporary variable. Also, make
3783 sure that we dont emit a `callvirt' on a valuetype method.
3785 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3787 * expression.cs (StackAlloc.DoReSolve): Added test for
3788 negative parameter (CS0247).
3790 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3793 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
3795 2004-06-15 Marek Safar <marek.safar@seznam.cz>
3798 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
3801 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3803 Fix bug #58254 & cs1555.cs, cs1556.cs
3804 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
3806 2004-06-14 Marek Safar <marek.safar@seznam.cz>
3808 * cs-parser.jay: Added error CS1669 test for indexers.
3810 2004-06-11 Martin Baulig <martin@ximian.com>
3812 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
3813 call this twice: for params and varargs methods.
3815 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3818 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
3820 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3822 * attribute.cs (Attribute.GetValidTargets): Made public.
3825 (AbstractPropertyEventMethod): New class for better code sharing.
3826 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
3828 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
3830 2004-06-11 Raja R Harinath <rharinath@novell.com>
3833 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
3834 that the call to Resolve is part of a MemberAccess.
3835 (Expression.Resolve): Use it for SimpleName resolution.
3836 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
3837 Add 'intermediate' boolean argument.
3838 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
3839 error message when the SimpleName can be resolved ambiguously
3840 between an expression and a type.
3841 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
3843 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
3844 call on the left-side.
3846 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3849 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
3851 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3853 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
3855 2004-06-11 Martin Baulig <martin@ximian.com>
3857 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
3858 varargs methods if applicable.
3860 2004-06-11 Martin Baulig <martin@ximian.com>
3862 * expression.cs (Invocation.EmitCall): Don't use
3863 `method.CallingConvention == CallingConventions.VarArgs' since the
3864 method could also have `CallingConventions.HasThis'.
3866 2004-06-11 Marek Safar <marek.safar@seznam.cz>
3868 * class.cs (Event.GetSignatureForError): Implemented.
3869 Fixed crash in error test cs3010.cs
3871 2004-06-10 Miguel de Icaza <miguel@ximian.com>
3873 * cs-tokenizer.cs: Change the way we track __arglist to be
3874 consistent with the other keywords.
3876 2004-06-09 Miguel de Icaza <miguel@ximian.com>
3878 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
3881 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
3883 * codegen.cs: Check that all referenced assemblies have a strongname
3884 before strongnaming the compiled assembly. If not report error CS1577.
3885 Fix bug #56563. Patch by Jackson Harper.
3886 * typemanager.cs: Added a method to return all referenced assemblies.
3887 Fix bug #56563. Patch by Jackson Harper.
3889 2004-06-08 Marek Safar <marek.safar@seznam.cz>
3892 (Method.ApplyAttributeBuilder): Moved and added conditional
3893 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
3896 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
3898 2004-06-08 Marek Safar <marek.safar@seznam.cz>
3901 * class.cs: (EventField.attribute_targets): Changed default target.
3903 2004-06-08 Martin Baulig <martin@ximian.com>
3905 * expression.cs (Invocation.EmitCall): Enable varargs methods.
3907 2004-06-08 Martin Baulig <martin@ximian.com>
3909 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
3911 2004-06-07 Martin Baulig <martin@ximian.com>
3913 Added support for varargs methods.
3915 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
3918 * cs-parser.jay: Added support for `__arglist'.
3920 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
3922 * expression.cs (Argument.AType): Added `ArgList'.
3923 (Invocation): Added support for varargs methods.
3924 (ArglistAccess): New public class.
3925 (Arglist): New public class.
3927 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
3929 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
3930 a method's top-level block if the method has varargs.
3932 * support.cs (ReflectionParameters, InternalParameters): Added
3933 support for varargs methods.
3935 2004-06-07 Miguel de Icaza <miguel@ximian.com>
3937 * class.cs: Provide location in indexer error report.
3939 * driver.cs: Use standard names.
3941 * namespace.cs: Catch the use of using after a namespace has been
3942 declared also on using aliases.
3944 2004-06-03 Raja R Harinath <rharinath@novell.com>
3947 * typemanager.cs (closure_private_ok, closure_invocation_type)
3948 (closure_qualifier_type, closure_invocation_assembly)
3949 (FilterWithClosure): Move to ...
3950 (Closure): New internal nested class.
3951 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
3952 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
3953 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
3954 (MemberLookup, MemberLookupFailed): Use it.
3955 * expression.cs (New.DoResolve): Treat the lookup for the
3956 constructor as being qualified by the 'new'ed type.
3957 (Indexers.GetIndexersForTypeOrInterface): Update.
3959 2004-06-03 Marek Safar <marek.safar@seznam.cz>
3962 (GetConditionalAttributeValue): New method. Returns
3963 condition of ConditionalAttribute.
3964 (SearchMulti): New method. Returns all attributes of type 't'.
3965 Use it when attribute is AllowMultiple = true.
3966 (IsConditionalMethodExcluded): New method.
3969 (Method.IsExcluded): Implemented. Returns true if method has conditional
3970 attribute and the conditions is not defined (method is excluded).
3971 (IMethodData): Extended interface for ConditionalAttribute support.
3972 (PropertyMethod.IsExcluded): Implemented.
3975 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
3978 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
3981 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
3983 * expression.cs (ArrayCreationExpression): Make this just an
3984 `expression'. It can't be a statement, so the code here was
3987 2004-06-02 Marek Safar <marek.safar@seznam.cz>
3990 * typemanager.cs (GetFullNameSignature): New method for
3993 2004-06-02 Marek Safar <marek.safar@seznam.cz>
3996 * class.cs (MemberBase.GetSignatureForError): New virtual method.
3997 Use this method when MethodBuilder is null.
3998 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
3999 Added test for error CS0626 (MONO reports error for this situation).
4000 (IMethodData.GetSignatureForError): Extended interface.
4002 2004-06-01 Marek Safar <marek.safar@seznam.cz>
4005 (AttributeTester.GetObsoleteAttribute): Returns instance of
4006 ObsoleteAttribute when type is obsolete.
4009 (TypeContainer.VerifyObsoleteAttribute): Override.
4010 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
4011 (MethodCode.VerifyObsoleteAttribute): Override.
4012 (MemberBase.VerifyObsoleteAttribute): Override.
4015 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
4016 and report proper error.
4019 Delegate.VerifyObsoleteAttribute): Override.
4022 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
4023 and report proper error.
4024 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
4027 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
4031 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
4032 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
4033 Added test for ObsoleteAttribute.
4036 (Catch): Derived from Statement.
4038 2004-06-01 Marek Safar <marek.safar@seznam.cz>
4040 Fixed bug #59071 & cs0160.cs
4042 * statement.cs (Try.Resolve): Check here whether order of catch
4043 clauses matches their dependencies.
4045 2004-05-31 Miguel de Icaza <miguel@ximian.com>
4047 * Reverted patch to namespace.cs (Use lookuptypedirect). This
4048 caused a regression: #59343. Referencing nested classes from an
4049 assembly stopped working.
4051 2004-05-31 Martin Baulig <martin@ximian.com>
4053 MCS is now frozen for beta 2.
4055 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4057 * convert.cs: add a trivial cache for overload operator resolution.
4059 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4061 * decl.cs: If possible, use lookuptypedirect here. We can only do
4062 this if there is no `.' after the namespace. Avoids using
4063 LookupType, which does lots of slow processing.
4064 (FindNestedType) New method, does what it says :-).
4065 * namespace.cs: use LookupTypeDirect.
4066 * rootcontext.cs: use membercache, if possible.
4067 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
4069 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4072 According to the spec,
4074 In a member access of the form E.I, if E is a single identifier,
4075 and if the meaning of E as a simple-name (§7.5.2) is a constant,
4076 field, property, localvariable, or parameter with the same type as
4077 the meaning of E as a type-name (§3.8), then both possible
4078 meanings of E are permitted.
4080 We did not check that E as a simple-name had the same type as E as
4083 This trivial check gives us 5-7% on bootstrap time.
4085 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
4087 * expression.cs (Invocation.OverloadResolve): Avoid the
4088 use of hashtables and boxing here by allocating on demand.
4090 2004-05-30 Martin Baulig <martin@ximian.com>
4092 * rootcontext.cs (RootContext.LookupType): Don't cache things if
4093 we're doing a silent lookup. Don't try to lookup nested types in
4094 TypeManager.object_type (thanks to Ben Maurer).
4096 2004-05-30 Martin Baulig <martin@ximian.com>
4098 Committing a patch from Ben Maurer.
4100 * rootcontext.cs (RootContext.LookupType): Cache negative results.
4102 2004-05-29 Martin Baulig <martin@ximian.com>
4104 * class.cs (IMethodData.ShouldIgnore): New method.
4106 * typemanager.cs (TypeManager.MethodFlags): Don't take a
4107 `Location' argument, we don't need it anywhere. Use
4108 `IMethodData.ShouldIgnore ()' instead of
4109 `MethodData.GetMethodFlags ()'.
4110 (TypeManager.AddMethod): Removed.
4111 (TypeManager.AddMethod2): Renamed to AddMethod.
4113 2004-05-29 Martin Baulig <martin@ximian.com>
4115 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
4117 * convert.cs (Convert.ImplicitReferenceConversion): If we're
4118 converting from a class type S to an interface type and we already
4119 have an object on the stack, don't box it again. Fixes #52578.
4121 2004-05-29 Martin Baulig <martin@ximian.com>
4123 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
4124 Added support for `params' parameters. Fixes #59267.
4126 2004-05-29 Martin Baulig <martin@ximian.com>
4128 * literal.cs (NullPointer): Provide a private .ctor which sets
4129 `type' to TypeManager.object_type. Fixes #59048.
4131 2004-05-29 Martin Baulig <martin@ximian.com>
4133 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
4134 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
4136 * ecore.cs (EventExpr.instance_expr): Make the field private.
4138 2004-05-26 Marek Safar <marek.safar@seznam.cz>
4140 Fixed bug #50080 & cs0214-2.cs
4141 * expression.cs (Cast.DoResolve): Check unsafe context here.
4143 * statement.cs (Resolve.DoResolve): Likewise.
4145 2004-05-26 Martin Baulig <martin@ximian.com>
4147 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
4149 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
4150 (RootContext.LookupType): Pass down the `silent' flag.
4152 2004-05-25 Martin Baulig <martin@ximian.com>
4155 (MethodGroupExpr.IdenticalTypeName): New public property.
4156 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
4157 expression actually refers to a type.
4159 2004-05-25 Martin Baulig <martin@ximian.com>
4161 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
4162 for #56176 and made it actually work.
4164 2004-05-25 Martin Baulig <martin@ximian.com>
4166 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
4167 (FieldExpr, PropertyExpr): Override and implement
4168 CacheTemporaries. Fixes #52279.
4170 2004-05-25 Miguel de Icaza <miguel@ximian.com>
4172 * location.cs: In the new compiler listing a file twice is a
4173 warning, not an error.
4175 2004-05-24 Martin Baulig <martin@ximian.com>
4177 * enum.cs (Enum.DefineType): For the `BaseType' to be a
4178 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
4180 2004-05-24 Martin Baulig <martin@ximian.com>
4182 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
4183 walking the `using' list. Fixes #53921.
4185 2004-05-24 Martin Baulig <martin@ximian.com>
4187 * const.cs (Const.LookupConstantValue): Added support for
4188 EmptyCast's; fixes #55251.
4190 2004-05-24 Martin Baulig <martin@ximian.com>
4192 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
4193 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
4194 which does the CS0135 check. The reason is that we first need to
4195 check whether the variable actually exists.
4197 2004-05-24 Martin Baulig <martin@ximian.com>
4199 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
4200 than RootContext.LookupType() to find the explicit interface
4203 2004-05-24 Raja R Harinath <rharinath@novell.com>
4205 * Makefile: Simplify. Use executable.make.
4206 * mcs.exe.sources: New file. List of sources of mcs.exe.
4208 2004-05-24 Anders Carlsson <andersca@gnome.org>
4212 Use the invariant culture when doing String.Compare for CLS case
4215 2004-05-23 Martin Baulig <martin@ximian.com>
4217 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
4218 don't have any dots. Fixes #52622, added cs0246-8.cs.
4220 * namespace.cs (NamespaceEntry.Lookup): Likewise.
4222 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4224 * class.cs (MemberBase.Define): Reuse MemberType member for
4225 resolved type. Other methods can use it too.
4227 2004-05-23 Martin Baulig <martin@ximian.com>
4229 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
4230 the variable also exists in the current block (otherwise, we need
4231 to report a CS0103). Fixes #58670.
4233 2004-05-23 Martin Baulig <martin@ximian.com>
4235 * flowanalysis.cs (Reachability.Reachable): Compute this
4236 on-the-fly rather than storing it as a field.
4238 2004-05-23 Martin Baulig <martin@ximian.com>
4240 * flowanalysis.cs (Reachability.And): Manually compute the
4241 resulting `barrier' from the reachability.
4243 2004-05-23 Marek Safar <marek.safar@seznam.cz>
4246 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
4247 instance of ObsoleteAttribute when symbol is obsolete.
4250 (IMethodData): Extended interface for ObsoleteAttribute support.
4252 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4254 * attribute.cs: Fix bug #55970
4256 2004-05-22 Marek Safar <marek.safar@seznam.cz>
4260 (GetObsoleteAttribute): New method. Creates the instance of
4262 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
4263 ObsoleteAttribute when member is obsolete.
4264 (AttributeTester.Report_ObsoleteMessage): Common method for
4265 Obsolete error/warning reporting.
4268 (TypeContainer.base_classs_type): New member for storing parent type.
4271 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
4272 for this MemberCore.
4274 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4276 * attribute.cs, const.cs: Fix bug #58590
4278 2004-05-21 Martin Baulig <martin@ximian.com>
4280 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
4281 out parameters if the end of the method is unreachable. Fixes
4284 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4286 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
4287 Hari was right, why extra method.
4289 2004-05-21 Marek Safar <marek.safar@seznam.cz>
4291 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
4293 2004-05-20 Martin Baulig <martin@ximian.com>
4295 Merged this back from gmcs to keep the differences to a minumum.
4297 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
4298 instead of a Declspace.
4299 (Attribute.ResolveType): Likewise.
4300 (Attributes.Search): Likewise.
4301 (Attributes.Contains): Likewise.
4302 (Attributes.GetClsCompliantAttribute): Likewise.
4304 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
4306 (MethodData.ApplyAttributes): Take an EmitContext instead of a
4309 2004-05-19 Marek Safar <marek.safar@seznam.cz>
4311 Fix bug #58688 (MCS does not report error when the same attribute
4314 * attribute.cs (Attribute.Emit): Distinction between null and default.
4316 2004-05-19 Raja R Harinath <rharinath@novell.com>
4318 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
4319 of a top-level attribute without an attribute target.
4320 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
4322 (Attribute.Conditional_GetConditionName),
4323 (Attribute.Obsolete_GetObsoleteMessage): Update.
4324 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
4325 part of ScanForIndexerName.
4326 (Attribute.CanIgnoreInvalidAttribute): New function.
4327 (Attribute.ScanForIndexerName): Move to ...
4328 (Attributes.ScanForIndexerName): ... here.
4329 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
4330 (Attributes.Search): New internal variant that can choose not to
4331 complain if types aren't resolved. The original signature now
4333 (Attributes.GetClsCompliantAttribute): Use internal variant, with
4334 complaints suppressed.
4335 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
4336 only if it not useful.
4337 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
4338 top-level for attributes that are shared between the assembly
4339 and a top-level class.
4340 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
4341 * class.cs: Update to reflect changes.
4342 (DefineIndexers): Fuse loops.
4343 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
4344 a couple more variants of attribute names.
4346 2004-05-18 Marek Safar <marek.safar@seznam.cz>
4348 Fix bug #52585 (Implemented explicit attribute declaration)
4351 (Attributable.ValidAttributeTargets): New abstract method. It gets
4352 list of valid attribute targets for explicit target declaration.
4353 (Attribute.Target): It holds target itself.
4354 (AttributeSection): Removed.
4355 (Attribute.CheckTargets): New method. It checks whether attribute
4356 target is valid for the current element.
4359 (EventProperty): New class. For events that are declared like
4360 property (with add and remove accessors).
4361 (EventField): New class. For events that are declared like field.
4364 * cs-parser.jay: Implemented explicit attribute target declaration.
4366 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
4367 Override ValidAttributeTargets.
4370 (ReturnParameter): Class for applying custom attributes on
4372 (ParameterAtribute): New class. Class for applying custom
4373 attributes on the parameter type.
4375 2004-05-17 Miguel de Icaza <miguel@ximian.com>
4377 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
4380 (Method): Allow UNSAFE here.
4382 * modifiers.cs: Support unsafe reporting.
4384 2004-05-17 Marek Safar <marek.safar@seznam.cz>
4386 * decl.cs: Fix bug #58478.
4388 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4390 * statement.cs: When checking for unreachable code on an EmptyStatement,
4391 set the location. Fixes bug #58488.
4393 2004-05-13 Miguel de Icaza <miguel@ximian.com>
4395 * driver.cs: Add -pkg handling.
4397 From Gonzalo: UseShelLExecute=false
4399 2004-05-12 Marek Safar <marek.safar@seznam.cz>
4402 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
4404 (Attribute.IsClsCompliaceRequired): Moved to base for better
4406 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
4407 when attribute is AttributeUsageAttribute.
4408 (Attribute.GetValidTargets): Simplified.
4409 (Attribute.GetAttributeUsage): New method returns AttributeUsage
4410 attribute for this type.
4411 (Attribute.ApplyAttributes): Method renamed to Emit and make
4413 (GlobalAttributeSection): New class for special handling of global
4414 attributes (assembly, module).
4415 (AttributeSection.Emit): New method.
4417 * class.cs: Implemented Attributable abstract methods.
4418 (MethodCore.LabelParameters): Moved to Parameter class.
4419 (Accessor): Is back simple class.
4420 (PropertyMethod): Implemented Attributable abstract class.
4421 (DelegateMethod): Implemented Attributable abstract class.
4422 (Event): New constructor for disctintion between normal Event
4423 and Event with accessors.
4425 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
4427 * codegen.cs, const.cs, decl.cs, delegate.cs:
4428 (CommonAssemblyModulClass): Implemented Attributable abstract class
4431 * enum.cs: Implement IAttributeSupport interface.
4432 (EnumMember): New class for emum members. Implemented Attributable
4436 (ParameterBase): Is abstract.
4437 (ReturnParameter): New class for easier [return:] attribute handling.
4439 * typemanager.cs: Removed builder_to_attr.
4441 2004-05-11 Raja R Harinath <rharinath@novell.com>
4444 * attribute.cs (Attribute.GetPositionalValue): New function.
4445 * class.cs (TypeContainer.VerifyMembers): New function.
4446 (TypeContainer.Emit): Use it.
4447 (ClassOrStruct): New base class for Class and Struct.
4448 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
4449 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
4451 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
4452 then each non-static field should have a FieldOffset attribute.
4453 Otherwise, none of the fields should have a FieldOffset attribute.
4454 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
4455 and FieldOffset attributes.
4456 * typemanager.cs (TypeManager.struct_layout_attribute_type)
4457 (TypeManager.field_offset_attribute_type): New core types.
4458 (TypeManager.InitCoreTypes): Initialize them.
4460 2004-05-11 Michal Moskal <malekith@pld-linux.org>
4462 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
4463 Return correct type.
4466 2004-05-09 Miguel de Icaza <miguel@ximian.com>
4468 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
4469 be implicitly converted to ulong.
4471 * expression.cs: The logic for allowing operator &, | and ^ worked
4472 was wrong, it worked before because we did not report an error in
4473 an else branch. Fixes 57895.
4475 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
4476 allow volatile fields to be reference types.
4478 2004-05-07 Miguel de Icaza <miguel@ximian.com>
4480 * driver.cs: Add support for /debug-
4482 2004-05-07 Raja R Harinath <rharinath@novell.com>
4484 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
4485 Add a 'complain' parameter to silence errors.
4486 (Attribute.Resolve): Update to changes. Put in sanity check to catch
4487 silently overlooked type-resolutions.
4488 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
4490 (Attributes.Search): New function.
4491 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
4492 (Attributes.GetAttributeFullName): Remove hack.
4493 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
4494 Update to reflect changes.
4495 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
4496 Use Attributes.Search instead of nested loops.
4498 2004-05-07 Marek Safar <marek.safar@seznam.cz>
4501 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
4502 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
4503 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
4505 * report.cs: (Report.Warning): Renamed to Warning_T because of
4506 parameter collision.
4508 2004-05-05 Raja R Harinath <rharinath@novell.com>
4510 * expression.cs (MemberAccess.ResolveMemberAccess):
4511 Exit with non-zero status after Report.Error.
4512 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
4514 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
4516 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4518 * support.cs: Don't hang when the file is empty.
4520 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
4522 * support.cs: In SeekableStreamReader, compute the preamble size of the
4523 underlying stream. Position changes should take into account that initial
4526 2004-05-03 Todd Berman <tberman@sevenl.net>
4528 * driver.cs: remove unused GetSysVersion function.
4530 2004-05-03 Todd Berman <tberman@sevenl.net>
4532 * driver.cs: Remove the hack from saturday, as well as the hack
4533 from jackson (LoadAssemblyFromGac), also adds the CWD to the
4534 link_paths to get that bit proper.
4536 2004-05-01 Todd Berman <tberman@sevenl.net>
4538 * driver.cs: Try a LoadFrom before a Load, this checks the current
4539 path. This is currently a bug in mono that is be fixed, however, this
4540 provides a workaround for now. This will be removed when the bug
4543 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
4545 * CryptoConvert.cs: Updated to latest version. Fix issue with
4546 incomplete key pairs (#57941).
4548 2004-05-01 Todd Berman <tberman@sevenl.net>
4550 * driver.cs: Remove '.' from path_chars, now System.* loads properly
4553 2004-04-30 Jackson Harper <jackson@ximian.com>
4555 * codegen.cs: Open keys readonly.
4557 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4559 * typemanager.cs: don't report cyclic struct layout when a struct
4560 contains 2 or more fields of the same type. Failed for Pango.AttrShape
4561 which has 2 Pango.Rectangle fields.
4563 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
4565 * expression.cs: Handle IntPtr comparisons with IL code
4566 rather than a method call.
4568 2004-04-29 Martin Baulig <martin@ximian.com>
4570 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
4571 the list of PropertyInfo's in class hierarchy and find the
4572 accessor. Fixes #56013.
4574 2004-04-29 Martin Baulig <martin@ximian.com>
4576 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
4578 2004-04-29 Martin Baulig <martin@ximian.com>
4580 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4582 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
4584 2004-04-29 Martin Baulig <martin@ximian.com>
4586 * class.cs (ConstructorInitializer.Resolve): Check whether the
4587 parent .ctor is accessible. Fixes #52146.
4589 2004-04-29 Martin Baulig <martin@ximian.com>
4591 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
4593 * statement.cs (Using.EmitLocalVariableDecls): Use
4594 TypeManager.idisposable_type, not typeof (IDisposable).
4595 (Foreach.EmitCollectionForeach): Added support for valuetypes.
4597 2004-04-29 Martin Baulig <martin@ximian.com>
4599 * class.cs (Event.Define): Don't emit the field and don't set
4600 RTSpecialName and SpecialName for events on interfaces. Fixes
4603 2004-04-29 Raja R Harinath <rharinath@novell.com>
4605 Refactor Attribute.ApplyAttributes.
4606 * attribute.cs (Attributable): New base class for objects that can
4607 have Attributes applied on them.
4608 (Attribute): Make AttributeUsage fields public.
4609 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
4610 (Attribute.IsInternalCall): New property.
4611 (Attribute.UsageAttr): Convert to a public read-only property.
4612 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
4613 (Attribute.ResolveType, Attribute.Resolve)
4614 (Attribute.ScanForIndexerName): Update to reflect changes.
4615 (Attribute.CheckAttributeTarget): Re-format.
4616 (Attribute.ApplyAttributes): Refactor, to various
4617 Attributable.ApplyAttributeBuilder methods.
4618 * decl.cs (MemberCore): Make Attributable.
4619 * class.cs (Accessor): Make Attributable.
4620 (MethodData.ApplyAttributes): Use proper attribute types, not
4622 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
4623 (TypeContainer.ApplyAttributeBuilder)
4624 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
4625 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
4626 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
4627 (Operator.ApplyAttributeBuilder): New factored-out methods.
4628 * const.cs (Const.ApplyAttributeBuilder): Likewise.
4629 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
4630 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
4631 * parameter.cs (ParameterBase): New Attributable base class
4632 that can also represent Return types.
4633 (Parameter): Update to the changes.
4635 2004-04-29 Jackson Harper <jackson@ximian.com>
4637 * driver.cs: Prefer the corlib system version when looking for
4638 assemblies in the GAC. This is still a hack, but its a better hack
4641 2004-04-29 Marek Safar <marek.safar@seznam.cz>
4643 * decl.cs, enum.cs: Improved error 3005 reporting.
4645 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
4646 (related_symbols): New private member for list of symbols
4647 related to reported error/warning.
4649 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
4651 2004-04-29 Martin Baulig <martin@ximian.com>
4653 * ecore.cs (Expression.Constantify): If we're an enum and
4654 TypeManager.TypeToCoreType() doesn't give us another type, use
4655 t.UnderlyingSystemType. Fixes #56178.
4657 2004-04-29 Martin Baulig <martin@ximian.com>
4659 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
4660 interfaces and for each interface, only add members directly
4661 declared in that interface. Fixes #53255.
4663 2004-04-28 Martin Baulig <martin@ximian.com>
4665 * expression.cs (ConditionalLogicalOperator): Use a temporary
4666 variable for `left' to avoid that we evaluate it more than once;
4669 2004-04-28 Martin Baulig <martin@ximian.com>
4671 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
4674 2004-04-28 Martin Baulig <martin@ximian.com>
4676 * statement.cs (LocalInfo.Resolve): Check whether the type is not
4679 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
4680 whether the type is not void (CS1547).
4682 2004-04-28 Martin Baulig <martin@ximian.com>
4684 * expression.cs (Unary.DoResolveLValue): Override this and report
4685 CS0131 for anything but Operator.Indirection.
4687 2004-04-28 Martin Baulig <martin@ximian.com>
4689 Committing a patch from Ben Maurer; see bug #50820.
4691 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4694 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4697 2004-04-28 Martin Baulig <martin@ximian.com>
4699 Committing a patch from Ben Maurer; see bug #50820.
4701 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
4704 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
4707 2004-04-28 Martin Baulig <martin@ximian.com>
4709 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
4710 (Block.AddLabel): Call DoLookupLabel() to only search in the
4713 2004-04-28 Martin Baulig <martin@ximian.com>
4715 * cfold.cs (ConstantFold.BinaryFold): Added special support for
4716 comparing StringConstants and NullLiterals in Equality and Inequality.
4718 2004-04-28 Jackson Harper <jackson@ximian.com>
4720 * driver.cs: Attempt to load referenced assemblies from the
4721 GAC. This is the quick and dirty version of this method that
4722 doesnt take into account versions and just takes the first
4723 canidate found. Will be good enough for now as we will not have more
4724 then one version installed into the GAC until I update this method.
4726 2004-04-28 Martin Baulig <martin@ximian.com>
4728 * typemanager.cs (TypeManager.CheckStructCycles): New public
4729 static method to check for cycles in the struct layout.
4731 * rootcontext.cs (RootContext.PopulateTypes): Call
4732 TypeManager.CheckStructCycles() for each TypeContainer.
4733 [Note: We only need to visit each type once.]
4735 2004-04-28 Martin Baulig <martin@ximian.com>
4737 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
4739 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
4740 success and added `out object value'. Use a `bool resolved' field
4741 to check whether we've already been called rather than
4742 `ConstantValue != null' since this breaks for NullLiterals.
4744 2004-04-28 Raja R Harinath <rharinath@novell.com>
4746 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
4747 setting of this flag, since the 'set' method may be non-public.
4749 2004-04-28 Raja R Harinath <rharinath@novell.com>
4751 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
4752 check on current_vector.Block.
4754 2004-04-27 Martin Baulig <martin@ximian.com>
4756 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
4757 a field initializer. Fixes #56459.
4759 2004-04-27 Martin Baulig <martin@ximian.com>
4761 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
4762 we're not attempting to use an indexer. Fixes #52154.
4764 2004-04-27 Martin Baulig <martin@ximian.com>
4766 * statement.cs (Return): Don't create a return label if we don't
4767 need it; reverts my change from January 20th. Thanks to Ben
4770 2004-04-27 Martin Baulig <martin@ximian.com>
4772 According to the spec, `goto' can only leave a nested scope, but
4775 * statement.cs (Block.LookupLabel): Only lookup in the current
4776 block, don't recurse into parent or child blocks.
4777 (Block.AddLabel): Check in parent and child blocks, report
4778 CS0140/CS0158 if we find a duplicate.
4779 (Block): Removed this indexer for label lookups.
4780 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
4781 this already does the error reporting for us.
4784 (FlowBranching.UsageVector.Block): New public variable; may be null.
4785 (FlowBranching.CreateSibling): Added `Block' argument.
4786 (FlowBranching.LookupLabel): New public virtual method. Lookup a
4787 label for the target of a `goto' and check whether we're not
4788 leaving a `finally'.
4790 2004-04-27 Martin Baulig <martin@ximian.com>
4792 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
4793 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
4796 2004-04-27 Martin Baulig <martin@ximian.com>
4798 * statement.cs (Block.AddLabel): Also check for implicit blocks
4799 and added a CS0158 check.
4801 2004-04-27 Martin Baulig <martin@ximian.com>
4803 * flowanalysis.cs (FlowBranchingLoop): New class.
4804 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
4805 UsageVector's instead of an ArrayList.
4806 (FlowBranching.Label): Likewise.
4807 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
4808 (FlowBranching.AddBreakVector): New method.
4810 2004-04-27 Miguel de Icaza <miguel@ximian.com>
4812 * attribute.cs: Small regression fix: only convert the type if we
4813 the type is different, fixes System.Drawing build.
4815 2004-04-27 Martin Baulig <martin@ximian.com>
4817 * attribute.cs (Attribute.Resolve): If we have a constant value
4818 for a named field or property, implicity convert it to the correct
4821 2004-04-27 Raja R Harinath <rharinath@novell.com>
4823 * statement.cs (Block.Block): Implicit blocks share
4824 'child_variable_names' fields with parent blocks.
4825 (Block.AddChildVariableNames): Remove.
4826 (Block.AddVariable): Mark variable as "used by a child block" in
4827 every surrounding block.
4828 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
4829 been used in a child block, complain about violation of "Invariant
4830 meaning in blocks" rule.
4831 * cs-parser.jay (declare_local_variables): Don't use
4832 AddChildVariableNames.
4833 (foreach_statement): Don't create an implicit block: 'foreach'
4836 2004-04-23 Miguel de Icaza <miguel@ximian.com>
4838 * convert.cs (ImplicitNumericConversion): 0 is also positive when
4839 converting from 0L to ulong. Fixes 57522.
4841 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4843 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
4844 derived class hides via 'new' keyword field from base class (test-242.cs).
4845 TODO: Handle this in the more general way.
4847 * class.cs (CheckBase): Ditto.
4849 2004-04-22 Marek Safar <marek.safar@seznam.cz>
4851 * decl.cs (caching_flags): New member for storing cached values
4853 (MemberCore.Flags): New enum where bit flags for caching_flags
4855 (MemberCore.cls_compliance): Moved to caching_flags.
4856 (DeclSpace.Created): Moved to caching_flags.
4858 * class.cs: Use caching_flags instead of DeclSpace.Created
4860 2004-04-21 Miguel de Icaza <miguel@ximian.com>
4862 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
4863 if we are only a derived class, not a nested class.
4865 * typemanager.cs: Same as above, but do this at the MemberLookup
4866 level (used by field and methods, properties are handled in
4867 PropertyExpr). Allow for the qualified access if we are a nested
4870 2004-04-21 Marek Safar <marek.safar@seznam.cz>
4872 * class.cs: Refactoring.
4873 (IMethodData): New inteface; Holds links to parent members
4874 to avoid member duplication (reduced memory allocation).
4875 (Method): Implemented IMethodData interface.
4876 (PropertyBase): New inner classes for get/set methods.
4877 (PropertyBase.PropertyMethod): Implemented IMethodData interface
4878 (Event): New inner classes for add/remove methods.
4879 (Event.DelegateMethod): Implemented IMethodData interface.
4881 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
4882 EmitContext (related to class.cs refactoring).
4884 2004-04-21 Raja R Harinath <rharinath@novell.com>
4886 * delegate.cs (Delegate.VerifyApplicability): If the number of
4887 arguments are the same as the number of parameters, first try to
4888 verify applicability ignoring any 'params' modifier on the last
4892 2004-04-16 Raja R Harinath <rharinath@novell.com>
4894 * class.cs (TypeContainer.AddIndexer): Use
4895 'ExplicitInterfaceName' to determine if interface name was
4896 explicitly specified. 'InterfaceType' is not initialized at this time.
4897 (TypeContainer.DefineIndexers): Remove use of temporary list. The
4898 Indexers array is already in the required order. Initialize
4899 'IndexerName' only if there are normal indexers.
4900 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
4901 (TypeContainer.Emit): Emit DefaultMember attribute only if
4902 IndexerName is initialized.
4905 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
4907 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
4910 2004-04-15 Raja R Harinath <rharinath@novell.com>
4912 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
4916 * attribute.cs (Attribute.Resolve): Check for duplicate named
4920 2004-04-15 Miguel de Icaza <miguel@ximian.com>
4922 * iterators.cs (MarkYield): track whether we are in an exception,
4923 and generate code accordingly. Use a temporary value to store the
4924 result for our state.
4926 I had ignored a bit the interaction of try/catch with iterators
4927 since their behavior was not entirely obvious, but now it is
4928 possible to verify that our behavior is the same as MS .NET 2.0
4932 2004-04-14 Miguel de Icaza <miguel@ximian.com>
4934 * iterators.cs: Avoid creating temporaries if there is no work to
4937 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
4938 Enumerations, use TypeManager.EnumToUnderlying and call
4941 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
4944 (This.Emit): Use EmitContext.EmitThis to emit our
4947 (This.EmitAssign): Ditto.
4949 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
4950 codepaths, we will move all the functionality into
4953 (FieldExpr.EmitAssign): Ditto.
4955 This fixes several hidden bugs that I uncovered while doing a code
4956 review of this today.
4958 * codegen.cs (EmitThis): reworked so the semantics are more clear
4959 and also support value types "this" instances.
4961 * iterators.cs: Changed so that for iterators in value types, we
4962 do not pass the value type as a parameter.
4964 Initialization of the enumerator helpers is now done in the caller
4965 instead of passing the parameters to the constructors and having
4966 the constructor set the fields.
4968 The fields have now `assembly' visibility instead of private.
4970 2004-04-11 Miguel de Icaza <miguel@ximian.com>
4972 * expression.cs (Argument.Resolve): Check if fields passed as ref
4973 or out are contained in a MarshalByRefObject.
4975 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
4976 another compiler type.
4978 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
4980 * class.cs (Indexer.Define): use the new name checking method.
4981 Also, return false on an error.
4982 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
4983 (is_identifier_[start/part]_character): make static.
4985 2004-04-10 Miguel de Icaza <miguel@ximian.com>
4987 * expression.cs (Binary.ResolveOperator): Do no append strings
4988 twice: since we can be invoked more than once (array evaluation)
4989 on the same concatenation, take care of this here. Based on a fix
4990 from Ben (bug #56454)
4992 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
4994 * codegen.cs: Fix another case where CS1548 must be reported (when
4995 delay-sign isn't specified and no private is available #56564). Fix
4996 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
4997 error when MCS is used on the MS runtime and we need to delay-sign
4998 (which seems unsupported by AssemblyBuilder - see #56621).
5000 2004-04-08 Marek Safar <marek.safar@seznam.cz>
5002 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
5003 (TypeManager.ComputeNamespaces): Faster implementation for
5006 * compiler.csproj: Updated AssemblyName to mcs.
5008 2004-04-07 Miguel de Icaza <miguel@ximian.com>
5010 * rootcontext.cs: Add new types to the boot resolution.
5012 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
5013 MulticastDelegate is not allowed.
5015 * typemanager.cs: Add new types to lookup: System.TypedReference
5018 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
5019 check for TypedReference or ArgIterator, they are not allowed.
5021 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
5022 makes us properly catch 1510 in some conditions (see bug 56016 for
5025 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
5027 * CryptoConvert.cs: update from corlib version
5030 2004-04-05 Miguel de Icaza <miguel@ximian.com>
5032 * class.cs (Indexer.Define): Check indexername declaration
5034 2004-04-05 Marek Safar <marek.safar@seznam.cz>
5036 * attribute.cs (IsClsCompliant): Fixed problem with handling
5037 all three states (compliant, not-compliant, undetected).
5039 2004-03-30 Marek Safar <marek.safar@seznam.cz>
5041 * attribute.cs (Attribute): Location is now public.
5042 (Resolve): Store resolved arguments (pos_values) in attribute class.
5043 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
5044 (GetClsCompliantAttributeValue): New method that gets
5045 CLSCompliantAttribute value.
5046 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
5047 if exists else null.
5048 (AttributeTester): New class for CLS-Compliant verification routines.
5050 * class.cs (Emit): Add CLS-Compliant verification.
5051 (Method.GetSignatureForError): Implemented.
5052 (Constructor.GetSignatureForError): Implemented
5053 (Constructor.HasCompliantArgs): Returns if constructor has
5054 CLS-Compliant arguments.
5055 (Constructor.Emit): Override.
5056 (Construcor.IsIdentifierClsCompliant): New method; For constructors
5057 is needed to test only parameters.
5058 (FieldBase.GetSignatureForError): Implemented.
5059 (TypeContainer): New member for storing base interfaces.
5060 (TypeContainer.FindMembers): Search in base interfaces too.
5062 * codegen.cs (GetClsComplianceAttribute): New method that gets
5063 assembly or module CLSCompliantAttribute value.
5064 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
5066 (ModuleClass.Emit): Add error 3012 test.
5068 * const.cs (Emit): Override and call base for CLS-Compliant tests.
5070 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
5071 state for all decl types.
5072 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
5073 if CLS-Compliant tests are required.
5074 (IsClsCompliaceRequired): New method. Analyze whether code
5075 must be CLS-Compliant.
5076 (IsExposedFromAssembly): New method. Returns true when MemberCore
5077 is exposed from assembly.
5078 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
5079 value or gets cached value.
5080 (HasClsCompliantAttribute): New method. Returns true if MemberCore
5081 is explicitly marked with CLSCompliantAttribute.
5082 (IsIdentifierClsCompliant): New abstract method. This method is
5083 used to testing error 3005.
5084 (IsIdentifierAndParamClsCompliant): New method. Common helper method
5085 for identifier and parameters CLS-Compliant testing.
5086 (VerifyClsCompliance): New method. The main virtual method for
5087 CLS-Compliant verifications.
5088 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
5089 null. I don't know why is null (too many public members !).
5090 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
5091 and get value of first CLSCompliantAttribute that found.
5093 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
5094 (VerifyClsCompliance): Override and add extra tests.
5096 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
5097 clscheck- disable CLS-Compliant verification event if assembly is has
5098 CLSCompliantAttribute(true).
5100 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
5101 ApllyAttribute is now called in emit section as in the other cases.
5102 Possible future Emit integration.
5103 (IsIdentifierClsCompliant): New override.
5104 (VerifyClsCompliance): New override.
5105 (GetEnumeratorName): Returns full enum name.
5107 * parameter.cs (GetSignatureForError): Implemented.
5109 * report.cs (WarningData): New struct for Warning message information.
5110 (LocationOfPreviousError): New method.
5111 (Warning): New method. Reports warning based on the warning table.
5112 (Error_T): New method. Reports error based on the error table.
5114 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
5115 verifications are done here.
5117 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
5119 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
5120 CLSCompliantAttribute.
5121 (all_imported_types): New member holds all imported types from other
5123 (LoadAllImportedTypes): New method fills static table with exported types
5124 from all referenced assemblies.
5125 (Modules): New property returns all assembly modules.
5127 2004-03-30 Miguel de Icaza <miguel@ximian.com>
5129 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
5130 throwing a parser error.
5132 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
5133 which removes the hardcoded get_/set_ prefixes for properties, as
5134 IL allows for the properties to be named something else.
5138 * expression.cs: Do not override operand before we know if it is
5141 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5143 * typemanager.cs: support for pinned variables.
5145 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5147 * decl.cs, typemanager.cs: Avoid using an arraylist
5148 as a buffer if there is only one result set.
5150 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
5152 * expression.cs: Make sure you cant call a static method
5153 with an instance expression, bug #56174.
5155 2004-03-29 Miguel de Icaza <miguel@ximian.com>
5157 * class.cs (IsDuplicateImplementation): Improve error reporting to
5158 flag 663 (method only differs in parameter modifier).
5160 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
5161 in preprocessor directives.
5163 * location.cs (LookupFile): Allow for the empty path.
5165 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
5166 better approach for some of that patch, but its failing with the
5167 CharSet enumeration. For now try/catch will do.
5169 * typemanager.cs: Do not crash if a struct does not have fields.
5172 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5174 * expression.cs: cs0213, cant fix a fixed expression.
5177 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5179 * cs-parser.jay: detect invalid embeded statements gracefully.
5182 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
5184 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
5187 the invocation type may not be a subclass of the tye of the item/
5188 The type of the item must be a subclass of the invocation item.
5193 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
5195 * attribute.cs: Added methods to get a string and a bool from an
5196 attribute. Required to information from AssemblyKeyFileAttribute,
5197 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
5198 * codegen.cs: Modified AssemblyName creation to include support for
5199 strongnames. Catch additional exceptions to report them as CS1548.
5200 * compiler.csproj: Updated include CryptoConvert.cs.
5201 * compiler.csproj.user: Removed file - user specific configuration.
5202 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
5203 Mono.Security assembly. The original class is maintained and tested in
5204 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
5205 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
5206 like CSC 8.0 (C# v2) supports.
5207 * Makefile: Added CryptoConvert.cs to mcs sources.
5208 * rootcontext.cs: Added new options for strongnames.
5210 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
5212 * driver.cs: For --expect-error, report error code `2'
5213 if the program compiled with no errors, error code `1' if
5214 it compiled with an error other than the one expected.
5216 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
5218 * compiler.csproj: Updated for Visual Studio .NET 2003.
5219 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
5220 * compiler.sln: Updated for Visual Studio .NET 2003.
5222 2004-03-24 Ravi Pratap M <ravi@ximian.com>
5224 * expression.cs: Fix bug #47234. We basically need to apply the
5225 rule that we prefer the conversion of null to a reference type
5226 when faced with a conversion to 'object' (csc behaviour).
5228 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5230 * statement.cs: Shorter form for foreach, eliminates
5231 a local variable. r=Martin.
5233 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5235 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
5236 checks if we can use brtrue/brfalse to test for 0.
5237 * expression.cs: use the above in the test for using brtrue/brfalse.
5240 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5242 * expression.cs: Rewrite string concat stuff. Benefits:
5244 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
5245 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
5246 rather than a concat chain.
5248 * typemanager.cs: Add lookups for more concat overloads.
5250 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
5252 * expression.cs: Emit shorter il code for array init.
5269 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
5271 * statement.cs: Before, two switch blocks would be merged if the
5272 total size of the blocks (end_item - begin_item + 1) was less than
5273 two times the combined sizes of the blocks.
5275 Now, it will only merge if after the merge at least half of the
5280 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
5282 * class.cs : csc build fix for GetMethods(). See bug #52503.
5284 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
5286 * expression.cs: Make sure fp comparisons work with NaN.
5287 This fixes bug #54303. Mig approved this patch a long
5288 time ago, but we were not able to test b/c the runtime
5291 2004-03-19 Miguel de Icaza <miguel@ximian.com>
5293 * ecore.cs (TypExpr.GetHashCode): implement this overload.
5295 2004-03-19 Martin Baulig <martin@ximian.com>
5297 * class.cs (MemberCore.IsDuplicateImplementation): Report the
5298 error here and not in our caller.
5300 2004-03-19 Martin Baulig <martin@ximian.com>
5302 * interface.cs: Completely killed this file.
5303 (Interface): We're now a TypeContainer and live in class.cs.
5305 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
5306 argument; we're now also called for interfaces.
5307 (TypeContainer.DefineMembers): Allow this method being called
5309 (TypeContainer.GetMethods): New public method; formerly known as
5310 Interface.GetMethod(). This is used by PendingImplementation.
5311 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
5312 it's now private and non-static.
5313 (Interface): Moved this here; it's now implemented similar to
5315 (Method, Property, Event, Indexer): Added `bool is_interface'
5316 argument to their .ctor's.
5317 (MemberBase.IsInterface): New public field.
5319 * cs-parser.jay: Create normal Method, Property, Event, Indexer
5320 instances instead of InterfaceMethod, InterfaceProperty, etc.
5321 (opt_interface_base): Removed; we now use `opt_class_base' instead.
5322 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
5324 2004-03-19 Martin Baulig <martin@ximian.com>
5326 * class.cs (MethodCore.IsDuplicateImplementation): New private
5327 method which does the CS0111 checking.
5328 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
5329 Use IsDuplicateImplementation().
5331 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
5333 * decl.cs (FindMemberToOverride): New method to find the correct
5334 method or property to override in the base class.
5336 - Make Method/Property use the above method to find the
5337 version in the base class.
5338 - Remove the InheritableMemberSignatureCompare as it is now
5341 This patch makes large code bases much faster to compile, as it is
5342 O(n) rather than O(n^2) to do this validation.
5344 Also, it fixes bug 52458 which is that nested classes are not
5345 taken into account when finding the base class member.
5347 Reviewed/Approved by Martin.
5349 2004-03-17 Marek Safar <marek.safar@seznam.cz>
5351 * interface.cs: In all interface classes removed redundant
5352 member initialization.
5354 2004-03-16 Martin Baulig <martin@ximian.com>
5356 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
5358 2004-03-15 Miguel de Icaza <miguel@ximian.com>
5360 * decl.cs (DefineTypeAndParents): New helper method to define a
5361 type's containers before the type itself is defined; This is a
5362 bug exposed by the recent changes to Windows.Forms when an
5363 implemented interface was defined inside a class that had not been
5366 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
5368 (Check): Loop correctly to report errors modifiers
5369 (UNSAFE was not in the loop, since it was the same as TOP).
5371 * interface.cs: Every interface member now takes a ModFlags,
5372 instead of a "is_new" bool, which we set on the base MemberCore.
5374 Every place where we called "UnsafeOk" in the interface, now we
5375 call the proper member (InterfaceMethod.UnsafeOK) instead to get
5376 the unsafe settings from the member declaration instead of the
5377 container interface.
5379 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
5381 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
5382 `set_indexer_name' to the pending bits (one per type).
5384 We fixed a bug today that was picking the wrong method to
5385 override, since for properties the existing InterfaceMethod code
5386 basically ignored the method name. Now we make sure that the
5387 method name is one of the valid indexer names.
5389 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
5391 * support.cs (SeekableStreamReader): Keep track of stream byte
5392 positions and don't mix them with character offsets to the buffer.
5394 Patch from Gustavo Giráldez
5396 2004-03-15 Marek Safar <marek.safar@seznam.cz>
5398 * interface.cs (InterfaceSetGetBase): Removed double member
5399 initialization, base class does it as well.
5401 2004-03-13 Martin Baulig <martin@ximian.com>
5403 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
5404 when compiling corlib.
5406 2004-03-13 Miguel de Icaza <miguel@ximian.com>
5408 * convert.cs (ExplicitConversion): We were reporting an error on
5409 certain conversions (object_type source to a value type, when the
5410 expression was `null') before we had a chance to pass it through
5411 the user defined conversions.
5413 * driver.cs: Replace / and \ in resource specifications to dots.
5416 * class.cs: Add check for duplicate operators. Fixes 52477
5418 2004-03-11 Miguel de Icaza <miguel@ximian.com>
5420 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
5421 that are in the middle of the statements, not only at the end.
5424 * class.cs (TypeContainer.AddField): No longer set the
5425 `HaveStaticConstructor' flag, now we call it
5426 `UserDefineStaticConstructor' to diferentiate the slightly
5427 semantic difference.
5429 The situation is that we were not adding BeforeFieldInit (from
5430 Modifiers.TypeAttr) to classes that could have it.
5431 BeforeFieldInit should be set to classes that have no static
5436 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
5438 And most importantly Zoltan's comment:
5440 http://bugzilla.ximian.com/show_bug.cgi?id=44229
5442 "I think beforefieldinit means 'it's ok to initialize the type sometime
5443 before its static fields are used', i.e. initialization does not need
5444 to be triggered by the first access to the type. Setting this flag
5445 helps the JIT to compile better code, since it can run the static
5446 constructor at JIT time, and does not need to generate code to call it
5447 (possibly lots of times) at runtime. Unfortunately, mcs does not set
5448 this flag for lots of classes like String.
5450 csc sets this flag if the type does not have an explicit static
5451 constructor. The reasoning seems to be that if there are only static
5452 initalizers for a type, and no static constructor, then the programmer
5453 does not care when this initialization happens, so beforefieldinit
5456 This bug prevents the AOT compiler from being usable, since it
5457 generates so many calls to mono_runtime_class_init that the AOT code
5458 is much slower than the JITted code. The JITted code is faster,
5459 because it does not generate these calls if the vtable is type is
5460 already initialized, which is true in the majority of cases. But the
5461 AOT compiler can't do this."
5463 2004-03-10 Miguel de Icaza <miguel@ximian.com>
5465 * class.cs (MethodData.Emit): Refactor the code so symbolic
5466 information is generated for destructors; For some reasons we
5467 were taking a code path that did not generate symbolic information
5470 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
5472 * class.cs: Create a Constructor.CheckBase method that
5473 takes care of all validation type code. The method
5474 contains some code that was moved from Define.
5476 It also includes new code that checks for duplicate ctors.
5477 This fixes bug #55148.
5479 2004-03-09 Joshua Tauberer <tauberer@for.net>
5481 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
5482 a { ... }-style array creation invokes EmitStaticInitializers
5483 which is not good for reference-type arrays. String, decimal
5484 and now null constants (NullCast) are not counted toward
5485 static initializers.
5487 2004-03-05 Martin Baulig <martin@ximian.com>
5489 * location.cs (SourceFile.HasLineDirective): New public field;
5490 specifies whether the file contains or is referenced by a "#line"
5492 (Location.DefineSymbolDocuments): Ignore source files which
5493 either contain or are referenced by a "#line" directive.
5495 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
5497 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
5498 direct access to our parent, so check the method inline there.
5500 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
5502 * expression.cs (Invocation.EmitCall): Miguel's last commit
5503 caused a regression. If you had:
5508 In Foo the implict this would be null.
5510 2004-02-27 Miguel de Icaza <miguel@ximian.com>
5512 * expression.cs (Invocation.EmitCall): If the method is not
5513 virtual, do not emit a CallVirt to it, use Call.
5515 * typemanager.cs (GetFullNameSignature): Improve the method to
5516 cope with ".ctor" and replace it with the type name.
5518 * class.cs (ConstructorInitializer.Resolve): Now the method takes
5519 as an argument the ConstructorBuilder where it is being defined,
5520 to catch the recursive constructor invocations.
5522 2004-02-26 Miguel de Icaza <miguel@ximian.com>
5524 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
5525 routines to check if a type is an enumerable/enumerator allow
5526 classes that implement the IEnumerable or IEnumerator interfaces.
5528 * class.cs (Property, Operator): Implement IIteratorContainer, and
5529 implement SetYields.
5531 (Property.Define): Do the block swapping for get_methods in the
5532 context of iterators. We need to check if Properties also
5533 include indexers or not.
5535 (Operator): Assign the Block before invoking the
5536 OperatorMethod.Define, so we can trigger the Iterator code
5539 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
5540 Property and Operator classes are not created when we parse the
5541 declarator but until we have the block completed, so we use a
5542 singleton SimpleIteratorContainer.Simple to flag whether the
5543 SetYields has been invoked.
5545 We propagate this setting then to the Property or the Operator to
5546 allow the `yield' to function.
5548 2004-02-25 Marek Safar <marek.safar@seznam.cz>
5550 * codegen.cs: Implemented attribute support for modules.
5551 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
5552 Assembly/Module functionality.
5554 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
5555 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
5556 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
5558 2004-02-16 Marek Safar <marek.safar@seznam.cz>
5560 * interface.cs (FindMembers): The operation is performed on all base
5561 interfaces and not only on the first. It is required for future CLS Compliance patch.
5563 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
5565 * statement.cs, codegen.cs:
5566 This patch deals with patterns such as:
5568 public class List : IEnumerable {
5570 public MyEnumerator GetEnumerator () {
5571 return new MyEnumerator(this);
5574 IEnumerator IEnumerable.GetEnumerator () {
5578 public struct MyEnumerator : IEnumerator {
5583 Before, there were a few things we did wrong:
5584 1) we would emit callvirt on a struct, which is illegal
5585 2) we emited ldarg when we needed to emit ldarga
5586 3) we would mistakenly call the interface methods on an enumerator
5587 type that derived from IEnumerator and was in another assembly. For example:
5589 public class MyEnumerator : IEnumerator
5591 Would have the interface methods called, even if there were public impls of the
5592 method. In a struct, this lead to invalid IL code.
5594 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5596 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5599 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5601 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5603 * cs-parser.jay: Fix small regression: we were not testing V2
5604 compiler features correctly.
5606 * interface.cs: If the emit context is null, then create one
5608 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5610 * decl.cs (GetSignatureForError): New virtual method to get full name
5613 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5614 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5616 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5617 Duplicated members and code in these classes has been removed.
5618 Better encapsulation in these classes.
5620 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5622 * assign.cs (Assign.DoResolve): When dealing with compound
5623 assignments, there is a new rule in ECMA C# 2.4 (might have been
5624 there before, but it is documented here) that states that in:
5628 If b is of type int, and the `op' is a shift-operator, then the
5629 above is evaluated as:
5633 * expression.cs (Binary.ResolveOperator): Instead of testing for
5634 int/uint/long/ulong, try to implicitly convert to any of those
5635 types and use that in pointer arithmetic.
5637 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5638 method to print information for from the type, not from the
5639 null-method we were given.
5641 2004-02-01 Duncan Mak <duncan@ximian.com>
5643 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5644 parsing for cmd, fixes bug #53694.
5646 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5648 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5649 in the member name duplication tests. Property and operator name duplication
5650 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5652 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5654 * interface.cs (PopulateMethod): Fixed crash when interface method
5655 returns not existing type (error test cs0246-3.cs).
5657 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5659 * cs-parser.jay (interface_accessors): Re-write actions to also
5660 store attributes attached to get and set methods. Fix spelling
5663 (inteface_property_declaration): Modify accordingly.
5665 (InterfaceAccessorInfo): New helper class to store information to pass
5666 around between rules that use interface_accessors.
5668 * interface.cs (Emit): Apply attributes on the get and set
5669 accessors of properties and indexers too.
5671 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5672 right MethodBuilder when applying attributes to the get and set accessors.
5674 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5676 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5678 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5680 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5682 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5684 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5685 changes that treat `yield' specially when present before `break'
5688 * cs-tokenizer.cs: yield is no longer a keyword.
5690 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5692 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5693 setting for default constructors.
5694 For default constructors are almost every time set wrong Modifier. The
5695 generated IL code has been alright. But inside mcs this values was
5696 wrong and this was reason why several of my CLS Compliance tests
5699 2004-01-22 Martin Baulig <martin@ximian.com>
5701 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5702 not a QualifiedIdentifier. This is what `type_name_expression'
5703 was previously doing.
5704 (type_name_expression): Removed; the code is now in
5705 `namespace_or_type_name'.
5706 (qualified_identifier): Removed, use `namespace_or_type_name'
5708 (QualifiedIdentifier): Removed this class.
5710 2004-01-22 Martin Baulig <martin@ximian.com>
5712 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5713 not a string as alias name.
5715 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5717 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5718 #52730 bug, and instead compute correctly the need to use a
5719 temporary variable when requesting an address based on the
5720 static/instace modified of the field and the constructor.
5722 2004-01-21 Martin Baulig <martin@ximian.com>
5724 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5725 class and namespace before looking up aliases. Fixes #52517.
5727 2004-01-21 Martin Baulig <martin@ximian.com>
5729 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5730 assinged in a 'try'; fixes exception4.cs.
5732 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5733 * class.cs : Implemented parameter-less constructor for TypeContainer
5735 * decl.cs: Attributes are now stored here. New property OptAttributes
5737 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5739 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5741 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5743 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5744 (CSharpSignature): New method for indexer and property signature.
5746 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5748 * pending.cs (IsVirtualFilter): Faster implementation.
5750 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5752 * typemanager.cs: Avoid inclusion of same assembly more than once.
5754 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5756 * cs-parser.jay: Fixed problem where the last assembly attribute
5757 has been applied also to following declaration (class, struct, etc.)
5759 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5761 * class.cs: Added error CS0538, CS0539 reporting.
5762 Fixed crash on Microsoft runtime when field type is void.
5764 * cs-parser.jay: Added error CS0537 reporting.
5766 * pending.cs: Added error CS0535 reporting.
5767 Improved error report for errors CS0536, CS0534.
5769 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5771 Merge a few bits from the Anonymous Method MCS tree.
5773 * statement.cs (ToplevelBlock): New class for toplevel methods,
5774 will hold anonymous methods, lifted variables.
5776 * cs-parser.jay: Create toplevel blocks for delegates and for
5777 regular blocks of code.
5779 2004-01-20 Martin Baulig <martin@ximian.com>
5781 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5782 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5783 and `NeedExplicitReturn'; added `IsLastStatement'.
5784 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5785 have a `ReturnLabel' or we're not unreachable.
5787 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5788 child's reachability; don't just override ours with it. Fixes
5789 #58058 (lluis's example).
5790 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5791 InFinally(), InLoop(), InSwitch() and
5792 BreakCrossesTryCatchBoundary() methods.
5794 * statement.cs (Return): Do all error checking in Resolve().
5795 Unless we are the last statement in a top-level block, always
5796 create a return label and jump to it.
5797 (Break, Continue): Do all error checking in Resolve(); also make
5798 sure we aren't leaving a `finally'.
5799 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
5800 statement in a top-level block.
5801 (Block.Flags): Added `IsDestructor'.
5802 (Block.IsDestructor): New public property.
5804 2004-01-20 Martin Baulig <martin@ximian.com>
5806 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
5808 2004-01-20 Martin Baulig <martin@ximian.com>
5810 * statement.cs (Statement.ResolveUnreachable): New public method.
5811 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
5812 (Block.Resolve): Resolve unreachable statements.
5814 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5816 * expression.cs: We need to fix the case where we do
5817 not have a temp variable here.
5819 * assign.cs: Only expression compound assignments need
5820 temporary variables.
5822 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5824 * flowanalysis.cs: Reduce memory allocation in a few ways:
5825 - A block with no variables should not allocate a bit
5827 - A method with no out parameters does not need any tracking
5828 for assignment of the parameters, so we need not allocate
5831 public readonly Type[] VariableTypes;
5832 public readonly string[] VariableNames;
5833 Are redundant. The data is already stored in the variable
5834 map, so we need not allocate another array for it.
5835 - We need to add alot of checks for if (params | locals) == null
5836 due to the first two changes.
5838 2004-01-18 Miguel de Icaza <miguel@ximian.com>
5840 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
5841 implement IMemoryLocation, we store a copy on a local variable and
5842 take the address of it. Patch from Benjamin Jemlich
5844 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
5845 to use a special "type_name_expression" rule which reduces the
5846 number of "QualifiedIdentifier" classes created, and instead
5847 directly creates MemberAccess expressions.
5849 2004-01-17 Miguel de Icaza <miguel@ximian.com>
5851 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
5852 that fixes #52853. Null literal assignment to ValueType
5854 * class.cs (MethodData.Emit): Instead of checking the name of the
5855 method to determine if its a destructor, create a new derived
5856 class from Method called Destructor, and test for that.
5858 * cs-parser.jay: Create a Destructor object instead of a Method.
5860 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
5864 2004-01-16 Miguel de Icaza <miguel@ximian.com>
5866 * expression.cs (Binary.ResolveOperator): Perform an implicit
5867 conversion from MethodGroups to their delegate types on the
5870 * delegate.cs: Introduce a new class DelegateCreation that is the
5871 base class for `NewDelegate' and `ImplicitDelegateCreation',
5872 factor some code in here.
5874 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
5875 conversion from MethodGroups to compatible delegate types.
5877 * ecore.cs (Expression.Resolve): Do not flag error 654
5878 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
5879 we allow conversions from MethodGroups to delegate types now.
5881 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
5882 assignments in v2 either.
5884 2004-01-10 Miguel de Icaza <miguel@ximian.com>
5886 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
5887 static read-only fields in ctors.
5889 Applied patch from Benjamin Jemlich
5891 * expression.cs (UnaryMutator): Avoid leaking local variables.
5893 2004-01-09 Miguel de Icaza <miguel@ximian.com>
5895 * cs-tokenizer.cs (IsCastToken): Allow the various native types
5896 here to return true, as they can be used like this:
5900 Fixed 49836 and all the other dups
5902 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
5904 * driver.cs: Implement /win32res and /win32icon.
5906 2004-01-08 Miguel de Icaza <miguel@ximian.com>
5908 * cs-parser.jay: Add a rule to improve error handling for the
5909 common mistake of placing modifiers after the type.
5911 2004-01-07 Miguel de Icaza <miguel@ximian.com>
5913 * cs-parser.jay (interface_event_declaration): Catch
5914 initialization of events on interfaces, and report cs0068
5916 * cs-parser.jay (interface_event_declaration): Catch
5917 initialization of events.
5919 * ecore.cs: Better report missing constructors.
5921 * expression.cs (Binary.ResolveOperator): My previous bug fix had
5922 the error reporting done in the wrong place. Fix.
5924 * expression.cs (Binary.ResolveOperator): Catch the
5925 operator + (E x, E y) error earlier, and later allow for implicit
5926 conversions in operator +/- (E e, U x) from U to the underlying
5929 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
5930 52596, if the container class is abstract, the default constructor
5931 is protected otherwise its public (before, we were always public).
5933 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
5936 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
5937 Jemlich that fixes bug #52597, MCS was generating invalid code for
5938 idisposable structs. Thanks to Ben for following up with this
5941 2004-01-06 Miguel de Icaza <miguel@ximian.com>
5943 * driver.cs: Allow assemblies without code to be generated, fixes
5946 2004-01-07 Nick Drochak <ndrochak@gol.com>
5948 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
5950 2004-01-05 Miguel de Icaza <miguel@ximian.com>
5952 * cs-parser.jay: Add rules to improve error reporting if fields or
5953 methods are declared at the namespace level (error 116)
5955 * Add rules to catch event add/remove
5957 2004-01-04 David Sheldon <dave-mono@earth.li>
5959 * expression.cs: Added matching ")" to error message for
5962 2004-01-03 Todd Berman <tberman@gentoo.org>
5964 * ecore.cs, attribute.cs:
5965 Applying fix from #52429.
5967 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5969 * ecore.cs, expression.cs, statement.cs:
5970 Total rewrite of how we handle branching. We
5971 now handle complex boolean expressions with fewer
5972 jumps. As well if (x == 0) no longer emits a ceq.
5974 if (x is Foo) is much faster now, because we generate
5977 Overall, we get a pretty big improvement on our benchmark
5978 tests. The code we generate is smaller and more readable.
5980 I did a full two-stage bootstrap. The patch was reviewed
5981 by Martin and Miguel.
5983 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5985 * cs-parser.jay: Make primary_expression not take a QI.
5986 we dont need this because the member_access rule covers
5987 us here. So we replace the rule with just IDENTIFIER.
5989 This has two good effects. First, we remove a s/r conflict.
5990 Second, we allocate many fewer QualifiedIdentifier objects.
5992 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5994 * attribute.cs: Handle MarshalAs attributes as pseudo, and
5995 set the correct information via SRE. This prevents
5996 hanging on the MS runtime. Fixes #29374.
5998 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
6000 * convert.cs: correctly handle conversions to value types
6001 from Enum and ValueType as unboxing conversions.
6003 Fixes bug #52569. Patch by Benjamin Jemlich.
6005 2004-01-02 Ravi Pratap <ravi@ximian.com>
6007 * expression.cs (BetterConversion): Prefer int -> uint
6008 over int -> ulong (csc's behaviour). This fixed bug #52046.
6010 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
6012 * decl.cs (MemberCache.FindMembers): now returns a
6015 * typemanager.cs: In general, go with with ^^.
6016 (CopyNewMethods): take an IList.
6017 (RealMemberLookup): Only allocate an arraylist
6018 if we copy from two sets of methods.
6020 This change basically does two things:
6021 1) Fewer array lists allocated due to CopyNewMethods.
6022 2) the explicit cast in MemberList costed ALOT.
6024 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
6026 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
6027 a hashtable to avoid needless string allocations when an identifier is
6028 used more than once (the common case).
6030 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6032 * pending.cs: MS's TypeBuilder.GetInterfaces ()
6033 is broken, it will not return anything. So, we
6034 have to use the information we have in mcs to
6037 * typemanager.cs: Add a cache for GetInterfaces,
6038 since this will now be used more often (due to ^^)
6040 (GetExplicitInterfaces) New method that gets the
6041 declared, not effective, interfaces on a type
6042 builder (eg, if you have interface IFoo, interface
6043 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
6046 This patch makes MCS able to bootstrap itself on
6049 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
6051 * expression.cs: Remove the Nop's that Miguel put
6054 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6056 * report.cs, codegen.cs: Give the real stack trace to
6057 the error when an exception is thrown.
6059 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6061 * decl.cs: only allocate hashtables for ifaces if
6064 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
6066 * expression.cs: fix the error from cs0121-2.cs
6067 (a parent interface has two child interfaces that
6068 have a function with the same name and 0 params
6069 and the function is called through the parent).
6071 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
6073 * class.cs, rootcontext.cs, typmanager.cs: do not
6076 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
6078 * codegen.cs: remove stack for the ec flow branching.
6079 It is already a linked list, so no need.
6081 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
6083 * Makefile: Allow custom profiler here.
6085 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6087 * typemanager.cs (LookupType):
6088 - Use a static char [], because split takes
6089 a param array for args, so it was allocating
6091 - Do not store true in a hashtable, it boxes.
6093 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
6095 * flowanalysis.cs: bytify common enums.
6097 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6099 * modifiers.cs: Add a new set of flags for the
6100 flags allowed on explicit interface impls.
6101 * cs-parser.jay: catch the use of modifiers in
6102 interfaces correctly.
6103 * class.cs: catch private void IFoo.Blah ().
6105 All related to bug #50572.
6107 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6109 * decl.cs: Rewrite the consistant accessability checking.
6110 Accessability is not linear, it must be implemented in
6111 a tableish way. Fixes #49704.
6113 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
6115 * expression.cs: Handle negation in a checked context.
6116 We must use subtraction from zero. Fixes #38674.
6118 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6120 * class.cs: Ignore static void main in DLLs.
6121 * rootcontext.cs: Handle the target type here,
6122 since we are have to access it from class.cs
6123 * driver.cs: account for the above.
6125 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
6127 * report.cs: Give line numbers and files if available.
6129 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
6131 * driver.cs: Implement /addmodule.
6133 * typemanager.cs: Change 'modules' field so it now contains Modules not
6136 2003-12-20 Martin Baulig <martin@ximian.com>
6138 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
6139 (FieldBase.IsAssigned): Removed this field.
6140 (FieldBase.SetAssigned): New public method.
6141 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
6143 2003-12-20 Martin Baulig <martin@ximian.com>
6145 * expression.cs (LocalVariableReference.DoResolve): Don't set
6146 `vi.Used' if we're called from DoResolveLValue().
6148 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
6149 returns the usage vector it just merged into the current one -
6150 pass this one to UsageWarning().
6151 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
6152 of the `EmitContext', don't call this recursively on our children.
6154 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
6156 * driver.cs: Implement /target:module.
6158 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
6160 * support.cs (CharArrayHashtable): New helper class.
6162 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
6163 char arrays, not strings, so we can avoid creating a string in
6164 consume_identifier if the identifier is a keyword.
6166 2003-12-16 Martin Baulig <martin@ximian.com>
6168 * statement.cs (LocalInfo.Assigned): Removed this property.
6169 (LocalInfo.Flags): Removed `Assigned'.
6170 (LocalInfo.IsAssigned): New public method; takes the EmitContext
6171 and uses flow analysis.
6172 (Block.UsageWarning): Made this method private.
6173 (Block.Resolve): Call UsageWarning() if appropriate.
6175 * expression.cs (LocalVariableReference.DoResolve): Always set
6176 LocalInfo.Used here.
6178 2003-12-13 Martin Baulig <martin@ximian.com>
6180 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
6181 any value here; we're now using flow analysis to figure out
6182 whether a statement/block returns a value.
6184 2003-12-13 Martin Baulig <martin@ximian.com>
6186 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
6188 (FlowBranching.MergeFinally): Don't call
6189 `branching.CheckOutParameters()' here, this is called in
6191 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
6192 when adding the `finally' vector.
6194 2003-12-13 Martin Baulig <martin@ximian.com>
6197 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
6198 actually work and also fix #48962.
6200 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
6202 * decl.cs: Do not check System.Object for nested types,
6203 since we know it does not have any. Big bang for buck:
6208 corlib: 17.99 seconds
6212 corlib: 17.39 seconds
6214 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
6216 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
6217 time we are returning 0 members, so we save alot here.
6219 2003-12-11 Martin Baulig <martin@ximian.com>
6221 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
6222 `MergeChild()', also just take the `FlowBranching' as argument;
6223 call Merge() on it and return the result.
6224 (FlowBranching.Merge): We don't need to do anything if we just
6227 2003-12-11 Martin Baulig <martin@ximian.com>
6229 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
6230 them in an `ArrayList' to reduce memory usage. Thanks to Ben
6231 Maurer for this idea.
6233 2003-12-11 Martin Baulig <martin@ximian.com>
6235 * flowanalysis.cs (MergeResult): This class is now gone; we now
6236 use the `UsageVector' for this. The reason for this is that if a
6237 branching just has one sibling, we don't need to "merge" them at
6238 all - that's the next step to do.
6239 (FlowBranching.Merge): We now return a `UsageVector' instead of a
6242 2003-12-11 Martin Baulig <martin@ximian.com>
6244 Reworked flow analyis and made it more precise and bug-free. The
6245 most important change is that we're now using a special `Reachability'
6246 class instead of having "magic" meanings of `FlowReturns'. I'll
6247 do some more cleanups and optimizations and also add some more
6248 documentation this week.
6250 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
6251 largely reworked this class.
6252 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
6253 the new `Reachability' class instead of having "magic" values here.
6254 (FlowBranching): We're now using an instance of `Reachability'
6255 instead of having separate `Returns', `Breaks' etc. fields.
6257 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
6258 based on flow analysis; ignore the return value of block.Emit ().
6260 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
6262 * driver.cs typemanager.cs: Find the mono extensions to corlib even
6263 if they are private.
6265 2003-12-09 Martin Baulig <martin@ximian.com>
6267 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
6268 call them directly on the UsageVector.
6270 2003-12-09 Martin Baulig <martin@ximian.com>
6272 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
6273 Changed return type from `FlowReturns' to `Reachability'.
6275 2003-12-09 Martin Baulig <martin@ximian.com>
6277 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
6278 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
6279 `Reachable' fields with a single `Reachability' one.
6281 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6283 * class.cs (FindMembers): Remove foreach's.
6296 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6301 This patch does a few things:
6302 1. EmptyStatement is now a singleton, so it is never reallocated.
6303 2. All blah is EmptyStatement constructs have been changed to
6304 blah == EmptyStatement.Value, which is much faster and valid
6305 now that EmptyStatement is a singleton.
6306 3. When resolving a block, rather than allocating a new array for
6307 the non-empty statements, empty statements are replaced with
6308 EmptyStatement.Value
6309 4. Some recursive functions have been made non-recursive.
6310 Mainly the performance impact is from (3), however (1) and (2) are needed for
6311 this to work. (4) does not make a big difference in normal situations, however
6312 it makes the profile look saner.
6317 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6318 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
6319 Total memory allocated: 56397 KB
6322 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
6323 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
6324 Total memory allocated: 55666 KB
6326 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6328 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
6329 than the hashtable in a hashtable version
6331 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
6332 we always end up concating a string. This results in a huge perf
6333 loss, because many strings have to be tracked by the GC. In this
6334 patch, we first use a hashtable that works with two keys, so that
6335 the strings do not need to be concat'ed.
6346 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
6348 * Makefile: Add a new target `do-time' that does a quick and simple
6349 profile, leaving easy to parse output.
6351 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
6353 * codegen.cs (Init): Create the dynamic assembly with
6354 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
6356 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
6358 * support.cs: Make the PtrHashtable use only one
6359 instance of its comparer.
6361 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
6363 * typemanager.cs: Fix lookup of GetNamespaces.
6365 2003-11-29 Miguel de Icaza <miguel@ximian.com>
6367 * expression.cs: Removed redundant line.
6369 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
6370 ArrayLists, use for loops with bounds.
6372 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
6375 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
6376 arraylists, use for loop with bounds.
6378 The above three changes give us a 0.071 second performance
6379 improvement out of 3.294 seconds down to 3.223. On my machine
6380 the above changes reduced the memory usage by 1,387 KB during
6383 * cs-parser.jay (QualifiedIdentifier): New class used to represent
6384 QualifiedIdentifiers. Before we created a new string through
6385 concatenation, and mostly later on, the result would be
6386 manipulated by DecomposeQI through string manipulation.
6388 This reduced the compiler memory usage for bootstrapping from
6389 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
6390 compile times in 0.05 seconds.
6392 2003-11-28 Dick Porter <dick@ximian.com>
6394 * support.cs: Do string compares with the Invariant culture.
6402 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
6403 the comparison is done with the Invariant culture.
6405 2003-11-27 Miguel de Icaza <miguel@ximian.com>
6407 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
6408 GetEnumerator method.
6410 (ProbeCollectionType): Iterate starting at the most specific type
6411 upwards looking for a GetEnumerator
6413 * expression.cs: Shift count can be up to 31 for int/uint and 63
6416 2003-11-26 Miguel de Icaza <miguel@ximian.com>
6418 * statement.cs (Block.LookupLabel): Also look for the label on the
6419 children blocks. Use a hash table to keep track of visited
6422 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
6423 we actually did transform the other operand, otherwise fall back
6424 to the common codepath that casts to long.
6426 * cs-tokenizer.cs: Use the same code pattern as the int case.
6427 Maybe I should do the parsing myself, and avoid depending on the
6428 Parse routines to get this done.
6430 2003-11-25 Miguel de Icaza <miguel@ximian.com>
6432 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6433 which fixes bug 51347. This time test it.
6435 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
6436 attributes for example can not tell the difference between these.
6437 The difference was only a syntax feature of the language.
6439 * attribute.cs: Apply attributes to delegates.
6441 * delegate.cs: Call the apply attributes method.
6443 2003-11-24 Miguel de Icaza <miguel@ximian.com>
6445 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
6446 comparing 0 vs Byte.MinValue, not the value
6448 (ImplicitConversionRequired): When reporting a conversion error,
6449 use error 31 to print out the constant error instead of the
6452 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
6453 which fixes bug 51347.
6455 2003-11-22 Miguel de Icaza <miguel@ximian.com>
6457 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
6458 which fixes the -warnaserror command line option.
6460 2003-11-21 Miguel de Icaza <miguel@ximian.com>
6462 * cfold.cs (DoNumericPromotions): During constant folding of
6463 additions on UIntConstant, special case intconstants with
6464 IntConstants like we do on the expression binary operator.
6466 2003-11-12 Miguel de Icaza <miguel@ximian.com>
6468 * convert.cs (ImplicitReferenceConversion): We were missing a case
6469 (System.Enum are not value types or class types, so we need to
6470 classify them separatedly).
6472 * driver.cs: We do not support error 2007.
6474 2003-11-12 Jackson Harper <jackson@ximian.com>
6476 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6477 system directory. Also use the full file name so users can
6478 libraries names mscorlib-o-tron.dll in a non system dir.
6480 2003-11-10 Martin Baulig <martin@ximian.com>
6482 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6483 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6484 calling `ResolveType()' on them, directly assign their `Type'.
6486 2003-11-08 Martin Baulig <martin@ximian.com>
6488 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6489 return value and the `out parent' parameter.
6490 (TypeContainer.DefineType): Moved the CS0644 check into
6491 GetClassBases(). Don't pass the interface types to the
6492 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6493 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6495 * ecore.cs (TypeExpr.IsAttribute): New property.
6496 (TypeExpr.GetInterfaces): New method.
6498 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6499 TypeExpr instead of a Type.
6500 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6501 (Interface.DefineType): Don't pass the interface types to the
6502 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6503 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6505 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6506 instead of a `Type[]'.
6507 (TypeManager.RegisterBuilder): Likewise.
6508 (TypeManager.AddUserInterface): Likewise.
6509 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6510 `Type[]' and also return a `TypeExpr[]'.
6511 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6513 2003-11-08 Martin Baulig <martin@ximian.com>
6515 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6518 2003-11-08 Martin Baulig <martin@ximian.com>
6520 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6521 TypeManager.ResolveExpressionTypes().
6523 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6524 instead of an Expression.
6525 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6526 (TypeExpression): New public class; formerly known as `TypeExpr'.
6528 * expression.cs (ComposedCast): Derive from TypeExpr.
6530 * typemanager.cs (TypeManager.system_*_expr): These are now
6531 TypExpr's instead of Expression's.
6532 (TypeManager.ResolveExpressionTypes): New public static function;
6533 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6536 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6538 * expression.cs (New.DoResolve): Do not dereference value that
6539 might be a null return.
6541 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6542 sure that the constant value has the right type. Fixes an
6543 unreported bug, similar to 50425.
6545 * const.cs (Const.LookupConstantValue): Call
6546 ImplicitStandardConversionExists before doing a conversion to
6547 avoid havng the TypeManager.ChangeType do conversions.
6549 Reduced the number of casts used
6551 (Const.ChangeType): New routine to enable reuse of the constant
6552 type changing code from statement.
6554 * typemanager.cs (ChangeType): Move common initialization to
6555 static global variables.
6559 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6560 every value type to go through, even if it was void. Fix that.
6562 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6563 character of the define, and the is_identifier_part_character for
6564 the rest of the string.
6566 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6568 * expression.cs (UnaryMutator.EmitCode): When I updated
6569 LocalVariableReference.DoResolve, I overdid it, and dropped an
6570 optimization done on local variable references.
6572 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6574 * ecore.cs: Convert the return from Ldlen into an int.
6576 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6578 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6579 the accessibility, this is a special case for toplevel non-public
6580 classes (internal for instance).
6582 2003-10-20 Nick Drochak <ndrochak@gol.com>
6584 * ecore.cs: Fix typo and build. Needed another right paren.
6586 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6588 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6589 `internal' case regular and protected, but not allowing protected
6590 to be evaluated later. Bug 49840
6592 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6594 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6595 to kb.Nlast, and not the kb.nFirst to isolate the switch
6598 Extract the underlying type, so enumerations of long/ulong are
6599 treated like long/ulong.
6601 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6603 * expression.cs (New): Overload the meaning of RequestedType to
6604 track the possible creation of the NewDelegate type, since
6605 DoResolve is invoked more than once for new constructors on field
6608 See bugs: #48800 and #37014
6610 * cs-parser.jay (declare_local_constants): Take an arraylist
6611 instead of a single constant.
6613 (local_constant_declaration): It should take a
6614 constant_declarators, not a constant_declarator. Fixes 49487
6616 * convert.cs: Fix error report.
6618 2003-10-13 Jackson Harper <jackson@ximian.com>
6620 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6623 2003-10-09 Martin Baulig <martin@ximian.com>
6625 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
6627 (MethodCore.DoDefineParameters): Removed the TypeContainer
6628 argument; use the DeclSpace which was passed to the .ctor instead.
6629 (MethodCore.CheckParameter): Take a DeclSpace instead of a
6630 TypeContainer; we only need a DeclSpace here.
6632 2003-10-09 Martin Baulig <martin@ximian.com>
6634 * class.cs (MethodData): Added additional `DeclSpace ds' argument
6636 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
6637 EmitContext's .ctor.
6639 2003-10-09 Martin Baulig <martin@ximian.com>
6641 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
6642 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
6643 AsAccessible(), moved them as well.
6645 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
6647 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6649 * cs-parser.jay : Renamed yyName to yyNames related to jay.
6651 2003-10-07 Miguel de Icaza <miguel@ximian.com>
6653 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
6654 generation for >=, as spotted by Paolo, bug 48679.
6655 Patch from David Waite.
6657 * cs-tokenizer.cs: Add handling for #pragma.
6659 * cs-parser.jay: Allow for both yield and yield return in the
6660 syntax. The anti-cobolization of C# fight will go on!
6662 * class.cs (TypeBuilder.DefineType): Catch error condition here
6663 (Parent.DefineType erroring out and returning null).
6665 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
6666 coping with enumerations variables, we were mistakenly processing
6667 them as a regular value type instead of built-in types. Fixes the
6670 * typemanager.cs (IsBuiltinOrEnum): New method.
6672 2003-09-30 Miguel de Icaza <miguel@ximian.com>
6674 * cs-parser.jay: Upgrade: yield now needs the return clause.
6676 2003-09-19 Martin Baulig <martin@ximian.com>
6678 * decl.cs (MemberCache.SetupCacheForInterface): Take a
6679 `MemberCache parent' argument. Normally, an interface doesn't
6680 have a parent type except System.Object, but we use this in gmcs
6681 for generic type parameters.
6683 2003-09-18 Martin Baulig <martin@ximian.com>
6685 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
6686 on `type.IsInterface'; don't check whether the type has a parent
6687 to determine whether it's an interface.
6689 2003-09-15 Martin Baulig <martin@ximian.com>
6691 * class.cs (TypeContainer.DefineType): Added an error flag to
6692 avoid reporting duplicate CS0146's ("class definition is
6695 * driver.cs (Driver.MainDriver): Abort if
6696 RootContext.ResolveTree() reported any errors.
6698 2003-09-07 Martin Baulig <martin@ximian.com>
6700 * report.cs (Error, Warning): Added overloaded versions which take
6701 a `params object[] args' and call String.Format().
6703 2003-09-07 Martin Baulig <martin@ximian.com>
6705 * decl.cs (DeclSpace..ctor): Don't call
6706 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
6707 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
6708 (DeclSpace.RecordDecl): New method.
6710 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
6712 2003-09-02 Ravi Pratap <ravi@ximian.com>
6714 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
6715 value attributes to be applied to ParameterBuilders.
6717 * class.cs (MethodCore.LabelParameters): Make static and more
6718 generic so that it can be used from other places - like interface
6719 methods, for instance.
6721 * interface.cs (Interface.Emit): Call LabelParameters before
6722 emitting attributes on the InterfaceMethod.
6724 2003-08-26 Martin Baulig <martin@ximian.com>
6726 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
6727 resolving aliases; fixes #47927.
6729 2003-08-26 Martin Baulig <martin@ximian.com>
6731 * statement.cs (Using.DoResolve): This is internally emitting a
6732 try/finally clause, so we need to set ec.NeedExplicitReturn if we
6733 do not always return. Fixes #47681.
6735 2003-08-26 Martin Baulig <martin@ximian.com>
6737 * decl.cs (MemberCore): Moved WarningNotHiding(),
6738 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
6740 (AdditionResult): Make this nested in DeclSpace.
6741 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
6742 argument; call NamespaceEntry.Define() unless we're nested in a
6745 * namespace.cs (Namespace.DefineName): New public function. This
6746 is called from DeclSpace's .ctor to add
6747 (Namespace.Lookup): Include DeclSpaces in the lookup.
6749 * class.cs (Operator): Derive from MemberBase, not MemberCore.
6751 * const.cs (Const): Derive from MemberBase, not MemberCore.
6753 2003-08-25 Martin Baulig <martin@ximian.com>
6755 * convert.cs (Convert.ExplicitReferenceConversion): When
6756 converting from an interface type to a class, unbox if the target
6757 type is a struct type. Fixes #47822.
6759 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6761 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
6764 2003-08-22 Martin Baulig <martin@ximian.com>
6766 * class.cs (TypeManager.DefineType): When defining a nested type,
6767 call DefineType() on our parent; fixes #47801.
6769 2003-08-22 Martin Baulig <martin@ximian.com>
6771 * class.cs (MethodData.Define): While checking if a method is an
6772 interface implementation, improve the test a bit more to fix #47654.
6774 2003-08-22 Martin Baulig <martin@ximian.com>
6776 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
6777 correctly; fixes #47722.
6779 2003-08-22 Martin Baulig <martin@ximian.com>
6781 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
6782 LocalVariableReference, ensure it's not read-only. Fixes #47536.
6784 * statement.cs (Fixed.DoResolve): Make all variables read-only.
6786 2003-08-22 Martin Baulig <martin@ximian.com>
6788 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
6789 can only be assigned in static constructors. Fixes #47161.
6791 2003-08-22 Martin Baulig <martin@ximian.com>
6793 Rewrote and improved the flow analysis code.
6795 * flowbranching.cs (FlowBranching): Make this class abstract.
6796 (FlowBranching.CreateBranching): New static function to create a
6798 (FlowBranchingBlock, FlowBranchingException): New classes.
6799 (FlowBranching.UsageVector.Type): New public readonly field.
6800 (FlowBranching.UsageVector.Breaks): Removed the setter.
6801 (FlowBranching.UsageVector.Returns): Removed the setter.
6802 (FlowBranching.UsageVector): Added Break(), Return(),
6803 NeverReachable() and Throw() methods to modify the reachability.
6804 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
6805 done by FlowBranching.Merge().
6806 (FlowBranching.UsageVector.MergeChild): New method; merges the
6807 merge result into the current vector.
6808 (FlowBranching.Merge): New abstract method to merge a branching.
6810 2003-08-12 Martin Baulig <martin@ximian.com>
6812 * expression.cs (Indirection.CacheTemporaries): Create the
6813 LocalTemporary with the pointer type, not its element type.
6815 2003-08-10 Miguel de Icaza <miguel@ximian.com>
6817 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
6818 token was a keyword or not.
6820 Add `error' options where an IDENTIFIER was expected; Provide
6821 CheckToken and CheckIdentifierToken convenience error reporting
6824 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
6826 * decl.cs: Rename `NamespaceEntry Namespace' public field into
6827 NameSpaceEntry NameSpaceEntry.
6829 (LookupInterfaceOrClass): Avoid creating a full qualified name
6830 from namespace and name: avoid doing lookups when we know the
6831 namespace is non-existant. Use new Tree.LookupByNamespace which
6832 looks up DeclSpaces based on their namespace, name pair.
6834 * driver.cs: Provide a new `parser verbose' to display the
6835 exception thrown during parsing. This is turned off by default
6836 now, so the output of a failure from mcs is more graceful.
6838 * namespace.cs: Track all the namespaces defined in a hashtable
6841 (IsNamespace): New method
6843 2003-08-09 Miguel de Icaza <miguel@ximian.com>
6845 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
6846 we know that we need to concatenate (full typename can never be
6851 * statement.cs: Use a bitfield; Do not initialize to null things
6852 which are done by the constructor by default.
6854 * cs-parser.jay: bug fix, parameter was 4, not 3.
6856 * expression.cs: Just use the property;
6858 * statement.cs: No need for GetVariableInfo method.
6860 2003-08-08 Martin Baulig <martin@ximian.com>
6862 * flowanalysis.cs (FlowReturns): This is now nested in the
6863 `FlowBranching' class.
6864 (MyBitVector): Moved this here from statement.cs.
6865 (FlowBranching.SiblingType): New enum type.
6866 (FlowBranching.CreateSibling): Added `SiblingType' argument.
6868 2003-08-07 Martin Baulig <martin@ximian.com>
6870 * flowanalysis.cs (FlowBranchingType): This is now nested in the
6871 `FlowBranching' class and called `BranchingType'.
6873 2003-08-07 Martin Baulig <martin@ximian.com>
6875 * flowanalysis.cs: Moved all the control flow analysis code into
6878 2003-08-07 Martin Baulig <martin@ximian.com>
6880 * assign.cs (Assign.DoResolve): `target' must either be an
6881 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
6884 2003-08-07 Miguel de Icaza <miguel@ximian.com>
6886 * expression.cs (BinaryMethod): This kind of expression is created by the
6887 Binary class if it determines that the operator has to be handled
6890 (BinaryDelegate): This kind of expression is created if we are
6891 dealing with a + or - operator on delegates.
6893 (Binary): remove method, argumetns, and DelegateOperator: when
6894 dealing with methods,
6896 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
6898 * statement.cs (Block): use bitfields for the three extra booleans
6899 we had in use. Remove unused topblock parameter.
6901 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
6903 * assign.cs: Drop extra unneeded tests.
6905 2003-08-06 Miguel de Icaza <miguel@ximian.com>
6907 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
6909 * statement.cs (Foreach): Use VariableStorage instead of
6912 * codegen.cs (VariableStorage): New class used by clients that
6913 require a variable stored: locals or fields for variables that
6914 need to live across yield.
6916 Maybe provide a convenience api for EmitThis+EmitLoad?
6918 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
6921 2003-08-05 Miguel de Icaza <miguel@ximian.com>
6923 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
6924 RemapParameterLValue): New methods that are used to turn a
6925 precomputed FieldInfo into an expression like this:
6929 The idea is to use this instead of making LocalVariableReference
6930 have more than one meaning.
6932 * cs-parser.jay: Add error production to BASE.
6934 * ecore.cs: Deal with TypeManager.GetField returning null, which
6935 is now a valid return value.
6937 (FieldExprNoAddress): New expression for Fields whose address can
6940 * expression.cs (LocalVariableReference): During the resolve
6941 phases, create new expressions if we are in a remapping context.
6942 Remove code that dealt with remapping here.
6944 (ParameterReference): same.
6946 (ProxyInstance): New expression, like the `This' expression, but
6947 it is born fully resolved. We know what we are doing, so remove
6948 the errors that are targeted to user-provided uses of `this'.
6950 * statement.cs (Foreach): our variable is now stored as an
6951 Expression; During resolution, follow the protocol, dont just
6952 assume it will return this.
6954 2003-08-06 Martin Baulig <martin@ximian.com>
6956 * support.cs (SeekableStreamReader.cs): New public class.
6958 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
6959 SeekableStreamReader instead of the normal StreamReader.
6961 2003-08-04 Martin Baulig <martin@ximian.com>
6963 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
6964 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
6965 deambiguate casts and delegate invocations.
6966 (parenthesized_expression): Use the new tokens to ensure this is
6967 not a cast of method invocation.
6969 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
6970 when reading a `)' and Deambiguate_CloseParens () was previously
6973 * expression.cs (ParenthesizedExpression): New class. This is
6974 just used for the CS0075 test.
6975 (Binary.DoResolve): Check for CS0075.
6977 2003-07-29 Ravi Pratap <ravi@ximian.com>
6979 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
6980 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
6981 reference comparison.
6983 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
6984 examine the ReturnType for equality - this is necessary in the
6985 cases of implicit and explicit operators whose signature also
6986 includes the return type.
6988 2003-07-26 Miguel de Icaza <miguel@ximian.com>
6990 * namespace.cs: Cache the result of the namespace computation,
6991 instead of computing it every time.
6993 2003-07-24 Miguel de Icaza <miguel@ximian.com>
6995 * decl.cs: Use a global arraylist that we reuse over invocations
6996 to avoid excesive memory consumption. Reduces memory usage on an
6997 mcs compile by one meg (45 average).
6999 * typemanager.cs (LookupTypeReflection): In .NET pointers are
7000 private, work around that.
7002 2003-07-23 Miguel de Icaza <miguel@ximian.com>
7004 * literal.cs (IntLiteral): Define Zero and One static literals.
7006 * cs-parser.jay (integer_literal): use static literals to reduce
7007 memory usage for the most used literals (0, 1 and -1). 211kb
7008 reduced in memory usage.
7010 Replace all calls to `new ArrayList' with `new
7011 ArrayList(4)' which is a good average number for most allocations,
7012 and also requires only 16 bytes of memory for its buffer by
7015 This reduced MCS memory usage in seven megabytes for the RSS after
7018 2003-07-28 Ravi Pratap <ravi@ximian.com>
7020 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
7021 handle params methods the correct way by forming only one
7022 applicable set with params and normal methods in them. Earlier we
7023 were looking at params methods only if we found no normal methods
7024 which was not the correct thing to do.
7026 (Invocation.BetterFunction): Take separate arguments indicating
7027 when candidate and the best method are params methods in their
7030 This fixes bugs #43367 and #46199.
7032 * attribute.cs: Documentation updates.
7034 (CheckAttribute): Rename to CheckAttributeTarget.
7035 (GetValidPlaces): Rename to GetValidTargets.
7037 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
7038 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
7042 2003-07-28 Martin Baulig <martin@ximian.com>
7044 * class.cs (TypeContainer.DefineMembers): Use the base type's full
7045 name when looking up the base class of a nested class. Fixes #46977.
7047 2003-07-26 Martin Baulig <martin@ximian.com>
7049 * expression.cs (Indexers.Indexer): New nested struct; contains
7050 getter, setter and the indexer's type.
7051 (Indexers.Properties): This is now an ArrayList of
7053 (IndexerAccess.DoResolveLValue): Correctly set the type if the
7054 indexer doesn't have any getters.
7056 * assign.cs (Assign.DoResolve): Also do the implicit conversions
7057 for embedded property and indexer assignments.
7059 2003-07-26 Martin Baulig <martin@ximian.com>
7061 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
7062 preprocessor directive is not the first non-whitespace character
7065 2003-07-26 Martin Baulig <martin@ximian.com>
7067 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
7068 namespace parsing, follow the spec more closely.
7070 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
7071 NamespaceEntry.Lookup().
7073 2003-07-25 Martin Baulig <martin@ximian.com>
7075 * MethodCore.cs (OverridesSomething): New public field; it's set
7076 from TypeContainer.DefineMembers if this method overrides
7077 something (which doesn't need to be a method). Fix #39462.
7079 2003-07-25 Ravi Pratap <ravi@ximian.com>
7081 * typemanager.cs (GetMembers): Ensure that the list of members is
7082 reversed. This keeps things in sync.
7084 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
7085 find an AttributeUsage attribute.
7087 * expression.cs (Invocation.OverloadResolve): Perform the check
7088 which disallows Invoke to be directly called on a Delegate.
7090 (Error_InvokeOnDelegate): Report error cs1533.
7092 2003-07-25 Martin Baulig <martin@ximian.com>
7094 * expression.cs (Indexers.GetIndexersForType): Only look in the
7095 interface hierarchy if the requested type is already an
7096 interface. Fixes #46788 while keeping #46502 fixed.
7098 2003-07-25 Martin Baulig <martin@ximian.com>
7100 * class.cs (TypeContainer.DefineMembers): Check whether all
7101 readonly fields have been assigned and report warning CS0649 if
7104 * statement.cs (LocalInfo.IsFixed): Always return true if this is
7107 2003-07-24 Ravi Pratap <ravi@ximian.com>
7109 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
7110 returned from GetMethods to make things consistent with the
7111 assumptions MCS makes about ordering of methods.
7113 This should comprehensively fix bug #45127 and it does :-)
7115 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
7116 ordering is actually reverse.
7118 * Clean up some debug messages I left lying around.
7120 * interface.cs (Populate*): Get rid of code which emits attributes
7121 since the stage in which we emit attributes is the 'Emit' stage,
7122 not the define stage.
7124 (Emit): Move attribute emission for interface members here.
7126 2003-07-22 Ravi Pratap <ravi@ximian.com>
7128 * expression.cs (Invocation.OverloadResolve): Follow the spec more
7129 closely: we eliminate methods in base types when we have an
7130 applicable method in a top-level type.
7132 Please see section 14.5.5.1 for an exact description of what goes
7135 This fixes bug #45127 and a host of other related to corlib compilation.
7137 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
7138 array is the method corresponding to the top-level type (this is
7139 because of the changes made to icall.c) so we change this
7142 (MethodGroupExpr.Name): This too.
7144 * typemanager.cs (GetElementType): New method which does the right
7145 thing when compiling corlib.
7147 * everywhere: Make use of the above in the relevant places.
7149 2003-07-22 Martin Baulig <martin@ximian.com>
7151 * cs-parser.jay (invocation_expression): Moved
7152 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
7153 `cast_expression', but create a InvocationOrCast which later
7154 resolves to either an Invocation or a Cast.
7156 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
7157 method; call this before EmitStatement() to make sure that this
7158 expression can be used as a statement.
7160 * expression.cs (InvocationOrCast): New class; resolves to either
7161 an Invocation or a Cast.
7163 * statement.cs (StatementExpression): Call ResolveStatement() on
7164 the ExpressionStatement before emitting it.
7166 2003-07-21 Martin Baulig <martin@ximian.com>
7168 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
7169 `ref' and `out' attributes match; fixes #46220.
7170 (MemberAccess.ResolveMemberAccess): You can't reference a type
7171 through an expression; fixes #33180.
7172 (Indexers.GetIndexersForType): Don't return the indexers from
7173 interfaces the class implements; fixes #46502.
7175 2003-07-21 Martin Baulig <martin@ximian.com>
7177 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
7178 CS0661 checks; fixes bug #30442.
7180 2003-07-21 Martin Baulig <martin@ximian.com>
7182 * decl.cs (AdditionResult): Added `Error'.
7184 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
7186 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
7187 makes cs0031.cs actually work.
7189 2003-07-20 Martin Baulig <martin@ximian.com>
7191 * namespace.cs: Fixed that bug which caused a crash when compiling
7194 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7196 * typemanager.cs (LookupTypeReflection): Never expose types which
7197 are NotPublic, NestedPrivate, NestedAssembly, or
7198 NestedFamANDAssem. We used to return these, and later do a check
7199 that would report a meaningful error, but the problem is that we
7200 would not get the real match, if there was a name override.
7202 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7204 * namespace.cs (Namespace, Name): Do not compute the namespace
7205 name dynamically, compute it in the constructor. This reduced
7206 memory usage by 1697 KB.
7208 * driver.cs: Use --pause to pause at the end.
7210 2003-07-17 Peter Williams <peter@newton.cx>
7212 * Makefile: Change the name of the test target so that it doesn't
7213 conflict with the recursive test target.
7215 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7217 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7218 AddressOf): Do not use EmitThis, that was wrong, use the actual
7221 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7223 * class.cs (MethodData.Define): While checking if a method is an
7224 interface implementation, improve the test: If we are not public
7225 (use new test here: use the computed MethodAttributes directly,
7226 instead of the parsed modifier flags) check if the `implementing'
7227 method comes from an interface or not.
7229 * pending.cs (VerifyPendingMethods): Slightly better error
7232 * makefile: add test target that does the mcs bootstrap.
7234 2003-07-16 Ravi Pratap <ravi@ximian.com>
7236 * interface.cs (Define): Do nothing here since there are no
7237 members to populate etc. Move the attribute emission out of here
7238 since this was just totally the wrong place to put it. Attribute
7239 application happens during the 'Emit' phase, not in the 'Define'
7242 (Emit): Add this method and move the attribute emission here
7244 * rootcontext.cs (EmitCode): Call the Emit method on interface
7247 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7249 * expression.cs (OverloadResolve): Report error only if Location
7250 is not 'Null' which means that there was a probe going on.
7252 2003-07-14 Martin Baulig <martin@ximian.com>
7254 * expression.cs (ConditionalLogicalOperator): New public class to
7255 implement user defined conditional logical operators.
7256 This is section 14.11.2 in the spec and bug #40505.
7258 2003-07-14 Martin Baulig <martin@ximian.com>
7260 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7262 2003-07-14 Martin Baulig <martin@ximian.com>
7264 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7266 * ecore.cs (IVariable.VerifyFixed): New interface method.
7268 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7269 operator, check whether the variable is actually fixed. Fixes bug
7270 #36055. Set a variable definitely assigned when taking its
7271 address as required by the spec.
7273 * statement.cs (LocalInfo.IsFixed): New field.
7274 (LocalInfo.MakePinned): Set `IsFixed' to true.
7276 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7278 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7279 for .ctors, ensure that we only ask for members declared in the
7280 attribute type (BindingFlags.DeclaredOnly).
7284 * expression.cs (Error_WrongNumArguments): Report error 1501
7285 correctly the way CSC does.
7287 2003-07-13 Martin Baulig <martin@ximian.com>
7289 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7290 lookup on the fully qualified name, to make things like "X.X" work
7291 where "X.X" is a fully qualified type name, but we also have a
7292 namespace "X" in the using list. Fixes #41975.
7294 2003-07-13 Martin Baulig <martin@ximian.com>
7296 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7297 function. If we're a CompoundAssign, we need to create an embedded
7298 CompoundAssign, not an embedded Assign.
7299 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7302 2003-07-13 Martin Baulig <martin@ximian.com>
7304 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7305 work to fix bug #46088.
7307 2003-07-13 Ravi Pratap <ravi@ximian.com>
7309 * class.cs (Operator.Emit): Do not emit attributes here - it is
7310 taken care of by the Method class that we delegate too. This takes
7313 2003-07-10 Martin Baulig <martin@ximian.com>
7315 * expression.cs (TypeOfVoid): New class.
7316 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7318 2003-07-10 Martin Baulig <martin@ximian.com>
7320 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7323 2003-07-10 Martin Baulig <martin@ximian.com>
7325 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7326 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7328 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7330 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7332 2003-07-10 Martin Baulig <martin@ximian.com>
7334 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7335 of decimal. Fixes #42850.
7337 NOTE: I also fixed the created byte blob, but this doesn't work on
7338 the MS runtime and csc never produces any byte blobs for decimal
7341 2003-07-10 Martin Baulig <martin@ximian.com>
7343 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7344 structs; fixes #32068.
7345 (Block.AddChildVariableNames): Fixed #44302.
7347 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7349 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7351 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7353 * attribute.cs: And this test is onger needed.
7355 2003-07-08 Martin Baulig <martin@ximian.com>
7357 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7358 inaccessible types. Fixes #36313.
7360 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7362 * namespace.cs (NamespaceEntry): Create implicit entries for all
7363 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7364 implicit entries for N1.N2 and N1.
7366 2003-07-08 Martin Baulig <martin@ximian.com>
7368 Rewrote the handling of namespaces to fix a lot of the issues
7369 wrt. `using' aliases etc.
7371 * namespace.cs (Namespace): Splitted this class into a
7372 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7374 * typemanager.cs (TypeManager.IsNamespace): Removed.
7375 (TypeManager.ComputeNamespaces): Only compute namespaces from
7376 loaded assemblies here, not the namespaces from the assembly we're
7377 currently compiling.
7379 2003-07-08 Martin Baulig <martin@ximian.com>
7381 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7383 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7385 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7388 I thought about the memory savings here, but LookupTypeReflection
7389 is used under already very constrained scenarios. Compiling
7390 corlib or mcs only exposes one hit, so it would not really reduce
7391 any memory consumption.
7393 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7395 * typemanager.cs: fixes bug #45889 by only adding public types from
7396 other assemblies to the list of known types.
7398 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7400 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7401 on the type we resolved.
7403 2003-07-05 Martin Baulig <martin@ximian.com>
7405 * pending.cs (PendingImplementation.ParentImplements): Don't
7406 create the proxy if the parent is abstract.
7408 * class.cs (TypeContainer.DefineIndexers): Process explicit
7409 interface implementations first. Fixes #37714.
7411 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7413 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7414 defined recursively; but since we modify the input parameters
7415 (left is set to `this' temporarily), we reset this value if the
7416 left_is_explicit is false, which gives the original semantics to
7419 * literal.cs (NullPointer): new class used to represent a null
7420 literal in a pointer context.
7422 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7423 type is a pointer, use a NullPointer object instead of a
7424 NullLiteral. Closes 43687
7426 (ExplicitConversion): Convert pointer values using
7427 the conv opcode to the proper type.
7429 * ecore.cs (New): change ValueTypeVariable property into a method,
7430 that returns whether the valuetype is suitable for being used.
7432 * expression.cs (Binary.DoNumericPromotions): Only return if we
7433 the int constant was a valid uint, and we can return both left and
7434 right as uints. If not, we continue processing, to trigger the
7435 type conversion. This fixes 39018.
7437 * statement.cs (Block.EmitMeta): During constant resolution, set
7438 the CurrentBlock property on the emitcontext, so that we resolve
7439 constants propertly.
7441 2003-07-02 Martin Baulig <martin@ximian.com>
7443 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7444 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7446 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7447 than emitting it here.
7449 * statement.cs: Fixed some more flow analysis bugs.
7451 2003-07-02 Martin Baulig <martin@ximian.com>
7453 * class.cs (MethodData.Define): When implementing interface
7454 methods, set Final unless we're Virtual.
7456 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7457 check work for interface methods.
7459 2003-07-01 Martin Baulig <martin@ximian.com>
7461 * ecore.cs (EmitContext.This): Replaced this property with a
7462 GetThis() method which takes a Location argument. This ensures
7463 that we get the correct error location for a CS0188.
7465 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7467 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7468 ImplicitStandardConversion.
7470 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7472 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7474 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7477 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7479 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7482 (MethodData.Define): Turn off initlocals for unsafe methods.
7484 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7486 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7487 complete; Fixes #37521.
7489 * delegate.cs: Use Modifiers.TypeAttr to compute the
7490 TypeAttributes, instead of rolling our own. This makes the flags
7491 correct for the delegates.
7493 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7495 * class.cs (Constructor.Define): Set the private flag for static
7496 constructors as well.
7498 * cs-parser.jay (statement_expression): Set the return value to
7499 null, to avoid a crash when we catch an error.
7501 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7503 * cs-parser.jay: Applied patch from Jackson that adds support for
7504 extern and unsafe modifiers to destructor declarations.
7506 * expression.cs: Report error 21 if the user is trying to index a
7509 * driver.cs: Add an error message, suggested by the bug report.
7511 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7512 if we do not have a ": this ()" constructor initializer. Fixes 45149
7514 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7516 * namespace.cs: Add some information to reduce FAQs.
7518 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7520 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7521 underlying enumeration types. Fixes #43915.
7523 * expression.cs: Treat ushort/short as legal values to be used in
7526 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7528 * delegate.cs: transfer custom attributes for paramenters from
7529 the delegate declaration to Invoke and BeginInvoke.
7531 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7533 * attribute.cs: handle custom marshalers and emit marshal info
7536 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7538 * makefile.gnu: Added anonymous.cs to the compiler sources.
7540 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7542 * iterators.cs: Change the name of the proxy class to include two
7545 * cs-parser.jay: Update grammar to include anonymous methods.
7547 * anonymous.cs: new file.
7549 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7551 * class.cs (Field.Define): Add missing test for pointers and
7554 2003-05-27 Ravi Pratap <ravi@ximian.com>
7556 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7557 we use the stobj opcode.
7559 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7560 since it wasn't the correct fix.
7562 It still is puzzling that we are required to use stobj for IntPtr
7563 which seems to be a ValueType.
7565 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7567 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7568 during regular simple name resolution. Now, the trick is that
7569 instead of returning for processing the simplename, we do a
7570 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7571 contextual lookup type). If a match is found, return that, if
7572 not, return for further composition.
7574 This fixes long-standing 30485.
7576 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7577 using the address to initialize an object, do an Stobj instead of
7578 using the regular Stelem.
7580 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7581 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
7582 Because if we are a BaseIndexerAccess that value will be true.
7585 * statement.cs (GotoCase.Resolve): Return after reporting an
7586 error, do not attempt to continue.
7588 * expression.cs (PointerArithmetic.Emit): If our operand is a
7589 long, convert our constants to match the operand before
7590 multiplying. Convert to I type before adding. Fixes 43670.
7592 2003-05-14 Ravi Pratap <ravi@ximian.com>
7594 * enum.cs (ImplicitConversionExists) : Rename to
7595 ImplicitEnumConversionExists to remove ambiguity.
7597 * ecore.cs (NullCast): New type of cast expression class which
7598 basically is very similar to EmptyCast with the difference being
7599 it still is a constant since it is used only to cast a null to
7603 * convert.cs (ImplicitReferenceConversion): When casting a null
7604 literal, we return a NullCast.
7606 * literal.cs (NullLiteralTyped): Remove - I don't see why this
7607 should be around anymore.
7609 The renaming (reported was slightly wrong). Corrections:
7611 ConvertImplicitStandard -> ImplicitConversionStandard
7612 ConvertExplicitStandard -> ExplicitConversionStandard
7614 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
7615 before passing them in !
7617 * convert.cs (ImplicitConversionStandard): When comparing for
7618 equal expr and target types, ensure that expr is not a
7621 In general, we must not be checking (expr_type ==
7622 target_type) in the top level conversion methods
7623 (ImplicitConversion, ExplicitConversion etc). This checking is
7624 done in the methods that they delegate to.
7626 2003-05-20 Miguel de Icaza <miguel@ximian.com>
7628 * convert.cs: Move Error_CannotConvertType,
7629 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
7630 ImplicitNumericConversion, ImplicitConversionExists,
7631 ImplicitUserConversionExists, StandardConversionExists,
7632 FindMostEncompassedType, FindMostSpecificSource,
7633 FindMostSpecificTarget, ImplicitUserConversion,
7634 ExplicitUserConversion, GetConversionOperators,
7635 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
7636 TryImplicitIntConversion, Error_CannotConvertImplicit,
7637 ConvertImplicitRequired, ConvertNumericExplicit,
7638 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
7639 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
7642 Perform the following renames:
7644 StandardConversionExists -> ImplicitStandardConversionExists
7645 ConvertImplicit -> ImplicitConversion
7646 ConvertImplicitStandard -> ImplicitStandardConversion
7647 TryImplicitIntConversion -> ImplicitIntConversion
7648 ConvertImplicitRequired -> ImplicitConversionRequired
7649 ConvertNumericExplicit -> ExplicitNumericConversion
7650 ConvertReferenceExplicit -> ExplicitReferenceConversion
7651 ConvertExplicit -> ExplicitConversion
7652 ConvertExplicitStandard -> ExplicitStandardConversion
7654 2003-05-19 Martin Baulig <martin@ximian.com>
7656 * statement.cs (TypeInfo.StructInfo): Made this type protected.
7657 (TypeInfo): Added support for structs having structs as fields.
7659 * ecore.cs (FieldExpr): Implement IVariable.
7660 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
7661 VariableInfo for the field.
7663 2003-05-18 Martin Baulig <martin@ximian.com>
7665 * expression.cs (This.DoResolve): Report a CS0027 if we're
7666 emitting a field initializer.
7668 2003-05-18 Martin Baulig <martin@ximian.com>
7670 * expression.cs (This.ResolveBase): New public function.
7671 (This.DoResolve): Check for CS0188.
7673 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
7676 * ecore.cs (MethodGroupExpr.DoResolve): Set the
7677 `instance_expression' to null if we don't have any non-static
7680 2003-05-18 Martin Baulig <martin@ximian.com>
7682 Reworked the way how local variables and parameters are handled by
7683 the flow analysis code.
7685 * statement.cs (TypeInfo, VariableMap): New public classes.
7686 (VariableInfo): New public class. This is now responsible for
7687 checking whether a variable has been assigned. It is used for
7688 parameters and local variables.
7689 (Block.EmitMeta): Take the InternalParameters as argument; compute
7690 the layout of the flow vectors here.
7691 (Block.LocalMap, Block.ParameterMap): New public properties.
7692 (FlowBranching): The .ctor doesn't get the InternalParameters
7693 anymore since Block.EmitMeta() now computes the layout of the flow
7695 (MyStructInfo): This class is now known as `StructInfo' and nested
7696 in `TypeInfo'; we don't access this directly anymore.
7698 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
7699 property and removed IsAssigned(), IsFieldAssigned(),
7700 SetAssigned() and SetFieldAssigned(); we now call them on the
7701 VariableInfo so we don't need to duplicate this code everywhere.
7703 * expression.cs (ParameterReference): Added `Block block' argument
7705 (LocalVariableReference, ParameterReference, This): The new
7706 VariableInfo class is now responsible for all the definite
7709 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
7710 IsParameterAssigned, SetParameterAssigned): Removed.
7712 2003-05-18 Martin Baulig <martin@ximian.com>
7714 * typemanager.cs (InitCoreTypes): Try calling
7715 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
7716 the 3-args-version. Corlib now also needs our `void_type'.
7717 (GetMethod): Added overloaded version which takes an optional
7718 `bool report_errors' to allow lookups of optional methods.
7720 2003-05-12 Martin Baulig <martin@ximian.com>
7722 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
7723 only used for locals and not for parameters.
7725 2003-05-12 Miguel de Icaza <miguel@ximian.com>
7727 * support.cs (InternalParameters.ParameterType): Return the
7728 ExternalType of the parameter.
7730 * parameter.cs (Parameter.ExternalType): drop the two arguments,
7733 2003-05-11 Miguel de Icaza <miguel@ximian.com>
7735 * class.cs (MethodData.Define): Do not set the `newslot' on
7736 interface members, if they are also flagged as "override".
7738 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
7739 better code for ++i and i++. This only works for static fields
7740 and local variables.
7742 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
7743 want to pull the DeclSpace out of the builder_to_declspace instead
7744 of the TypeBuilder (like in TypeContainer.FindMembers).
7746 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
7747 instead of LookupTypeContainer. Fixes the crash on .NET for
7748 looking up interface members.
7750 * const.cs: Create our own emit context during the Definition
7751 stage, so that constants are evaluated in the proper context, when
7752 a recursive definition happens.
7754 2003-05-11 Martin Baulig <martin@ximian.com>
7756 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
7757 new block for a switch section.
7758 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
7759 the adding/lookup in the switch block. Fixes #39828.
7761 2003-05-09 Miguel de Icaza <miguel@ximian.com>
7763 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
7764 functionality: I needed to convert the data after I had performed
7765 the add/sub operation into the operands type size.
7767 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
7768 pass the type for the box operation, otherwise the resulting
7769 object would have been of type object.
7771 (BoxedCast): Add constructor to specify the type to box as.
7773 2003-05-07 Miguel de Icaza <miguel@ximian.com>
7775 * iterators.cs: I was reusing the `count' variable inadvertently,
7776 take steps to not allow this to happen.
7778 2003-05-06 Miguel de Icaza <miguel@ximian.com>
7780 * attribute.cs (Attribute.Resolve): Params attributes are encoded
7781 by creating an array at the point where the params starts and
7782 putting all those arguments there, then adjusting the size of the
7785 2003-05-05 Miguel de Icaza <miguel@ximian.com>
7787 * expression.cs (New.AddressOf): Implement interface
7788 IMemoryLocation. This is used when the `new' operator is used in
7789 the context of an invocation to a method on a value type.
7791 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
7794 * namespace.cs: Also check the using aliases here.
7796 * driver.cs: Move the test for using validity after the types have
7797 been entered, so we do a single pass that also includes the using
7800 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
7801 in the regular case. CreateSiblingForFinally is doing extra
7804 * attribute.cs (GetAttributeArgumentExpression): Store the result
7805 on an out value, and use the return value to indicate failure
7806 instead of using null (which is a valid return for Constant.GetValue).
7808 * statement.cs: Perform the analysis flow for the increment
7809 portion after the statement, because this will be the real flow of
7810 execution. Fixes #42385
7812 * codegen.cs (EmitContext.EmitArgument,
7813 EmitContext.EmitStoreArgument): New helper functions when the
7814 RemapToProxy flag is set.
7816 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
7819 Add support for remapping parameters.
7821 * iterators.cs: Propagate parameter values; Store parameter
7822 values in the proxy classes.
7824 2003-05-04 Miguel de Icaza <miguel@ximian.com>
7826 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
7827 need a proxy reference; I do not know what I was thinking
7829 * cs-parser.jay (constructor_initializer): catch another error,
7830 and display nice message.
7832 (field_declaration): catch void field declaration
7833 to flag a better error.
7835 * class.cs (MemberBase.CheckBase): Report an error instead of a
7836 warning if a new protected member is declared in a struct.
7837 (Field.Define): catch the error of readonly/volatile.
7839 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
7841 (FieldExpr.AddressOf): ditto. Catch error where the address of a
7842 volatile variable is taken
7844 2003-05-02 Miguel de Icaza <miguel@ximian.com>
7846 * statement.cs (Fixed.Resolve): Report an error if we are not in
7849 2003-05-01 Miguel de Icaza <miguel@ximian.com>
7851 * typemanager.cs: reuse the code that handles type clashes for
7852 delegates and enumerations.
7854 * class.cs (Report28): Always report.
7856 * expression.cs (EncodeAsAttribute): Allow nulls here.
7858 2003-04-28 Miguel de Icaza <miguel@ximian.com>
7860 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
7861 the functionality for testing whether an expression is valid for
7862 an attribute here. Also handle the case of arrays of elements
7865 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
7866 encoding a linear array into an array of objects that are suitable
7867 to be passed to an CustomAttributeBuilder.
7869 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
7871 * ecore.cs: (FieldExpr): Handle field remapping here.
7873 * iteratators.cs: Pass the instance variable (if the method is an
7874 instance method) to the constructors, so we can access the field
7875 variables on the class.
7877 TODO: Test this with structs. I think the THIS variable on
7878 structs might have to be a pointer, and not a refenrece
7880 2003-04-27 Miguel de Icaza <miguel@ximian.com>
7882 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
7883 local variables to fields in a proxy class.
7885 * iterators.cs (PopulateProxy): Rename our internal fields to
7887 Create a <THIS> field if we are an instance method, so we can
7888 reference our parent container variables.
7889 (MapVariable): Called back from the EmitContext code to enter a
7890 new variable to field mapping into the proxy class (we just create
7894 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
7895 for using the remapped locals to fields.
7897 I placed the code here, because that gives the same semantics to
7898 local variables, and only changes the Emit code.
7900 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
7901 statements inside iterators.
7902 (VariableInfo): Add a FieldBuilder for the cases when we are
7903 remapping local variables to fields in a proxy class
7905 * ecore.cs (SimpleNameResolve): Avoid testing two times for
7906 current_block != null.
7908 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
7909 not cope with strings, as it has been moved to the
7910 TableSwitchEmit. Fixed bug in switch generation.
7912 * expression.cs (New.DoResolve): Provide more context for the user
7913 when reporting an error.
7915 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
7918 * expression.cs (MemberAccess.DoResolve): When we get a type back,
7919 check the permissions for it. Note than in a type-resolution
7920 context the check was already present in DeclSpace.ResolveType,
7921 but was missing from the MemberAccess.
7923 (ArrayCreation.CheckIndices): warn if the user has
7924 more nested levels of expressions, but there are no more
7925 dimensions specified. Avoids crash on bug 41906.
7927 2003-04-26 Miguel de Icaza <miguel@ximian.com>
7929 * statement.cs (Block): replace Implicit bool, for a generic
7931 New flag: `Unchecked'. This is used during the EmitMeta phase
7932 (which is out-of-line with the regular Resolve/Emit process for a
7933 statement, as this is done ahead of time, but still gets a chance
7934 to call constant resolve).
7936 (Block.Flags): new enum for adding a new flag.
7938 (Block.EmitMeta): track the state of unchecked.
7940 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
7941 to enable constant resolution to work there as well.
7943 2003-04-22 Miguel de Icaza <miguel@ximian.com>
7945 * typemanager.cs (ienumerable_type): Also look up
7946 System.Collections.IEnumerable.
7948 2003-04-21 Miguel de Icaza <miguel@ximian.com>
7950 TODO: Test more than one conditional per method.
7952 * class.cs (Indexer.Define): Report the location where the user is
7953 referencing the unsupported feature.
7955 (MethodData): Overload the use of `conditionals' to
7956 minimize the creation of needless ArrayLists. This saves roughly
7957 212kb on my machine.
7959 (Method): Implement the new IIteratorContainer interface.
7960 (Method.SetYields): Implement the method by setting the ModFlags
7961 to contain METHOD_YIELDS.
7963 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
7964 which just got set to null.
7966 * iterators.cs: New file.
7968 (Yield, YieldBreak): New statements.
7970 * statement.cs (Return.Resolve): Flag an error if we are used in
7973 * codegen.cs (InIterator): New flag set if the code is being
7974 compiled in an iterator method.
7976 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
7977 internal modifier, and we just use it to avoid adding extra
7978 fields, as this is seldom used.
7980 * cs-parser.jay: Add yield_statement (yield and yield break).
7982 * driver.cs: New flag -v2 to turn on version 2 features.
7984 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
7985 hashtable when v2 is enabled.
7987 2003-04-20 Miguel de Icaza <miguel@ximian.com>
7989 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
7990 there is already a namespace defined with this name.
7992 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
7993 people upgraded their corlibs.
7995 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
7996 always use fully qualified types, no need to use the compiler
7999 (TypeManager.IsNamespace): Use binarysearch.
8001 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
8002 AddDelegate): I did not quite use the new IsValid API properly: I
8003 have to pass the short-name and the fullname. I was passing only
8004 the basename instead of the fullname sometimes.
8006 (TypeContainer.DefineType): call NamespaceClash.
8008 * interface.cs (Interface.DefineType): use NamespaceClash before
8011 * delegate.cs (Delegate.DefineType): use NamespaceClash before
8014 * enum.cs: (Enum.DefineType): use NamespaceClash before
8017 * typemanager.cs (: 3-line patch that gives us some tasty 11%
8018 speed increase. First, use the negative_hits cache when we get a
8019 negative. Second, add the type with its full original name
8020 instead of the new . and + encoded name (reflection uses + to
8021 separate type from a nested type). Use LookupTypeReflection
8022 directly which bypasses the type->name hashtable (that we already
8023 know does not contain the type.
8025 * decl.cs (DeclSpace.ResolveTypeExpr): track the
8026 location/container type.
8028 * driver.cs: When passing utf8, use directly the UTF8Encoding.
8030 2003-04-19 Miguel de Icaza <miguel@ximian.com>
8032 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
8034 * delegate.cs (NewDelegate.Resolve): Test whether an instance
8035 method is being referenced in the method group from a static
8036 context, and report error 120 if so.
8038 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
8041 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
8042 is created, we create the A namespace).
8044 * cs-parser.jay: A namespace also introduces a DeclarationFound.
8047 2003-04-18 Miguel de Icaza <miguel@ximian.com>
8049 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
8050 invocation to ModuleBuilder.GetType with the same values will
8051 return a new type instance, so we need to cache its return
8054 * expression.cs (Binary.ResolveOperator): Only allow the compare
8055 operators on enums if they are of the same type.
8057 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
8058 types of ValueType on their own case. Before we were giving them
8059 the same treatment as objects.
8061 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
8062 fullname. Short name is used to compare against container name.
8063 Fullname is used to check against defined namespace names.
8065 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
8066 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
8068 (Method.CheckBase): Call parent.
8069 (MemberBase.CheckBase): Check for protected members on sealed
8071 (PropertyBase.CheckBase): Call parent.
8072 (Field.Define): Call parent.
8074 * report.cs: Negative error codes are now mapped to 8000 - code,
8075 so that the display is render more nicely.
8077 * typemanager.cs: Do not use try/catch, instead report a regular
8080 (GetPointerType, GetReferenceType): These methods provide
8081 mechanisms to obtain the T* and T& from a T. We had the code
8082 previously scattered around the code base, and it also used
8083 TypeManager.LookupType that would go through plenty of caches.
8084 This one goes directly to the type source.
8086 In some places we did the Type.GetType followed by
8087 ModuleBuilder.GetType, but not in others, so this unifies the
8090 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
8091 statements now that we have namespace information.
8093 * typemanager.cs (IsNamespace): New method, returns whether the
8094 string presented is a namespace or not.
8096 (ComputeNamespaces): New public entry point, computes the list of
8097 available namespaces, using the GetNamespaces API call in Mono, or
8098 the slower version in MS.NET.
8100 Now before we start the semantic analysis phase, we have a
8101 complete list of namespaces including everything that the user has
8104 Deleted old code to cache namespaces in .nsc files.
8106 2003-04-17 Miguel de Icaza <miguel@ximian.com>
8108 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
8109 class/struct location definition Location for the implicit
8110 constructor location.
8112 (Operator.Define): Use the location of the operator for the
8113 implicit Method definition.
8115 (Constructor.Emit): use the constructor location for the implicit
8116 base initializer constructor.
8118 * ecore.cs: Remove ITypeExpression. This interface is now gone,
8119 and the Expression class now contains two new methods:
8121 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
8122 isolate type lookup from the rest of the resolution process.
8124 Since we use Expressions to hold type definitions due to the way
8125 we parse the input we have historically overloaded Resolve to
8126 perform the Type lookups if a special flag is passed. Now this is
8127 eliminated and two methods take their place.
8129 The differences in the two methods between xStep and xTerminal is
8130 that xStep is involved in our current lookup system that uses
8131 SimpleNames to compose a name, while xTerminal is used just to
8132 catch the case where the simplename lookup failed.
8134 2003-04-16 Miguel de Icaza <miguel@ximian.com>
8136 * expression.cs (ResolveMemberAccess): Remove redundant code.
8137 TypeExpr expressions are always born fully resolved.
8139 * interface.cs (PopulateMethod): Do not lookup the types twice.
8140 We were doing it once during SemanticAnalysis and once during
8143 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8144 in local variable type definitions, were being returned as a
8145 SimpleName (we decomposed everything into a string), that is
8146 because primary_expression was being used instead of a type in the
8147 grammar (reduce/reduce conflicts).
8149 The part that was wrong is that we converted the expression into a
8150 string (an oversimplification in one hand, compounded with primary
8151 expressions doing string concatenation).
8157 Would return "A.B.C[]" as a SimpleName. This stopped things like
8158 using clauses from working on this particular context. And a type
8159 was being matched directly against "A.B.C[]".
8161 We now use the correct approach, and allow for ComposedCast to be
8162 part of the unary expression. So the "A.B.C []" become a composed
8163 cast of "A.B.C" (as a nested group of MemberAccess with a
8164 SimpleName at the end) plus the rank composition "[]".
8168 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8170 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8171 for the access level checking.
8173 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8174 `TypeContainer container', because I kept getting confused when I
8175 was debugging this code.
8177 * expression.cs (Indexers): Instead of tracking getters/setters,
8178 we now track them in parallel. We create one arraylist less, but
8179 most importantly it is possible now for the LValue code to find a
8180 matching get for a set.
8182 (IndexerAccess.DoResolveLValue): Update the code.
8183 GetIndexersForType has been modified already to extract all the
8184 indexers from a type. The code assumed it did not.
8186 Also make the code set the correct return type for the indexer.
8187 This was fixed a long time ago for properties, but was missing for
8188 indexers. It used to be void_type.
8190 (Binary.Emit): Test first for doubles instead of
8191 floats, as they are more common.
8193 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8194 when dealing with floats and the <=, >= operators. This fixes bug
8197 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8198 to load the array value by emitting a load on the foreach variable
8199 type. This was incorrect.
8201 We now emit the code to load an element using the the array
8202 variable type, and then we emit the conversion operator.
8206 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8208 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8210 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8212 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8213 test for protection before we test for signatures.
8215 (MethodSignature.ToString): implement.
8217 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8218 to the case where we reduced into a LongConstant.
8220 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8221 depend on whether the information is acurrate, because the
8222 Microsoft runtime will always claim that the array type is public,
8223 regardless of the real state.
8225 If the type is a pointer, another problem happens: the type is
8226 reported as non-public in Microsoft.
8228 In both cases we have to call CheckAccessLevel recursively with
8229 the underlying type as the argument to be tested.
8231 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8233 * assign.cs (Assign.Emit): If we are dealing with a compound
8234 assignment expression, we should use the code path that stores the
8235 intermediate result in a temporary value. This fixes #40903.
8237 *expression.cs (Indirection.ToString): Provide ToString method for
8240 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8242 * class.cs: Null out fields holding references to Block objects so
8243 they can be garbage collected.
8245 * expression.cs (OverloadResolve): Remove unused local.
8247 2003-04-07 Martin Baulig <martin@ximian.com>
8249 * codegen.cs (EmitContext.CurrentFile): New public field.
8250 (EmitContext.Mark): Use the CurrentFile to check whether the
8251 location is in the correct file.
8252 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8254 2003-04-07 Martin Baulig <martin@ximian.com>
8256 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8258 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8259 location. [FIXME: The location argument which gets passed to this
8260 method is sometimes wrong!]
8262 2003-04-07 Nick Drochak <ndrochak@gol.com>
8264 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8266 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8268 * expression.cs (Indirection.EmitAssign): We were using the
8269 temporary, but returning immediately instead of continuing the
8272 2003-04-06 Martin Baulig <martin@ximian.com>
8274 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8275 if it's a nested child, but also deriving from the outer class.
8278 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8279 nested child, but also deriving from the outer class. See
8281 (FilterWithClosure): We may access private members of the outer
8282 class if we're a nested child and deriving from the outer class.
8283 (RealMemberLookup): Only set `closure_private_ok' if the
8284 `original_bf' contained BindingFlags.NonPublic.
8286 2003-04-05 Martin Baulig <martin@ximian.com>
8288 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
8290 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8292 * class.cs (Event.Define): Do not allow abstract events to have
8295 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8297 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8298 block in event declarations.
8300 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8301 value type, get its address.
8303 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8304 leaving a class on the stack instead of a boolean value (int
8305 0/1). Change the code so we compare against null, and then the
8306 result against zero.
8308 * class.cs (TypeContainer.GetClassBases): We were checking for the
8309 parent class being sealed too late.
8311 * expression.cs (Binary.Emit): For <= and >= when dealing with
8312 floating point values, use cgt.un and clt.un instead of cgt and
8315 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8317 * statement.cs: Apply the same optimization as MS: skip the
8318 GetEnumerator returning an IEnumerator, and use the one returning a
8319 CharEnumerator instead. This allows us to avoid the try-finally block
8322 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8324 * cs-parser.jay: Attributes cannot be applied to
8325 namespaces. Fixes #40473
8327 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8330 (Add*): check if the name is valid using the full name for constants,
8331 fields, properties and events.
8333 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8335 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8336 char constants to be part of the enumeration.
8338 * expression.cs (Conditional.DoResolve): Add support for operator
8339 true. Implements the missing functionality from 14.12
8341 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8342 operator true/false as required by the spec.
8344 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8345 implicit conversion to boolean.
8347 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8348 also one where the type implements `operator true'.
8350 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8351 get an expression that will invoke operator true based on an
8354 (GetConversionOperators): Removed the hack that called op_True
8357 (Expression.ResolveBoolean): Move this from Statement.
8359 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8361 * ecore.cs (FieldExpr): do not allow initialization of initonly
8362 fields on derived classes
8364 2003-03-13 Martin Baulig <martin@ximian.com>
8366 * statement.cs (Block.Emit): Call ig.BeginScope() and
8367 ig.EndScope() when compiling with debugging info; call
8368 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8370 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8372 * expression.cs (Indexers): Do not construct immediately, allow
8373 for new members to be appended as we go. Fixes 38143
8375 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8377 * expression.cs: save/restore context when resolving an unchecked
8380 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8382 * cfold.cs: Catch division by zero in modulus operator during
8385 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8387 * interface.cs (Interface.DefineMembers): Avoid defining members
8390 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8392 * driver.cs: handle the +/- options for -noconfig
8394 * statement.cs (Unckeched.Resolve): Also track the state of
8395 unchecked in the Resolve phase.
8397 2003-02-27 Martin Baulig <martin@ximian.com>
8399 * ecore.cs (Expression.MemberLookup): Don't create a
8400 MethodGroupExpr for something which is not a method. Fixes #38291.
8402 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8404 * class.cs (MemberBase.CheckParameters): Also check that the type
8405 is unmanaged if it is a pointer.
8407 * expression.cs (SizeOf.Resolve): Add location information.
8409 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8410 a managed type is declared.
8412 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8413 parameter modifiers as well. Fixes bug 38606
8415 * class.cs: Very sad. Am backing out the speed up changes
8416 introduced by the ArrayList -> Array in the TypeContainer, as they
8417 were not actually that much faster, and introduced a bug (no error
8418 reports on duplicated methods).
8420 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8421 source first, this will guarantee that we have a valid expression
8422 before calling in lower levels functions that will require a
8423 resolved object. Then use this original_source in the
8424 target.ResolveLValue instead of the original source that was
8427 Another change. Use target.Resolve instead of LValueResolve.
8428 Although we are resolving for LValues, we will let the Assign code
8429 take care of that (it will be called again from Resolve). This
8430 basically allows code like this:
8432 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8433 class Y { void A (X x) { x [0] += o; }
8435 The problem was that the indexer was trying to resolve for
8436 set_Item (idx, object o) and never finding one. The real set_Item
8437 was set_Item (idx, X). By delaying the process we get the right
8442 2003-02-23 Martin Baulig <martin@ximian.com>
8444 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8445 while calling DoEmit ().
8447 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8448 source files; if you use the #line directive inside a method, the
8449 compiler stops emitting line numbers for the debugger until it
8450 reaches the end of the method or another #line directive which
8451 restores the original file.
8453 2003-02-23 Martin Baulig <martin@ximian.com>
8455 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8457 2003-02-23 Martin Baulig <martin@ximian.com>
8459 * statement.cs (Block.AddChildVariableNames): We need to call this
8460 recursively, not just for our immediate children.
8462 2003-02-23 Martin Baulig <martin@ximian.com>
8464 * class.cs (Event.Define): Always make the field private, like csc does.
8466 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8467 actually work, fixes bug #37521.
8469 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8471 * delegate.cs: When creating the various temporary "Parameters"
8472 classes, make sure that we call the ComputeAndDefineParameterTypes
8473 on those new parameters (just like we do with the formal ones), to
8474 allow them to be resolved in the context of the DeclSpace.
8476 This fixes the bug that Dick observed in Bugzilla #38530.
8478 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8480 * expression.cs (ResolveMemberAccess): When resolving a constant,
8481 do not attempt to pull a constant if the value was not able to
8482 generate a valid constant.
8484 * const.cs (LookupConstantValue): Do not report more errors than required.
8486 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8488 * expression.cs: fixes bug #38328.
8490 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8492 * class.cs: Changed all the various members that can be part of a
8493 class from being an ArrayList to be an Array of the right type.
8494 During the DefineType type_list, interface_list, delegate_list and
8495 enum_list are turned into types, interfaces, delegates and enums
8498 And during the member population, indexer_list, event_list,
8499 constant_list, field_list, instance_constructor_list, method_list,
8500 operator_list and property_list are turned into their real arrays.
8502 Although we could probably perform this operation earlier, for
8503 good error reporting we need to keep the lists and remove the
8504 lists for longer than required.
8506 This optimization was triggered by Paolo profiling the compiler
8507 speed on the output of `gen-sample-program.pl' perl script.
8509 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8510 not crash in methods like MemberLookupFailed that use this field.
8512 This problem arises when the compiler fails to resolve a type
8513 during interface type definition for example.
8515 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8517 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8518 inherit from System.Object, so we have to stop at null, not only
8519 when reaching System.Object.
8521 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8523 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8524 DeclaredOnly because the parent indexer might have had a different
8525 name, but did not loop until the top of the hierarchy was reached.
8527 The problem this one fixes is 35492: when a class implemented an
8528 indexer from an interface, we were getting the interface method
8529 (which was abstract) and we were flagging an error (can not invoke
8532 This also keeps bug 33089 functioning, and test-148 functioning.
8534 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8535 out if a method is special is to see if it is declared in a
8536 property or event, or whether it is one of the predefined operator
8537 names. This should fix correctly #36804.
8539 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8541 The goal here is to remove the dependency on EmptyCast.Peel ().
8542 Killing it completely.
8544 The problem is that currently in a number of places where
8545 constants are expected, we have to "probe" for an EmptyCast, and
8546 Peel, which is not the correct thing to do, as this will be
8547 repetitive and will likely lead to errors.
8549 The idea is to remove any EmptyCasts that are used in casts that
8550 can be reduced to constants, so we only have to cope with
8553 This bug hunt was triggered by Bug 37363 and the desire to remove
8554 the duplicate pattern where we were "peeling" emptycasts to check
8555 whether they were constants. Now constants will always be
8558 * ecore.cs: Use an enumconstant here instead of wrapping with
8561 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
8562 throwing me off. By handling this we can get rid of a few hacks.
8564 * statement.cs (Switch): Removed Peel() code.
8566 2003-02-14 Miguel de Icaza <miguel@ximian.com>
8568 * class.cs: Location information for error 508
8570 * expression.cs (New.DoResolve): Add a guard against double
8571 resolution of an expression.
8573 The New DoResolve might be called twice when initializing field
8574 expressions (see EmitFieldInitializers, the call to
8575 GetInitializerExpression will perform a resolve on the expression,
8576 and later the assign will trigger another resolution
8578 This leads to bugs (#37014)
8580 * delegate.cs: The signature for EndInvoke should contain any ref
8581 or out parameters as well. We were not doing this in the past.
8583 * class.cs (Field.Define): Do not overwrite the type definition
8584 inside the `volatile' group. Turns out that volatile enumerations
8585 were changing the type here to perform a validity test, which
8588 2003-02-12 Miguel de Icaza <miguel@ximian.com>
8590 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
8591 and structs, we do not want to load the instance variable
8593 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
8594 enum_type has to be handled like an object reference (implicit
8595 conversions exists from this to object), but the regular IsClass
8596 and IsValueType tests will never return true for this one.
8598 Also we use TypeManager.IsValueType instead of type.IsValueType,
8599 just for consistency with the rest of the code (this is only
8600 needed if we ever use the construct exposed by test-180.cs inside
8601 corlib, which we dont today).
8603 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
8605 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
8608 2003-02-09 Martin Baulig <martin@ximian.com>
8610 * namespace.cs (Namespace..ctor): Added SourceFile argument.
8611 (Namespace.DefineNamespaces): New static public method; this is
8612 called when we're compiling with debugging to add all namespaces
8615 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
8616 pass it to the Namespace's .ctor.
8618 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
8619 and MethodBase arguments; pass the namespace ID to the symwriter;
8620 pass the MethodBase instead of the token to the symwriter.
8621 (SymbolWriter.DefineNamespace): New method to add a namespace to
8624 2003-02-09 Martin Baulig <martin@ximian.com>
8626 * symbolwriter.cs: New file. This is a wrapper around
8627 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
8628 methods here in near future.
8630 2003-02-09 Martin Baulig <martin@ximian.com>
8632 * codegen.cs (EmitContext.Mark): Just pass the arguments to
8633 ILGenerator.MarkSequencePoint() which are actually used by the
8636 2003-02-09 Martin Baulig <martin@ximian.com>
8638 * location.cs (SourceFile): New public sealed class. This
8639 contains the name and an index which is used in the location's token.
8640 (Location): Reserve an appropriate number of bits in the token for
8641 the source file instead of walking over that list, this gives us a
8642 really huge performance improvement when compiling with debugging.
8644 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
8645 `SourceFile' argument instead of a string.
8646 (Driver.ProcessFile): Add all the files via Location.AddFile(),
8647 but don't parse/tokenize here, we need to generate the list of all
8648 source files before we do that.
8649 (Driver.ProcessFiles): New static function. Parses/tokenizes all
8652 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
8653 instead of a string.
8655 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
8658 2003-02-09 Martin Baulig <martin@ximian.com>
8660 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
8661 filename on `#line default'.
8663 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
8665 * statement.cs: don't clear the pinned var when the fixed statement
8666 returns from the method (fixes bug#37752).
8668 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
8670 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
8673 2003-02-07 Martin Baulig <martin@ximian.com>
8675 * driver.cs: Removed the `--debug-args' command line argument.
8677 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
8678 automatically by the AsssemblyBuilder.
8679 (CodeGen.InitializeSymbolWriter): We don't need to call any
8680 initialization function on the symbol writer anymore. This method
8681 doesn't take any arguments.
8683 2003-02-03 Miguel de Icaza <miguel@ximian.com>
8685 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
8686 from referenced assemblies as well.
8688 2003-02-02 Martin Baulig <martin@ximian.com>
8690 * class.cs (MethodData.Emit): Generate debugging info for external methods.
8692 2003-02-02 Martin Baulig <martin@ximian.com>
8694 * class.cs (Constructor.Emit): Open the symbol writer before
8695 emitting the constructor initializer.
8696 (ConstructorInitializer.Emit): Call ec.Mark() to allow
8697 single-stepping through constructor initializers.
8699 2003-01-30 Miguel de Icaza <miguel@ximian.com>
8701 * class.cs: Handle error 549: do not allow virtual methods in
8704 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
8706 * decl.cs: Check access levels when resolving types
8708 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
8710 * statement.cs: Add parameters and locals set in catch blocks that might
8711 return to set vector
8713 2003-01-29 Miguel de Icaza <miguel@ximian.com>
8715 * class.cs (Operator): Set the SpecialName flags for operators.
8717 * expression.cs (Invocation.DoResolve): Only block calls to
8718 accessors and operators on SpecialName methods.
8720 (Cast.TryReduce): Handle conversions from char constants.
8723 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
8725 * statement.cs: small memory and time optimization in FlowBranching.
8727 2003-01-28 Pedro Mart <yoros@wanadoo.es>
8729 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
8730 problem that the last fix but in the other sid (Set).
8732 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
8733 access when there is no indexer in the hierarchy.
8735 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
8737 * class.cs: Combine some if statements.
8739 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8741 * driver.cs: fixed bug #37187.
8743 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
8745 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
8746 any indexer, it's needed to build a list with all the indexers in the
8747 hierarchy (AllGetters), else we have problems. Fixes #35653.
8749 2003-01-23 Miguel de Icaza <miguel@ximian.com>
8751 * class.cs (MethodData.Define): It is wrong for an interface
8752 implementation to be static in both cases: explicit and implicit.
8753 We were only handling this in one case.
8755 Improve the if situation there to not have negations.
8757 * class.cs (Field.Define): Turns out that we do not need to check
8758 the unsafe bit on field definition, only on usage. Remove the test.
8760 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8762 * driver.cs: use assembly.Location instead of Codebase (the latest
8763 patch made mcs fail when using MS assemblies).
8765 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
8767 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
8768 get the path to *corlib.dll.
8770 2003-01-21 Nick Drochak <ndrochak@gol.com>
8774 * typemanager.cs: Remove compiler warnings
8776 2003-01-20 Duncan Mak <duncan@ximian.com>
8778 * AssemblyInfo.cs: Bump the version number to 0.19.
8780 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8782 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
8784 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
8786 * class.cs (Constructor::Emit): Emit debugging info for constructors.
8788 2003-01-17 Miguel de Icaza <miguel@ximian.com>
8790 * cs-parser.jay: Small fix: we were not comparing the constructor
8791 name correctly. Thanks to Zoltan for the initial pointer.
8793 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
8795 * cs-tokenizer.cs: Set file name when specified with #line
8797 2003-01-15 Miguel de Icaza <miguel@ximian.com>
8799 * cs-parser.jay: Only perform the constructor checks here if we
8800 are named like the class; This will help provider a better
8801 error. The constructor path is taken when a type definition is
8802 not found, but most likely the user forgot to add the type, so
8803 report that rather than the constructor error.
8805 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
8807 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
8810 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8812 * cs-parser.jay: Add cleanup call.
8814 2003-01-13 Duncan Mak <duncan@ximian.com>
8816 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
8817 consistent with other methods.
8819 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8821 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
8823 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
8825 * attribute.cs: only set GuidAttr to true when we have a
8828 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8832 * typemanager.cs: fixes to allow mcs compile corlib with the new
8833 Type.IsSubclassOf fix.
8835 2003-01-08 Miguel de Icaza <miguel@ximian.com>
8837 * expression.cs (LocalVariableReference.DoResolve): Classify a
8838 constant as a value, not as a variable. Also, set the type for
8841 * cs-parser.jay (fixed_statement): take a type instead of a
8842 pointer_type, so we can produce a better error message later.
8844 * statement.cs (Fixed.Resolve): Flag types that are not pointers
8847 (For.DoEmit): Make inifinite loops have a
8848 non-conditional branch back.
8850 (Fixed.DoEmit): First populate the pinned variables, then emit the
8851 statement, then clear the variables. Before I was emitting the
8852 code once for each fixed piece.
8855 2003-01-08 Martin Baulig <martin@ximian.com>
8857 * statement.cs (FlowBranching.MergeChild): A break in a
8858 SWITCH_SECTION does not leave a loop. Fixes #36155.
8860 2003-01-08 Martin Baulig <martin@ximian.com>
8862 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
8863 lives in the same number space than `param_map'. Fixes #36154.
8865 2003-01-07 Miguel de Icaza <miguel@ximian.com>
8867 * cs-parser.jay (constructor_declaration): Set the
8868 Constructor.ModFlags before probing for it. This makes the
8869 compiler report 514, 515 and 132 (the code was there, but got
8872 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
8873 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
8874 (GotoCase.Resolve): Set `Returns' to ALWAYS.
8876 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
8878 * enum.cs: create the enum static fields using the enum type.
8880 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
8882 * class.cs: don't try to create the ParamBuilder for the return
8883 type if it's not needed (and handle it breaking for the ms runtime
8886 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
8888 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
8890 2002-12-29 Miguel de Icaza <miguel@ximian.com>
8892 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
8893 the command. This showed up while compiling the JANET source
8894 code, which used \r as its only newline separator.
8896 2002-12-28 Miguel de Icaza <miguel@ximian.com>
8898 * class.cs (Method.Define): If we are an operator (because it
8899 reuses our code), then set the SpecialName and HideBySig. #36128
8901 2002-12-22 Miguel de Icaza <miguel@ximian.com>
8903 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
8904 exception, report error 120 `object reference required'.
8906 * driver.cs: Add --pause option, used during to measure the size
8907 of the process as it goes with --timestamp.
8909 * expression.cs (Invocation.DoResolve): Do not allow methods with
8910 SpecialName to be invoked.
8912 2002-12-21 Miguel de Icaza <miguel@ximian.com>
8914 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
8915 number before adding it.
8917 2002-12-21 Ravi Pratap <ravi@ximian.com>
8919 * ecore.cs (StandardImplicitConversion): When in an unsafe
8920 context, we allow conversion between void * to any other pointer
8921 type. This fixes bug #35973.
8923 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
8925 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
8926 is not thrown when extensionless outputs are used
8928 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8930 * rootcontext.cs: fixed compilation of corlib.
8932 2002-12-19 Miguel de Icaza <miguel@ximian.com>
8934 * attribute.cs (Attributes.Contains): Add new method.
8936 * class.cs (MethodCore.LabelParameters): if the parameter is an
8937 `out' parameter, check that no attribute `[In]' has been passed.
8939 * enum.cs: Handle the `value__' name in an enumeration.
8941 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
8943 * decl.cs: Added special case to allow overrides on "protected
8946 2002-12-18 Ravi Pratap <ravi@ximian.com>
8948 * attribute.cs (Attributes.AddAttributeSection): Rename to this
8949 since it makes much more sense.
8951 (Attributes.ctor): Don't require a Location parameter.
8953 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
8955 * attribute.cs (ApplyAttributes): Remove extra Location parameters
8956 since we already have that information per attribute.
8958 * everywhere : make appropriate changes.
8960 * class.cs (LabelParameters): Write the code which actually
8961 applies attributes to the return type. We can't do this on the MS
8962 .NET runtime so we flag a warning in the case an exception is
8965 2002-12-18 Miguel de Icaza <miguel@ximian.com>
8967 * const.cs: Handle implicit null conversions here too.
8969 2002-12-17 Ravi Pratap <ravi@ximian.com>
8971 * class.cs (MethodCore.LabelParameters): Remove the extra
8972 Type [] parameter since it is completely unnecessary. Instead
8973 pass in the method's attributes so that we can extract
8974 the "return" attribute.
8976 2002-12-17 Miguel de Icaza <miguel@ximian.com>
8978 * cs-parser.jay (parse): Use Report.Error to flag errors instead
8979 of ignoring it and letting the compile continue.
8981 * typemanager.cs (ChangeType): use an extra argument to return an
8982 error condition instead of throwing an exception.
8984 2002-12-15 Miguel de Icaza <miguel@ximian.com>
8986 * expression.cs (Unary.TryReduce): mimic the code for the regular
8987 code path. Perform an implicit cast in the cases where we can
8988 implicitly convert to one of the integral types, and then reduce
8989 based on that constant. This fixes bug #35483.
8991 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8993 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
8995 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8997 * namespace.cs: fixed bug #35489.
8999 2002-12-12 Miguel de Icaza <miguel@ximian.com>
9001 * class.cs: Remove some dead code.
9003 * cs-parser.jay: Estimate the number of methods needed
9004 (RootContext.MethodCount);
9006 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
9007 numbers instead of StringBuilders.
9009 * support.cs (PtrHashtable): Add constructor with initial size;
9010 We can now reduce reallocations of the method table.
9012 2002-12-10 Ravi Pratap <ravi@ximian.com>
9014 * attribute.cs (ApplyAttributes): Keep track of the emitted
9015 attributes on a per-target basis. This fixes bug #35413.
9017 2002-12-10 Miguel de Icaza <miguel@ximian.com>
9019 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
9020 default to the Windows 1252 encoding.
9022 (UnixParseOption): Support version, thanks to Alp for the missing
9025 * AssemblyInfo.cs: Add nice assembly information.
9027 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
9030 * cs-parser.jay: Allow a trailing comma before the close bracked
9031 in the attribute_section production.
9033 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
9034 address of the instance was being taken, I will take this out,
9035 because we take the address of the object immediately here.
9037 2002-12-09 Ravi Pratap <ravi@ximian.com>
9039 * typemanager.cs (AreMultipleAllowed): Take care of the most
9040 obvious case where attribute type is not in the current assembly -
9043 2002-12-08 Miguel de Icaza <miguel@ximian.com>
9045 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
9046 definitions, instead of doing that afterwards.
9048 Also we use a nice little hack, depending on the constructor, we
9049 know if we are a "composed" name or a simple name. Hence, we
9050 avoid the IndexOf test, and we avoid
9052 * codegen.cs: Add code to assist in a bug reporter to track down
9053 the source of a compiler crash.
9055 2002-12-07 Ravi Pratap <ravi@ximian.com>
9057 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
9058 types have been emitted for a given element and flag an error
9059 if something which does not have AllowMultiple set is used more
9062 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
9063 attribute types and their corresponding AllowMultiple properties
9065 (AreMultipleAllowed): Check the property for a given type.
9067 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
9068 property in the case we have a TypeContainer.
9070 (Attributes.AddAttribute): Detect duplicates and just skip on
9071 adding them. This trivial fix catches a pretty gross error in our
9072 attribute emission - global attributes were being emitted twice!
9074 Bugzilla bug #33187 is now fixed.
9076 2002-12-06 Miguel de Icaza <miguel@ximian.com>
9078 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
9081 * expression.cs (Binary.ResolveOperator): I can only use the
9082 Concat (string, string, string) and Concat (string, string,
9083 string, string) if the child is actually a concatenation of
9086 2002-12-04 Miguel de Icaza <miguel@ximian.com>
9088 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
9089 context where we need a 2-character lookahead.
9091 * pending.cs (PendingImplementation): Rework so we can keep track
9092 of interface types all the time, and flag those which were
9093 implemented by parents as optional.
9095 2002-12-03 Miguel de Icaza <miguel@ximian.com>
9097 * expression.cs (Binary.ResolveOperator): Use
9098 String.Concat(string,string,string) or
9099 String.Concat(string,string,string,string) when possible.
9101 * typemanager: More helper methods.
9104 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
9106 * pending.cs: remove the bogus return from GetMissingInterfaces()
9107 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
9109 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9111 * namespace.cs: avoid duplicated 'using xxx' being added to
9112 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
9113 when we get more than one 'using' statement for the same namespace.
9114 Report a CS0105 warning for it.
9116 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9118 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9119 of calling getChar/putback, uses internal knowledge of it.
9121 (xtoken): Reorder tokenizer so most common patterns are checked
9122 first. This reduces the compilation time in another 5% (from 8.11s
9123 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9125 The parsing time is 22% of the compilation in mcs, and from that
9126 64% is spent on the tokenization process.
9128 I tried using a binary search for keywords, but this is slower
9129 than the hashtable. Another option would be to do a couple of
9132 * Not use a StringBuilder, instead use an array of chars,
9133 with a set value. Notice that this way we could catch
9134 the 645 error without having to do it *afterwards*.
9136 * We could write a hand-parser to avoid the hashtable
9137 compares altogether.
9139 The identifier consumption process takes 37% of the tokenization
9140 time. Another 15% is spent on is_number. 56% of the time spent
9141 on is_number is spent on Int64.Parse:
9143 * We could probably choose based on the string length to
9144 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9147 Another 3% is spend on wrapping `xtoken' in the `token' function.
9149 Handle 0xa0 as whitespace (#34752)
9151 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9153 * typemanager.cs (IsCLRType): New routine to tell whether a type
9154 is one of the builtin types.
9156 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9157 typecode in more places instead of doing pointer comparissions.
9158 We could leverage some knowledge about the way the typecodes are
9161 New code to cache namespaces in assemblies, it is currently not
9162 invoked, to be used soon.
9164 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9166 * expression.cs (Binary.ResolveOperator): specially handle
9167 strings, and do not perform user-defined operator overloading for
9170 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9172 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9173 internalcall as it is a pretty simple operation; Avoid whenever
9174 possible to call Char.IsLetter.
9176 (consume_identifier): Cut by half the number of
9177 hashtable calls by merging the is_keyword and GetKeyword behavior.
9179 Do not short-circuit, because if we do, we
9180 report errors (ie, #if false && true would produce an invalid
9184 2002-11-24 Martin Baulig <martin@ximian.com>
9186 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9187 check constant ranges and report a CS0221. Fixes #33186.
9189 2002-11-24 Martin Baulig <martin@ximian.com>
9191 * cs-parser.jay: Make this work for uninitialized variable
9192 declarations in the `for' initializer. Fixes #32416.
9194 2002-11-24 Martin Baulig <martin@ximian.com>
9196 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9197 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9199 2002-11-24 Martin Baulig <martin@ximian.com>
9201 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9202 argument; if true, we also check for user-defined conversions.
9203 This is only needed if both arguments are of a user-defined type.
9204 Fixes #30443, added test-175.cs.
9205 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9207 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9209 2002-11-24 Martin Baulig <martin@ximian.com>
9211 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9212 function to get the store opcode.
9213 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9214 only emit the Ldelema if the store opcode is Stobj. You must run
9215 both test-34 and test-167 to test this. Fixes #34529.
9217 2002-11-23 Martin Baulig <martin@ximian.com>
9219 * ecore.cs (Expression.MemberLookup): Added additional
9220 `qualifier_type' argument which is used when we're being called
9221 from MemberAccess.DoResolve() and null if we're called from a
9223 (Expression.MemberLookupFailed): New method to report errors; this
9224 does the CS1540 check and reports the correct error message.
9226 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9227 argument for the CS1540 check and redone the way how we're dealing
9228 with private members. See the comment in the source code for details.
9229 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9230 `closure_start_type' to `closure_qualifier_type' and check whether
9231 it's not null. It was not this filter being broken, it was just
9232 being called with the wrong arguments.
9234 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9235 and pass it the correct `qualifier_type'; this also does the error
9238 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9240 * expression.cs (Invocation.EmitParams): If the we are dealing
9241 with a non-built-in value type, load its address as well.
9243 (ArrayCreation): Use a a pretty constant instead
9244 of the hardcoded value 2. Use 6 instead of 2 for the number of
9245 static initializers.
9247 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9248 because they are not really value types, just glorified integers.
9250 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9252 * ecore.cs: Remove redundant code for enumerations, make them use
9253 the same code path as everything else, fixes the casting issue
9254 with enumerations in Windows.Forms.
9256 * attribute.cs: Do only cast to string if it is a string, the
9257 validation happens later.
9259 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9260 people upgrade their corlibs.
9262 * ecore.cs: Oops, enumerations were not following the entire code path
9264 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9266 * typemanager.cs (FilterWithClosure): Commented out the test for
9267 1540 in typemanager.cs, as it has problems when accessing
9268 protected methods from a parent class (see test-174.cs).
9270 * attribute.cs (Attribute.ValidateGuid): new method.
9271 (Attribute.Resolve): Use above.
9273 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9275 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9277 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9278 handling for enumerations, as we only needed the TypeContainer
9279 functionality to begin with (this is required for the fix below to
9280 work for enums that reference constants in a container class for
9283 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9285 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9286 a valid TypeBuilder to perform lookups on.o
9288 * class.cs (InheritableMemberSignatureCompare): Use true in the
9289 call to GetGetMethod and GetSetMethod, because we are comparing
9290 the signature, and we need to get the methods *even* if they are
9293 (PropertyBase.CheckBase): ditto.
9295 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9296 GotoCase.Resolve): Use Peel on EmpytCasts.
9298 * ecore.cs (EmptyCast): drop child, add Peel method.
9300 2002-11-17 Martin Baulig <martin@ximian.com>
9302 * ecore.cs (EmptyCast.Child): New public property.
9304 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9305 label resolved to an EmptyCast. Fixes #34162.
9306 (GotoCase.Resolve): Likewise.
9307 (Block.EmitMeta): Likewise.
9309 2002-11-17 Martin Baulig <martin@ximian.com>
9311 * expression.cs (Invocation.BetterConversion): Prefer int over
9312 uint; short over ushort; long over ulong for integer literals.
9313 Use ImplicitConversionExists instead of StandardConversionExists
9314 since we also need to check for user-defined implicit conversions.
9315 Fixes #34165. Added test-173.cs.
9317 2002-11-16 Martin Baulig <martin@ximian.com>
9319 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9320 with the `true' and `false' literals. Fixes #33151.
9322 2002-11-16 Martin Baulig <martin@ximian.com>
9324 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9325 October 22nd; don't do the cs1540 check for static members.
9327 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9328 now using our own filter here and doing the cs1540 check again.
9330 2002-11-16 Martin Baulig <martin@ximian.com>
9332 * support.cs (InternalParameters): Don't crash if we don't have
9333 any fixed parameters. Fixes #33532.
9335 2002-11-16 Martin Baulig <martin@ximian.com>
9337 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9338 when looking up static methods to make this work on Windows.
9341 2002-11-16 Martin Baulig <martin@ximian.com>
9343 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9344 a setter rather than using PropertyInfo.CanWrite.
9346 2002-11-15 Nick Drochak <ndrochak@gol.com>
9348 * class.cs: Allow acces to block member by subclasses. Fixes build
9351 2002-11-14 Martin Baulig <martin@ximian.com>
9353 * class.cs (Constructor.Emit): Added the extern/block check.
9356 2002-11-14 Martin Baulig <martin@ximian.com>
9358 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9359 iteration while looking for indexers, this is needed because the
9360 indexer may have a different name in our base classes. Fixed the
9361 error reporting (no indexers at all, not get accessor, no
9362 overloaded match). Fixes bug #33089.
9363 (IndexerAccess.DoResolveLValue): Likewise.
9365 2002-11-14 Martin Baulig <martin@ximian.com>
9367 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9368 indexers. Fixes the first part of bug #33089.
9369 (MethodSignature.InheritableMemberSignatureCompare): Added support
9372 2002-11-13 Ravi Pratap <ravi@ximian.com>
9374 * attribute.cs (Attribute.Resolve): Catch the
9375 NullReferenceException and report it since it isn't supposed to
9378 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9380 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9381 LogicalOr and LogicalAnd that can benefit from recursively
9382 handling EmitBranchable. The code now should be nice for Paolo.
9384 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9386 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9387 the Type lookups, as we perform quite a number of lookups on
9388 non-Types. This can be removed once we can deterministically tell
9389 whether we have a type or a namespace in advance.
9391 But this might require special hacks from our corlib.
9395 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9396 and double which avoids a conversion from an integer to a double.
9398 * expression.cs: tiny optimization, avoid calling IsConstant,
9399 because it effectively performs the lookup twice.
9401 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9403 But a bogus return here to keep the semantics of the old code
9404 until the Mono runtime is fixed.
9406 * pending.cs (GetMissingInterfaces): New method used to remove all
9407 the interfaces that are already implemented by our parent
9408 classes from the list of pending methods.
9410 * interface.cs: Add checks for calls after ResolveTypeExpr.
9412 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9414 * class.cs (Class.Emit): Report warning 67: event not used if the
9415 warning level is beyond 3.
9417 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9418 being a NullLiteral.
9420 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9423 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9424 path that might fail if a type can not be resolved.
9426 * expression.cs (Binary.Emit): Emit unsigned versions of the
9429 * driver.cs: use error 5.
9431 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9433 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9435 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9437 * cs-parser.jay (switch_section): A beautiful patch from Martin
9438 Baulig that fixed 33094.
9440 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9442 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9443 Check whether the base is abstract and report an error if so.
9445 * expression.cs (IndexerAccess.DoResolveLValue,
9446 IndexerAccess.DoResolve): ditto.
9448 (Invocation.DoResolve): ditto.
9450 (Invocation.FullMethodDesc): Improve the report string.
9452 * statement.cs (Block): Eliminate IsVariableDefined as it is
9453 basically just a wrapper for GetVariableInfo.
9455 * ecore.cs (SimpleName): Use new
9457 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9458 type, as we return the actual parameter ref/unref state on a
9461 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9463 * support.cs: Return proper flags REF/OUT fixing the previous
9466 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9467 not used to mean `ref' but `ref or out' in ParameterReference
9469 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9470 full type signature instead of calling TypeManger.CSharpName
9473 * support.cs (InternalParameters.ParameterDesc): Do not compare
9474 directly to the modflags, because REF/OUT will actually be bitsets
9477 * delegate.cs (VerifyMethod): Check also the modifiers.
9479 * cs-tokenizer.cs: Fix bug where floating point values with an
9480 exponent where a sign was missing was ignored.
9482 * driver.cs: Allow multiple assemblies to be specified in a single
9485 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9487 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9488 because identifiers after a parenthesis would end up in this kind
9489 of production, and we needed to desamiguate it for having casts
9492 (UserDefinedType *) xxx
9494 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9496 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9497 we should set on the Bindingflags.NonPublic, but not turn on
9498 private_ok. private_ok controls whether a Private member is
9499 returned (this is chekced on the filter routine), while the
9500 BindingFlags.NonPublic just controls whether private/protected
9501 will be allowed. This fixes the problem part of the problem of
9502 private properties being allowed to be used in derived classes.
9504 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9505 so we can call the children DoResolveLValue method (this will
9506 properly signal errors on lvalue assignments to base properties)
9508 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9509 getter are null, and we have a property info, we know that this
9510 happened because the lookup failed, so we report an error 122 for
9511 protection level violation.
9513 We also silently return if setter and getter are null in the
9514 resolve functions, this condition only happens if we have flagged
9515 the error before. This is the other half of the problem.
9517 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9518 not have accessibility information, that is why we were returning
9519 true in the filter function in typemanager.cs.
9521 To properly report 122 (property is inaccessible because of its
9522 protection level) correctly, we report this error in ResolveAccess
9523 by failing if both the setter and the getter are lacking (ie, the
9526 DoResolve and DoLResolve have been modified to check for both
9527 setter/getter being null and returning silently, the reason being
9528 that I did not want to put the knowledge about this error in upper
9531 int old = Report.Errors;
9532 x = new PropertyExpr (...);
9533 if (old != Report.Errors)
9538 So the property expr is returned, but it is invalid, so the error
9539 will be flagged during the resolve process.
9541 * class.cs: Remove InheritablePropertySignatureCompare from the
9542 class, as we no longer depend on the property signature to compute
9543 whether it is possible to implement a method or not.
9545 The reason is that calling PropertyInfo.GetGetMethod will return
9546 null (in .NET, in Mono it works, and we should change this), in
9547 cases where the Get Method does not exist in that particular
9552 class X { public virtual int A { get { return 1; } } }
9554 class Z : Y { public override int A { get { return 2; } } }
9556 Would fail in Z because the parent (Y) would not have the property
9557 defined. So we avoid this completely now (because the alternative
9558 fix was ugly and slow), and we now depend exclusively on the
9561 (PropertyBase.CheckBase): Use a method-base mechanism to find our
9562 reference method, instead of using the property.
9564 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
9565 routines are gone now.
9567 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
9568 names, they were incorrectly named.
9570 * cs-tokenizer.cs: Return are more gentle token on failure.
9572 * pending.cs (PendingImplementation.InterfaceMethod): This routine
9573 had an out-of-sync index variable, which caused it to remove from
9574 the list of pending methods the wrong method sometimes.
9576 2002-10-22 Miguel de Icaza <miguel@ximian.com>
9578 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
9579 CanWrite, because those refer to this particular instance of the
9580 property, and do not take into account the fact that we can
9581 override single members of a property.
9583 Constructor requires an EmitContext. The resolution process does
9584 not happen here, but we need to compute the accessors before,
9585 because the resolution does not always happen for properties.
9587 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
9588 subclass, before we did not update this flag, but we did update
9591 (GetAccessors): Drop this routine, as it did not work in the
9592 presence of partially overwritten set/get methods.
9594 Notice that this broke the cs1540 detection, but that will require
9597 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9601 * driver.cs: issue a warning instead of an error if we don't support
9602 debugging for the platform. Also ignore a couple of errors that may
9603 arise when trying to write the symbols. Undo my previous patch.
9605 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9607 * driver.cs: ignore /debug switch except for Unix platforms.
9609 2002-10-23 Nick Drochak <ndrochak@gol.com>
9611 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
9613 2002-10-21 Miguel de Icaza <miguel@ximian.com>
9615 * driver.cs: Do not make mcs-debug conditional, so we do not break
9618 * statement.cs (UsageVector.MergeChildren): I would like Martin to
9619 review this patch. But basically after all the children variables
9620 have been merged, the value of "Breaks" was not being set to
9621 new_breaks for Switch blocks. I think that it should be set after
9622 it has executed. Currently I set this to the value of new_breaks,
9623 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
9624 conservative, but I do not understand this code very well.
9626 I did not break anything in the build, so that is good ;-)
9628 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
9630 2002-10-20 Mark Crichton <crichton@gimp.org>
9632 * cfold.cs: Fixed compile blocker. Really fixed it this time.
9634 2002-10-20 Nick Drochak <ndrochak@gol.com>
9636 * cfold.cs: Fixed compile blocker.
9638 2002-10-20 Miguel de Icaza <miguel@ximian.com>
9640 * driver.cs: I was chekcing the key, not the file.
9642 2002-10-19 Ravi Pratap <ravi@ximian.com>
9644 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
9645 message that we were generating - we just need to silently return
9648 2002-10-19 Miguel de Icaza <miguel@ximian.com>
9650 * class.cs (Event.Define): Change my previous commit, as this
9651 breaks the debugger. This is a temporary hack, as it seems like
9652 the compiler is generating events incorrectly to begin with.
9654 * expression.cs (Binary.ResolveOperator): Added support for
9655 "U operator - (E x, E y)"
9657 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
9660 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
9661 init-only variables, but this path did not take into account that
9662 there might be also instance readonly variables. Correct this
9665 This fixes bug 32253
9667 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
9670 * driver.cs: Change the extension for modules to `netmodule'
9672 * cs-parser.jay: Improved slightly the location tracking for
9673 the debugger symbols.
9675 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
9676 modifiers that were specified instead of the hardcoded value
9677 (FamAndAssem). This was basically ignoring the static modifier,
9678 and others. Fixes 32429.
9680 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
9681 fixed a bug in the process (32476)
9683 * expression.cs (ArrayAccess.EmitAssign): Patch from
9684 hwang_rob@yahoo.ca that fixes bug 31834.3
9686 2002-10-18 Miguel de Icaza <miguel@ximian.com>
9688 * driver.cs: Make the module extension .netmodule.
9690 2002-10-16 Miguel de Icaza <miguel@ximian.com>
9692 * driver.cs: Report an error if the resource file is not found
9693 instead of crashing.
9695 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
9696 false, like Emit does.
9698 2002-10-16 Nick Drochak <ndrochak@gol.com>
9700 * typemanager.cs: Remove unused private member. Also reported mcs
9701 bug to report this as a warning like csc.
9703 2002-10-15 Martin Baulig <martin@gnome.org>
9705 * statement.cs (Statement.Emit): Made this a virtual method; emits
9706 the line number info and calls DoEmit().
9707 (Statement.DoEmit): New protected abstract method, formerly knows
9708 as Statement.Emit().
9710 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
9712 2002-10-11 Miguel de Icaza <miguel@ximian.com>
9714 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
9715 have fixed a remaining problem: not every AddXXXX was adding a
9716 fully qualified name.
9718 Now everyone registers a fully qualified name in the DeclSpace as
9719 being defined instead of the partial name.
9721 Downsides: we are slower than we need to be due to the excess
9722 copies and the names being registered this way.
9724 The reason for this is that we currently depend (on the corlib
9725 bootstrap for instance) that types are fully qualified, because
9726 we dump all the types in the namespace, and we should really have
9727 types inserted into the proper namespace, so we can only store the
9728 basenames in the defined_names array.
9730 2002-10-10 Martin Baulig <martin@gnome.org>
9732 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
9733 from bug #31834, see the bug report for a testcase which is
9736 2002-10-10 Martin Baulig <martin@gnome.org>
9738 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
9739 flow analysis code for this.
9741 * statement.cs (Do, While, For): Tell the flow analysis code about
9743 (FlowBranching.UsageVector): Added support for infinite loops.
9744 (Block.Resolve): Moved the dead code elimination here and use flow
9747 2002-10-09 Miguel de Icaza <miguel@ximian.com>
9749 * class.cs (Field.Define): Catch cycles on struct type
9752 * typemanager.cs (IsUnmanagedtype): Do not recursively check
9753 fields if the fields are static. We only need to check instance
9756 * expression.cs (As.DoResolve): Test for reference type.
9758 * statement.cs (Using.ResolveExpression): Use
9759 ConvertImplicitRequired, not ConvertImplicit which reports an
9761 (Using.ResolveLocalVariableDecls): ditto.
9763 * expression.cs (Binary.ResolveOperator): Report errors in a few
9764 places where we had to.
9766 * typemanager.cs (IsUnmanagedtype): Finish implementation.
9768 2002-10-08 Miguel de Icaza <miguel@ximian.com>
9770 * expression.cs: Use StoreFromPtr instead of extracting the type
9771 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
9773 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
9774 an enumeration value to a System.Enum, but System.Enum is not a
9775 value type, but an class type, so we need to box.
9777 (Expression.ConvertExplicit): One codepath could return
9778 errors but not flag them. Fix this. Fixes #31853
9780 * parameter.cs (Resolve): Do not allow void as a parameter type.
9782 2002-10-06 Martin Baulig <martin@gnome.org>
9784 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
9785 if it's a class type and not a struct. Fixes #31815.
9787 2002-10-06 Martin Baulig <martin@gnome.org>
9789 * statement.cs: Reworked the flow analysis code a bit to make it
9790 usable for dead code elimination.
9792 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9794 * cs-parser.jay: allow empty source files. Fixes bug #31781.
9796 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9798 * expression.cs (ComposedCast.DoResolveType): A quick workaround
9799 to fix the test 165, will investigate deeper.
9801 2002-10-04 Martin Baulig <martin@gnome.org>
9803 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
9804 finally blocks actually work.
9805 (Try.Resolve): We don't need to create a sibling for `finally' if
9806 there is no finally block.
9808 2002-10-04 Martin Baulig <martin@gnome.org>
9810 * class.cs (Constructor.Define): The default accessibility for a
9811 non-default constructor is private, not public.
9813 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9815 * class.cs (Constructor): Make AllowedModifiers public, add
9818 * cs-parser.jay: Perform the modifiers test here, as the
9819 constructor for the Constructor class usually receives a zero
9820 because of the way we create it (first we create, later we
9821 customize, and we were never checking the modifiers).
9823 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
9824 is a version of LookupTypeReflection that includes the type-name
9825 cache. This can be used as a fast path for functions that know
9826 the fully qualified name and are only calling into *.GetType() to
9827 obtain a composed type.
9829 This is also used by TypeManager.LookupType during its type
9832 (LookupType): We now also track the real type name, as sometimes
9833 we can get a quey for the real type name from things like
9834 ComposedCast. This fixes bug 31422.
9836 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
9837 complete type fullname, it does not have to go through the type
9838 resolution system to obtain the composed version of the type (for
9839 obtaining arrays or pointers).
9841 (Conditional.Emit): Use the EmitBoolExpression to
9842 generate nicer code, as requested by Paolo.
9844 (ArrayCreation.CheckIndices): Use the patch from
9845 hwang_rob@yahoo.ca to validate the array initializers.
9847 2002-10-03 Miguel de Icaza <miguel@ximian.com>
9849 * class.cs (ConstructorInitializer.Emit): simplify code by using
9850 Invocation.EmitCall, and at the same time, fix the bugs in calling
9851 parent constructors that took variable arguments.
9853 * ecore.cs (Expression.ConvertNumericExplicit,
9854 Expression.ImplicitNumericConversion): Remove the code that
9855 manually wrapped decimal (InternalTypeConstructor call is now gone
9858 * expression.cs (Cast.TryReduce): Also handle decimal types when
9859 trying to perform a constant fold on the type.
9861 * typemanager.cs (IsUnmanagedtype): Partially implemented.
9863 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
9864 that only turned off an error report, and did nothing else.
9866 2002-10-02 Miguel de Icaza <miguel@ximian.com>
9868 * driver.cs: Handle and ignore /fullpaths
9870 2002-10-01 Miguel de Icaza <miguel@ximian.com>
9872 * expression.cs (Binary.ResolveOperator): Catch the case where
9873 DoNumericPromotions returns true,
9875 (Binary.DoNumericPromotions): Simplify the code, and the tests.
9877 2002-09-27 Miguel de Icaza <miguel@ximian.com>
9879 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
9882 2002-09-26 Miguel de Icaza <miguel@ximian.com>
9884 * ecore.cs (ConvertNumericExplicit): It is not enough that the
9885 conversion exists, but it is also required that the conversion be
9886 performed. This manifested in "(Type64Enum) 2".
9888 * class.cs (TypeManager.AddMethod): The fix is not to change
9889 AddEnum, because that one was using a fully qualified name (every
9890 DeclSpace derivative does), but to change the AddMethod routine
9891 that was using an un-namespaced name. This now correctly reports
9892 the duplicated name.
9894 Revert patch until I can properly fix it. The issue
9895 is that we have a shared Type space across all namespaces
9896 currently, which is wrong.
9898 Options include making the Namespace a DeclSpace, and merge
9899 current_namespace/current_container in the parser.
9901 2002-09-25 Miguel de Icaza <miguel@ximian.com>
9903 * cs-parser.jay: Improve error reporting when we get a different
9904 kind of expression in local_variable_type and
9905 local_variable_pointer_type.
9907 Propagate this to avoid missleading errors being reported.
9909 * ecore.cs (ImplicitReferenceConversion): treat
9910 TypeManager.value_type as a target just like object_type. As
9915 Is valid, and needs to result in the int 1 being boxed before it
9916 is assigned to the value type v.
9918 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
9919 to validate the enumeration name.
9921 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
9922 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
9923 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
9925 * ecore.cs (TryImplicitIntConversion): When doing an
9926 implicit-enumeration-conversion, check if the type is 64-bits and
9927 perform a conversion before passing to EnumConstant.
9929 2002-09-23 Miguel de Icaza <miguel@ximian.com>
9931 * decl.cs (Error_AmbiguousTypeReference); New routine used to
9932 report ambiguous type references. Unlike the MS version, we
9933 report what the ambiguity is. Innovation at work ;-)
9935 (DeclSpace.FindType): Require a location argument to
9936 display when we display an ambiguous error.
9938 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
9940 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
9942 * expression.cs (EmitDynamicInitializers): Apply patch from
9943 hwang_rob@yahoo.ca that fixes the order in which we emit our
9946 2002-09-21 Martin Baulig <martin@gnome.org>
9948 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
9949 delegate takes no arguments.
9951 2002-09-20 Miguel de Icaza <miguel@ximian.com>
9953 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
9956 * expression.cs: Extract the underlying type.
9958 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
9960 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
9962 2002-09-19 Miguel de Icaza <miguel@ximian.com>
9964 * class.cs (TypeContainer.DefineType): We can not use the nice
9965 PackingSize with the size set to 1 DefineType method, because it
9966 will not allow us to define the interfaces that the struct
9969 This completes the fixing of bug 27287
9971 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
9972 means also structs. This fixes part of the problem.
9973 (Expresion.ImplicitReferenceConversionExists): ditto.
9975 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
9976 error if there were no errors reported during the type lookup
9977 process, to avoid duplicates or redundant errors. Without this
9978 you would get an ambiguous errors plus a type not found. We have
9979 beaten the user enough with the first error.
9981 (DeclSparce.FindType): Emit a warning if we have an ambiguous
9984 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
9985 during the resolution process, stop the lookup, this avoids
9986 repeated error reports (same error twice).
9988 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
9990 * typemanager.cs (LookupType): Redo the type lookup code to match
9991 the needs of System.Reflection.
9993 The issue is that System.Reflection requires references to nested
9994 types to begin with a "+" sign instead of a dot. So toplevel
9995 types look like: "NameSpace.TopLevelClass", and nested ones look
9996 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
9999 2002-09-19 Martin Baulig <martin@gnome.org>
10001 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
10002 says that a method always returns or always throws an exception,
10003 don't report the CS0161.
10005 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
10006 set `Returns = new_returns'.
10008 2002-09-19 Martin Baulig <martin@gnome.org>
10010 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
10011 to an enum constant, check for a CS0176.
10013 2002-09-18 Miguel de Icaza <miguel@ximian.com>
10015 * class.cs (TypeContainer.CheckPairedOperators): Now we check
10016 for operators that must be in pairs and report errors.
10018 * ecore.cs (SimpleName.DoResolveType): During the initial type
10019 resolution process, when we define types recursively, we must
10020 check first for types in our current scope before we perform
10021 lookups in the enclosing scopes.
10023 * expression.cs (MakeByteBlob): Handle Decimal blobs.
10025 (Invocation.VerifyArgumentsCompat): Call
10026 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
10027 I thought we were supposed to always call this, but there are a
10028 few places in the code where we dont do it.
10030 2002-09-17 Miguel de Icaza <miguel@ximian.com>
10032 * driver.cs: Add support in -linkres and -resource to specify the
10033 name of the identifier.
10035 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10037 * ecore.cs (StandardConversionExists): Sync with the conversion
10038 code: allow anything-* to void* conversions.
10040 (FindMostSpecificSource): Use an Expression argument
10041 instead of a Type, because we might be handed over a Literal which
10042 gets a few more implicit conversions that plain types do not. So
10043 this information was being lost.
10045 Also, we drop the temporary type-holder expression when not
10048 2002-09-17 Martin Baulig <martin@gnome.org>
10050 * class.cs (PropertyBase.CheckBase): Don't check the base class if
10051 this is an explicit interface implementation.
10053 2002-09-17 Martin Baulig <martin@gnome.org>
10055 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
10056 different `IndexerName' attributes.
10058 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
10059 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
10060 virtual CommonResolve().
10062 2002-09-16 Miguel de Icaza <miguel@ximian.com>
10064 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
10065 and convert that to the UnderlyingType.
10067 * statement.cs (Foreach.Resolve): Indexers are just like variables
10068 or PropertyAccesses.
10070 * cs-tokenizer.cs (consume_string): Track line numbers and columns
10071 inside quoted strings, we were not doing this before.
10073 2002-09-16 Martin Baulig <martin@gnome.org>
10075 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
10076 resolve it. This is needed for the definite assignment check of the
10077 instance expression, fixes bug #29846.
10078 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
10080 2002-09-16 Nick Drochak <ndrochak@gol.com>
10082 * parameter.cs: Fix compile error. Cannot reference static member
10083 from an instance object. Is this an mcs bug?
10085 2002-09-14 Martin Baulig <martin@gnome.org>
10087 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
10088 multiple times. Fixes bug #30295, added test-166.cs.
10090 2002-09-14 Martin Baulig <martin@gnome.org>
10092 * statement.cs (Block.Emit): Don't emit unreachable code.
10093 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
10094 `break' statements.
10095 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
10097 2002-09-14 Martin Baulig <martin@gnome.org>
10099 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
10102 2002-09-14 Martin Baulig <martin@gnome.org>
10104 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
10105 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
10106 be false on the ms runtime.
10108 2002-09-13 Martin Baulig <martin@gnome.org>
10110 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
10111 the CS0038 error message.
10113 2002-09-12 Miguel de Icaza <miguel@ximian.com>
10115 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
10116 constant inside, return it.
10118 2002-09-12 Martin Baulig <martin@gnome.org>
10120 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10121 implicit conversion can be done between enum types.
10123 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10124 check whether an implicit conversion to the current enum's UnderlyingType
10125 exists and report an error if not.
10127 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10128 without debugging support.
10130 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10131 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10133 2002-09-12 Martin Baulig <martin@gnome.org>
10135 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10137 * ecore.cs (IMemberExpr.DeclaringType): New property.
10138 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10139 nonstatic member of an outer type (CS0038).
10141 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10143 * driver.cs: Activate the using-error detector at warning level
10144 4 (at least for MS-compatible APIs).
10146 * namespace.cs (VerifyUsing): Small buglett fix.
10148 * pending.cs (PendingImplementation): pass the container pointer.
10150 * interface.cs (GetMethods): Allow for recursive definition. Long
10151 term, I would like to move every type to support recursive
10152 definitions, not the current ordering mechanism that we have right
10155 The situation is this: Attributes are handled before interfaces,
10156 so we can apply attributes to interfaces. But some attributes
10157 implement interfaces, we will now handle the simple cases
10158 (recursive definitions will just get an error).
10160 * parameter.cs: Only invalidate types at the end if we fail to
10163 2002-09-09 Martin Baulig <martin@gnome.org>
10165 * ecore.cs (PropertyExpr.Emit): Also check for
10166 TypeManager.system_int_array_get_length so this'll also work when
10167 compiling corlib. Fixes #30003.
10169 2002-09-09 Martin Baulig <martin@gnome.org>
10171 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10172 and throw an exception if we can't get the type's size. Fixed #30040,
10175 2002-09-09 Martin Baulig <martin@gnome.org>
10177 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10179 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10180 context. Fixes bug #30027.
10182 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10183 virtual functions. Fixes bug #30043, added test-164.cs.
10185 2002-09-08 Ravi Pratap <ravi@ximian.com>
10187 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10189 2002-09-08 Nick Drochak <ndrochak@gol.com>
10191 * driver.cs: Use an object to get the windows codepage since it's not a
10194 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10196 * statement.cs (For.Emit): for infinite loops (test == null)
10197 return whether there is a break inside, not always "true".
10199 * namespace.cs (UsingEntry): New struct to hold the name of the
10200 using definition, the location where it is defined, and whether it
10201 has been used in a successful type lookup.
10203 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10208 2002-09-06 Ravi Pratap <ravi@ximian.com>
10210 * attribute.cs : Fix incorrect code which relied on catching
10211 a NullReferenceException to detect a null being passed in
10212 where an object was expected.
10214 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10216 * statement.cs (Try): flag the catch variable as assigned
10218 * expression.cs (Cast): Simplified by using ResolveType instead of
10219 manually resolving.
10221 * statement.cs (Catch): Fix bug by using ResolveType.
10223 2002-09-06 Ravi Pratap <ravi@ximian.com>
10225 * expression.cs (BetterConversion): Special case for when we have
10226 a NullLiteral as the argument and we have to choose between string
10227 and object types - we choose string the way csc does.
10229 * attribute.cs (Attribute.Resolve): Catch the
10230 NullReferenceException and report error #182 since the Mono
10231 runtime no more has the bug and having this exception raised means
10232 we tried to select a constructor which takes an object and is
10235 2002-09-05 Ravi Pratap <ravi@ximian.com>
10237 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10238 message (1502, 1503) when we can't locate a method after overload
10239 resolution. This is much more informative and closes the bug
10242 * interface.cs (PopulateMethod): Return if there are no argument
10243 types. Fixes a NullReferenceException bug.
10245 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10246 expressions too. Previously we were checking only in one place for
10247 positional arguments leaving out named arguments.
10249 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10250 type to the enum type is not allowed. Remove code corresponding to
10253 (ConvertNumericExplicit): Allow explicit conversions from
10254 the underlying type to enum type. This precisely follows the spec
10255 and closes a bug filed by Gonzalo.
10257 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10260 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10262 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10264 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10265 it was important that we stored the right value after the
10266 reduction in `converted'.
10268 2002-09-04 Martin Baulig <martin@gnome.org>
10270 * location.cs (Location.SymbolDocument): Use full pathnames for the
10273 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10275 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10276 of the expression resolve mechanism, because that will catch the
10277 SimpleName error failures.
10279 (Conditional): If we can not resolve the
10280 expression, return, do not crash.
10282 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10285 (location): display token name instead of its number.
10287 2002-08-28 Martin Baulig <martin@gnome.org>
10289 * expression.cs (Binary.ResolveOperator): Don't silently return
10290 but return an error if an operator cannot be applied between two
10293 2002-08-28 Martin Baulig <martin@gnome.org>
10295 * class.cs (Constructor.Define): Set the permission attributes
10296 correctly instead of making all constructors public.
10298 2002-08-28 Martin Baulig <martin@gnome.org>
10300 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10301 for private members before reporting a CS0103; if we find anything,
10304 2002-08-28 Martin Baulig <martin@gnome.org>
10306 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10307 to check whether `closure_start_type == closure_invocation_type',
10308 we also need to check whether `m.DeclaringType == closure_invocation_type'
10309 before bypassing the permission checks. We might be accessing
10310 protected/private members from the base class.
10311 (TypeManager.RealMemberLookup): Only set private_ok if private
10312 members were requested via BindingFlags.NonPublic.
10314 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10316 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10317 MethodGroupExpr.IsExplicitImpl if appropriate.
10318 (Invocation.DoResolve): Don't report the CS0120 for explicit
10319 interface implementations.
10321 2002-08-27 Martin Baulig <martin@gnome.org>
10323 * expression.cs (Invocation.DoResolve): If this is a static
10324 method and we don't have an InstanceExpression, we must report
10327 2002-08-25 Martin Baulig <martin@gnome.org>
10329 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10330 `==' between a valuetype and an object.
10332 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10334 * ecore.cs (TypeExpr): Provide a ToString method.
10336 2002-08-24 Martin Baulig <martin@gnome.org>
10338 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10339 now called proggie.dbg and it's a binary file.
10341 2002-08-23 Martin Baulig <martin@gnome.org>
10343 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10345 2002-08-23 Martin Baulig <martin@gnome.org>
10347 * struct.cs (MyStructInfo.ctor): Make this work with empty
10348 structs; it's not allowed to use foreach() on null.
10350 2002-08-23 Martin Baulig <martin@gnome.org>
10352 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10353 writer the full pathname of the generated assembly.
10355 2002-08-23 Martin Baulig <martin@gnome.org>
10357 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10358 A `finally' block never returns or breaks; improved handling of
10361 2002-08-23 Martin Baulig <martin@gnome.org>
10363 * statement.cs (Throw.Resolve): Allow `throw null'.
10365 2002-08-23 Martin Baulig <martin@gnome.org>
10367 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10368 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10369 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10370 MemberLookup would return a wrong event if this is an explicit
10371 interface implementation and the class has an event with the same
10374 2002-08-23 Martin Baulig <martin@gnome.org>
10376 * statement.cs (Block.AddChildVariableNames): New public method.
10377 (Block.AddChildVariableName): Likewise.
10378 (Block.IsVariableNameUsedInChildBlock): Likewise.
10379 (Block.AddVariable): Check whether a variable name has already
10380 been used in a child block.
10382 * cs-parser.jay (declare_local_variables): Mark all variable names
10383 from the current block as being used in a child block in the
10386 2002-08-23 Martin Baulig <martin@gnome.org>
10388 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10389 find the symbol writer.
10391 * driver.cs: csc also allows the arguments to /define being
10392 separated by commas, not only by semicolons.
10394 2002-08-23 Martin Baulig <martin@gnome.org>
10396 * interface.cs (Interface.GetMembers): Added static check for events.
10398 2002-08-15 Martin Baulig <martin@gnome.org>
10400 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10401 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10403 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10404 why the MethodData.EmitDestructor() change was necessary.
10406 2002-08-20 Martin Baulig <martin@gnome.org>
10408 * class.cs (TypeContainer.FindMembers): Added static check for events.
10410 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10412 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10413 use Type.GetEvents(), not Type.FindMembers().
10415 2002-08-20 Martin Baulig <martin@gnome.org>
10417 * decl.cs (MemberCache): Added a special method cache which will
10418 be used for method-only searched. This ensures that a method
10419 search will return a MethodInfo with the correct ReflectedType for
10422 2002-08-20 Martin Baulig <martin@gnome.org>
10424 * decl.cs (DeclSpace.FindMembers): Made this public.
10426 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10428 * delegate.cs: fixed build on windows.
10429 [FIXME: Filed as bug #29150: MCS must report these errors.]
10431 2002-08-19 Ravi Pratap <ravi@ximian.com>
10433 * ecore.cs (StandardConversionExists): Return a false
10434 if we are trying to convert the void type to anything else
10435 since that is not allowed.
10437 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10438 we flag error 70 in the event an event is trying to be accessed
10439 directly from outside the declaring type.
10441 2002-08-20 Martin Baulig <martin@gnome.org>
10443 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10444 MemberCache from typemanager.cs to decl.cs.
10446 2002-08-19 Martin Baulig <martin@gnome.org>
10448 * class.cs (TypeContainer): Implement IMemberContainer.
10449 (TypeContainer.DefineMembers): Create the MemberCache.
10450 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10451 return public members if BindingFlags.Public was given, check
10452 whether members are static.
10454 2002-08-16 Martin Baulig <martin@gnome.org>
10456 * decl.cs (DeclSpace.Define): Splitted this in Define and
10457 DefineMembers. DefineMembers is called first and initializes the
10460 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10461 DefineMembers() on all our DeclSpaces.
10463 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10464 but call DefineMembers() on all nested interfaces. We call their
10465 Define() in our new Define() function.
10467 * interface.cs (Interface): Implement IMemberContainer.
10468 (Interface.Define): Moved all code except the attribute stuf to
10470 (Interface.DefineMembers): Initialize the member cache.
10472 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10473 need this anymore since we can use MemberCache.FindMembers directly.
10475 2002-08-19 Martin Baulig <martin@gnome.org>
10477 * typemanager.cs (MemberCache): When creating the cache for an
10478 interface type, add all inherited members.
10479 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10480 to `out bool used_cache' and documented it.
10481 (TypeManager.MemberLookup): If we already used the cache in the first
10482 iteration, we don't need to do the interfaces check.
10484 2002-08-19 Martin Baulig <martin@gnome.org>
10486 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10487 here from IMemberFinder and don't implement this interface anymore.
10488 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10490 * typemanager.cs (IMemberFinder): This interface is now only used by
10491 classes which actually support the member cache.
10492 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10493 since we only put DeclSpaces into this Hashtable.
10494 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10495 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10497 2002-08-16 Martin Baulig <martin@gnome.org>
10499 * typemanager.cs (ICachingMemberFinder): Removed.
10500 (IMemberFinder.MemberCache): New property.
10501 (TypeManager.FindMembers): Merged this with RealFindMembers().
10502 This function will never be called from TypeManager.MemberLookup()
10503 so we can't use the cache here, just the IMemberFinder.
10504 (TypeManager.MemberLookup_FindMembers): Check whether the
10505 IMemberFinder has a MemberCache and call the cache's FindMembers
10507 (MemberCache): Rewrote larger parts of this yet another time and
10508 cleaned it up a bit.
10510 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10512 * driver.cs (LoadArgs): Support quoting.
10514 (Usage): Show the CSC-like command line arguments.
10516 Improved a few error messages.
10518 2002-08-15 Martin Baulig <martin@gnome.org>
10520 * typemanager.cs (IMemberContainer.Type): New property.
10521 (IMemberContainer.IsInterface): New property.
10523 The following changes are conditional to BROKEN_RUNTIME, which is
10524 defined at the top of the file.
10526 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10527 class'es members, but add all members from TypeHandle.ObjectType
10528 if we're an interface.
10529 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10530 is the current type.
10531 (MemberCache.CacheEntry.Container): Removed this field.
10532 (TypeHandle.GetMembers): Include inherited members.
10534 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10536 * typemanager.cs: fixed compilation and added a comment on a field that
10539 2002-08-15 Martin Baulig <martin@gnome.org>
10541 * class.cs (ConstructorInitializer.Resolve): In the
10542 Expression.MemberLookup call, use the queried_type as
10545 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10546 declared' attribute, it's always true.
10547 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10548 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10549 temporary wrapper for FindMembers which tells MemberLookup whether
10550 members from the base classes are included in the return value.
10551 This will go away soon.
10552 (TypeManager.MemberLookup): Use this temporary hack here; once the
10553 new MemberCache is completed, we don't need to do the DeclaredOnly
10554 looping here anymore since the MemberCache will take care of this.
10555 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10556 (MemberCache): When creating the MemberCache for a class, get
10557 members from the current class and all its base classes.
10558 (MemberCache.CacheEntry.Container): New field. This is a
10559 temporary hack until the Mono runtime is fixed to distinguish
10560 between ReflectedType and DeclaringType. It allows us to use MCS
10561 with both the MS runtime and the unfixed Mono runtime without
10562 problems and without accecting performance.
10563 (MemberCache.SearchMembers): The DeclaredOnly looping from
10564 TypeManager.MemberLookup is now done here.
10566 2002-08-14 Martin Baulig <martin@gnome.org>
10568 * statement.cs (MyStructInfo.MyStructInfo): Don't call
10569 Type.GetFields on dynamic types but get the fields from the
10570 corresponding TypeContainer.
10571 (MyStructInfo.GetStructInfo): Added check for enum types.
10573 * typemanager.cs (MemberList.IsSynchronized): Implemented.
10574 (MemberList.SyncRoot): Implemented.
10575 (TypeManager.FilterWithClosure): No need to check permissions if
10576 closure_start_type == closure_invocation_type, don't crash if
10577 closure_invocation_type is null.
10579 2002-08-13 Martin Baulig <martin@gnome.org>
10581 Rewrote TypeContainer.FindMembers to use a member cache. This
10582 gives us a speed increase of about 35% for the self-hosting MCS
10583 build and of about 15-20% for the class libs (both on GNU/Linux).
10585 * report.cs (Timer): New class to get enhanced profiling. This
10586 whole class is "TIMER" conditional since it remarkably slows down
10589 * class.cs (MemberList): New class. This is an IList wrapper
10590 which we're now using instead of passing MemberInfo[]'s around to
10591 avoid copying this array unnecessarily.
10592 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
10593 (ICachingMemberFinder, IMemberContainer): New interface.
10594 (TypeManager.FilterWithClosure): If `criteria' is null, the name
10595 has already been checked, otherwise use it for the name comparision.
10596 (TypeManager.FindMembers): Renamed to RealMemberFinder and
10597 provided wrapper which tries to use ICachingMemberFinder.FindMembers
10598 if possible. Returns a MemberList, not a MemberInfo [].
10599 (TypeHandle): New class, implements IMemberContainer. We create
10600 one instance of this class per type, it contains a MemberCache
10601 which is used to do the member lookups.
10602 (MemberCache): New class. Each instance of this class contains
10603 all members of a type and a name-based hash table.
10604 (MemberCache.FindMembers): This is our new member lookup
10605 function. First, it looks up all members of the requested name in
10606 the hash table. Then, it walks this list and sorts out all
10607 applicable members and returns them.
10609 2002-08-13 Martin Baulig <martin@gnome.org>
10611 In addition to a nice code cleanup, this gives us a performance
10612 increase of about 1.4% on GNU/Linux - not much, but it's already
10613 half a second for the self-hosting MCS compilation.
10615 * typemanager.cs (IMemberFinder): New interface. It is used by
10616 TypeManager.FindMembers to call FindMembers on a TypeContainer,
10617 Enum, Delegate or Interface.
10618 (TypeManager.finder_to_member_finder): New PtrHashtable.
10619 (TypeManager.finder_to_container): Removed.
10620 (TypeManager.finder_to_delegate): Removed.
10621 (TypeManager.finder_to_interface): Removed.
10622 (TypeManager.finder_to_enum): Removed.
10624 * interface.cs (Interface): Implement IMemberFinder.
10626 * delegate.cs (Delegate): Implement IMemberFinder.
10628 * enum.cs (Enum): Implement IMemberFinder.
10630 * class.cs (TypeContainer): Implement IMemberFinder.
10632 2002-08-12 Martin Baulig <martin@gnome.org>
10634 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
10636 2002-08-12 Martin Baulig <martin@gnome.org>
10638 * ecore.cs (ITypeExpression): New interface for expressions which
10640 (TypeExpression): Renamed to TypeLookupExpression.
10641 (Expression.DoResolve): If we're doing a types-only lookup, the
10642 expression must implement the ITypeExpression interface and we
10643 call DoResolveType() on it.
10644 (SimpleName): Implement the new ITypeExpression interface.
10645 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
10646 hack, the situation that we're only looking up types can't happen
10647 anymore when this method is called. Moved the type lookup code to
10648 DoResolveType() and call it.
10649 (SimpleName.DoResolveType): This ITypeExpression interface method
10650 is now doing the types-only lookup.
10651 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
10652 (ResolveFlags): Added MaskExprClass.
10654 * expression.cs (MemberAccess): Implement the ITypeExpression
10656 (MemberAccess.DoResolve): Added support for a types-only lookup
10657 when we're called via ITypeExpression.DoResolveType().
10658 (ComposedCast): Implement the ITypeExpression interface.
10660 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
10661 Expression.Resolve() with ResolveFlags.Type instead.
10663 2002-08-12 Martin Baulig <martin@gnome.org>
10665 * interface.cs (Interface.Define): Apply attributes.
10667 * attribute.cs (Attribute.ApplyAttributes): Added support for
10668 interface attributes.
10670 2002-08-11 Martin Baulig <martin@gnome.org>
10672 * statement.cs (Block.Emit): Only check the "this" variable if we
10673 do not always throw an exception.
10675 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
10676 whether the property has a set accessor.
10678 2002-08-11 Martin Baulig <martin@gnome.org>
10680 Added control flow analysis support for structs.
10682 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
10683 with control flow analysis turned off.
10684 (IVariable): New interface.
10685 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
10686 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
10687 (FieldExpr.DoResolve): Resolve the instance expression with flow
10688 analysis turned off and do the definite assignment check after the
10689 resolving when we know what the expression will resolve to.
10691 * expression.cs (LocalVariableReference, ParameterReference):
10692 Implement the new IVariable interface, only call the flow analysis
10693 code if ec.DoFlowAnalysis is true.
10694 (This): Added constructor which takes a Block argument. Implement
10695 the new IVariable interface.
10696 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
10697 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
10698 This does the definite assignment checks for struct members.
10700 * class.cs (Constructor.Emit): If this is a non-static `struct'
10701 constructor which doesn't have any initializer, call
10702 Block.AddThisVariable() to tell the flow analysis code that all
10703 struct elements must be initialized before control returns from
10706 * statement.cs (MyStructInfo): New public class.
10707 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
10708 argument to this indexer. If non-zero, check an individual struct
10709 member, not the whole struct.
10710 (FlowBranching.CheckOutParameters): Check struct members.
10711 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
10712 overloaded versions of these methods which take an additional
10713 `int field_idx' argument to check struct members.
10714 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
10715 overloaded versions of these methods which take an additional
10716 `string field_name' argument to check struct member.s
10717 (VariableInfo): Implement the IVariable interface.
10718 (VariableInfo.StructInfo): New public property. Returns the
10719 MyStructInfo instance of the variable if it's a struct or null.
10720 (Block.AddThisVariable): New public method. This is called from
10721 Constructor.Emit() for non-static `struct' constructor which do
10722 not have any initializer. It creates a special variable for the
10723 "this" instance variable which will be checked by the flow
10724 analysis code to ensure that all of the struct's fields are
10725 initialized before control returns from the constructor.
10726 (UsageVector): Added support for struct members. If a
10727 variable/parameter is a struct with N members, we reserve a slot
10728 in the usage vector for each member. A struct is considered fully
10729 initialized if either the struct itself (slot 0) or all its
10730 members are initialized.
10732 2002-08-08 Martin Baulig <martin@gnome.org>
10734 * driver.cs (Driver.MainDriver): Only report an error CS5001
10735 if there were no compilation errors.
10737 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
10738 `UnsafeContext' property to determine whether the parent is in
10739 unsafe context rather than checking the parent's ModFlags:
10740 classes nested in an unsafe class are unsafe as well.
10742 2002-08-08 Martin Baulig <martin@gnome.org>
10744 * statement.cs (UsageVector.MergeChildren): Distinguish between
10745 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
10746 we return. Added test17() and test18() to test-154.cs.
10748 2002-08-08 Martin Baulig <martin@gnome.org>
10750 * typemanager.cs (TypeManager.FilterWithClosure): If we have
10751 Family access, make sure the invoking type isn't a subclass of the
10752 queried type (that'd be a CS1540).
10754 * ecore.cs (Expression.MemberLookup): Added overloaded version of
10755 this method which takes an additional `Type invocation_type'.
10757 * expression.cs (BaseAccess.DoResolve): Use the base type as
10758 invocation and query type.
10759 (MemberAccess.DoResolve): If the lookup failed and we're about to
10760 report a CS0122, try a lookup with the ec.ContainerType - if this
10761 succeeds, we must report a CS1540.
10763 2002-08-08 Martin Baulig <martin@gnome.org>
10765 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
10766 (MethodGroupExpr): Implement the IMemberExpr interface.
10768 * expression (MemberAccess.ResolveMemberAccess): No need to have
10769 any special code for MethodGroupExprs anymore, they're now
10772 2002-08-08 Martin Baulig <martin@gnome.org>
10774 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
10775 Family, FamANDAssem and FamORAssem permissions.
10776 (TypeManager.IsSubclassOrNestedChildOf): New public method.
10778 2002-08-08 Martin Baulig <martin@gnome.org>
10780 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
10781 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
10784 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
10786 * driver.cs: implemented /resource option to embed managed resources.
10788 2002-08-07 Martin Baulig <martin@gnome.org>
10790 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
10791 (FieldBase.HasFieldInitializer): New public property.
10792 (FieldBase.GetInitializerExpression): New public method. Resolves and
10793 returns the field initializer and makes sure it is only resolved once.
10794 (TypeContainer.EmitFieldInitializers): Call
10795 FieldBase.GetInitializerExpression to get the initializer, this ensures
10796 that it isn't resolved multiple times.
10798 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
10799 the resolving process (SimpleName/MemberLookup) that we're currently
10800 emitting a field initializer (which must not access any instance members,
10801 this is an error CS0236).
10803 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
10804 argument, if the `IsFieldInitializer' flag is set, we must report and
10805 error CS0236 and not an error CS0120.
10807 2002-08-07 Martin Baulig <martin@gnome.org>
10809 * ecore.cs (IMemberExpr): New public interface.
10810 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
10811 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
10812 if the expression is an IMemberExpr.
10814 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
10815 to be null, implicitly default to `this' if we're non-static in
10816 this case. Simplified the code a lot by using the new IMemberExpr
10817 interface. Also fixed bug #28176 here.
10819 2002-08-06 Martin Baulig <martin@gnome.org>
10821 * cs-parser.jay (SimpleLookup): Removed. We need to create
10822 ParameterReferences during semantic analysis so that we can do a
10823 type-only search when resolving Cast, TypeOf and SizeOf.
10824 (block): Pass the `current_local_parameters' to the Block's
10827 * class.cs (ConstructorInitializer): Added `Parameters parameters'
10828 argument to the constructor.
10829 (ConstructorInitializer.Resolve): Create a temporary implicit
10830 block with the parameters.
10832 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
10833 references here if we aren't doing a type-only search.
10835 * statement.cs (Block): Added constructor which takes a
10836 `Parameters parameters' argument.
10837 (Block.Parameters): New public property.
10839 * support.cs (InternalParameters.Parameters): Renamed `parameters'
10840 to `Parameters' and made it public readonly.
10842 2002-08-06 Martin Baulig <martin@gnome.org>
10844 * ecore.cs (Expression.Warning): Made this public as well.
10846 * report.cs (Report.Debug): Print the contents of collections.
10848 2002-08-06 Martin Baulig <martin@gnome.org>
10850 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
10851 used to tell Resolve() which kinds of expressions it may return.
10852 (Expression.Resolve): Added overloaded version of this method which
10853 takes a `ResolveFlags flags' argument. This can be used to tell
10854 Resolve() which kinds of expressions it may return. Reports a
10856 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
10857 ResolveFlags.SimpleName.
10858 (Expression.Error118): Added overloaded version of this method which
10859 takes a `ResolveFlags flags' argument. It uses the flags to determine
10860 which kinds of expressions are allowed.
10862 * expression.cs (Argument.ResolveMethodGroup): New public method.
10863 Resolves an argument, but allows a MethodGroup to be returned.
10864 This is used when invoking a delegate.
10866 * TODO: Updated a bit.
10868 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10870 Fixed compilation with csc.
10872 * ecore.cs: Expression.Error made public. Is this correct? Should
10873 Warning be made public too?
10875 * expression.cs: use ea.Location instead of ea.loc.
10876 [FIXME: Filed as bug #28607: MCS must report these errors.]
10878 2002-08-06 Martin Baulig <martin@gnome.org>
10880 * ecore.cs (Expression.loc): Moved the location here instead of
10881 duplicating it in all derived classes.
10882 (Expression.Location): New public property.
10883 (Expression.Error, Expression.Warning): Made them non-static and
10884 removed the location argument.
10885 (Expression.Warning): Added overloaded version which takes an
10886 `int level' argument.
10887 (Expression.Error118): Make this non-static and removed the
10888 expression and location arguments.
10889 (TypeExpr): Added location argument to the constructor.
10891 * expression.cs (StaticCallExpr): Added location argument to
10893 (Indirection, PointerArithmetic): Likewise.
10894 (CheckedExpr, UnCheckedExpr): Likewise.
10895 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
10896 (StringPtr): Likewise.
10899 2002-08-05 Martin Baulig <martin@gnome.org>
10901 * expression.cs (BaseAccess.DoResolve): Actually report errors.
10903 * assign.cs (Assign.DoResolve): Check whether the source
10904 expression is a value or variable.
10906 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
10907 while resolving the corresponding blocks.
10909 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
10910 an error, don't silently return null.
10912 * statement.cs (Block.AddVariable): Do the error reporting here
10913 and distinguish between CS0128 and CS0136.
10914 (Block.DoResolve): Report all unused labels (warning CS0164).
10915 (LabeledStatement): Pass the location to the constructor.
10916 (LabeledStatement.HasBeenReferenced): New property.
10917 (LabeledStatement.Resolve): Set it to true here.
10919 * statement.cs (Return.Emit): Return success even after reporting
10920 a type mismatch error (CS0126 or CS0127), this is what csc does and
10921 it avoids confusing the users with any consecutive errors.
10923 2002-08-05 Martin Baulig <martin@gnome.org>
10925 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
10927 * const.cs (Const.LookupConstantValue): Catch circular definitions.
10929 * expression.cs (MemberAccess.DoResolve): Silently return if an
10930 error has already been reported.
10932 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
10933 error has already been reported.
10935 2002-08-05 Martin Baulig <martin@gnome.org>
10937 * statement.cs (UsageVector): Only initialize the `parameters'
10938 vector if we actually have any "out" parameters.
10940 2002-08-05 Martin Baulig <martin@gnome.org>
10942 * expression.cs (Binary.ResolveOperator): When combining delegates,
10943 they must have the same type.
10945 2002-08-05 Martin Baulig <martin@gnome.org>
10947 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
10948 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
10949 work with the ms runtime and we also don't need it: if we're a
10950 PropertyBuilder and not in the `indexer_arguments' hash, then we
10951 are a property and not an indexer.
10953 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
10954 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
10955 since the latter one doesn't work with the ms runtime.
10957 2002-08-03 Martin Baulig <martin@gnome.org>
10959 Fixed bugs #27998 and #22735.
10961 * class.cs (Method.IsOperator): New public field.
10962 (Method.CheckBase): Report CS0111 if there's already a method
10963 with the same parameters in the current class. Report CS0508 when
10964 attempting to change the return type of an inherited method.
10965 (MethodData.Emit): Report CS0179 if a method doesn't have a body
10966 and it's not marked abstract or extern.
10967 (PropertyBase): New abstract base class for Property and Indexer.
10968 (PropertyBase.CheckBase): Moved here from Property and made it work
10970 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
10971 the same so we can reuse it there.
10972 (Property, Indexer): Derive from PropertyBase.
10973 (MethodSignature.inheritable_property_signature_filter): New delegate
10974 to find properties and indexers.
10976 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
10977 argument and improved error reporting.
10979 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
10980 EmptyReadOnlyParameters and made it a property.
10982 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
10983 version of this method which takes a `PropertyInfo indexer'.
10984 (TypeManager.RegisterIndexer): New method.
10986 * class.cs: Added myself as author of this file :-)
10988 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10990 * class.cs: fixed compilation on windoze.
10992 2002-08-03 Martin Baulig <martin@gnome.org>
10994 * interface.cs (Interface.GetInterfaceBases): Check whether all
10995 base interfaces are at least as accessible than the current one.
10997 * class.cs (TypeContainer.GetClassBases): Check whether base types
10998 are at least as accessible than the current type.
10999 (TypeContainer.AsAccessible): Implemented and made non-static.
11000 (MemberBase.CheckParameters): Report errors if the accessibility
11003 * delegate.cs (Delegate.Delegate): The default visibility is
11004 internal for top-level types and private for nested types.
11005 (Delegate.Define): Report errors if the accessibility checks fail.
11007 * enum.cs (Enum.Enum): The default visibility is internal for
11008 top-level types and private for nested types.
11009 (Enum.DefineType): Compute the correct visibility.
11011 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
11012 function which takes a `bool is_toplevel' instead of a TypeContainer.
11014 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
11017 2002-08-02 Martin Baulig <martin@gnome.org>
11019 * expression.cs (LocalVariableReferenc): Added constructor which
11020 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
11021 (LocalVariableReference.IsReadOnly): New property.
11022 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
11023 variable is readonly, use our own readonly flag to do this; you can
11024 use the new constructor to get a writable reference to a read-only
11027 * cs-parser.jay (foreach_statement, using_statement): Get a writable
11028 reference to the local variable.
11030 2002-08-01 Miguel de Icaza <miguel@ximian.com>
11032 * rootcontext.cs (ResolveCore): Also include System.Exception
11034 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
11035 we reach an EmptyStatement.
11037 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
11040 * expression.cs (Binary.ResolveOperator): Check error result in
11043 use brtrue/brfalse directly and avoid compares to null.
11045 2002-08-02 Martin Baulig <martin@gnome.org>
11047 * class.cs (TypeContainer.Define): Define all nested interfaces here.
11048 Fixes bug #28407, added test-155.cs.
11050 2002-08-01 Martin Baulig <martin@gnome.org>
11052 * class.cs (Event.EmitDefaultMethod): Make this work with static
11053 events. Fixes #28311, added verify-3.cs.
11055 2002-08-01 Martin Baulig <martin@gnome.org>
11057 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
11058 `is_disposable' fields.
11059 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
11060 `hm.is_disposable' if we're using the collection pattern.
11061 (Foreach.EmitCollectionForeach): Use the correct type for the
11062 enumerator's local variable, only emit the try/finally block if
11063 necessary (fixes #27713).
11065 2002-08-01 Martin Baulig <martin@gnome.org>
11067 * ecore.cs (Expression.report118): Renamed to Error118 and made
11070 * statement.cs (Throw.Resolve): Check whether the expression is of
11071 the correct type (CS0118) and whether the type derives from
11072 System.Exception (CS0155).
11073 (Catch.Resolve): New method. Do the type lookup here and check
11074 whether it derives from System.Exception (CS0155).
11075 (Catch.CatchType, Catch.IsGeneral): New public properties.
11077 * typemanager.cs (TypeManager.exception_type): Added.
11079 2002-07-31 Miguel de Icaza <miguel@ximian.com>
11081 * driver.cs: Updated About function.
11083 2002-07-31 Martin Baulig <martin@gnome.org>
11085 Implemented Control Flow Analysis.
11087 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
11088 (EmitContext.CurrentBranching): Added.
11089 (EmitContext.StartFlowBranching): Added.
11090 (EmitContext.EndFlowBranching): Added.
11091 (EmitContext.KillFlowBranching): Added.
11092 (EmitContext.IsVariableAssigned): Added.
11093 (EmitContext.SetVariableAssigned): Added.
11094 (EmitContext.IsParameterAssigned): Added.
11095 (EmitContext.SetParameterAssigned): Added.
11096 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
11097 Added control flow analysis stuff here.
11099 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
11100 resolve the expression as lvalue.
11101 (LocalVariableReference.DoResolve): Check whether the variable has
11102 already been assigned.
11103 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
11104 the parameter as assigned here.
11105 (ParameterReference.DoResolve): Check whether the parameter has already
11107 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
11108 expression as lvalue.
11110 * statement.cs (FlowBranching): New class for the flow analysis code.
11111 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
11112 (LabeledStatement.IsDefined): New public property.
11113 (LabeledStatement.AddUsageVector): New public method to tell flow
11114 analyis that the label may be reached via a forward jump.
11115 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
11117 (VariableInfo.Number): New public field. This is used by flow analysis
11118 to number all locals of a block.
11119 (Block.CountVariables): New public property. This is the number of
11120 local variables in this block (including the locals from all parent
11122 (Block.EmitMeta): Number all the variables.
11124 * statement.cs: Added flow analysis support to all classes.
11126 2002-07-31 Martin Baulig <martin@gnome.org>
11128 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11129 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11130 then use this argument.
11132 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11134 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11135 use this to specify /define options.
11137 2002-07-29 Martin Baulig <martin@gnome.org>
11139 * statement.cs (Fixed): Moved all code that does variable lookups
11140 and resolvings from Emit to Resolve.
11142 * statement.cs (For): Moved all code that does variable lookups
11143 and resolvings from Emit to Resolve.
11145 * statement.cs (Using): Moved all code that does variable lookups
11146 and resolvings from Emit to Resolve.
11148 2002-07-29 Martin Baulig <martin@gnome.org>
11150 * attribute.cs (Attribute.Resolve): Explicitly catch a
11151 System.NullReferenceException when creating the
11152 CustromAttributeBuilder and report a different warning message.
11154 2002-07-29 Martin Baulig <martin@gnome.org>
11156 * support.cs (ParameterData.ParameterName): Added method to
11157 get the name of a parameter.
11159 * typemanager.cs (TypeManager.IsValueType): New public method.
11161 2002-07-29 Martin Baulig <martin@gnome.org>
11163 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11164 is a flag which specifies that it's either ref or out.
11165 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11166 the out parameter to `out Parameter.Modifier mod', also set the
11167 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11169 * support.cs (InternalParameters.ParameterModifier): Distinguish
11170 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11171 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11173 * expression.cs (Argument.GetParameterModifier): Distinguish
11174 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11175 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11177 2002-07-29 Martin Baulig <martin@gnome.org>
11179 * expression.cs (ParameterReference.ParameterReference): Added
11180 `Location loc' argument to the constructor.
11182 * cs-parser.jay: Pass location to ParameterReference.
11184 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11186 * statement.cs (Try): Initialize the location.
11188 * cs-parser.jay: pass location to Try.
11190 * expression.cs (Unary.Reduce): Change the prototype to return
11191 whether a constant fold could be performed or not. The result is
11192 returned in an out parameters. In the case of Indirection and
11193 AddressOf, we want to perform the full tests.
11195 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11197 * statement.cs (Statement.Emit): Flag dead code.
11199 2002-07-27 Andrew Birkett <andy@nobugs.org>
11201 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11203 2002-07-27 Martin Baulig <martin@gnome.org>
11205 * class.cs (MethodData.Define): Put back call to
11206 TypeManager.AddMethod(), accidentally commented this out.
11208 * report.cs (Debug): New public method to print debugging information,
11209 this is `[Conditional ("DEBUG")]'.
11211 2002-07-26 Martin Baulig <martin@gnome.org>
11213 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11214 (switch_statement): Push the current_block to the switch_stack and
11215 pop it again when we're done with the switch.
11216 (switch_section): The new block is a child of the current_block.
11217 Fixes bug #24007, added test-152.cs.
11219 2002-07-27 Martin Baulig <martin@gnome.org>
11221 * expression.cs (Invocation.EmitArguments): When calling a varargs
11222 function with only its fixed arguments, we need to pass an empty
11225 2002-07-27 Martin Baulig <martin@gnome.org>
11227 Mono 0.13 has been released.
11229 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11231 * driver.cs: Rename --resource to --linkres, because that is what
11232 we do currently, we dont support --resource yet.
11234 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11236 2002-07-25 Martin Baulig <martin@gnome.org>
11238 * class.cs (MethodData): New public class. This is a `method builder'
11239 class for a method or one accessor of a Property/Indexer/Event.
11240 (MethodData.GetMethodFlags): Moved here from MemberBase.
11241 (MethodData.ApplyAttributes): Likewise.
11242 (MethodData.ApplyObsoleteAttribute): Likewise.
11243 (MethodData.ApplyConditionalAttribute): Likewise.
11244 (MethodData.ApplyDllImportAttribute): Likewise.
11245 (MethodData.CheckAbstractAndExternal): Likewise.
11246 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11247 (MethodData.Emit): Formerly known as Method.Emit().
11248 (MemberBase): Moved everything which was specific to a single
11249 accessor/method to MethodData.
11250 (Method): Create a new MethodData and call Define() and Emit() on it.
11251 (Property, Indexer, Event): Create a new MethodData objects for each
11252 accessor and call Define() and Emit() on them.
11254 2002-07-25 Martin Baulig <martin@gnome.org>
11256 Made MethodCore derive from MemberBase to reuse the code from there.
11257 MemberBase now also checks for attributes.
11259 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11260 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11262 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11263 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11264 (MemberBase.ApplyAttributes): New virtual method; applies the
11265 attributes to a method or accessor.
11266 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11267 (MemberBase.ApplyConditionalAttribute): Likewise.
11268 (MemberBase.ApplyDllImportAttribute): Likewise.
11269 (MemberBase.CheckAbstractAndExternal): Likewise.
11270 (MethodCore.ParameterTypes): This is now a property instead of a
11271 method, it's initialized from DoDefineParameters().
11272 (MethodCore.ParameterInfo): Removed the set accessor.
11273 (MethodCore.DoDefineParameters): New protected virtual method to
11274 initialize ParameterTypes and ParameterInfo.
11275 (Method.GetReturnType): We can now simply return the MemberType.
11276 (Method.GetMethodFlags): Override the MemberBase version and add
11277 the conditional flags.
11278 (Method.CheckBase): Moved some code from Define() here, call
11279 DoDefineParameters() here.
11280 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11281 here to avoid some larger code duplication.
11282 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11283 ensure that abstract and external accessors don't declare a body.
11285 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11286 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11287 lookup in the attribute's parent classes, so we need to abort as soon
11288 as we found the first match.
11289 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11290 the attribute has no arguments.
11292 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11295 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11297 * cs-parser.jay: reverted previous patch.
11299 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11301 * cs-parser.jay: fixed bug #22119.
11303 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11305 * attribute.cs: fixed compilation. The error was:
11306 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11307 be assigned to before control leaves the current method."
11308 [FIXME: Filed as bug #28186: MCS must report this error.]
11310 2002-07-25 Martin Baulig <martin@gnome.org>
11312 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11313 method to pull the condition name ouf of a Conditional attribute.
11314 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11315 the obsolete message and error flag out of an Obsolete attribute.
11317 * class.cs (Method.GetMethodFlags): New public method to get the
11318 TypeManager.MethodFlags for this method.
11319 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11321 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11322 if we're overriding a virtual function, set the new private variable
11323 `parent_method'; call the new TypeManager.AddMethod().
11325 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11326 the MethodBuilder and the Method in a PtrHashtable.
11327 (TypeManager.builder_to_method): Added for this purpose.
11328 (TypeManager.MethodFlags): Added IsObsoleteError.
11329 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11330 Obsolete and Conditional arguments in MethodBuilders. If we discover
11331 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11332 the message from the attribute.
11334 2002-07-24 Martin Baulig <martin@gnome.org>
11336 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11337 preprocessor directives, ensure that the argument to #define/#undef is
11338 exactly one identifier and that it's actually an identifier.
11340 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11343 2002-07-24 Martin Baulig <martin@gnome.org>
11345 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11346 initialize it to TypeManager.object_type in the constructor.
11347 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11348 of the `hm.get_current' method if we're using the collection pattern.
11349 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11350 for the explicit conversion to make it work when we're using the collection
11351 pattern and the `Current' property has a different return type than `object'.
11354 2002-07-24 Martin Baulig <martin@gnome.org>
11356 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11357 does not match, but don't report any errors. This method is called in
11358 order for all methods in a MethodGroupExpr until a matching method is
11359 found, so we don't want to bail out if the first method doesn't match.
11360 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11361 matches, report the 123. Fixes #28070.
11363 2002-07-24 Martin Baulig <martin@gnome.org>
11365 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11366 TypeManager.TypeToCoreType() to the top of the method so the
11367 following equality checks will work. Fixes #28107.
11369 2002-07-24 Martin Baulig <martin@gnome.org>
11371 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11372 operand is of type uint, and the other operand is of type sbyte,
11373 short or int, the operands are converted to type long." -
11374 Actually do what this comment already told us. Fixes bug #28106,
11377 2002-07-24 Martin Baulig <martin@gnome.org>
11379 * class.cs (MethodBase): New abstract class. This is now a base
11380 class for Property, Indexer and Event to avoid some code duplication
11381 in their Define() and DefineMethods() methods.
11382 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11383 generic methods for Define() and DefineMethods().
11384 (FieldBase): Derive from MemberBase, not MemberCore.
11385 (Property): Derive from MemberBase, not MemberCore.
11386 (Property.DefineMethod): Moved all the code from this method to the
11387 new MethodBase.DefineAccessor(), just call it with appropriate
11389 (Property.Define): Call the new Property.DoDefine(), this does some
11390 sanity checks and we don't need to duplicate the code everywhere.
11391 (Event): Derive from MemberBase, not MemberCore.
11392 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11393 accessors, this will also make them work with interface events.
11394 (Indexer): Derive from MemberBase, not MemberCore.
11395 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11396 (Indexer.Define): Use the new MethodBase functions.
11398 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11399 argument to the constructor.
11400 (Interface.FindMembers): Added support for interface events.
11401 (Interface.PopluateEvent): Implemented.
11403 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11405 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11407 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11408 but this is required to check for a method name being the same as
11409 the containing class.
11413 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11415 * interface.cs: initialize variable.
11417 2002-07-23 Martin Baulig <martin@gnome.org>
11419 Implemented the IndexerName attribute in interfaces.
11421 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11422 name if this is an explicit interface implementation.
11423 (Indexer.InterfaceIndexerName): New public variable. If we're
11424 implementing an interface indexer, this is the IndexerName in that
11425 interface. Otherwise, it's the IndexerName.
11426 (Indexer.DefineMethod): If we're implementing interface indexer,
11427 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11428 and Pending.ImplementIndexer methods.
11429 (Indexer.Define): Also define the PropertyBuilder if we're
11430 implementing an interface indexer and this is neither an explicit
11431 interface implementation nor do the IndexerName match the one in
11434 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11435 If a method is defined here, then we always need to create a proxy
11436 for it. This is used when implementing interface indexers.
11437 (Pending.IsInterfaceIndexer): New public method.
11438 (Pending.ImplementIndexer): New public method.
11439 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11440 This is used when implementing interface indexers to define a proxy
11442 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11443 define a proxy if necessary.
11445 * interface.cs (Interface.IndexerName): New public variable.
11446 (Interface.PopulateIndexer): Set the IndexerName.
11447 (Interface.DefineIndexers): New private method. Populate all the
11448 indexers and make sure their IndexerNames match.
11450 * typemanager.cs (IndexerPropertyName): Added support for interface
11453 2002-07-22 Martin Baulig <martin@gnome.org>
11455 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11456 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11457 ret if HasReturnLabel.
11458 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11461 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11462 and set the ec.LoopBeginTryCatchLevel.
11463 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11464 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11465 the current ec.TryCatchLevel, the branch goes out of an exception
11466 block. In this case, we need to use Leave and not Br.
11468 2002-07-22 Martin Baulig <martin@gnome.org>
11470 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11471 block unless the block does not always return or it is contained in
11472 another try { ... } catch { ... } block. Fixes bug #26506.
11473 Added verify-1.cs to the test suite.
11475 2002-07-22 Martin Baulig <martin@gnome.org>
11477 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11478 then we do not always return. Fixes bug #24985.
11480 2002-07-22 Martin Baulig <martin@gnome.org>
11482 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11483 lookup on a per-class level; ie. walk up the class hierarchy until we
11484 found at least one applicable method, then choose the best among them.
11485 Fixes bug #24463 and test-29.cs.
11487 2002-07-22 Martin Baulig <martin@gnome.org>
11489 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11490 return types of the methods. The return type is not part of the
11491 signature and we must not check it to make the `new' modifier work.
11492 Fixes bug #27999, also added test-147.cs.
11493 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11495 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11496 on the method's return type.
11498 2002-07-21 Martin Baulig <martin@gnome.org>
11500 * assign.cs: Make this work if the rightmost source is a constant and
11501 we need to do an implicit type conversion. Also adding a few more tests
11502 to test-38.cs which should have caught this.
11504 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11505 target in the makefile for this. The makefile.gnu is primarily intended
11506 for end-users who don't want to debug the compiler.
11508 2002-07-21 Martin Baulig <martin@gnome.org>
11510 * assign.cs: Improved the Assign class so it can now handle embedded
11511 assignments (X = Y = Z = something). As a side-effect this'll now also
11512 consume less local variables. test-38.cs now passes with MCS, added
11513 a few new test cases to that test.
11515 2002-07-20 Martin Baulig <martin@gnome.org>
11517 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11518 instructions. Fixes bug #27977, also added test-146.cs.
11520 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11522 * cs-tokenizer.cs: fixed getHex ().
11524 2002-07-19 Martin Baulig <martin@gnome.org>
11526 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11527 not Type.GetType() to lookup the array type. This is needed when
11528 we're constructing an array of a user-defined type.
11529 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11530 single-dimensional arrays, but also for single-dimensial arrays of
11533 2002-07-19 Martin Baulig <martin@gnome.org>
11535 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11536 this function is called, it's not allowed to share LocalBuilders
11537 among ILGenerators.
11539 2002-07-19 Martin Baulig <martin@gnome.org>
11541 * expression.cs (Argument.Resolve): Report an error 118 when trying
11542 to pass a type as argument.
11544 2002-07-18 Martin Baulig <martin@gnome.org>
11546 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11547 Conv_R_Un for the signed `long' type.
11549 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11551 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11552 `expr' for the temporary result, as that will fail if we do
11553 multiple resolves on the same expression.
11555 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11557 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
11558 ec.TypeContainer for looking up aliases.
11560 * class.cs (TypeContainer): Remove LookupAlias from here.
11562 * decl.cs (DeclSpace); Move here.
11564 2002-07-01 Miguel de Icaza <miguel@ximian.com>
11566 * class.cs (FindMembers): Only call filter if the constructor
11567 bulider is not null.
11569 Also handle delegates in `NestedTypes' now. Now we will perform
11570 type lookups using the standard resolution process. This also
11573 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
11574 This uses Expressions (the limited kind that can be parsed by the
11575 tree) instead of strings.
11577 * expression.cs (ComposedCast.ToString): Implement, used to flag
11578 errors since now we have to render expressions.
11580 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
11583 * ecore.cs (SimpleName.ToString): ditto.
11585 * cs-parser.jay: Instead of using strings to assemble types, use
11586 Expressions to assemble the type (using SimpleName, ComposedCast,
11587 MemberAccess). This should fix the type lookups in declarations,
11588 because we were using a different code path for this.
11590 * statement.cs (Block.Resolve): Continue processing statements
11591 even when there is an error.
11593 2002-07-17 Miguel de Icaza <miguel@ximian.com>
11595 * class.cs (Event.Define): Also remove the `remove' method from
11596 the list of pending items.
11598 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
11599 generate more compact code.
11601 2002-07-17 Martin Baulig <martin@gnome.org>
11603 * const.cs (Const.LookupConstantValue): Add support for constant
11604 `unchecked' and `checked' expressions.
11605 Also adding test case test-140.cs for this.
11607 2002-07-17 Martin Baulig <martin@gnome.org>
11609 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
11610 check whether mi.ReturnType implements the IEnumerator interface; the
11611 `==' and the IsAssignableFrom() will fail in this situation.
11613 2002-07-16 Ravi Pratap <ravi@ximian.com>
11615 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
11618 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11620 * expression.cs: fixed bug #27811.
11622 2002-07-14 Miguel de Icaza <miguel@ximian.com>
11624 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
11625 Molaro: when we are a ref, the value already contains a pointer
11626 value, do not take the address of it.
11628 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
11629 * removed mb-parser.jay and mb-tokenizer.cs
11631 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11633 * expression.cs: check against the building corlib void type.
11635 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
11637 * ecore.cs: fix for valuetype static readonly fields: when
11638 initializing them, we need their address, not the address of a copy.
11640 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
11642 * typemanager.cs: register also enum_type in corlib.
11644 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11646 * class.cs: allow calling this (but not base) initializers in structs.
11648 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
11650 * ecore.cs: make sure we compare against the building base types
11653 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
11655 * typemanager.cs: fix TypeToCoreType() to handle void and object
11656 (corlib gets no more typerefs after this change).
11658 2002-07-12 Miguel de Icaza <miguel@ximian.com>
11660 * expression.cs (ArrayCreation.EmitArrayArguments): use
11661 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
11663 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
11664 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
11665 array indexes, the runtime actually forbids them.
11667 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
11668 for array arguments here.
11670 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
11671 instead of the default for ValueTypes.
11673 (New.DoEmit): Use IsValueType instead of
11674 IsSubclassOf (value_type)
11675 (New.DoResolve): ditto.
11676 (Invocation.EmitCall): ditto.
11678 * assign.cs (Assign): ditto.
11680 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
11681 Statements *are* currently doing part of their resolution during
11684 Expressions do always resolve during resolve, but statements are
11685 only required to propagate resolution to their children.
11687 2002-07-11 Miguel de Icaza <miguel@ximian.com>
11689 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
11691 (LoadAssembly): Do not add the dll if it is already specified
11693 (MainDriver): Add the System directory to the link path at the end,
11694 after all the other -L arguments.
11696 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
11697 wrong opcode for loading bytes and bools (ldelem.i1 instead of
11698 ldelem.u1) and using the opposite for sbytes.
11700 This fixes Digger, and we can finally run it.
11702 * driver.cs (UnixParseOption): Move the option parsing here.
11703 (CSCParseOption): Implement CSC-like parsing of options.
11705 We now support both modes of operation, the old Unix way, and the
11706 new CSC-like way. This should help those who wanted to make cross
11707 platform makefiles.
11709 The only thing broken is that /r:, /reference: and /lib: are not
11710 implemented, because I want to make those have the same semantics
11711 as the CSC compiler has, and kill once and for all the confussion
11712 around this. Will be doing this tomorrow.
11714 * statement.cs (Unsafe.Resolve): The state is checked during
11715 resolve, not emit, so we have to set the flags for IsUnsfe here.
11717 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11719 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
11720 not catch the Error_ObjectRefRequired in SimpleName (as it is
11721 possible to have a class/instance variable name that later gets
11722 deambiguated), we have to check this here.
11724 2002-07-10 Ravi Pratap <ravi@ximian.com>
11726 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
11727 make static and put into Expression.
11729 (Event.Define): Register the private field of the event with the
11730 TypeManager so that GetFieldFromEvent can get at it.
11732 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
11733 keep track of the private field associated with an event which
11736 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
11739 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
11741 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11743 * expression.cs (Binary.EmitBranchable): this routine emits the
11744 Binary expression in a branchable context. This basically means:
11745 we need to branch somewhere, not just get the value on the stack.
11747 This works together with Statement.EmitBoolExpression.
11749 * statement.cs (Statement.EmitBoolExpression): Use
11752 2002-07-09 Miguel de Icaza <miguel@ximian.com>
11754 * statement.cs (For): Reduce the number of jumps in loops.
11756 (For): Implement loop inversion for the For statement.
11758 (Break): We can be breaking out of a Try/Catch controlled section
11759 (foreach might have an implicit try/catch clause), so we need to
11760 use Leave instead of Br.
11762 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
11763 now). If the instace expression supports IMemoryLocation, we use
11764 the AddressOf method from the IMemoryLocation to extract the
11765 address instead of emitting the instance.
11767 This showed up with `This', as we were emitting the instance
11768 always (Emit) instead of the Address of This. Particularly
11769 interesting when This is a value type, as we dont want the Emit
11770 effect (which was to load the object).
11772 2002-07-08 Miguel de Icaza <miguel@ximian.com>
11774 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
11776 * statement.cs (Checked): Set the CheckedState during the resolve
11777 process too, as the ConvCast operations track the checked state on
11778 the resolve process, and not emit.
11780 * cs-parser.jay (namespace_member_declaration): Flag that we have
11781 found a declaration when we do. This is used to flag error 1529
11783 * driver.cs: Report ok when we display the help only.
11785 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
11787 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
11789 2002-07-04 Miguel de Icaza <miguel@ximian.com>
11791 * cs-tokenizer.cs (define): We also have to track locally the
11792 defines. AllDefines is just used for the Conditional Attribute,
11793 but we also need the local defines for the current source code.
11795 2002-07-03 Miguel de Icaza <miguel@ximian.com>
11797 * statement.cs (While, For, Do): These loops can exit through a
11798 Break statement, use this information to tell whether the
11799 statement is the last piece of code.
11801 (Break): Flag that we break.
11803 * codegen.cs (EmitContexts): New `Breaks' state variable.
11805 2002-07-03 Martin Baulig <martin@gnome.org>
11807 * class.cs (TypeContainer.MethodModifiersValid): Allow override
11808 modifiers in method declarations in structs. Otherwise, you won't
11809 be able to override things like Object.Equals().
11811 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11813 * class.cs (Method, Property, Indexer): Do not allow the public
11814 modifier to be used in explicit interface implementations.
11816 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
11817 override modifiers in method declarations in structs
11819 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
11821 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
11822 integer or real overflow, report an error
11824 2002-07-02 Martin Baulig <martin@gnome.org>
11826 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
11827 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
11828 to tell the runtime about our newly created System.Object and
11829 System.ValueType types.
11831 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11833 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
11834 struct instead of Ldarg/Starg.
11836 2002-07-02 Martin Baulig <martin@gnome.org>
11838 * expression.cs (Indirection.Indirection): Call
11839 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
11841 2002-07-02 Martin Baulig <martin@gnome.org>
11843 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
11844 ValueType, call TypeManager.TypeToCoreType() on it.
11845 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
11846 the OpCodes.Newarr argument.
11848 2002-07-02 Martin Baulig <martin@gnome.org>
11850 * expression.cs (Invocation.EmitCall): When compiling corlib,
11851 replace all calls to the system's System.Array type to calls to
11852 the newly created one.
11854 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
11855 System.Array methods.
11856 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
11857 from the system's System.Array type which must be replaced.
11859 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
11861 * typemanager.cs: load unverifiable_code_ctor so we can build
11862 corlib using the correct type. Avoid using GetTypeCode() with
11864 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
11865 TypeManager.object_type to allow building corlib.
11867 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
11869 * ecore.cs: handle System.Enum separately in LoadFromPtr().
11871 2002-07-01 Martin Baulig <martin@gnome.org>
11873 * class.cs: Make the last change actually work, we need to check
11874 whether `ifaces != null' to avoid a crash.
11876 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11878 * class.cs: when we build structs without fields that implement
11879 interfaces, we need to add the interfaces separately, since there is
11880 no API to both set the size and add the interfaces at type creation
11883 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11885 * expression.cs: the dimension arguments to the array constructors
11886 need to be converted if they are a long.
11888 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
11890 * class.cs: don't emit ldarg.0 if there is no parent constructor
11891 (fixes showstopper for corlib).
11893 2002-06-29 Martin Baulig <martin@gnome.org>
11895 MCS now compiles corlib on GNU/Linux :-)
11897 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
11898 ie. check for MethodImplOptions.InternalCall.
11900 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
11901 and TypeManager.attribute_type are null, so we must explicitly check
11902 whether parent is not null to find out whether it's an attribute type.
11903 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
11904 and SetBuilder, not only if the property is neither abstract nor external.
11905 This is necessary to set the MethodImplOptions on the accessor methods.
11906 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
11907 SetBuilder, see Property.Emit().
11909 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
11910 populate "System.Object", "System.ValueType" and "System.Attribute" since
11911 they've already been populated from BootCorlib_PopulateCoreTypes().
11913 2002-06-29 Martin Baulig <martin@gnome.org>
11915 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
11916 is the NullLiteral, we also need to make sure that target_type is not
11919 2002-06-29 Martin Baulig <martin@gnome.org>
11921 * rootcontext.cs (RootContext.ResolveCore): We must initialize
11922 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
11923 before calling BootstrapCorlib_ResolveDelegate ().
11925 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11927 * statement.cs: fixed build-breaker. All tests passed ok.
11929 2002-06-27 Martin Baulig <martin@gnome.org>
11931 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
11932 for System.Decimal when compiling corlib.
11934 2002-06-27 Martin Baulig <martin@gnome.org>
11936 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
11937 switch blocks which contain nothing but a default clause.
11939 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
11941 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
11943 2002-06-27 Martin Baulig <martin@gnome.org>
11945 * ecore.cs (PropertyExpr.PropertyExpr): Call
11946 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
11948 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
11949 is already a TypeBuilder.
11951 2002-06-27 Martin Baulig <martin@gnome.org>
11953 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
11954 `target_type == TypeManager.array_type', not IsAssignableFrom() in
11955 the "from an array-type to System.Array" case. This makes it work
11956 when compiling corlib.
11958 2002-06-27 Martin Baulig <martin@gnome.org>
11960 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
11961 non-static PropertyExpr, set its InstanceExpression. This makes
11962 the `ICollection.Count' property work in System/Array.cs.
11964 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
11966 * driver.cs: Made error handling more consistent. Errors now
11967 tracked by Report class, so many methods which used to return int
11968 now return void. Main() now prints success/failure and
11969 errors/warnings message.
11971 Renamed '--probe' compiler argument to '--expect-error'. Removed
11972 the magic number return values (123 and 124). Now, if the
11973 expected error occurs, the compiler exits with success (exit value
11974 0). If the compilation completes without seeing that particular
11975 error, the compiler exits with failure (exit value 1). The
11976 makefile in mcs/errors has been changed to handle the new behaviour.
11978 * report.cs: Made 'expected error' number a property and renamed
11979 it from 'Probe' to 'ExpectedError'.
11981 * genericparser.cs: Removed error handling support, since it is
11982 now all done by Report class.
11984 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
11985 class, so parse() no longer returns an int.
11987 * namespace.cs: Use Report.Error instead of GenericParser.error
11989 2002-06-22 Miguel de Icaza <miguel@ximian.com>
11991 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
11992 TypeContainer.AddOperator): At the front of the list put the
11993 explicit implementations, so they get resolved/defined first.
11995 2002-06-21 Miguel de Icaza <miguel@ximian.com>
11997 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
11998 interface type is implemented by this TypeContainer. Used during
11999 explicit interface implementation.
12001 (Property.Define, Indexer.Define, Method.Define): Validate that
12002 the given interface in the explicit implementation is one of the
12003 base classes for the containing type.
12005 Also if we are explicitly implementing an interface, but there is
12006 no match in the pending implementation table, report an error.
12008 (Property.Define): Only define the property if we are
12009 not explicitly implementing a property from an interface. Use the
12010 correct name also for those properties (the same CSC uses,
12011 although that is really not needed).
12013 (Property.Emit): Do not emit attributes for explicitly implemented
12014 properties, as there is no TypeBuilder.
12016 (Indexer.Emit): ditto.
12018 Hiding then means that we do not really *implement* a pending
12019 implementation, which makes code fail.
12021 2002-06-22 Martin Baulig <martin@gnome.org>
12023 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
12024 the return value of Object.GetType(). [FIXME: we need to do this whenever
12025 we get a type back from the reflection library].
12027 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
12029 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
12031 2002-06-20 Miguel de Icaza <miguel@ximian.com>
12033 * attribute.cs: Return null if we can not look up the type.
12035 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
12036 the interface types found.
12038 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
12039 interface types found.
12041 * typemanager.cs (GetInterfaces): Make this routine returns alll
12042 the interfaces and work around the lame differences between
12043 System.Type and System.Reflection.Emit.TypeBuilder in the results
12044 result for GetInterfaces.
12046 (ExpandInterfaces): Given an array of interface types, expand and
12047 eliminate repeated ocurrences of an interface. This expands in
12048 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
12051 2002-06-21 Martin Baulig <martin@gnome.org>
12053 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
12056 2002-06-21 Martin Baulig <martin@gnome.org>
12058 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
12059 and called with one of the core types, return the corresponding typebuilder for
12062 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
12065 2002-06-21 Martin Baulig <martin@gnome.org>
12067 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
12068 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
12069 (Expression.ConvertReferenceExplicit): Likewise.
12071 * expression.cs (ElementAccess.DoResolve): Likewise.
12072 (ElementAccess.DoResolveLValue): Likewise.
12074 2002-06-10 Martin Baulig <martin@gnome.org>
12076 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
12077 add the "value" parameter to the parameter list.
12079 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
12082 2002-06-19 Miguel de Icaza <miguel@ximian.com>
12084 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
12085 the argument to an int, uint, long or ulong, per the spec. Also
12086 catch negative constants in array creation.
12088 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
12090 * class.cs: do not allow the same interface to appear twice in
12091 the definition list.
12093 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
12095 * ecore.cs: don't use ldlen with System.Array.
12097 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
12099 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
12101 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
12103 * modifiers.cs: produce correct field attributes for protected
12104 internal. Easy fix so miguel can work on ther harder stuff:-)
12106 2002-06-18 Miguel de Icaza <miguel@ximian.com>
12108 * pending.cs: New file. Move the code from class.cs here.
12109 Support clearning the pending flag for all methods (when not doing
12110 explicit interface implementation).
12112 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
12114 * rootcontext.cs: added a couple more types needed to bootstrap.
12116 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12118 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12119 constructor in the type, instead of any constructor in the type
12120 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12121 a bug in the Mono runtime when applying the params attribute).
12123 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12124 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12126 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12128 * expression.cs (Unary.ResolveOperator): Use TypeManager
12129 to resolve the type.
12131 2002-06-13 Ravi Pratap <ravi@ximian.com>
12133 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12136 * enum.cs (AddEnumMember): Add support to store the attributes associated
12137 with each member too.
12139 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12140 field builders too - this takes care of the enum member case.
12142 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12144 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12145 address-of operator on both value types and pointers.
12147 2002-06-10 Martin Baulig <martin@gnome.org>
12149 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12150 PropertyBuilder to the `property_builders' list.
12152 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12153 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12154 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12155 find any indexers which are inherited from an interface.
12157 2002-06-09 Martin Baulig <martin@gnome.org>
12159 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12160 the same type as the constant if necessary. There's also a test-130.cs
12163 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12165 * typemanager.cs (TypeManager.ChangeType): Previously known as
12166 Enum.ChangeEnumType().
12168 2002-06-09 Martin Baulig <martin@gnome.org>
12170 * expression.cs (Cast.TryReduce): Added support for consts.
12172 2002-06-08 Ravi Pratap <ravi@ximian.com>
12174 * class.cs (Accessor): Hold attributes information so we can pass
12177 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12178 Modify to pass in attributes attached to the methods.
12180 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12182 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12183 to handle the Accessor kind :-)
12185 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12187 2002-06-08 Martin Baulig <martin@gnome.org>
12189 * expression.cs (Unary.TryReduceNegative): Added support for
12192 2002-06-08 Martin Baulig <martin@gnome.org>
12194 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12195 name can't be found in the `defined_names' - the caller will do a
12196 MemberLookup in this case and thus find methods in System.Enum
12197 such as Enum.IsDefined().
12199 2002-06-08 Martin Baulig <martin@gnome.org>
12201 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12202 Convert.ChangeType() which works with TypeBuilder created types.
12203 (Enum.LookupEnumValue, Enum.Define): Use it here.
12205 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12206 `TypeBuilder.BaseType != null' check.
12207 (TypeContainer.FindMembers): Only lookup parent members if we
12208 actually have a parent.
12209 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12210 (ConstructorInitializer.Resolve): Likewise.
12212 * interface.cs (Interface.FindMembers): Added
12213 `TypeBuilder.BaseType != null' check.
12215 * rootcontext.cs (RootContext.ResolveCore): Added
12216 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12217 classes_second_stage.
12219 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12220 debug_type and trace_type when compiling with --nostdlib.
12222 2002-06-07 Martin Baulig <martin@gnome.org>
12224 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12225 (AddField): Set it to true when adding a non-static field.
12226 (DefineType): Use `have_nonstatic_fields' to find out whether we
12227 have non-static fields, not `Fields != null'.
12229 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12231 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12232 dereferencing a null on the static-field code path)
12234 2002-05-30 Martin Baulig <martin@gnome.org>
12236 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12237 to take command line arguments. Use reflection to call the new
12238 custom `Initialize' function on the symbol writer and pass it the
12239 command line arguments.
12241 * driver.cs (--debug-args): New command line argument to pass command
12242 line arguments to the symbol writer.
12244 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12246 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12247 the target type for indexers and properties. Thanks to Joe for
12250 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12252 * typemanager.cs (MethodFlags): returns the method flags
12253 (Obsolete/ShouldIgnore) that control warning emission and whether
12254 the invocation should be made, or ignored.
12256 * expression.cs (Invocation.Emit): Remove previous hack, we should
12257 not do this on matching a base type, we should do this based on an attribute
12259 Only emit calls to System.Diagnostics.Debug and
12260 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12261 on the command line.
12263 * rootcontext.cs: Global settings for tracing and debugging.
12265 * cs-tokenizer.cs (define): New utility function to track
12266 defines. Set the global settings for TRACE and DEBUG if found.
12268 2002-05-25 Ravi Pratap <ravi@ximian.com>
12270 * interface.cs (Populate*): Pass in the TypeContainer as well as
12271 the DeclSpace as parameters so that we can create EmitContexts and
12272 then use that to apply attributes etc.
12274 (PopulateMethod, PopulateEvent, PopulateProperty)
12275 (PopulateIndexer): Apply attributes everywhere.
12277 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12280 (ApplyAttributes): Update accordingly.
12282 We now apply interface attributes for all members too.
12284 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12286 * class.cs (Indexer.Define); Correctly check if we are explicit
12287 implementation (instead of checking the Name for a ".", we
12288 directly look up if the InterfaceType was specified).
12290 Delay the creation of the PropertyBuilder.
12292 Only create the PropertyBuilder if we are not an explicit
12293 interface implementation. This means that explicit interface
12294 implementation members do not participate in regular function
12295 lookups, and hence fixes another major ambiguity problem in
12296 overload resolution (that was the visible effect).
12298 (DefineMethod): Return whether we are doing an interface
12301 * typemanager.cs: Temporary hack until we get attributes in
12302 interfaces (Ravi is working on that) and we get IndexerName
12303 support in interfaces.
12305 * interface.cs: Register the indexers as properties.
12307 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12308 warning, I have verified that this is a bug in the .NET runtime
12309 (JavaScript suffers of the same problem).
12311 * typemanager.cs (MemberLookup): When looking up members for
12312 interfaces, the parent of an interface is the implicit
12313 System.Object (so we succeed in searches of Object methods in an
12314 interface method invocation. Example: IEnumerable x; x.ToString
12317 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12319 * class.cs (Event): Events should also register if they do
12320 implement the methods that an interface requires.
12322 * typemanager.cs (MemberLookup); use the new GetInterfaces
12325 (GetInterfaces): The code used to lookup interfaces for a type is
12326 used in more than one place, factor it here.
12328 * driver.cs: Track the errors at the bottom of the file, we kept
12331 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12332 instance if the method we are calling is static!
12334 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12336 * attribute.cs (ApplyAttributes): Make this function filter out
12337 the IndexerName attribute (as that attribute in reality is never
12338 applied) and return the string constant for the IndexerName
12341 * class.cs (TypeContainer.Emit): Validate that all the indexers
12342 have the same IndexerName attribute, and if so, set the
12343 DefaultName attribute on the class.
12345 * typemanager.cs: The return value might contain other stuff (not
12346 only methods). For instance, consider a method with an "Item"
12347 property and an Item method.
12349 * class.cs: If there is a problem with the parameter types,
12352 2002-05-24 Ravi Pratap <ravi@ximian.com>
12354 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12355 looks at user defined conversion after making a call to
12356 StandardConversionExists - we need this for overload resolution.
12358 * expression.cs : Update accordingly the various method calls.
12360 This fixes 2 bugs filed against implicit user defined conversions
12362 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12364 * statement.cs: Track the result of the assignment.
12366 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12368 * expression.cs (MemberAccess): Improved error reporting for
12369 inaccessible members.
12371 2002-05-22 Martin Baulig <martin@gnome.org>
12373 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12374 itself with debugging support.
12376 2002-05-22 Martin Baulig <martin@gnome.org>
12378 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12379 Removed, this isn't needed anymore.
12381 2002-05-20 Martin Baulig <martin@gnome.org>
12383 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12384 be underlying type for an enum.
12386 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12388 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12389 that splits out the loading of just the core types.
12391 * rootcontext.cs (ResolveCore): Split the struct resolution in
12392 two, so we can load the enumeration underlying types before any
12395 * expression.cs (Is): Bandaid until we fix properly Switch (see
12396 bug #24985 for details).
12398 * typemanager.cs (ImplementsInterface): The hashtable will contain
12399 a null if there are no interfaces implemented.
12401 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12403 * cs-parser.jay (indexer_declarator): It is fine to have array
12406 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12408 * typemanager.cs: (RegisterBuilder): New function used to register
12409 TypeBuilders that implement interfaces. Since
12410 TypeBuilder.GetInterfaces (as usual) does not work with lame
12412 (AddUserType): register interfaces.
12414 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12415 dealing with TypeBuilder. Also, arrays are showing up as
12416 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12417 methods can not be invoked on them!
12419 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12420 (ImplicitReferenceConversionExists): Split out from
12421 StandardConversionExists.
12423 * expression.cs (As): We were only implementing one of the three
12424 cases for the as operator. We now implement them all.
12425 (Is): Implement the various other cases for Is as well.
12427 * typemanager.cs (CACHE): New define used to control if we want or
12428 not the FindMembers cache. Seems to have a negative impact on
12429 performance currently
12431 (MemberLookup): Nested types have full acess to
12432 enclosing type members
12434 Remove code that coped with instance/static returns for events, we
12435 now catch this in RealFindMembers.
12437 (RealFindMembers): only perform static lookup if the instance
12438 lookup did not return a type or an event.
12440 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12442 * assign.cs (CompoundAssign): We pass more semantic information
12443 now to Compound Assignments than we did before: now we have all
12444 the information at hand, and now we resolve the target *before* we
12445 do the expression expansion, which allows the "CacheValue" method
12446 to have the effect we intended (before, a [x] += 1 would generate
12447 two differen ArrayAccess expressions from the ElementAccess,
12448 during the resolution process).
12450 (CompoundAssign.DoResolve): Resolve target and original_source here.
12452 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12454 * expression.cs (ArrayAccess): dropped debugging information.
12456 * typemanager.cs: Small bug fix: I was always returning i_members,
12457 instead of one of i_members or s_members (depending on which had
12460 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12461 method is invoked before any code generation takes place, and it
12462 is a mechanism to inform that the expression will be invoked more
12463 than once, and that the method should use temporary values to
12464 avoid having side effects
12466 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12468 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12471 * expression.cs (Indirection, ArrayAccess): Add support for
12472 CacheTemporaries in these two bad boys.
12474 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12475 ldobj or ldind_ref.
12476 (StoreFromPtr): Handle stobj as well.
12478 * expression.cs (UnaryMutator): Share more code.
12480 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12481 down: I was not tracking the Filter function as well, which
12482 was affecting the results of the cache.
12484 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12486 * attribute.cs: Remove the hack to handle the CharSet property on
12489 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12491 * attribute.cs (DoResolve): More uglyness, we now only try to
12492 resolve the attribute partially, to extract the CharSet
12493 information (only if we are a StructLayout attribute). Otherwise
12495 (GetExtraTypeInfo): Add some code to conditionally kill in the
12496 future this. I am more and more convinced that the .NET
12497 framework has special code to handle the attribute setting on
12500 * expression.cs (IsParamsMethodApplicable): Revert my previous
12501 foreach change here, it was wrong.
12503 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12505 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12506 (pp_expr): do not abort on unknown input, just return.
12507 (eval): abort if there are pending chars.
12509 * attribute.cs (Attribute.Resolve): Positional parameters are
12510 optional. Deal with that case.
12512 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12513 the Ansi/Unicode/Auto information for the type.
12515 (TypeContainer.DefineType): instantiate the EmitContext here, as
12516 we will be using it during the type definition (to resolve
12517 attributes) and during the emit phase.
12519 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12520 to pull type information out of the attributes
12522 (Attribute.Resolve): track the constructor builder, and allow for
12523 multiple invocations (structs and classes will use this).
12525 * ecore.cs (MemberLookupFinal): new version with all the
12526 parameters customizable.
12528 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12529 constructors. Return if the result value is null (as the error
12530 would have been flagged already by MemberLookupFinal)
12532 Do not allow instances of abstract classes or interfaces to be
12535 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12536 We have to compare the assembly property here when dealing with
12537 FamANDAssem and Assembly access modifiers, because we might be
12538 creating an assembly from *modules* (that means that we are not
12539 getting TypeBuilders for types defined in other modules that are
12540 part of this assembly).
12542 (Method.Emit): If the method is marked abstract and has a body,
12545 (TypeContainer.DefineMembers): If both the defined member and the
12546 parent name match are methods, then do not emit any warnings: let
12547 the Method.Define routine take care of flagging warnings. But if
12548 there is a mismatch (method overrides something else, or method is
12549 overriwritten by something, then emit warning).
12551 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12552 set to null, this means `do not check for the return type on the
12555 (Method.Define): set the return type for the method signature to
12556 null, so that we get methods with the same name and parameters and
12557 different return types. This is used to flag warning 114 (you are
12558 hiding a method, and you probably want to use the new/override
12561 * typemanager.cs (MemberLookup): Implemented proper access
12562 control, closing a long standing set of bug reports. The problem
12563 was that the Framework only has two bits: Public and NonPublic,
12564 and NonPublic includes private and protected methods, but we need
12565 to enforce the FamANDAssem, FamOrAssem and Family.
12567 2002-05-11 Miguel de Icaza <miguel@ximian.com>
12569 * statement.cs (GotoCase): Return true: Ammounts to giving up
12570 knowledge on whether we return or not, and letting the other case
12571 be responsible for it.
12573 2002-05-10 Miguel de Icaza <miguel@ximian.com>
12575 * driver.cs: Do not load directories for each file processed, only
12576 do it if there is a pattern.
12578 * ecore.cs: Report readonly assigns here as well, as we might have
12579 been resolved only by MemberAccess.
12581 (SimpleName.SimpleNameResolve): Also be useful for LValue
12582 resolution. We need this to propagate assign to local readonly variables
12584 * typemanager.cs: Use a ptrhashtable for the criteria, because we
12585 do not want to reuse potential criteria memory.
12587 * class.cs (MyEventBuilder): Set reflected_type;
12589 * ecore.cs (Constantify): Added support for constifying bools.
12591 (RootContext.LookupType): Added a cache for values looked up in
12592 the declaration space.
12594 * typemanager.cs (FindMembers): Now is a front-end to
12595 RealFindMembers, and provides a two-level hashtable-based cache to
12598 15% performance improvement: from 22.5 to 19.2 seconds.
12600 * expression.cs (IsParamsMethodApplicable): use foreach.
12601 (Invocation.DoResolve): ditto.
12602 (New.DoResolve): ditto.
12603 (ArrayCreation.DoResolve): ditto.
12605 * ecore.cs (FindMostEncompassingType): use foreach.
12607 * delegate.cs (NewDelegate.DoResolve): Use foreach
12609 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
12610 (RemoveMethods): use foreach.
12612 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
12613 nested foreach statements instead of for, and also break out of
12614 the inner loop once a match is found.
12616 (Invocation.OverloadResolve): Use foreach, simplify the code.
12618 2002-05-08 Miguel de Icaza <miguel@ximian.com>
12620 * cfold.cs (BinaryFold): During an enumeration evaluation context,
12621 we actually unwrap the expression to allow for extra information
12624 * expression.cs: Use Shr_Un on unsigned operations.
12626 2002-05-08 Ravi Pratap <ravi@ximian.com>
12628 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
12629 applicable operators was not being considered correctly. This closes
12630 the bug Miguel reported.
12632 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
12634 * attribute.cs: check that the type derives from System.Attribute
12635 and report the correct error in that case (moved the duplicate code to
12636 its own method, too).
12638 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
12640 * attribute.cs: lookup attribute type name as the spec says: first the
12641 bare attribute name and then name + "Attribute" (nant compiles with
12642 mcs after this fix).
12644 2002-05-07 Miguel de Icaza <miguel@ximian.com>
12646 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
12647 Because of the way we parse things, we should try to see if a
12648 UIntConstant can fit in an integer.
12650 2002-05-07 Ravi Pratap <ravi@ximian.com>
12652 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
12653 when we are in an explicit context.
12655 (ConvertReferenceExplicit): When converting from Iface type S to Class
12656 T make sure the rules are implemented as an OR.
12658 * parameter.cs (ParameterType): Make it a property for now although the
12659 purpose really isn't anything immediate.
12661 * expression.cs (Is*Applicable): Do better checking on the parameter type
12662 of a ref/out parameter. The ones from the system assemblies are already
12663 marked with the correct type so we don't need to do any correction.
12665 * ecore.cs (StandardConversionExists): Conversion from Interface types to
12666 the object type is standard too so include that.
12668 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12670 * ecore.cs (StandardConversionExists): Augment with missing code:
12671 deal with IntConstant, LongConstants and Enumerations.
12673 * assign.cs: Report the error, instead of failing silently
12675 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
12676 typecontainer that they are declared, because the
12677 typecontainer/namespace will have the list of using clauses that
12678 need to be applied.
12680 Assembly Attributes were escaping the normal registration
12683 (EmitCode): Apply attributes within an EmitContext that represents
12684 the container they were declared on.
12686 * cs-parser.jay: Track bases for structs. How did I get this wrong?
12688 2002-05-06 Ravi Pratap <ravi@ximian.com>
12690 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
12691 Revamp completely - make much cleaner as we now operate only
12694 (FindMostSpecificSource, FindMostSpecificTarget): New methods
12695 to implement the logic detailed in the spec more correctly.
12697 (UserDefinedConversion): Update accordingly.
12699 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12701 * statement.cs: Return flow analysis information up.
12703 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
12706 (token): Do not consume an extra character before calling
12709 2002-05-06 Piers Haken <piersh@friskit.com>
12711 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
12713 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12715 * class.cs (Constructor.Emit): Set the IsStatic flag in the
12716 EmitContext during the instance constructor initializer
12717 resolution, to stop access to instance variables.
12719 This is mandated by the spec, last paragraph of the `constructor
12720 initializers' section.
12722 2002-05-05 Miguel de Icaza <miguel@ximian.com>
12724 * cs-parser.jay, class.cs (Accessor): new class used to represent
12725 an accessor (get or set). In the past we used `null' to represent
12726 a missing accessor. But this is ambiguous because there was no
12727 way to tell in abstract indexers/properties if one of them was
12730 Now there is a way of addressing that.
12732 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
12733 instead of FindMembers.
12735 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
12736 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
12738 * attribute.cs: Treat indexers and properties as the same in terms
12739 of applying attributes
12741 * ecore.cs (FindMostEncompassedType): Use statically initialized
12742 EmptyExpressions()s like we do elsewhere to avoid creating useless
12743 objects (and we take this out of the tight loop).
12745 (GetConversionOperators): Move the code to extract the actual
12746 operators to a separate routine to clean things up.
12748 2002-05-04 Miguel de Icaza <miguel@ximian.com>
12750 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
12751 events are always registered FieldBuilders.
12753 * class.cs (FieldBase): New class shared by Fields
12755 * delegate.cs: If we are a toplevel delegate, use our full name.
12756 If we are a nested delegate, then only use our tail name.
12758 2002-05-02 Ravi Pratap <ravi@ximian.com>
12760 * expression.cs (IsApplicable): Ensure that we add the "&" to
12761 ref/out types before comparing it with the type of the argument.
12763 (IsParamsMethodApplicable): Ditto.
12765 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
12768 * delegate.cs : Handle the case when we have more than one applicable
12769 method. Flag an error only when we finish checking all.
12771 2002-05-02 Miguel de Icaza <miguel@ximian.com>
12773 * expression.cs: Add support for boolean static initializers.
12775 2002-05-01 Miguel de Icaza <miguel@ximian.com>
12777 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
12779 * parameter.cs (ComputeParameterTypes,
12780 ComputeAndDefineParameterTypes): Better error handling: now we
12781 clear the `types' cache if we fail during any of the type lookups.
12782 We also return the status code correctly to our caller
12784 * delegate.cs: If we fail to define a delegate, abort the extra
12787 * expression.cs (Binary.ResolveOperator): for
12788 operator==(object,object) and operator !=(object, object) we also
12789 have to verify that there is an implicit conversion from one to
12792 (ArrayAccess.DoResolve): Array Access can operate on
12795 2002-04-30 Miguel de Icaza <miguel@ximian.com>
12797 * assign.cs (CompoundAssign): A new class used as a "flag" that
12798 the assignment actually is happening as part of a compound
12799 assignment operator.
12801 During compound assignment, a few new rules exist to enable things
12808 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
12809 to the type of x) if y is implicitly convertible to the type of x,
12810 and the operator is a builtin operator and the return type of the
12811 operator is explicitly convertible to the type of x.
12813 * rootcontext.cs: Reset warning level to 2. 4 catches various
12814 "interesting" features in mcs, we must clean this up at some
12815 point, but currently am trying to kill other bugs ;-)
12817 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
12818 in container classes as well.
12820 * expression.cs (Binary.ResolveOperator): Handle string case
12821 before anything else (as operator overloading does emit an error
12822 before doing anything else).
12824 This code could go away when we move to a table driven model, but
12825 i could not come up with a good plan last night.
12827 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
12829 * typemanager.cs (CSharpName): reimplementation using regex.
12830 * class.cs: added null check for fields in Emit
12831 * rootcontext.cs: set warninglevel to 4
12833 2002-04-29 Miguel de Icaza <miguel@ximian.com>
12835 * typemanager.cs (CSharpName): reimplemented with Lupus
12838 2002-04-28 Miguel de Icaza <miguel@ximian.com>
12840 * statement.cs (If): correclty implement Resolve, because we were
12841 not catching sem errors in there. The same process is needed
12843 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
12846 (Statement.Warning_DeadCodeFound): Factorize code.
12847 (While): Report dead code here too.
12849 (Statement): Added Resolve virtual method to allow
12850 for resolution split from the emit code.
12852 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12854 * statement.cs (EmitBoolExpression): No longer try to resolve the
12856 (MakeBoolean): New utility function that resolve, implicitly
12857 converts to boolean and tags the expression.
12860 (If, Do): Implement dead code elimination.
12861 (While): Implement loop inversion
12863 (Do, While, For, If): Resolve the expression prior to calling our
12866 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
12869 - added method Report28 (warning: program has more than one entry point)
12870 - added method IsEntryPoint, implements paragraph 10.1 of the spec
12871 - modified method Method.Define, the part at the end of the method
12873 * rootcontext.cs: added static public Location EntryPointLocation;
12875 * ../errors/cs0028.cs : Add test case for the above warning.
12878 - modified method CSharpName to allow arrays of primitive type to
12879 be printed nicely (e.g. instead of System.Int32[][] it now prints
12881 - added method CSharpSignature: returns the signature of a method
12882 in string format to be used in reporting errors, warnings, etc.
12884 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
12887 2002-04-26 Ravi Pratap <ravi@ximian.com>
12889 * delegate.cs (Define): Fix extremely silly bug where I was
12890 setting the type of the 'object' parameter of the BeginInvoke
12891 method to System.IAsyncResult instead of System.Object ;-)
12893 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12895 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
12898 (Constructor.Emit): return if we fail to initialize the
12899 constructor. Another door closed!
12901 * expression.cs (New.DoResolve): Improve error message (from -6 to
12902 1501). Use DeclaredOnly lookup to find the exact constructor.
12904 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
12905 loop. This is useful.
12907 * cs-parser.jay: Adjust the default parameters so that destructors
12908 have the proper signature.
12910 2002-04-26 Martin Baulig <martin@gnome.org>
12912 * driver.cs (LoadAssembly): If `assembly' contains any characters
12913 which are only valid in path names and not in assembly names
12914 (currently slash, backslash and point), use Assembly.LoadFrom ()
12915 instead of Assembly.Load () on the `assembly' (before iteration
12916 over the link_paths).
12918 2002-04-26 Martin Baulig <martin@gnome.org>
12920 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
12922 2002-04-25 Miguel de Icaza <miguel@ximian.com>
12924 * class.cs (Property): use the new typemanager.MemberLookup
12926 (TypeContainer.MemberLookup): Implement using the
12927 TypeManager.MemberLookup now.
12929 * typemanager.cs: Make MemberLookup a function of the TypeManager,
12930 and return MemberInfos, so that these can be used without an
12931 EmitContext (what we had before).
12933 2002-04-24 Miguel de Icaza <miguel@ximian.com>
12935 * expression.cs: Fix the case where the argument to params if the
12936 type of the params. I omitted handling this before. Fixed
12938 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12940 * driver.cs: Call BootCorlib_PopulateCoreType
12942 * class.cs (Property.CheckBase): Check for properties only, not
12945 * interface.cs: Temporary hack: try/catch around the
12946 CustomAttributeBuilder, because I am getting an exception that I
12949 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
12950 types whose definitions are required to be there (attributes are
12951 defined before standard types).
12953 Compute definitions as we boot the various types, as they are used
12954 immediately (value_type class will need object_type, but if we do
12955 not initialize object_type, we will pass a null, which will let
12956 the runtime pick the System.Object from the existing corlib, which
12957 is not what we want).
12959 2002-04-22 Patrik Torstensson <totte@labs2.com>
12961 * cs-tokenizer.cs: fixed a number of trim() issues.
12963 2002-04-22 Ravi Pratap <ravi@ximian.com>
12965 * expression.cs (Argument.Type): Ensure that we return the correct
12966 type when we have out or ref parameters [in which case we
12969 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12971 * class.cs (Property, Indexer): Allow extern modifier in there.
12973 * typemanager.cs (InitBaseTypes): Initializes object_type and
12974 value_type, since those will be used early on during the bootstrap
12975 process to compile corlib.
12977 (InitCoreTypes): Move code from here to InitBaseTypes.
12979 2002-04-21 Miguel de Icaza <miguel@ximian.com>
12981 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
12982 single-dimension arrays as using the ldlen opcode.
12984 Daniel Lewis discovered this optimization.
12986 * typemanager.cs: Add signature for System.Array::get_Length
12988 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12990 * statement.cs: report the error when the foreach does not apply to an
12991 array nor a collection.
12993 2002-04-19 Miguel de Icaza <miguel@ximian.com>
12995 * expression.cs: Add implicit conversions to the operator ~.
12997 * constant.cs (DecimalConstant.Emit): Emit decimal value.
12999 * typemanager.cs: Locate the decimal constructor.
13001 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13003 * attribute.cs: use the new property of TypeOf.
13004 * expression.cs: added 'get' property around typearg.
13006 These changes fix a build breaker reported by NickD. Is this the
13007 correct way to fix? If not, please, revert my changes and make it
13010 2002-04-17 Miguel de Icaza <miguel@ximian.com>
13012 * attribute.cs: Add support for typeof in attribute invocations.
13013 I am not sure that this is right though.
13015 2002-04-14 Duncan Mak <duncan@ximian.com>
13017 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
13018 Binary.Operator.Division case.
13020 2002-04-13 Ravi Pratap <ravi@ximian.com>
13022 * class.cs (DefineType): Ensure that we do a proper check on
13023 attribute types and also register it with the TypeManager.
13025 (TypeContainer.Targets): The default for attribute types is
13026 AttributeTargets.All.
13028 * attribute.cs (ApplyAttributes): Registering the attribute type
13029 is done elsewhere, not when we discover we have a Usage attribute.
13031 2002-04-12 Ravi Pratap <ravi@ximian.com>
13033 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
13034 and get rid of is_delegate parameter.
13036 * everywhere : update.
13038 2002-04-12 Ravi Pratap <ravi@ximian.com>
13040 * cs-parser.jay (compilation_unit): Revamp completely to use
13041 some new ideas that I got from Rhys' grammar to solve the problems
13042 with assembly level attributes.
13044 (outer_declaration): New grammar production.
13046 (attribute_sections): Add.
13048 (opt_attributes): Base on attribute_sections
13050 (namespace_declaration): Allow opt_attributes to tackle the case
13051 when we have assembly level attributes - we are clever in this
13054 * attribute.cs (ApplyAttributes): Do not worry about assembly
13055 attributes in the non-global context.
13057 * rootcontext.cs (AddGlobalAttributes): Go back to using this
13058 instead of SetGlobalAttributes.
13060 * class.cs, rootcontext.cs : Ensure we define and generate
13061 attribute types before anything else.
13063 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
13064 and flag the new error -20 for the case when the attribute type
13065 does not have valid targets specified. csc does not catch this.
13067 * ../errors/errors.txt : update for error # -20
13069 2002-04-11 Ravi Pratap <ravi@ximian.com>
13071 * support.cs (InternalParameters.ParameterModifier): Do some null
13072 checking and return sane values.
13074 * class.cs (Method.Define): If we are a PInvoke method, ensure
13075 that we are static and extern. Report error # 601
13077 * ../errors/cs0601.cs : Add test case for the above error.
13079 2002-04-07 Ravi Pratap <ravi@ximian.com>
13081 * rootcontext.cs (attribute_types): We need to keep type of
13082 all attribute types separately and emit code for them first.
13084 (RegisterAttribute) : Implement.
13086 * class.cs (DefineType): Check if the current Type is a custom
13087 attribute type and register it accordingly.
13089 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
13090 adding the first attribute twice and rename to
13092 (SetGlobalAttributes): this.
13094 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
13097 * attribute.cs (ApplyAttributes): Take an additional argument telling us
13098 if we are processing global arguments. Hmm, I am unsure of this.
13100 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
13102 * expression.cs: added static array of strings to avoid calling
13103 Enum.ToString () for Operator in Binary. Significant recover of
13106 2002-04-10 Miguel de Icaza <miguel@ximian.com>
13108 * class.cs (FindMembers): Allow the Builders of the various
13109 members to be null. If they are skip them. This only happens
13110 during the PInvoke declaration.
13112 2002-04-09 Miguel de Icaza <miguel@ximian.com>
13114 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
13115 failure, so we do not keep going afterwards.
13117 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13118 wanted to pass `false' as the `is_delegate' argument. If this is
13119 the case, why not use delegate_type == null to mean `is_delegate =
13120 false' and anything else as is_delegate = true.
13122 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13124 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13125 code for the section, not the beginning of the tests.
13127 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13129 * cfold.cs: Handle operator + (Enum x, Underlying x)
13131 * expression.cs (Binary): same. Warn about errors where we have
13132 Enum/Enum in operator + as well.
13134 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13137 - added support for switch(bool)
13138 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13139 - add TableSwitchEmit() to handle table-based switch statements
13141 2002-04-05 Ravi Pratap <ravi@ximian.com>
13143 * expression.cs (Invocation.OverloadResolve): Factor out code which
13144 does parameter compatibility checking with arguments so that we can
13145 re-use the code even from Delegate.VerifyApplicability
13147 (VerifyArgumentsCompat): Move above code here.
13149 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13150 and instead make a call to the above method.
13152 2002-03-31 Ravi Pratap <ravi@ximian.com>
13154 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13155 We use it to keep track of classes which are attribute types.
13157 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13159 * delegate.cs (Delegate.Define): Correctly define the types in the
13160 presence of fixed and array parameters.
13162 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13165 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13166 include NonPublic after the first iteration.
13168 * class.cs (Indexer.CheckBase): Only check if both parents are
13171 * cs-parser.jay (accessor_body): If empty, set to null.
13173 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13174 same code path here to resolve constants names that we did have in
13175 MemberAccess.DoResolve. There is too much code duplicated here.
13177 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13179 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13181 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13184 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13185 tokens, numbers and strings.
13187 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13190 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13191 asyncronous parameters and the regular parameters.
13193 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13194 specify the target directory.
13196 * expression.cs: (This.DoResolve): Simplify
13197 (As.Emit): Optimize, do not generate IsInst if the expression is
13198 always of the given type.
13200 (Is.DoResolve): Bug fix, we were reporting both always/never for
13203 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13204 creating too many unnecessary arrays.
13206 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13208 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13209 fields instead of rolling our own initializer. Takes care of all
13210 implicit conversions, and drops unnecessary static checks/argument.
13212 2002-03-31 Dick Porter <dick@ximian.com>
13214 * driver.cs: use the GetDirectories() return values properly, and
13215 use "/" as path separator.
13217 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13219 * expression.cs (Unary): Optimize - - expr into expr.
13220 (Binary): Optimize a + (-b) into a -b.
13222 * codegen.cs (CodeGen): Made all methods static.
13224 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13228 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13229 TypeBuilder property.
13231 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13234 * tree.cs: Removed the various RecordXXXX, and replaced with a
13235 single RecordDecl. Removed all the accessor methods, and just
13236 left a single access point Type
13238 * enum.cs: Rename DefineEnum to DefineType.
13240 * decl.cs: New abstract method `DefineType' used to unify the
13241 Defines for Enumerations, Interfaces, TypeContainers and
13244 (FindType): Moved LookupInterfaceOrClass here. Moved the
13245 LookupBaseClasses method that used to live in class.cs and
13246 interface.cs here, and renamed to FindType.
13248 * delegate.cs: Implement DefineType. Take advantage of the
13249 refactored pattern for locating the parent builder without taking
13250 the parent_builder argument (which we know does not work if we are
13251 nested, and triggering a toplevel definition).
13253 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13255 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13256 accessibility of a member has changed during override and report
13259 * class.cs (Method.Define, Property.Define): Only complain on
13260 overrides if the method is private, any other accessibility is
13261 fine (and since we just checked the permission is the same, we are
13264 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13265 and elif are processed always. The other pre-processing
13266 directives are only processed if we are "taking" the path
13268 2002-03-29 Martin Baulig <martin@gnome.org>
13270 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13271 current location is not Null.
13273 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13274 a separate method so we can profile it.
13276 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13277 `span.Seconds' are just seconds, but no minutes or hours.
13278 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13280 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13282 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13283 Remove the gratuitous set of Final:
13285 // If an interface implementation, then we can set Final.
13286 if (((flags & MethodAttributes.Abstract) == 0) &&
13287 implementing.DeclaringType.IsInterface)
13288 flags |= MethodAttributes.Final;
13290 I do not know what I was smoking when I used that.
13293 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13294 step into fixing the name resolution issues for delegates and
13295 unifying the toplevel name resolution.
13297 2002-03-28 Martin Baulig <martin@gnome.org>
13299 * class.cs (Method.Emit): If we have a symbol writer, call its
13300 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13301 tell it about the current method.
13303 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13304 writer that we're going to emit the first byte of IL code for a new
13305 statement (a new source line).
13306 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13307 EmitContext.Mark() before emitting any code.
13309 * location.cs (SymbolDocument): Return null when we're Null.
13311 * statement.cs (Statement): Moved the `Location loc' variable here.
13312 (Statement.EmitBoolExpression): If we have a symbol writer, call
13313 ec.Mark() before emitting any code to tell it that we're at the
13314 beginning of a new statement.
13315 (StatementExpression): Added `Location' argument to the constructor.
13316 (Block): Added public readonly variable `StartLocation' and public
13317 variable `EndLocation'. The latter is to be set using SetEndLocation().
13318 (Block): Added constructor which takes a start and end location.
13319 (Block.SetEndLocation): New method. This sets the end location.
13320 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13321 local variables we create.
13322 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13323 each statement and do also mark the begin and end of the block.
13325 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13326 tell it the current lexer.Location, use Location.Null for the end of the
13328 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13329 current block, set its end location using SetEndLocation().
13330 (statement_expression): StatementExpression constructor now takes the
13331 lexer.Location as additional argument.
13332 (for_statement, declare_local_variables): Likewise.
13333 (declare_local_variables): When creating a new implicit block, use the
13334 new Block constructor and pass it the lexer.Location.
13336 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13338 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13339 members also on the parent interfaces recursively.
13341 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13343 * report.cs: Use new formats, since Gonzalo finished the missing
13346 * expression.cs (Binary.ResolveOperator): added missing operator|
13347 operator& and operator^ for bool/bool.
13349 * cs-parser.jay: CheckDef now takes a Location argument that is
13350 used to report errors more precisly (instead of reporting the end
13351 of a definition, we try to track something which is a lot closer
13352 to the source of the problem).
13354 * cs-tokenizer.cs: Track global token use, so we can properly flag
13355 the use of #define/#undef after the first token has been seen.
13357 Also, rename the reportXXXX to Error_DescriptiveName
13359 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13360 TypeContainer, so that Enum and Interface can use this too.
13362 * class.cs (TypeContainer.LookupInterfaceOrClass,
13363 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13364 `builder' argument. Typically this was used to pass the parent
13365 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13368 The problem is that a nested class could trigger the definition of
13369 a toplevel class, and the builder would be obviously wrong in that
13372 So we drop this argument, and we compute dynamically the
13373 TypeBuilder/ModuleBuilder (the correct information was available
13374 to us anyways from DeclSpace.Parent)
13376 * interface.cs (Interface.DefineInterface): Drop builder
13377 parameter cleanup like class.cs
13379 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13382 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13385 (Try.Emit): Propagate the returns value from the statement.
13387 (Return.Emit): Even if we are leavning
13389 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13391 * modifiers.cs: Fix the computation of MethodAttributes flags.
13393 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13395 * driver.cs: allow compilation of files that start with '/'.
13396 Add a default case when checking the argument of --target.
13398 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13400 * interface.cs: Implement the same search algorithm for types in
13401 the interface code.
13403 * delegate.cs: Do not allow multiple definition.
13405 * Recovered ChangeLog that got accidentally amputated
13407 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13409 * rootcontext.cs: Load manually enum to allow core classes to
13410 contain enumerations.
13412 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13413 Update to new static methods in TypeManager.
13415 * typemanager.cs (GetMethod, GetConstructor): Use our
13416 implementation of FindMembers to find the members, since during
13417 corlib compilation, the types are TypeBuilders and GetMethod and
13418 GetConstructor do not work.
13420 Make all methods in TypeManager static.
13422 (InitCodeHelpers): Split the functionality from
13423 the InitCodeTypes function.
13425 * driver.cs: Call InitCodeHelpers after we have populated the
13428 * cs-parser.jay (delegate_declaration): we did not used to compute
13429 the delegate name correctly for void delegates.
13431 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13433 * rootcontext.cs (RootContext): Init the interface_resolve_order
13434 and type_container_resolve_order always.
13436 (ResolveCore, BootstrapCorlib_ResolveClass,
13437 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13438 compiler when compiling with --nostdlib
13440 * class.cs (TypeContainer.DefineType): Check that our parent is
13441 not null. This test is most important when we are bootstraping
13444 * codegen.cs: Split out the symbol writing code.
13446 2002-03-25 Martin Baulig <martin@gnome.org>
13448 * driver.cs (-g): Made -g an alias for --debug.
13450 2002-03-24 Martin Baulig <martin@gnome.org>
13452 * codegen.cs (SymbolWriter): New public variable. Returns the
13453 current symbol writer.
13454 (CodeGen): Added `bool want_debugging_support' argument to the
13455 constructor. If true, tell the ModuleBuild that we want debugging
13456 support and ask it for the ISymbolWriter.
13457 (Save): If we have a symbol writer, call it's Close() method after
13458 saving the assembly.
13460 * driver.c (--debug): New command line argument to create a
13461 debugger information file.
13463 * location.cs (SymbolDocument): New public property. Returns an
13464 ISymbolDocumentWriter object for the current source file or null
13465 if we don't have a symbol writer.
13467 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13469 * driver.cs (LoadAssembly): Correctly return when all the paths
13470 have been tried and not before.
13472 * statement.cs (Switch.Emit): return the actual coverage for this
13473 statement (returns/not-returns)
13475 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13476 switch of the statement if we are the last switch section. That
13477 kills two problems: try/catch problems (we used to emit an empty
13478 nop at the end) and switch statements where all branches would
13481 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13483 * driver.cs: Add default assemblies (the equivalent to the
13484 Microsoft CSC.RSP file)
13486 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13487 also update tokens_seen and set it to false.
13489 * driver.cs: Implement --recurse for Mike.
13491 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13492 correctly splitting out the paths.
13494 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13496 * interface.cs (Interface.PopulateProperty): Instead of using
13497 `parent' as the declaration space for the set parameters, use
13500 * support.cs (InternalParameters): InternalParameters constructor
13501 takes a DeclSpace instead of a TypeContainer.
13503 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13504 types are being initialized, load the address of it before calling
13507 (New): Provide a mechanism to disable the generation of local
13508 value type temporaries when the caller will be providing us with
13509 an address to store it.
13511 (ArrayCreation.EmitDynamicInitializers): Use it.
13513 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13515 * expression.cs (Invocation.EmitArguments): Only probe for array
13516 property if there is more than one argument. Sorry about that.
13518 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13519 empty param arrays.
13521 * class.cs (Method.LabelParameters): Fix incorrect code path that
13522 prevented the `ParamArrayAttribute' from being applied to the
13525 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13527 * support.cs (ReflectionParameters): Correctly compute whether the
13528 last argument is a params array. Fixes the problem with
13531 * typemanager.cs: Make the assemblies array always be non-null
13532 (empty, but non-null)
13534 * tree.cs (RecordDecl): New function that abstracts the recording
13535 of names. This reports error 101, and provides a pointer to the
13536 previous declaration. Fixes a crash in the compiler.
13538 * cs-parser.jay (constructor_declaration): Update to new grammar,
13539 and provide a constructor_body that can be empty.
13541 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13543 * driver.cs: Add support for --resources.
13545 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13546 Make all types for the various array helper methods be integer.
13548 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13549 CheckState to ConvCast.
13551 (ConvCast): Now it takes a `checked' state argument, to avoid
13552 depending on the emit context for the conversion, and just using
13553 the resolve time setting.
13555 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13556 instead of Invocation.EmitArguments. We do not emit the original
13557 arguments, instead we emit those which have been converted to
13558 unsigned int expressions.
13560 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
13562 * codegen.cs: ditto.
13564 * expression.cs (LocalVariableReference): Drop the use of the
13565 Store function that depended on the variable index.
13567 * statement.cs (VariableInfo): Drop the `Idx' property from this
13568 class, as this is not taking into account the indexes for
13569 temporaries tat we generate during the execution, getting the
13572 * class.cs: First emit class initializers, then call the parent
13575 * expression.cs (Binary): Fix opcode emision.
13576 (UnaryMutator.EmitCode): Support checked code generation
13578 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
13579 matches for events for both the Static and Instance scans,
13580 pointing to the same element. Fix that.
13582 2002-03-14 Miguel de Icaza <miguel@ximian.com>
13584 * rootcontext.cs (ResolveTree): Always set the
13585 interface_resolve_order, because nested interfaces will be calling
13588 * class.cs (GetInterfaceOrClass): Track the same resolution
13589 process used by TypeManager.LookupType. This fixes the nested
13590 type lookups in class declarations (separate path from
13593 (TypeContainer.DefineType): Also define nested interfaces.
13594 (TypeContainer.RegisterOrder): New public function used to
13595 register the order in which child interfaces need to be closed.
13597 Nested interfaces need to be closed after their parents have been
13600 * interface.cs (InterfaceAttr): Put all the logic for computing
13601 the interface attribute here.
13603 (DefineInterface): Register our interface order with the
13604 RootContext or with the TypeContainer depending on the case.
13606 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13608 * cs-parser.jay: rework foreach statement to work with the new
13609 changes to the policy on SimpleNames.
13611 * report.cs: support Stacktrace on warnings as well.
13613 * makefile: drop --unsafe and /unsafe from the compile.
13615 2002-03-13 Ravi Pratap <ravi@ximian.com>
13617 * ecore.cs (StandardConversionExists): Modify to take an Expression
13618 as the first parameter. Ensure we do null -> reference type conversion
13621 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
13622 temporary Expression objects.
13624 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
13626 * interface.cs: workaround bug in method overloading resolution
13627 (there is already a bugzilla bug for it).
13629 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13631 We could also solve this problem by having a separate path for
13632 performing type lookups, instead of DoResolve, we could have a
13633 ResolveType entry point, and only participating pieces of the
13634 production (simplename, deref, array) would implement this.
13636 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
13637 signal SimpleName to only resolve type names and not attempt to
13638 resolve anything else.
13640 * expression.cs (Cast): Set the flag.
13642 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
13644 * class.cs: Only report 108 if there is no `new' modifier.
13646 * cs-parser.jay: rework foreach statement to work with the new
13647 changes to the policy on SimpleNames.
13649 * report.cs: support Stacktrace on warnings as well.
13651 * makefile: drop --unsafe and /unsafe from the compile.
13653 2002-03-11 Miguel de Icaza <miguel@ximian.com>
13655 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13656 lookups here, instead of doing that at parse time. This means
13657 that our grammar will not introduce `LocalVariableReferences' as
13658 expressions at this point. That solves the problem of code like
13662 static void Main ()
13666 This is only half the fix. The full fix requires parameters to
13667 also be handled in this way.
13669 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
13670 makes the use more obvious of the DeclSpace. The
13671 ec.TypeContainer.TypeBuilder is now only used to pull the
13672 TypeBuilder for it.
13674 My theory is that I can get rid of the TypeBuilder completely from
13675 the EmitContext, and have typecasts where it is used (from
13676 DeclSpace to where it matters).
13678 The only pending problem is that the code that implements Aliases
13679 is on TypeContainer, and probably should go in DeclSpace.
13681 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13682 lookups here, instead of doing that at parse time. This means
13683 that our grammar will not introduce `LocalVariableReferences' as
13684 expressions at this point. That solves the problem of code like
13688 static void Main ()
13692 This is only half the fix. The full fix requires parameters to
13693 also be handled in this way.
13695 * class.cs (Property.DefineMethod): When implementing an interface
13696 method, set newslot, when implementing an abstract method, do not
13697 set the flag (before we tried never setting it, or always setting
13698 it, which is the difference).
13699 (Indexer.DefineMethod): same.
13700 (Method.DefineMethod): same.
13702 * ecore.cs: Only set the status used flag if we get back a Field.
13704 * attribute.cs: Temporary hack, so Paolo can keep working.
13706 2002-03-08 Ravi Pratap <ravi@ximian.com>
13708 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
13709 the unmanaged type in the case we have a MarshalAs attribute.
13711 (Resolve): Handle the case when we are parsing the special MarshalAs
13712 attribute [we need to store the unmanaged type to use later]
13714 * typemanager.cs (marshal_as_attr_type): Built in type for the
13715 MarshalAs Attribute.
13717 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
13718 on parameters and accordingly set the marshalling info.
13720 2002-03-09 Miguel de Icaza <miguel@ximian.com>
13722 * class.cs: Optimizing slightly by removing redundant code after
13723 we switched to the `NoTypes' return value.
13724 (Property.DefineMethod): use NoTypes here too.
13726 This fixes the bug I introduced in my last batch of changes.
13728 2002-03-05 Ravi Pratap <ravi@ximian.com>
13730 * tree.cs (RecordEnum): Add. We now keep track of enums too.
13732 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
13733 Enums since those are types too.
13735 * cs-parser.jay (enum_declaration): Record enums as we parse them.
13737 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
13738 thanks to a call during the lookup process.
13740 2002-03-07 Miguel de Icaza <miguel@ximian.com>
13742 * statement.cs (Foreach): Lots of work to accomodate a particular
13743 kind of foreach statement that I had not kept in mind. It is
13744 possible to have foreachs on classes that provide a GetEnumerator
13745 method that return objects that implement the "pattern" for using
13746 a foreach, there is no need to support GetEnumerator
13749 This is needed to compile nant.
13751 * decl.cs: Only report 114 if the member is not `Finalize' and if
13752 the warning level is at least 2.
13754 * class.cs: Moved the compare function from Method to
13757 (MethodSignature.InheritableMemberSignatureCompare): Add new
13758 filter function that is used to extract inheritable methods from a
13761 (Method.Define): Use the new `inheritable_method_signature_filter'
13764 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
13767 2002-03-06 Miguel de Icaza <miguel@ximian.com>
13769 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
13771 * cs-parser.jay: Add opt_semicolon to the interface declaration.
13773 * expression.cs: Pass location information to
13774 ConvertImplicitStandard.
13776 * class.cs: Added debugging code to track return values from
13779 2002-03-05 Miguel de Icaza <miguel@ximian.com>
13781 * expression.cs (Is.DoResolve): If either side of the `is' is an
13782 interface, do not flag the warning.
13784 * ecore.cs (ImplicitReferenceConversion): We need a separate test
13787 * report.cs: Allow for --fatal to be used with --probe.
13789 * typemanager.cs (NoTypes): Move the definition for the empty Type
13792 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
13794 (TypeContainer.DefineProxy): New function used to proxy to parent
13795 implementations when implementing interfaces.
13796 (TypeContainer.ParentImplements): used to lookup if our parent
13797 implements a public function that is required by an interface.
13798 (TypeContainer.VerifyPendingMethods): Hook this up.
13800 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
13801 `modules' and `assemblies' arraylists into arrays. We only grow
13802 these are the very early start up of the program, so this improves
13803 the speedof LookupType (nicely measured).
13805 * expression.cs (MakeByteBlob): Replaced unsafe code with
13806 BitConverter, as suggested by Paolo.
13808 * cfold.cs (ConstantFold.Binary): Special case: perform constant
13809 folding of string concatenation, but if either side is a string,
13810 and the other is not, then return null, and let the runtime use
13811 the concatenation on the string plus the object (using
13812 `Object.ToString').
13814 2002-03-04 Miguel de Icaza <miguel@ximian.com>
13816 Constant Folding has been implemented now.
13818 * expression.cs (Unary.Reduce): Do not throw an exception, catch
13819 the error instead on types that are not supported in one's
13822 * constant.cs (Constant and all children): New set of functions to
13823 perform implict and explicit conversions.
13825 * ecore.cs (EnumConstant): Implement the new functions to perform
13826 conversion by proxying to the child expression.
13828 * codegen.cs: (ConstantCheckState): Constant evaluation has its
13829 own separate setting that can not be turned off from the command
13830 line using --unchecked or --checked and is only controlled using
13831 the checked/unchecked statements and expressions. This setting is
13832 used by the constant folder to flag errors.
13834 * expression.cs (CheckedExpr, UncheckedExpr): Set the
13835 ConstantCheckState as well.
13837 During Resolve, they also have to flag the state, because the
13838 constant folder runs completely in the Resolve phase.
13840 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
13843 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13845 * cfold.cs: New file, this file contains the constant folder.
13847 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
13848 argument to track whether we are using the resulting address to
13849 load or store a value and provide better error messages.
13851 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
13852 new AddressOf arguments.
13854 * statement.cs (Foreach.EmitCollectionForeach): Update
13856 * expression.cs (Argument.Emit): Call AddressOf with proper
13857 arguments to track usage.
13859 (New.DoEmit): Call AddressOf with new arguments.
13861 (Unary.Emit): Adjust AddressOf call.
13863 2002-03-01 Ravi Pratap <ravi@ximian.com>
13865 * cs-parser.jay (member_access): Change the case for pre-defined types
13866 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
13869 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
13872 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
13873 essentially like methods and apply attributes like MethodImplOptions to them too.
13875 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
13878 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
13879 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
13882 * Update code everywhere accordingly.
13884 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
13886 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
13888 2002-02-28 Ravi Pratap <ravi@ximian.com>
13890 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
13891 try performing lookups against those instead of jumping straight into using
13892 the 'using' clauses.
13894 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
13896 (LookupType): Perform lookups in implicit parents too.
13898 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
13899 sequence as RootContext.LookupType.
13901 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
13902 the various cases of namespace lookups into this method.
13904 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13906 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
13907 in positional arguments)
13909 * class.cs (Operator): Update the AllowedModifiers to contain
13912 * cs-parser.jay: Update operator declaration to allow for the
13913 operator body to be empty.
13915 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
13918 2002-02-27 Miguel de Icaza <miguel@ximian.com>
13920 * class.cs (Method.Emit): Label parameters.
13922 * driver.cs: Return 1 or 0 as the program exit code.
13924 2002-02-26 Miguel de Icaza <miguel@ximian.com>
13926 * expression.cs: Special case the `null' object when trying to
13927 auto-compute the type, as anything can be explicitly converted to
13930 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
13931 spotting this Paolo.
13933 (Expression.ImplicitNumericConversion): Perform comparissions of
13934 the type using the underlying type in the case of an enumeration
13935 rather than using the enumeration type for the compare.
13937 Cope with the underlying == type case, which is not possible to
13940 (Expression.ConvertNumericExplicit): Perform comparissions of
13941 the type using the underlying type in the case of an enumeration
13942 rather than using the enumeration type for the compare.
13944 * driver.cs: If the user does not supply an extension, assume .exe
13946 * cs-parser.jay (if_statement): Rewrote so that we can track the
13947 location for the if statement.
13949 * expression.cs (Binary.ConstantFold): Only concat strings when
13950 the operation is "+", not everything ;-)
13952 * statement.cs (Statement.EmitBoolExpression): Take a location
13954 (If, While, Do): Track location.
13956 * expression.cs (Binary.ResolveOperator): In the object + string
13957 case, I was missing a call to ConvertImplicit
13959 2002-02-25 Ravi Pratap <ravi@ximian.com>
13961 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
13962 Location arguments. Ensure we use RootContext.LookupType to do our work
13963 and not try to do a direct Type.GetType and ModuleBuilder.GetType
13965 * interface.cs (PopulateMethod): Handle the type of the parameter being
13968 * expression.cs (Invocation.BetterFunction): Handle the case when we
13969 have a params method with no fixed arguments and a call is made with no
13972 2002-02-25 Miguel de Icaza <miguel@ximian.com>
13974 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
13975 the verbatim-string-literal
13977 * support.cs (InternalParameters.ParameterModifier): handle null
13979 (InternalParameters.ParameterType): ditto.
13981 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
13982 duplicating the name of the variable parameter.
13983 (GetParameterByName): Fix bug where we were not looking up array
13984 paramters if they were the only present (thanks Paolo!).
13985 (GetParameterInfo): We only have an empty set of types if both
13986 fixed and array are set to null.
13987 (GetParameterInfo-idx): Handle FixedParameter == null
13989 * cs-parser.jay: Handle the case where there is no catch
13990 statements (missing null test).
13992 2002-02-22 Miguel de Icaza <miguel@ximian.com>
13994 * driver.cs (MainDriver): Be conservative on our command line
13997 Catch DirectoryNotFoundException when calling GetFiles.
13999 (SplitPathAndPattern): Used to split the input specification into
14000 a path and a pattern that we can feed to Directory.GetFiles.
14002 2002-02-21 Miguel de Icaza <miguel@ximian.com>
14004 * statement.cs (Fixed): Implement the last case of the Fixed
14005 statement (string handling).
14007 * expression.cs (StringPtr): New class used to return a char * to
14008 a string; Used by the Fixed statement.
14010 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
14012 * expression.cs (Binary.ResolveOperator): Remove redundant
14013 MemberLookup pn parent type.
14014 Optimize union call, we do not need a union if the types are the same.
14015 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
14018 Specialize the use of MemberLookup everywhere, instead of using
14019 the default settings.
14021 (StackAlloc): Implement stackalloc keyword.
14023 * cs-parser.jay: Add rule to parse stackalloc.
14025 * driver.cs: Handle /h, /help, /?
14027 * expression.cs (MakeByteBlob): Removed the hacks we had in place
14028 before we supported unsafe code.
14030 * makefile: add --unsafe to the self compilation of mcs.
14032 2002-02-20 Miguel de Icaza <miguel@ximian.com>
14034 * expression.cs (PointerArithmetic): New class that is used to
14035 perform pointer arithmetic.
14036 (Binary.Resolve): Handle pointer arithmetic
14037 Handle pointer comparission.
14038 (ArrayPtr): Utility expression class that is used to take the
14039 address of an array.
14041 (ElementAccess): Implement array access for pointers
14043 * statement.cs (Fixed): Implement fixed statement for arrays, we
14044 are missing one more case before we are done.
14046 * expression.cs (Indirection): Implement EmitAssign and set the
14047 ExprClass to Variable. This allows pointer dereferences to be
14048 treated as variables, and to have values assigned to them.
14050 * ecore.cs (Expression.StoreFromPtr): New utility function to
14051 store values dereferencing.
14053 2002-02-20 Ravi Pratap <ravi@ximian.com>
14055 * expression.cs (Binary.ResolveOperator): Ensure that we are
14056 not trying to operate on a void type - this fixes the reported
14059 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
14060 the parent implementation is sealed.
14062 * ../errors/cs0239.cs : Add.
14064 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
14066 * typemanager.cs (unverifiable_code_type): Corresponds to
14067 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
14068 which have unsafe code in them.
14070 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
14073 2002-02-19 Miguel de Icaza <miguel@ximian.com>
14075 * cs-tokenizer.cs: Add support for @"litreal strings"
14077 Make tokenizer accept pre-processor directives
14078 on any column (remove the old C-like limitation).
14080 * rootcontext.cs (EmitCode): Emit any global attributes.
14081 (AddGlobalAttributes): Used to keep track of assembly attributes.
14083 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
14085 * cs-parser.jay: Add support for global attributes.
14087 2002-02-17 Miguel de Icaza <miguel@ximian.com>
14089 * expression.cs (Indirection): New helper class. Unary will
14090 create Indirection classes to be able to implement the
14091 IMemoryLocation interface on it.
14093 2002-02-16 Miguel de Icaza <miguel@ximian.com>
14095 * cs-parser.jay (fixed_statement): reference the right statement.
14097 * statement.cs (Fixed.Emit): Finish implementing the fixed
14098 statement for the &x case.
14100 2002-02-14 Miguel de Icaza <miguel@ximian.com>
14102 * class.cs (Property.Define, Method.Define): Remove newslot when
14105 * modifiers.cs: My use of NewSlot when `Abstract' was set was
14106 wrong. NewSlot should only be used if the `new' keyword is present.
14108 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
14109 locating our system dir. Sorry about this.
14111 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14113 * driver.cs (GetSystemDir): Compute correctly the location of our
14114 system assemblies. I was using the compiler directory instead of
14115 the library directory.
14117 2002-02-13 Ravi Pratap <ravi@ximian.com>
14119 * expression.cs (BetterFunction): Put back in what Miguel commented out
14120 since it is the correct fix. The problem is elsewhere ;-)
14122 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14123 parameters of the parms method are themselves compatible or not !
14125 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14126 to check that a class implements an interface before saying that an implicit
14127 conversion was allowed. Use ImplementsInterface to do the checking.
14129 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14131 * class.cs (Method.Define): Track whether we are an explicit
14132 implementation or not. And only call DefineMethodOverride if we
14133 are an explicit implementation.
14135 (Property.DefineMethod): Ditto.
14137 2002-02-11 Ravi Pratap <ravi@ximian.com>
14139 * expression.cs (BetterFunction): Catch hideous bug which was
14140 preventing us from detecting ambiguous calls due to implicit casts i.e
14143 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14145 * support.cs (Pair): Remove un-needed method. I figured why I was
14146 getting the error in cs-parser.jay, the variable in a foreach loop
14147 is readonly, and the compiler does not really treat this as a variable.
14149 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14150 instead of EQUALS in grammar.
14152 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14154 * expression.cs (Unary.DoResolve): Check whether the argument is
14157 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14159 * support.cs: Api for Pair to set a value. Despite the fact that
14160 the variables are public the MS C# compiler refuses to compile
14161 code that accesses the field if the variable is part of a foreach
14164 * statement.cs (Fixed): Begin implementation of the fixed
14167 (Block.AddVariable): Return the VariableInfo on success and null
14168 on failure instead of true/false.
14170 * cs-parser.jay (foreach): Catch errors on variables already
14171 defined (we were ignoring this value before) and properly unwind
14172 the block hierarchy
14174 (fixed_statement): grammar for the fixed statement.
14176 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14178 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14179 pointer types to be incretemented.
14181 (SizeOf): Implement.
14183 * cs-parser.jay (pointer_member_access): Implement
14184 expr->IDENTIFIER production.
14186 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14187 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14190 (Unary): Implement indirection.
14192 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14193 use in non-unsafe context).
14195 (SimpleName.DoResolve): Check for pointers in field access on safe
14198 (Expression.LoadFromPtr): Factor the load-indirect code in this
14199 function. This was duplicated in UnboxCast and ParameterReference
14201 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14203 * expression.cs (ComposedCast): report an error if a pointer cast
14204 is used in a safe region.
14206 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14207 pointer type casts in unsafe context.
14209 * codegen.cs (EmitContext): Set up IsUnsafe.
14211 * cs-parser.jay (non_expression_type): Add productions for pointer
14214 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14215 code. We should not use force into static mode if the method is
14216 not virtual. Fixes bug in MIS
14218 * statement.cs (Do.Emit, While.Emit, For.Emit,
14219 Statement.EmitBoolExpression): Add support to Do and While to
14220 propagate infinite loop as `I do return' semantics.
14222 Improve the For case to also test for boolean constants.
14224 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14225 to the list of attributes we can add.
14227 Remove `EmitContext' argument.
14229 * class.cs (Method.Define): Apply parameter attributes.
14230 (Constructor.Define): Apply parameter attributes.
14231 (MethodCore.LabelParameters): Move here the core of labeling
14234 * support.cs (ReflectionParameters.ParameterModifier,
14235 InternalParameters.ParameterModifier): Use IsByRef on the type and
14236 only return the OUT bit for these parameters instead of in/out/ref
14239 This is because I miss-understood things. The ParameterInfo.IsIn
14240 and IsOut represent whether the parameter has the [In] and [Out]
14243 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14245 * ecore.cs (FieldExpr.Emit): Release temporaries.
14247 * assign.cs (LocalTemporary.Release): new function.
14249 * codegen.cs (EmitContext.GetTemporaryStorage,
14250 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14251 temporary storage. Now we can "put back" localbuilders when we
14254 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14256 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14257 need to make a copy of the variable to generate verifiable code.
14259 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14261 * driver.cs: Compute dynamically the system directory.
14263 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14264 Slower, but more generally useful. Used by the abstract
14265 registering implementation.
14267 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14268 the rules for the special rule on Type/instances. First check if
14269 we have the same name, and if so, try that special static path
14270 rather than the instance path.
14272 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14274 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14277 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14278 Enum, ValueType, Delegate or Array for non-corlib compiles.
14280 * cs-tokenizer.cs: Catch long identifiers (645)
14282 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14285 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14286 fix, we were returning too early, so we were not registering
14287 pending methods from abstract classes.
14289 Do not register pending methods if the class is abstract.
14291 * expression.cs (Conditional.DoResolve): Report circular implicit
14292 conversions when we neecd to compute it for conditional
14295 (Is.DoResolve): If the expression is always of the provided type,
14296 flag warning 183. If the expression can not ever be of the
14297 provided type flag warning 184.
14299 * class.cs: Catch 169 as well.
14301 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14304 2002-01-18 Nick Drochak <ndrochak@gol.com>
14306 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14308 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14310 * interface.cs: (PopulateMethod): Check for pointers being defined
14311 only if the unsafe context is active.
14312 (PopulateProperty): ditto.
14313 (PopulateIndexer): ditto.
14315 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14316 specified. If pointers are present, make sure that they are
14317 present in an unsafe context.
14318 (Constructor, Constructor.Define): ditto.
14319 (Field, Field.Define): ditto.
14320 (Property, Property.Define): ditto.
14321 (Event, Event.Define): ditto.
14323 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14324 hashtable if there are classes or structs defined.
14326 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14327 code, as the constant resolution moved.
14329 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14330 the metadata, so we can flag error 133.
14332 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14333 pointer is being declared in an unsafe context.
14335 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14337 * modifiers.cs (Modifiers.Check): Require a Location argument.
14338 Report error 227 for Unsafe use.
14340 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14342 * statement.cs (For.Emit): If the test is null, then report that
14343 we do `return', as we wont reach anything afterwards.
14345 (Switch.SwitchGoverningType): Track the expression that matched
14348 * driver.cs: Allow negative numbers as an error code to flag.
14350 * cs-parser.jay: Handle 1551.
14352 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14354 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14356 * cs-parser.jay: Report 1518 (type declaration can only contain
14357 class, struct, interface, enum or delegate)
14359 (switch_label): Report 1523 (keywords `case' or `default' must
14362 (opt_switch_sections): Report 1522 (empty switch)
14364 * driver.cs: Report 1515 (response file specified multiple times)
14365 Report 1516 (Source file specified multiple times).
14367 * expression.cs (Argument.Resolve): Signal 1510
14369 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14370 access not allowed in static code)
14372 2002-01-11 Ravi Pratap <ravi@ximian.com>
14374 * typemanager.cs (IsPointerType): Utility method which we are going
14377 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14378 the object type, so we take care of that.
14380 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14382 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14383 added to non-params parameters :-)
14385 * typemanager.cs (CSharpName): Include 'void' type too.
14387 (void_ptr_type): Include in the set of core types.
14389 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14392 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14395 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14396 completely forgotten about it.
14398 2002-01-10 Ravi Pratap <ravi@ximian.com>
14400 * cs-parser.jay (pointer_type): Add. This begins our implementation
14401 of parsing rules for unsafe code.
14403 (unsafe_statement): Implement.
14405 (embedded_statement): Modify to include the above.
14407 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14409 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14410 if the current context is an unsafe one.
14412 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14413 are handled differently, we need separate rules for them.
14415 (local_variable_declaration): Update to use local_variable_pointer_type
14416 to allow variable declarations of unmanaged pointer types.
14418 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14419 in unsafe contexts.
14421 * ../errors/cs0214.cs : Add.
14423 2002-01-16 Nick Drochak <ndrochak@gol.com>
14425 * makefile: remove 'response' file when cleaning.
14427 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14429 * cs-parser.jay: Report 1524.
14431 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14433 * typemanager.cs (RegisterMethod): drop checking if we have
14434 registered this from here
14436 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14438 * class.cs (Method.EmitDestructor): Implement calling our base
14441 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14442 value of InFinally.
14444 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14445 this routine and will wrap the call in a try/catch block. Deal
14448 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14450 * ecore.cs (Expression.MemberLookup): instead of taking a
14451 parameter `same_type' that was used to tell whether we could
14452 access private members we compute our containing type from the
14455 (FieldExpr): Added partial support for volatile fields. This does
14456 not work for volatile fields exposed from assemblies, as I can not
14457 figure out how to extract the modreq from it.
14459 Updated all the source files to use this.
14461 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14462 because it is referenced by MemberLookup very often.
14464 2002-01-09 Ravi Pratap <ravi@ximian.com>
14466 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14467 TypeBuilder.GetCustomAttributes to retrieve what we need.
14469 Get rid of redundant default_member_attr_type as this is the same as
14470 default_member_type which already exists.
14472 * interface.cs, attribute.cs : Update accordingly.
14474 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14476 * typemanager.cs: Enable IndexerPropertyName again. It does not
14477 work for TYpeBuilders though. Ravi, can you please fix this?
14479 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14481 * expression.cs (Argument.Emit): Handle the case of ref objects
14482 being passed to ref functions;
14484 (ParameterReference.EmitLoad): Loads the content of the pointer
14485 without dereferencing.
14487 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14489 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14491 2002-01-08 Ravi Pratap <ravi@ximian.com>
14493 * class.cs (Indexer.DefineMethod): Incorporate the interface
14494 type in the name of the method if we are doing explicit interface
14497 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14499 (BetterConversion): Fix extremely trivial bug where we were referring to
14500 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14503 * ../errors/bug16.cs : Add although we have fixed it.
14505 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14507 * expression.cs (BaseIndexer): Begin implementation.
14509 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14511 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14512 production directly to remove a shift/reduce, and implement
14513 explicit interface implementation.
14515 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14516 after a floating point suffix.
14518 * expression.cs (DoNumericPromotions): Improved the conversion for
14519 uint/uint. If we have a constant, we avoid doing a typecast to a
14522 * class.cs (Indexer): Implement explicit interface implementation
14525 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14527 * class.cs: make the default instance constructor public and hidebysig.
14529 2001-01-03 Ravi Pratap <ravi@ximian.com>
14531 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14532 so we can call it from elsewhere.
14534 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14535 we emit it internally if the class has a defined indexer; otherwise the user
14536 emits it by decorating the class definition with the DefaultMemberAttribute.
14538 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14539 attribute is not used on a type which defines an indexer.
14541 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14542 character when we skip whitespace.
14544 * ../errors/cs0646.cs : Add.
14546 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14548 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14551 * makefile: Add practical target `mcs3.exe' which builds the third
14552 generation compiler.
14554 * expression.cs (New): Fix structures constructor calling.
14556 * class.cs (Property, Method, Indexer): Emit Final flag on the
14557 method if we are an interface implementation and we are not
14560 * ecore.cs (PropertyExpr): New public field `IsBase', tells
14561 whether this property is referencing a `base' method.
14563 * expression.cs (Invocation.EmitCall): take an extra argument:
14564 is_base, this is used to determine whether the `call' or
14565 `callvirt' opcode should be used.
14568 * delegate.cs: update EmitCall.
14570 * class.cs (Method.Define): Set NewSlot for the cases where we are
14571 not implementing an interface method.
14573 (Property.Define): ditto.
14575 2002-01-02 Miguel de Icaza <miguel@ximian.com>
14577 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
14578 'r'. Allows mcs to parse itself fully.
14580 2002-01-02 Ravi Pratap <ravi@ximian.com>
14582 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
14583 of the number of initializers that require the InitializeArray method.
14585 (CheckIndices): Store the Expression in all cases - not the plain value. Also
14586 update the above field where necessary.
14588 (MakeByteBlob): Update accordingly.
14590 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
14593 (EmitDynamicInitializers): Update in accordance with the new optimization.
14595 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
14596 same OpCode applies.
14598 * cs-parser.jay : Fix some glaring errors I introduced.
14600 2002-01-01 Ravi Pratap <ravi@ximian.com>
14602 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
14603 so that we can check for name clashes there too.
14605 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
14606 for interface indexers.
14608 * interfaces.cs (Define): Emit the default member attribute.
14610 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
14611 variable was being referred to while setting the value ;-)
14613 2002-01-01 Miguel de Icaza <miguel@ximian.com>
14615 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
14616 byte-by-byte information when we know the data is zero.
14618 Make the block always a multiple of 4, because
14619 DefineInitializedData has a bug.
14621 * assign.cs: Fix, we should assign from the temporary, not from
14624 * expression.cs (MakeByteBlob): Fix my incorrect code.
14626 2001-12-31 Miguel de Icaza <miguel@ximian.com>
14628 * typemanager.cs (EnumToUnderlying): This function is used to get
14629 the underlying type from an enumeration, because it does not
14632 * constant.cs: Use the I4_S form for values between -128 and 127.
14634 * statement.cs (Block.LookupLabel): Looks up a label.
14635 (Block): Drop support for labeled blocks.
14637 (LabeledStatement): New kind of statement that represents a label
14640 (Goto): Finally implement this bad boy.
14642 * cs-parser.jay: Update to reflect new mechanism to implement
14645 2001-12-30 Miguel de Icaza <miguel@ximian.com>
14647 * codegen.cs (EmitContext.This): a codegen property that keeps the
14648 a single instance of this instead of creating many different this
14651 * delegate.cs (Delegate.DoResolve): Update to use the property;
14653 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
14655 * expression.cs (BaseAccess.DoResolve): Ditto.
14657 2001-12-29 Ravi Pratap <ravi@ximian.com>
14659 * typemanager.cs (methodimpl_attr_type): Add to hold the type
14660 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
14662 (InitCoreTypes): Update accordingly.
14664 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
14665 so we can quickly store the state.
14667 (ApplyAttributes): Set the correct implementation flags
14668 for InternalCall methods.
14670 2001-12-29 Miguel de Icaza <miguel@ximian.com>
14672 * expression.cs (EmitCall): if a method is not virtual, then do
14673 not use callvirt on it.
14675 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
14676 user defined stuff) requires the use of stobj, which takes an
14677 address on the stack instead of an array and an index. So emit
14678 the Ldelema operation for it.
14680 (EmitStoreOpcode): Use stobj for valuetypes.
14682 (UnaryMutator.EmitCode): Use the right 1 value depending on
14683 whether we are dealing with int64/uint64, float or doubles.
14685 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
14686 constructors that I implemented last night.
14688 (Constructor.IsDefault): Fix to work properly for static
14691 * cs-parser.jay (CheckDef): report method signature errors.
14692 Update error number 103 to be 132.
14694 * decl.cs: New AdditionResult enumeration value: MethodExists.
14695 Although we do this check for methods later on in the semantic
14696 analysis, catching repeated default constructors is so easy that
14697 we catch these here.
14699 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
14702 (ParameterReference.EmitAssign, Emit): handle
14705 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
14706 (ArrayAccess.EmitStoreOpcode): ditto.
14708 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
14710 * expression.cs (MakeByteBlob): Complete all the missing types
14711 (uint, short, ushort, byte, sbyte)
14713 * class.cs: Only init instance field initializers on instance
14716 Rename `constructors' to instance_constructors.
14718 (TypeContainer.AddConstructor): Only add constructors to the list
14719 if it is not static.
14721 Make sure that we handle default_static_constructor independently
14722 everywhere where we handle instance_constructors
14724 2001-12-28 Miguel de Icaza <miguel@ximian.com>
14726 * class.cs: Do not lookup or create a base initializer for a
14727 static constructor.
14729 (ConstructorInitializer.Resolve): use the proper type to lookup
14732 * cs-parser.jay: Report error 1585 (modifiers between type and name).
14734 * enum.cs, interface.cs: Remove CloseType, this is taken care by
14737 * decl.cs: CloseType is now an virtual method, the default
14738 implementation just closes this type.
14740 2001-12-28 Ravi Pratap <ravi@ximian.com>
14742 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
14743 to PreserveSig by default. Also emit HideBySig on such methods.
14745 Basically, set the defaults to standard values.
14747 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
14748 argument, if candidate is better, it can't be worse than the best !
14750 (Invocation): Re-write bits to differentiate between methods being
14751 applicable in their expanded form and their normal form - for params
14754 Get rid of use_standard everywhere as only standard conversions are allowed
14755 in overload resolution.
14757 More spec conformance.
14759 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14761 * driver.cs: Add --timestamp, to see where the compiler spends
14764 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
14765 `this' in static code.
14767 (SimpleName.DoResolve): Implement in terms of a helper function
14768 that allows static-references to be passed upstream to
14771 (Expression.ResolveWithSimpleName): Resolve specially simple
14772 names when called by MemberAccess to implement the special
14775 (Expression.ImplicitReferenceConversion): Handle conversions from
14776 Null to reference types before others, as Null's type is
14779 * expression.cs (Invocation.EmitCall): Handle the special case of
14780 calling methods declared on a reference type from a ValueType
14781 (Base classes System.Object and System.Enum)
14783 (MemberAccess.Resolve): Only perform lookups on Enumerations if
14784 the left hand side is a TypeExpr, not on every enumeration.
14786 (Binary.Resolve): If types are reference types, then do a cast to
14787 object on operators != and == of both arguments.
14789 * typemanager.cs (FindMembers): Extract instance and static
14790 members if requested.
14792 * interface.cs (PopulateProperty): Use void_type instead of null
14793 as the return type for the setter method.
14795 (PopulateIndexer): ditto.
14797 2001-12-27 Ravi Pratap <ravi@ximian.com>
14799 * support.cs (ReflectionParameters): Fix minor bug where we
14800 were examining the wrong parameter for the ParamArray attribute.
14802 Cope with requests for the type of the parameter at position
14803 greater than the params parameter's. We now return the element
14804 type of the params array as that makes more sense.
14806 * expression.cs (Invocation.IsParamsMethodApplicable): Update
14807 accordingly as we no longer have to extract the element type
14810 (Invocation.OverloadResolve): Update.
14812 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14814 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
14815 against IEnumerator, test whether the return value is a descendant
14816 of the IEnumerator interface.
14818 * class.cs (Indexer.Define): Use an auxiliary method to implement
14819 the other bits of the method definition. Begin support for
14820 explicit interface implementation.
14822 (Property.DefineMethod): Use TypeManager.void_type instead of null
14823 for an empty return value.
14825 2001-12-26 Miguel de Icaza <miguel@ximian.com>
14827 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
14828 dealing with a FieldExpr which is composed of a FieldBuilder, in
14829 the code path we did extract the constant, but we should have
14830 obtained the underlying value to be able to cast it (otherwise we
14831 end up in an infinite loop, this is what Ravi was running into).
14833 (ArrayCreation.UpdateIndices): Arrays might be empty.
14835 (MemberAccess.ResolveMemberAccess): Add support for section
14836 14.5.4.1 that deals with the special case of E.I when E is a type
14837 and something else, that I can be a reference to a static member.
14839 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
14840 handle a particular array type to create byte blobs, it is just
14841 something we dont generate byteblobs for.
14843 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
14846 * location.cs (Push): remove the key from the hashtable that we
14847 are about to add. This happens for empty files.
14849 * driver.cs: Dispose files after we have parsed them.
14851 (tokenize): new function that only runs the tokenizer on its
14852 input, for speed testing.
14854 2001-12-26 Ravi Pratap <ravi@ximian.com>
14856 * class.cs (Event.Define): Define the private field only if there
14857 are no accessors defined.
14859 * expression.cs (ResolveMemberAccess): If there is no associated
14860 field with the event, that means we have an event defined with its
14861 own accessors and we should flag error cs0070 since transforming
14862 ourselves into a field is not valid in that case.
14864 * ecore.cs (SimpleName.DoResolve): Same as above.
14866 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
14867 and charset to sane values.
14869 2001-12-25 Ravi Pratap <ravi@ximian.com>
14871 * assign.cs (DoResolve): Perform check on events only if they
14872 are being accessed outside the declaring type.
14874 * cs-parser.jay (event_declarations): Update rules to correctly
14875 set the type of the implicit parameter etc.
14877 (add_accessor, remove_accessor): Set current local parameters.
14879 * expression.cs (Binary): For delegate addition and subtraction,
14880 cast the return value from the method into the appropriate delegate
14883 2001-12-24 Ravi Pratap <ravi@ximian.com>
14885 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
14886 of these as the workaround is unnecessary.
14888 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
14889 delegate data - none of that is needed at all.
14891 Re-write bits to extract the instance expression and the delegate method
14894 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
14897 * attribute.cs (ApplyAttributes): New method to take care of common tasks
14898 of attaching attributes instead of duplicating code everywhere.
14900 * everywhere : Update code to do attribute emission using the above method.
14902 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14904 * expression.cs (IsParamsMethodApplicable): if there are not
14905 parameters, return immediately.
14907 * ecore.cs: The 0 literal can be implicity converted to an enum
14910 (SimpleName.DoResolve): First lookup the type, then lookup the
14913 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
14914 want to get its address. If the InstanceExpression is not
14915 addressable, store the result in a temporary variable, then get
14918 * codegen.cs: Only display 219 errors on warning level or above.
14920 * expression.cs (ArrayAccess): Make it implement the
14921 IMemoryLocation interface.
14923 (Binary.DoResolve): handle the operator == (object a, object b)
14924 and operator != (object a, object b) without incurring into a
14925 BoxedCast (because 5 != o should never be performed).
14927 Handle binary enumerator operators.
14929 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
14930 value type, otherwise use Ldelem_ref.
14932 Use precomputed names;
14934 (AddressOf): Implement address of
14936 * cs-parser.jay (labeled_statement): Fix recursive block
14937 addition by reworking the production.
14939 * expression.cs (New.DoEmit): New has a special case:
14941 If we are dealing with a ValueType, we have a few
14942 situations to deal with:
14944 * The target of New is a ValueType variable, that is
14945 easy, we just pass this as the variable reference
14947 * The target of New is being passed as an argument,
14948 to a boxing operation or a function that takes a
14951 In this case, we need to create a temporary variable
14952 that is the argument of New.
14955 2001-12-23 Ravi Pratap <ravi@ximian.com>
14957 * rootcontext.cs (LookupType): Check that current_type is not null before
14958 going about looking at nested types.
14960 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
14961 not implement the IAssignMethod interface any more.
14963 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
14964 where we tranform them into FieldExprs if they are being resolved from within
14965 the declaring type.
14967 * ecore.cs (SimpleName.DoResolve): Do the same here.
14969 * assign.cs (DoResolve, Emit): Clean up code considerably.
14971 * ../errors/bug10.cs : Add.
14973 * ../errors/cs0070.cs : Add.
14975 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
14977 * assign.cs : Get rid of EventIsLocal everywhere.
14979 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14981 * ecore.cs (ConvertIntLiteral): finished the implementation.
14983 * statement.cs (SwitchLabel): Convert the value we are using as a
14984 key before looking up the table.
14986 2001-12-22 Miguel de Icaza <miguel@ximian.com>
14988 * codegen.cs (EmitTopBlock): Require a Location argument now.
14990 * cs-parser.jay (constructor_declarator): We need to setup
14991 current_local_parameters before we parse the
14992 opt_constructor_initializer, to allow the variables to be bound
14993 to the constructor arguments.
14995 * rootcontext.cs (LookupType): First lookup nested classes in our
14996 class and our parents before we go looking outside our class.
14998 * expression.cs (ConstantFold): Extract/debox the values at the
15001 * rootcontext.cs (EmitCode): Resolve the constants first before we
15002 resolve the types. This is not really needed, but it helps debugging.
15004 * statement.cs: report location.
15006 * cs-parser.jay: pass location to throw statement.
15008 * driver.cs: Small bug fix.
15010 * report.cs: Updated format to be 4-zero filled digits.
15012 2001-12-22 Ravi Pratap <ravi@ximian.com>
15014 * expression.cs (CheckIndices): Fix minor bug where the wrong
15015 variable was being referred to ;-)
15017 (DoEmit): Do not call EmitStaticInitializers when the
15018 underlying type is System.Object.
15020 2001-12-21 Ravi Pratap <ravi@ximian.com>
15022 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
15023 and do the usual workaround for SRE.
15025 * class.cs (MyEventBuilder.EventType): New member to get at the type
15026 of the event, quickly.
15028 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
15030 * assign.cs (Assign.DoResolve): Handle the case when the target
15031 is an EventExpr and perform the necessary checks.
15033 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
15036 (SimpleName.MemberStaticCheck): Include check for EventExpr.
15038 (EventExpr): Set the type in the constructor itself since we
15039 are meant to be born fully resolved.
15041 (EventExpr.Define): Revert code I wrote earlier.
15043 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
15044 instance expression is null. The instance expression is a This in that case
15045 or a null, depending on whether it is a static method or not.
15047 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
15048 refers to more than one method.
15050 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
15051 and accordingly flag errors.
15053 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15055 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
15057 2001-12-22 Miguel de Icaza <miguel@ximian.com>
15059 * location.cs (ToString): Provide useful rutine.
15061 2001-12-21 Miguel de Icaza <miguel@ximian.com>
15063 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
15064 objects, return the actual integral boxed.
15066 * statement.cs (SwitchLabel): define an ILLabel for each
15069 (Switch.CheckSwitch): If the value is a Literal, extract
15070 the underlying literal.
15072 Also in the unused hashtable we had, add the SwitchLabel so we can
15073 quickly look this value up.
15075 * constant.cs: Implement a bunch of new constants. Rewrite
15076 Literal based on this. Made changes everywhere to adapt to this.
15078 * expression.cs (Expression.MakeByteBlob): Optimize routine by
15079 dereferencing array only once, and also copes with enumrations.
15081 bytes are two bytes wide, not one.
15083 (Cast): Perform constant conversions.
15085 * ecore.cs (TryImplicitIntConversion): Return literals instead of
15086 wrappers to the literals here.
15088 * expression.cs (DoNumericPromotions): long literals can converted
15089 to ulong implicity (this is taken care of elsewhere, but I was
15090 missing this spot).
15092 * ecore.cs (Expression.Literalize): Make the return type Literal,
15093 to improve type checking.
15095 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
15097 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15099 * literal.cs: Revert code from ravi that checked the bounds. The
15100 bounds are sane by the definition of the type itself.
15102 * typemanager.cs: Fix implementation of ImplementsInterface. We
15103 need to actually look up in our parent hierarchy for interfaces
15106 * const.cs: Use the underlying type for enumerations
15108 * delegate.cs: Compute the basename for the delegate creation,
15109 that should fix the delegate test case, and restore the correct
15110 Type Lookup semantics in rootcontext
15112 * rootcontext.cs: Revert Ravi's last patch. The correct way of
15113 referencing a nested type with the Reflection API is using the "+"
15116 * cs-parser.jay: Do not require EOF token at the end.
15118 2001-12-20 Ravi Pratap <ravi@ximian.com>
15120 * rootcontext.cs (LookupType): Concatenate type names with
15121 a '.' instead of a '+' The test suite passes again.
15123 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15124 field of the enumeration.
15126 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15127 the case when the member is an EventExpr.
15129 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15130 static has an associated instance expression.
15132 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15134 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15136 * class.cs (Event.Define): Register event and perform appropriate checks
15139 We define the Add and Remove methods even if the use provides none because
15140 in that case, we provide default implementations ourselves.
15142 Define a private field of the type of the event. This is done by the CSC compiler
15143 and we should be doing it too ;-)
15145 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15146 More methods we use in code we generate.
15148 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15151 (InitCoreTypes): Update accordingly for the above.
15153 * class.cs (Event.Emit): Generate code for default accessors that we provide
15155 (EmitDefaultMethod): Do the job in the above.
15157 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15160 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15162 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15163 builders even if we were missing one.
15165 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15166 pass the Basename as our class name instead of the Name. The
15167 basename will be correctly composed for us.
15169 * parameter.cs (Paramters): Now takes a Location argument.
15171 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15172 make all the code call directly LookupType in RootContext and take
15173 this chance to pass the Location information everywhere.
15175 * Everywhere: pass Location information.
15177 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15179 * class.cs (Constructor.Define): Updated way of detecting the
15180 length of the parameters.
15182 (TypeContainer.DefineType): Use basename as the type name for
15185 (TypeContainer.Define): Do not recursively define types here, as
15186 definition is taken care in order by the RootContext.
15188 * tree.cs: Keep track of namespaces in a per-file basis.
15190 * parameter.cs (Parameter.ComputeSignature): Update to use
15193 (Parameters.GetSignature): ditto.
15195 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15196 instead of a TypeContainer.
15198 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15199 resolve names. Because we need to be resolve in our context, not
15202 * driver.cs: Implement response files.
15204 * class.cs (TypeContainer.DefineType): If we are defined, do not
15205 redefine ourselves.
15207 (Event.Emit): Emit the code for add/remove handlers.
15208 (Event.Define): Save the MethodBuilders for add/remove.
15210 * typemanager.cs: Use pair here too.
15212 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15213 DictionaryEntry requires the first argument to be non-null.
15215 (enum_declaration): Compute full name for registering the
15218 (delegate_declaration): Instead of using
15219 formal_parameter_list, use opt_formal_parameter_list as the list
15222 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15223 (EventParsing): New property that controls whether `add' and
15224 `remove' are returned as tokens or identifiers (for events);
15226 2001-12-19 Ravi Pratap <ravi@ximian.com>
15228 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15229 use MyEventBuilder only and let it wrap the real builder for us.
15231 (MyEventBuilder): Revamp constructor etc.
15233 Implement all operations that we perform on EventBuilder in precisely the same
15236 (FindMembers): Update to use the EventBuilder member.
15238 (Event.Emit): Update accordingly.
15240 2001-12-18 Ravi Pratap <ravi@ximian.com>
15242 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15243 by calling the appropriate methods.
15245 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15248 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15250 2001-12-17 Ravi Pratap <ravi@ximian.com>
15252 * delegate.cs (Delegate.Populate): Check that the return type
15253 and various parameters types are indeed accessible.
15255 * class.cs (Constructor.Define): Same here.
15257 (Field.Define): Ditto.
15259 (Event.Define): Ditto.
15261 (Operator.Define): Check that the underlying Method defined itself
15262 correctly - so it's MethodBuilder should not be null.
15264 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15265 expression happens to be null.
15267 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15268 members but as of now we don't seem to be able to do anything really useful with it.
15270 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15271 not the EventBuilder.
15273 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15275 * cs-tokenizer.cs: Add support for defines.
15276 Add support for #if, #elif, #else, #endif
15278 (eval_var): evaluates a variable.
15279 (eval): stubbed for evaluating functions.
15281 * cs-parser.jay: Pass the defines information
15283 * driver.cs: Add --define command line option.
15285 * decl.cs: Move MemberCore here.
15287 Make it the base class for DeclSpace. This allows us to catch and
15288 report 108 and 109 for everything now.
15290 * class.cs (TypeContainer.Define): Extract all the members
15291 before populating and emit the warning 108 (new keyword required
15292 to override) instead of having each member implement this.
15294 (MemberCore.Define): New abstract method, we will be using this in
15295 the warning reporting engine in Populate.
15297 (Operator.Define): Adjust to new MemberCore protocol.
15299 * const.cs (Const): This does not derive from Expression, it is a
15300 temporary object we use to create fields, it is a MemberCore.
15302 * class.cs (Method.Define): Allow the entry point to be in a
15305 * driver.cs: Rewrite the argument handler to clean it up a bit.
15307 * rootcontext.cs: Made it just an auxiliary namespace feature by
15308 making everything static.
15310 * driver.cs: Adapt code to use RootContext type name instead of
15313 * delegate.cs: Remove RootContext argument.
15315 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15318 * class.cs (Event.Define): The lookup can fail.
15320 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15322 * expression.cs: Resolve the this instance before invoking the code.
15324 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15326 * cs-parser.jay: Add a production in element_access that allows
15327 the thing to become a "type" reference. This way we can parse
15328 things like "(string [])" as a type.
15330 Note that this still does not handle the more complex rules of
15334 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15336 * ecore.cs: (CopyNewMethods): new utility function used to
15337 assemble the list of methods from running FindMembers.
15339 (MemberLookup): Rework FindMembers so that
15341 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15343 * class.cs (TypeContainer): Remove Delegates who fail to be
15346 * delegate.cs (Populate): Verify that we dont get null return
15347 values. TODO: Check for AsAccessible.
15349 * cs-parser.jay: Use basename to emit error 574 (destructor should
15350 have the same name as container class), not the full name.
15352 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15353 possible representation.
15355 Also implements integer type suffixes U and L.
15357 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15359 * expression.cs (ArrayCreation.DoResolve): We need to do the
15360 argument resolution *always*.
15362 * decl.cs: Make this hold the namespace. Hold the root context as
15364 (LookupType): Move here.
15366 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15368 * location.cs (Row, Name): Fixed the code, it was always returning
15369 references to the first file.
15371 * interface.cs: Register properties defined through interfaces.
15373 * driver.cs: Add support for globbing on the command line
15375 * class.cs (Field): Make it derive from MemberCore as well.
15378 2001-12-15 Ravi Pratap <ravi@ximian.com>
15380 * class.cs (Event::Define): Check that the type of the event is a delegate
15381 type else flag error #66.
15383 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15386 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15387 values of EntryPoint, CharSet etc etc.
15389 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15391 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15392 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15393 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15394 which needs this to do its work.
15396 * ../errors/cs0066.cs : Add.
15398 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15400 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15403 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15404 clears out the parameters field.
15405 (MemberSignatureCompare): Cleanup
15407 (MemberCore): New base class used to share code between MethodCore
15410 (RegisterRequiredImplementations) BindingFlags.Public requires
15411 either BindingFlags.Instace or Static. Use instance here.
15413 (Property): Refactored code to cope better with the full spec.
15415 * parameter.cs (GetParameterInfo): Return an empty array instead
15418 * class.cs (Property): Abstract or extern properties have no bodies.
15420 * parameter.cs (GetParameterInfo): return a zero-sized array.
15422 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15423 method modifier validation to the typecontainer so we can reuse
15424 this on properties.
15426 (MethodCore.ParameterTypes): return an empty sized array of types.
15428 (Property.Define): Test property modifier validity.
15430 Add tests for sealed/override too.
15432 (Method.Emit): abstract or extern methods have no bodies.
15434 2001-12-14 Ravi Pratap <ravi@ximian.com>
15436 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15439 (Method::Define, ::Emit): Modify accordingly.
15441 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15443 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15445 * makefile: Pass in /unsafe.
15447 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15449 * class.cs (MakeKey): Kill routine.
15451 * class.cs (TypeContainer.Define): Correctly define explicit
15452 method implementations (they require the full interface name plus
15455 * typemanager.cs: Deply the PtrHashtable here and stop using the
15456 lame keys. Things work so much better.
15458 This of course broke everyone who depended on `RegisterMethod' to
15459 do the `test for existance' test. This has to be done elsewhere.
15461 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15462 the object stupid Equals method (because, that like fails all over
15463 the place). We still do not use it.
15465 * class.cs (TypeContainer.SetRequiredInterface,
15466 TypeContainer.RequireMethods): Killed these two routines and moved
15467 all the functionality to RegisterRequiredImplementations.
15469 (TypeContainer.RegisterRequiredImplementations): This routine now
15470 registers all the implementations required in an array for the
15471 interfaces and abstract methods. We use an array of structures
15472 which can be computed ahead of time to reduce memory usage and we
15473 also assume that lookups are cheap as most classes will not
15474 implement too many interfaces.
15476 We also avoid creating too many MethodSignatures.
15478 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15479 clear the "pending" bit if we find that there are problems with
15482 (TypeContainer.VerifyPendingMethods): Update to report errors of
15483 methods that look like implementations but are not.
15485 (TypeContainer.Define): Add support for explicit interface method
15488 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15490 * typemanager.cs: Keep track of the parameters here instead of
15491 being a feature of the TypeContainer.
15493 * class.cs: Drop the registration of parameters here, as
15494 InterfaceMethods are also interface declarations.
15496 * delegate.cs: Register methods with the TypeManager not only with
15497 the TypeContainer. This code was buggy.
15499 * interface.cs: Full registation here.
15501 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15503 * expression.cs: Remove reducer for binary expressions, it can not
15506 * const.cs: Put here the code that used to go into constant.cs
15508 * constant.cs: Put here the code for constants, this is a new base
15509 class for Literals.
15511 * literal.cs: Make Literal derive from Constant.
15513 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15515 * statement.cs (Return.Emit): Report error 157 if the user
15516 attempts to return from a finally block.
15518 (Return.Emit): Instead of emitting a return, jump to the end of
15521 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15522 LocalBuilder to store the result of the function. ReturnLabel is
15523 the target where we jump.
15526 2001-12-09 Radek Doulik <rodo@ximian.com>
15528 * cs-parser.jay: remember alias in current namespace
15530 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15533 * class.cs (LookupAlias): lookup alias in my_namespace
15535 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15537 (LookupAlias): lookup alias in this and if needed in parent
15540 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15544 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15545 making things static. I need this to avoid passing the
15546 TypeContainer when calling ParameterType.
15548 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15549 that did string manipulation to compute the type and then call
15550 GetType. Use Parameter.ParameterType instead.
15552 * cs-tokenizer.cs: Consume the suffix for floating values.
15554 * expression.cs (ParameterReference): figure out whether this is a
15555 reference parameter or not. Kill an extra variable by computing
15556 the arg_idx during emission.
15558 * parameter.cs (Parameters.GetParameterInfo): New overloaded
15559 function that returns whether a parameter is an out/ref value or not.
15561 (Parameter.ParameterType): The type of the parameter (base,
15562 without ref/out applied).
15564 (Parameter.Resolve): Perform resolution here.
15565 (Parameter.ExternalType): The full type (with ref/out applied).
15567 * statement.cs (Using.Emit, Using.EmitExpression): Implement
15568 support for expressions on the using statement.
15570 2001-12-07 Miguel de Icaza <miguel@ximian.com>
15572 * statement.cs (Using.EmitLocalVariableDecls): Split the
15573 localvariable handling of the using statement.
15575 (Block.EmitMeta): Keep track of variable count across blocks. We
15576 were reusing slots on separate branches of blocks.
15578 (Try.Emit): Emit the general code block, we were not emitting it.
15580 Check the type of the declaration to be an IDisposable or
15581 something that can be implicity converted to it.
15583 Emit conversions if required.
15585 * ecore.cs (EmptyExpression): New utility class.
15586 (Expression.ImplicitConversionExists): New utility function.
15588 2001-12-06 Miguel de Icaza <miguel@ximian.com>
15590 * statement.cs (Using): Implement.
15592 * expression.cs (LocalVariableReference): Support read only variables.
15594 * statement.cs: Remove the explicit emit for the Leave opcode.
15595 (VariableInfo): Add a readonly field.
15597 2001-12-05 Miguel de Icaza <miguel@ximian.com>
15599 * ecore.cs (ConvCast): new class used to encapsulate the various
15600 explicit integer conversions that works in both checked and
15601 unchecked contexts.
15603 (Expression.ConvertNumericExplicit): Use new ConvCast class to
15604 properly generate the overflow opcodes.
15606 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15608 * statement.cs: The correct type for the EmptyExpression is the
15609 element_type, not the variable type. Ravi pointed this out.
15611 2001-12-04 Ravi Pratap <ravi@ximian.com>
15613 * class.cs (Method::Define): Handle PInvoke methods specially
15614 by using DefinePInvokeMethod instead of the usual one.
15616 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
15617 above to do the task of extracting information and defining the method.
15619 2001-12-04 Ravi Pratap <ravi@ximian.com>
15621 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
15622 of the condition for string type.
15624 (Emit): Move that here.
15626 (ArrayCreation::CheckIndices): Keep string literals in their expression
15629 (EmitDynamicInitializers): Handle strings appropriately.
15631 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15633 * codegen.cs (EmitContext): Replace multiple variables with a
15634 single pointer to the current Switch statement.
15636 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
15639 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15643 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
15646 (Foreach.Emit): Foreach on arrays was not setting
15647 up the loop variables (for break/continue).
15649 (GotoCase): Semi-implented.
15651 2001-12-03 Ravi Pratap <ravi@ximian.com>
15653 * attribute.cs (CheckAttribute): Handle system attributes by using
15654 Attribute.GetAttributes to examine information we need.
15656 (GetValidPlaces): Same here.
15658 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
15660 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
15662 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
15664 (Method::Define): Set appropriate flags if we have a DllImport attribute.
15666 (Method::Emit): Handle the case when we are a PInvoke method.
15668 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15670 * expression.cs: Use ResolveWithSimpleName on compound names.
15672 2001-12-02 Ravi Pratap <ravi@ximian.com>
15674 * constant.cs (EmitConstant): Make sure we resolve the associated expression
15675 before trying to reduce it.
15677 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
15679 * constant.cs (LookupConstantValue): Implement.
15681 (EmitConstant): Use the above in emitting the constant.
15683 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
15684 that are user-defined by doing a LookupConstantValue on them.
15686 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
15689 2001-11-29 Miguel de Icaza <miguel@ximian.com>
15691 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
15693 (BaseAccess.DoResolve): Implement.
15695 (MemberAccess.DoResolve): Split this routine into a
15696 ResolveMemberAccess routine that can be used independently
15698 2001-11-28 Miguel de Icaza <miguel@ximian.com>
15700 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
15701 As that share bits of the implementation. Is returns a boolean,
15702 while As returns the Type that is being probed.
15704 2001-12-01 Ravi Pratap <ravi@ximian.com>
15706 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
15707 instead of a Literal - much easier.
15709 (EnumInTransit): Remove - utterly useless :-)
15711 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
15713 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
15715 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
15716 chain when we have no associated expression.
15718 2001-11-30 Ravi Pratap <ravi@ximian.com>
15720 * constant.cs (Define): Use Location while reporting the errror.
15722 Also emit a warning when 'new' is used and there is no inherited
15725 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
15728 (LookupEnumValue): Implement to lookup an enum member's value and define it
15731 (Populate): Re-write accordingly to use the above routine.
15733 2001-11-27 Miguel de Icaza <miguel@ximian.com>
15735 * expression.cs (This): Fix prototype for DoResolveLValue to
15736 override the base class DoResolveLValue.
15738 * cs-parser.cs: Report errors cs574 and cs575 (destructor
15741 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
15742 (we need to load the address of the field here). This fixes
15745 (FieldExpr.DoResolveLValue): Call the DoResolve
15746 function to initialize the Instance expression.
15748 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
15749 correctly the GetEnumerator operation on a value type.
15751 * cs-parser.jay: Add more simple parsing error catches.
15753 * statement.cs (Switch): Add support for string switches.
15754 Handle null specially.
15756 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
15758 2001-11-28 Ravi Pratap <ravi@ximian.com>
15760 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
15762 (declare_local_constant): New helper function.
15764 * statement.cs (AddConstant): Keep a separate record of constants
15766 (IsConstant): Implement to determine if a variable is a constant.
15768 (GetConstantExpression): Implement.
15770 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
15772 * statement.cs (IsVariableDefined): Re-write.
15774 2001-11-27 Ravi Pratap <ravi@ximian.com>
15776 * class.cs (TypeContainer::FindMembers): Look for constants
15777 in the case when we are looking for MemberTypes.Field
15779 * expression.cs (MemberAccess::DoResolve): Check that in the
15780 case we are a FieldExpr and a Literal, we are not being accessed
15781 by an instance reference.
15783 * cs-parser.jay (local_constant_declaration): Implement.
15785 (declaration_statement): Implement for constant declarations.
15787 2001-11-26 Miguel de Icaza <miguel@ximian.com>
15789 * statement.cs (Switch): Catch double defaults.
15791 (Switch): More work on the switch() statement
15792 implementation. It works for integral values now, need to finish
15796 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15798 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
15799 integer literals into other integer literals. To be used by
15802 2001-11-24 Ravi Pratap <ravi@ximian.com>
15804 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
15807 (EmitDynamicInitializers): Cope with the above since we extract data
15808 directly from ArrayData now.
15810 (ExpectInitializers): Keep track of whether initializers are mandatory
15813 (Bounds): Make it a hashtable to prevent the same dimension being
15814 recorded for every element in that dimension.
15816 (EmitDynamicInitializers): Fix bug which prevented the Set array method
15819 Also fix bug which was causing the indices to be emitted in the reverse
15822 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15824 * expression.cs (ArrayCreation): Implement the bits that Ravi left
15825 unfinished. They do not work, because the underlying code is
15828 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15830 * cs-parser.jay: Remove bogus fixme.
15832 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
15833 on Switch statement.
15835 2001-11-23 Ravi Pratap <ravi@ximian.com>
15837 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
15840 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
15841 parameter. Apparently, any expression is allowed.
15843 (ValidateInitializers): Update accordingly.
15845 (CheckIndices): Fix some tricky bugs thanks to recursion.
15847 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
15848 I was being completely brain-dead.
15850 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
15851 and re-write acordingly.
15853 (DelegateInvocation): Re-write accordingly.
15855 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
15857 (MakeByteBlob): Handle types more correctly.
15859 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
15860 initialization from expressions but it is incomplete because I am a complete
15863 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15865 * statement.cs (If.Emit): Fix a bug that generated incorrect code
15866 on If. Basically, we have to return `true' (ie, we do return to
15867 our caller) only if both branches of the if return.
15869 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
15870 short-circuit operators, handle them as short circuit operators.
15872 (Cast.DoResolve): Resolve type.
15873 (Cast.Cast): Take an expression as the target type.
15875 * cs-parser.jay (cast_expression): Remove old hack that only
15876 allowed a limited set of types to be handled. Now we take a
15877 unary_expression and we resolve to a type during semantic
15880 Use the grammar productions from Rhys to handle casts (this is
15881 not complete like Rhys syntax yet, we fail to handle that corner
15882 case that C# has regarding (-x), but we will get there.
15884 2001-11-22 Ravi Pratap <ravi@ximian.com>
15886 * class.cs (EmitFieldInitializer): Take care of the case when we have a
15887 field which is an array type.
15889 * cs-parser.jay (declare_local_variables): Support array initialization too.
15891 * typemanager.cs (MakeKey): Implement.
15893 (everywhere): Use the above appropriately.
15895 * cs-parser.jay (for_statement): Update for array initialization while
15896 declaring variables.
15898 * ecore.cs : The error message was correct, it's the variable's names that
15899 were misleading ;-) Make the code more readable.
15901 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
15902 the correct type etc.
15904 (ConvertExplicit): Handle Enum types by examining the underlying type.
15906 2001-11-21 Ravi Pratap <ravi@ximian.com>
15908 * parameter.cs (GetCallingConvention): Always return
15909 CallingConventions.Standard for now.
15911 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15913 * expression.cs (Binary.ResolveOperator): Update the values of `l'
15914 and `r' after calling DoNumericPromotions.
15916 * ecore.cs: Fix error message (the types were in the wrong order).
15918 * statement.cs (Foreach.ProbeCollectionType): Need to pass
15919 BindingFlags.Instance as well
15921 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
15922 implicit int literal conversion in an empty cast so that we
15923 propagate the right type upstream.
15925 (UnboxCast): new class used to unbox value types.
15926 (Expression.ConvertExplicit): Add explicit type conversions done
15929 (Expression.ImplicitNumericConversion): Oops, forgot to test for
15930 the target type before applying the implicit LongLiterals to ULong
15933 2001-11-21 Miguel de Icaza <miguel@ximian.com>
15935 * cs-parser.jay (for_statement): Reworked the way For works: now
15936 we declare manually any variables that are introduced in
15937 for_initializer to solve the problem of having out-of-band code
15938 emition (that is what got for broken).
15940 (declaration_statement): Perform the actual variable declaration
15941 that used to be done in local_variable_declaration here.
15943 (local_variable_declaration): Do not declare anything, just pass
15944 the information on a DictionaryEntry
15946 2001-11-20 Ravi Pratap <ravi@ximian.com>
15948 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
15949 re-write of the logic to now make it recursive.
15951 (UpdateIndices): Re-write accordingly.
15953 Store element data in a separate ArrayData list in the above methods.
15955 (MakeByteBlob): Implement to dump the array data into a byte array.
15957 2001-11-19 Ravi Pratap <ravi@ximian.com>
15959 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
15962 * constant.cs (Define): Implement.
15964 (EmitConstant): Re-write fully.
15966 Pass in location info.
15968 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
15971 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
15972 DictionaryEntry since we need location info too.
15974 (constant_declaration): Update accordingly.
15976 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
15977 code into another method : UpdateIndices.
15979 2001-11-18 Ravi Pratap <ravi@ximian.com>
15981 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
15982 some type checking etc.
15984 2001-11-17 Ravi Pratap <ravi@ximian.com>
15986 * expression.cs (ArrayCreation::ValidateInitializers): Implement
15987 bits to provide dimension info if the user skips doing that.
15989 Update second constructor to store the rank correctly.
15991 2001-11-16 Ravi Pratap <ravi@ximian.com>
15993 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
15994 and try to implement.
15996 * ../errors/cs0150.cs : Add.
15998 * ../errors/cs0178.cs : Add.
16000 2001-11-16 Miguel de Icaza <miguel@ximian.com>
16002 * statement.cs: Implement foreach on multi-dimensional arrays.
16004 * parameter.cs (Parameters.GetParameterByName): Also lookup the
16005 name of the params argument.
16007 * expression.cs: Use EmitStoreOpcode to get the right opcode while
16008 initializing the array.
16010 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
16011 we can use this elsewhere.
16013 * statement.cs: Finish implementation of foreach for single
16016 * cs-parser.jay: Use an out-of-band stack to pass information
16017 around, I wonder why I need this.
16019 foreach_block: Make the new foreach_block the current_block.
16021 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
16022 function used to return a static Parameters structure. Used for
16023 empty parameters, as those are created very frequently.
16025 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
16027 2001-11-15 Ravi Pratap <ravi@ximian.com>
16029 * interface.cs : Default modifier is private, not public. The
16030 make verify test passes again.
16032 2001-11-15 Ravi Pratap <ravi@ximian.com>
16034 * support.cs (ReflectionParameters): Fix logic to determine
16035 whether the last parameter is a params one. Test 9 passes again.
16037 * delegate.cs (Populate): Register the builders we define with
16038 RegisterParameterForBuilder. Test 19 passes again.
16040 * cs-parser.jay (property_declaration): Reference $6 instead
16041 of $$ to get at the location.
16043 (indexer_declaration): Similar stuff.
16045 (attribute): Ditto.
16047 * class.cs (Property): Register parameters for the Get and Set methods
16048 if they exist. Test 23 passes again.
16050 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
16051 call to EmitArguments as we are sure there aren't any params arguments.
16052 Test 32 passes again.
16054 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
16055 IndexOutOfRangeException.
16057 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
16058 Test 33 now passes again.
16060 2001-11-15 Miguel de Icaza <miguel@ximian.com>
16062 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
16063 broke a bunch of things. Will have to come up with a better way
16064 of tracking locations.
16066 * statement.cs: Implemented foreach for single dimension arrays.
16068 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16070 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
16071 an error. This removes the lookup from the critical path.
16073 * cs-parser.jay: Removed use of temporary_loc, which is completely
16076 2001-11-14 Miguel de Icaza <miguel@ximian.com>
16078 * support.cs (ReflectionParameters.ParameterModifier): Report
16079 whether the argument is a PARAMS argument or not.
16081 * class.cs: Set the attribute `ParamArrayAttribute' on the
16082 parameter argument.
16084 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
16085 and cons_param_array_attribute (ConstructorInfo for
16086 ParamArrayAttribute).,
16088 * codegen.cs: Emit the return using the `Return' statement, that
16089 way we can report the error correctly for missing return values.
16091 * class.cs (Method.Emit): Clean up.
16093 * expression.cs (Argument.Resolve): Take another argument: the
16094 location where this argument is used. Notice that this is not
16095 part of the "Argument" class as to reduce the size of the
16096 structure (we know the approximate location anyways).
16098 Test if the argument is a variable-reference, if not, then
16099 complain with a 206.
16101 (Argument.Emit): Emit addresses of variables.
16103 (Argument.FullDesc): Simplify.
16105 (Invocation.DoResolve): Update for Argument.Resolve.
16107 (ElementAccess.DoResolve): ditto.
16109 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
16110 method should be virtual, as this method is always virtual.
16112 (NewDelegate.DoResolve): Update for Argument.Resolve.
16114 * class.cs (ConstructorInitializer.DoResolve): ditto.
16116 * attribute.cs (Attribute.Resolve): ditto.
16118 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16120 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16122 * expression.cs (ParameterReference): Drop IStackStorage and implement
16123 IAssignMethod instead.
16125 (LocalVariableReference): ditto.
16127 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16128 IAssignMethod instead.
16130 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16132 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16133 enumerations that are used in heavily used structures derive from
16134 byte in a laughable and pathetic attempt to reduce memory usage.
16135 This is the kind of pre-optimzations that you should not do at
16136 home without adult supervision.
16138 * expression.cs (UnaryMutator): New class, used to handle ++ and
16139 -- separatedly from the other unary operators. Cleans up the
16140 code, and kills the ExpressionStatement dependency in Unary.
16142 (Unary): Removed `method' and `Arguments' from this class, making
16143 it smaller, and moving it all to SimpleCall, so I can reuse this
16144 code in other locations and avoid creating a lot of transient data
16145 strucutres when not required.
16147 * cs-parser.jay: Adjust for new changes.
16149 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16151 * enum.cs (Enum.Populate): If there is a failure during
16154 * cs-parser.jay (opt_enum_base): we used to catch type errors
16155 here, but this is really incorrect. The type error should be
16156 catched during semantic analysis.
16158 2001-12-11 Ravi Pratap <ravi@ximian.com>
16160 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16161 current_local_parameters as expected since I, in my stupidity, had forgotten
16164 * attribute.cs (GetValidPlaces): Fix stupid bug.
16166 * class.cs (Method::Emit): Perform check on applicability of attributes.
16168 (Constructor::Emit): Ditto.
16170 (Field::Emit): Ditto.
16172 (Field.Location): Store location information.
16174 (Property, Event, Indexer, Operator): Ditto.
16176 * cs-parser.jay (field_declaration): Pass in location for each field.
16178 * ../errors/cs0592.cs : Add.
16180 2001-11-12 Ravi Pratap <ravi@ximian.com>
16182 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16184 (InitCoreTypes): Update accordingly.
16186 (RegisterAttrType, LookupAttr): Implement.
16188 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16189 info about the same.
16191 (Resolve): Update to populate the above as necessary.
16193 (Error592): Helper.
16195 (GetValidPlaces): Helper to the above.
16197 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16199 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16201 2001-11-12 Ravi Pratap <ravi@ximian.com>
16203 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16205 * ../errors/cs0617.cs : Add.
16207 2001-11-11 Ravi Pratap <ravi@ximian.com>
16209 * enum.cs (Emit): Rename to Populate to be more consistent with what
16210 we expect it to do and when exactly it is called.
16212 * class.cs, rootcontext.cs : Update accordingly.
16214 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16215 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16217 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16219 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16220 of a fieldinfo using the above, when dealing with a FieldBuilder.
16222 2001-11-10 Ravi Pratap <ravi@ximian.com>
16224 * ../errors/cs0031.cs : Add.
16226 * ../errors/cs1008.cs : Add.
16228 * ../errrors/cs0543.cs : Add.
16230 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16233 (FindMembers): Implement.
16235 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16236 enums and delegates too.
16238 (enum_types): Rename to builder_to_enum.
16240 (delegate_types): Rename to builder_to_delegate.
16242 * delegate.cs (FindMembers): Implement.
16244 2001-11-09 Ravi Pratap <ravi@ximian.com>
16246 * typemanager.cs (IsEnumType): Implement.
16248 * enum.cs (Emit): Re-write parts to account for the underlying type
16249 better and perform checking etc.
16251 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16252 of the underlying type.
16254 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16257 * enum.cs (error31): Helper to report error #31.
16259 * cs-parser.jay (enum_declaration): Store location of each member too.
16261 * enum.cs (member_to_location): New hashtable.
16263 (AddEnumMember): Update location hashtable.
16265 (Emit): Use the location of each member while reporting errors.
16267 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16269 * cs-parser.jay: A for_initializer if is a
16270 local_variable_declaration really ammount to have an implicit
16271 block with the variable declaration and no initializer for for.
16273 * statement.cs (For.Emit): Cope with null initializers.
16275 This fixes the infinite loop on for initializers.
16277 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16279 * enum.cs: More cleanup.
16281 * ecore.cs: Remove dead code.
16283 * class.cs (Property.Emit): More simplification.
16284 (Event.Emit): ditto.
16286 Reworked to have less levels of indentation.
16288 2001-11-08 Ravi Pratap <ravi@ximian.com>
16290 * class.cs (Property): Emit attributes.
16300 * enum.cs (Emit): Ditto.
16302 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16305 * class.cs (Field, Event, etc.): Move attribute generation into the
16306 Emit method everywhere.
16308 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16309 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16310 as we had no way of defining nested enums !
16312 * rootcontext.cs : Adjust code accordingly.
16314 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16316 2001-11-07 Ravi Pratap <ravi@ximian.com>
16318 * expression.cs (EvalConstantExpression): Move into ecore.cs
16320 * enum.cs (Enum): Rename some members and make them public and readonly
16321 according to our convention.
16323 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16326 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16328 (Enum::Emit): Write a simple version for now which doesn't try to compute
16329 expressions. I shall modify this to be more robust in just a while.
16331 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16333 (TypeContainer::CloseType): Create the Enum types too.
16335 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16337 * expression.cs (EvalConstantExpression): Get rid of completely.
16339 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16340 user-defined values and other cases.
16342 (IsValidEnumLiteral): Helper function.
16344 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16345 out there in the case we had a literal FieldExpr.
16347 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16349 (Literalize): Revamp a bit to take two arguments.
16351 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16353 2001-11-06 Ravi Pratap <ravi@ximian.com>
16355 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16357 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16359 (Resolve): Use the above to ensure we have proper initializers.
16361 2001-11-05 Ravi Pratap <ravi@ximian.com>
16363 * expression.cs (Expression::EvalConstantExpression): New method to
16364 evaluate constant expressions.
16366 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16368 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16370 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16373 (Binary.ResolveOperator): Handle operator != (object a, object b)
16374 and operator == (object a, object b);
16376 (Binary.DoNumericPromotions): Indicate whether the numeric
16377 promotion was possible.
16379 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16382 Made the ArrayAccess implement interface IAssignMethod instead of
16383 IStackStore as the order in which arguments are passed reflects
16386 * assign.cs: Instead of using expr.ExprClass to select the way of
16387 assinging, probe for the IStackStore/IAssignMethod interfaces.
16389 * typemanager.cs: Load InitializeArray definition.
16391 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16392 static data that can be used to initialize arrays.
16394 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16396 * expression.cs: Handle operator== and operator!= for booleans.
16398 (Conditioal.Reduce): Implement reducer for the ?: operator.
16400 (Conditional.Resolve): Implement dead code elimination.
16402 (Binary.Resolve): Catch string literals and return a new
16403 concatenated string.
16405 (Unary.Reduce): Implement reduction of unary expressions.
16407 * ecore.cs: Split out the expression core handling here.
16409 (Expression.Reduce): New method used to perform constant folding
16410 and CSE. This is needed to support constant-expressions.
16412 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16413 targets, and optimize for !x.
16415 2001-11-04 Ravi Pratap <ravi@ximian.com>
16417 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16418 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16419 set custom atttributes.
16421 * literal.cs (Literal::GetValue): New abstract method to return the actual
16422 value of the literal, cast as an object.
16424 (*Literal): Implement GetValue method.
16426 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16427 expressions to the arraylist but objects of type Argument.
16429 * class.cs (TypeContainer::Emit): Emit our attributes too.
16431 (Method::Emit, Constructor::Emit): Ditto.
16433 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16434 to be ignoring earlier.
16436 2001-11-03 Ravi Pratap <ravi@ximian.com>
16438 * attribute.cs (AttributeSection::Define): Implement to do the business
16439 of constructing a CustomAttributeBuilder.
16441 (Attribute): New trivial class. Increases readability of code.
16443 * cs-parser.jay : Update accordingly.
16445 (positional_argument_list, named_argument_list, named_argument): New rules
16447 (attribute_arguments): Use the above so that we are more correct.
16449 2001-11-02 Ravi Pratap <ravi@ximian.com>
16451 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16452 to perform all checks for a method with a params parameter.
16454 (Invocation::OverloadResolve): Update to use the above method and therefore
16455 cope correctly with params method invocations.
16457 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16460 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16461 constructors in our parent too because we can't afford to miss out on
16464 * attribute.cs (AttributeSection): New name for the class Attribute
16466 Other trivial changes to improve readability.
16468 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16469 use the new class names.
16471 2001-11-01 Ravi Pratap <ravi@ximian.com>
16473 * class.cs (Method::Define): Complete definition for params types too
16475 (Indexer::Define): Ditto.
16477 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16478 Cope everywhere with a request for info about the array parameter.
16480 2001-11-01 Ravi Pratap <ravi@ximian.com>
16482 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16484 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16485 local_variable_type to extract the string corresponding to the type.
16487 (local_variable_type): Fixup the action to use the new helper method.
16489 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16492 * expression.cs : Clean out code which uses the above.
16494 2001-10-31 Ravi Pratap <ravi@ximian.com>
16496 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16497 and bale out if necessary by returning a false.
16499 (RegisterProperty): Ditto.
16501 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16502 and print out appropriate error messages.
16504 * interface.cs (everywhere): Ditto.
16506 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16507 location to constructor.
16509 * class.cs (Property, Event, Indexer): Update accordingly.
16511 * ../errors/cs111.cs : Added.
16513 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16514 of a method, as laid down by the spec.
16516 (Invocation::OverloadResolve): Use the above method.
16518 2001-10-31 Ravi Pratap <ravi@ximian.com>
16520 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16521 now take a TypeContainer and a Parameters object.
16523 (ParameterData): Modify return type of ParameterModifier method to be
16524 Parameter.Modifier and not a string.
16526 (ReflectionParameters, InternalParameters): Update accordingly.
16528 * expression.cs (Argument::GetParameterModifier): Same here.
16530 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16531 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16532 symbol in it at all so maybe this is only for now.
16534 2001-10-30 Ravi Pratap <ravi@ximian.com>
16536 * support.cs (InternalParameters): Constructor now takes an extra argument
16537 which is the actual Parameters class.
16539 (ParameterDesc): Update to provide info on ref/out modifiers.
16541 * class.cs (everywhere): Update call to InternalParameters to pass in
16542 the second argument too.
16544 * support.cs (ParameterData): Add ParameterModifier, which is a method
16545 to return the modifier info [ref/out etc]
16547 (InternalParameters, ReflectionParameters): Implement the above.
16549 * expression.cs (Argument::ParameterModifier): Similar function to return
16550 info about the argument's modifiers.
16552 (Invocation::OverloadResolve): Update to take into account matching modifiers
16555 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16556 a new SetFormalParameters object which we pass to InternalParameters.
16558 2001-10-30 Ravi Pratap <ravi@ximian.com>
16560 * expression.cs (NewArray): Merge into the ArrayCreation class.
16562 2001-10-29 Ravi Pratap <ravi@ximian.com>
16564 * expression.cs (NewArray): Merge classes NewBuiltinArray and
16565 NewUserdefinedArray into one as there wasn't much of a use in having
16568 * expression.cs (Argument): Change field's name to ArgType from Type.
16570 (Type): New readonly property which returns the proper type, taking into
16571 account ref/out modifiers.
16573 (everywhere): Adjust code accordingly for the above.
16575 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
16576 whether we are emitting for a ref or out parameter.
16578 * expression.cs (Argument::Emit): Use the above field to set the state.
16580 (LocalVariableReference::Emit): Update to honour the flag and emit the
16583 * parameter.cs (Attributes): Set the correct flags for ref parameters.
16585 * expression.cs (Argument::FullDesc): New function to provide a full desc.
16587 * support.cs (ParameterData): Add method ParameterDesc to the interface.
16589 (ReflectionParameters, InternalParameters): Implement the above method.
16591 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
16594 (Invocation::FullMethodDesc): Ditto.
16596 2001-10-29 Miguel de Icaza <miguel@ximian.com>
16598 * cs-parser.jay: Add extra production for the second form of array
16601 * expression.cs (ArrayCreation): Update to reflect the above
16604 * Small changes to prepare for Array initialization.
16606 2001-10-28 Miguel de Icaza <miguel@ximian.com>
16608 * typemanager.cs (ImplementsInterface): interface might be null;
16609 Deal with this problem;
16611 Also, we do store negative hits on the cache (null values), so use
16612 this instead of calling t.GetInterfaces on the type everytime.
16614 2001-10-28 Ravi Pratap <ravi@ximian.com>
16616 * typemanager.cs (IsBuiltinType): New method to help determine the same.
16618 * expression.cs (New::DoResolve): Get rid of array creation code and instead
16619 split functionality out into different classes.
16621 (New::FormArrayType): Move into NewBuiltinArray.
16623 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
16626 (NewBuiltinArray): New class to handle creation of built-in arrays.
16628 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
16629 account creation of one-dimensional arrays.
16631 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
16633 (NewUserdefinedArray::DoResolve): Implement.
16635 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
16637 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
16638 we maintain inside the TypeManager. This is necessary to perform lookups on the
16641 (LookupType): Update to perform GetType on the module builders too.
16643 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
16645 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
16647 2001-10-23 Ravi Pratap <ravi@ximian.com>
16649 * expression.cs (New::DoResolve): Implement guts of array creation.
16651 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
16653 2001-10-27 Miguel de Icaza <miguel@ximian.com>
16655 * expression.cs: Fix bug I introduced lsat night that broke
16658 (Expression.Resolve): Report a 246 error (can not resolve name)
16659 if we find a SimpleName in the stream.
16661 (Expression.ResolveLValue): Ditto.
16663 (Expression.ResolveWithSimpleName): This function is a variant of
16664 ResolveName, this one allows SimpleNames to be returned without a
16665 warning. The only consumer of SimpleNames is MemberAccess
16667 2001-10-26 Miguel de Icaza <miguel@ximian.com>
16669 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
16670 might arrive here. I have my doubts that this is correct.
16672 * statement.cs (Lock): Implement lock statement.
16674 * cs-parser.jay: Small fixes to support `lock' and `using'
16676 * cs-tokenizer.cs: Remove extra space
16678 * driver.cs: New flag --checked, allows to turn on integer math
16681 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
16682 Threading.Monitor.Exit
16684 2001-10-23 Miguel de Icaza <miguel@ximian.com>
16686 * expression.cs (IndexerAccess::DoResolveLValue): Set the
16687 Expression Class to be IndexerAccess.
16689 Notice that Indexer::DoResolve sets the eclass to Value.
16691 2001-10-22 Miguel de Icaza <miguel@ximian.com>
16693 * class.cs (TypeContainer::Emit): Emit code for indexers.
16695 * assign.cs (IAssignMethod): New interface implemented by Indexers
16696 and Properties for handling assignment.
16698 (Assign::Emit): Simplify and reuse code.
16700 * expression.cs (IndexerAccess, PropertyExpr): Implement
16701 IAssignMethod, clean up old code.
16703 2001-10-22 Ravi Pratap <ravi@ximian.com>
16705 * typemanager.cs (ImplementsInterface): New method to determine if a type
16706 implements a given interface. Provides a nice cache too.
16708 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
16711 (ConvertReferenceExplicit): Ditto.
16713 * delegate.cs (Delegate::Populate): Update to define the parameters on the
16714 various methods, with correct names etc.
16716 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
16717 Operator.UnaryNegation.
16719 * cs-parser.jay (operator_declarator): Be a little clever in the case where
16720 we have a unary plus or minus operator.
16722 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
16725 * everywhere : update accordingly.
16727 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
16730 * class.cs (Method::Define): For the case where we are implementing a method
16731 inherited from an interface, we need to set the MethodAttributes.Final flag too.
16732 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
16734 2001-10-21 Ravi Pratap <ravi@ximian.com>
16736 * interface.cs (FindMembers): Implement to work around S.R.E
16739 * typemanager.cs (IsInterfaceType): Implement.
16741 (FindMembers): Update to handle interface types too.
16743 * expression.cs (ImplicitReferenceConversion): Re-write bits which
16744 use IsAssignableFrom as that is not correct - it doesn't work.
16746 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
16747 and accordingly override EmitStatement.
16749 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
16750 using the correct logic :-)
16752 2001-10-19 Ravi Pratap <ravi@ximian.com>
16754 * ../errors/cs-11.cs : Add to demonstrate error -11
16756 2001-10-17 Miguel de Icaza <miguel@ximian.com>
16758 * assign.cs (Assign::Resolve): Resolve right hand side first, and
16759 then pass this as a hint to ResolveLValue.
16761 * expression.cs (FieldExpr): Add Location information
16763 (FieldExpr::LValueResolve): Report assignment to readonly
16766 (Expression::ExprClassFromMemberInfo): Pass location information.
16768 (Expression::ResolveLValue): Add new method that resolves an
16771 (Expression::DoResolveLValue): Default invocation calls
16774 (Indexers): New class used to keep track of indexers in a given
16777 (IStackStore): Renamed from LValue, as it did not really describe
16778 what this did. Also ResolveLValue is gone from this interface and
16779 now is part of Expression.
16781 (ElementAccess): Depending on the element access type
16783 * typemanager.cs: Add `indexer_name_type' as a Core type
16784 (System.Runtime.CompilerServices.IndexerNameAttribute)
16786 * statement.cs (Goto): Take a location.
16788 2001-10-18 Ravi Pratap <ravi@ximian.com>
16790 * delegate.cs (Delegate::VerifyDelegate): New method to verify
16791 if two delegates are compatible.
16793 (NewDelegate::DoResolve): Update to take care of the case when
16794 we instantiate a delegate from another delegate.
16796 * typemanager.cs (FindMembers): Don't even try to look up members
16797 of Delegate types for now.
16799 2001-10-18 Ravi Pratap <ravi@ximian.com>
16801 * delegate.cs (NewDelegate): New class to take care of delegate
16804 * expression.cs (New): Split the delegate related code out into
16805 the NewDelegate class.
16807 * delegate.cs (DelegateInvocation): New class to handle delegate
16810 * expression.cs (Invocation): Split out delegate related code into
16811 the DelegateInvocation class.
16813 2001-10-17 Ravi Pratap <ravi@ximian.com>
16815 * expression.cs (New::DoResolve): Implement delegate creation fully
16816 and according to the spec.
16818 (New::DoEmit): Update to handle delegates differently.
16820 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
16821 because of which we were printing out arguments in reverse order !
16823 * delegate.cs (VerifyMethod): Implement to check if the given method
16824 matches the delegate.
16826 (FullDelegateDesc): Implement.
16828 (VerifyApplicability): Implement.
16830 * expression.cs (Invocation::DoResolve): Update to accordingly handle
16831 delegate invocations too.
16833 (Invocation::Emit): Ditto.
16835 * ../errors/cs1593.cs : Added.
16837 * ../errors/cs1594.cs : Added.
16839 * delegate.cs (InstanceExpression, TargetMethod): New properties.
16841 2001-10-16 Ravi Pratap <ravi@ximian.com>
16843 * typemanager.cs (intptr_type): Core type for System.IntPtr
16845 (InitCoreTypes): Update for the same.
16847 (iasyncresult_type, asynccallback_type): Ditto.
16849 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
16852 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
16855 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
16856 the builders for the 4 members of a delegate type :-)
16858 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
16861 * expression.cs (New::DoResolve): Implement guts for delegate creation.
16863 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
16865 2001-10-15 Miguel de Icaza <miguel@ximian.com>
16867 * statement.cs (Break::Emit): Implement.
16868 (Continue::Emit): Implement.
16870 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
16871 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
16872 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
16873 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
16876 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
16877 properties that track the label for the current loop (begin of the
16878 loop and end of the loop).
16880 2001-10-15 Ravi Pratap <ravi@ximian.com>
16882 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
16883 use of emitting anything at all.
16885 * class.cs, rootcontext.cs : Get rid of calls to the same.
16887 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
16889 (Populate): Define the constructor correctly and set the implementation
16892 * typemanager.cs (delegate_types): New hashtable to hold delegates that
16895 (AddDelegateType): Implement.
16897 (IsDelegateType): Implement helper method.
16899 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
16901 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
16902 and accordingly handle it.
16904 * delegate.cs (Populate): Take TypeContainer argument.
16905 Implement bits to define the Invoke method. However, I still haven't figured out
16906 how to take care of the native int bit :-(
16908 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
16909 Qualify the name of the delegate, not its return type !
16911 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
16914 (StandardConversionExists): Checking for array types turns out to be recursive.
16916 (ConvertReferenceExplicit): Implement array conversion.
16918 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
16920 2001-10-12 Ravi Pratap <ravi@ximian.com>
16922 * cs-parser.jay (delegate_declaration): Store the fully qualified
16923 name as it is a type declaration.
16925 * delegate.cs (ReturnType, Name): Rename members to these. Make them
16928 (DefineDelegate): Renamed from Define. Does the same thing essentially,
16929 as TypeContainer::DefineType.
16931 (Populate): Method in which all the definition of the various methods (Invoke)
16934 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
16937 (CloseDelegate): Finally creates the delegate.
16939 * class.cs (TypeContainer::DefineType): Update to define delegates.
16940 (Populate, Emit and CloseType): Do the same thing here too.
16942 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
16943 delegates in all these operations.
16945 2001-10-14 Miguel de Icaza <miguel@ximian.com>
16947 * expression.cs: LocalTemporary: a new expression used to
16948 reference a temporary that has been created.
16950 * assign.cs: Handle PropertyAccess back here, so that we can
16951 provide the proper semantic access to properties.
16953 * expression.cs (Expression::ConvertReferenceExplicit): Implement
16954 a few more explicit conversions.
16956 * modifiers.cs: `NEW' modifier maps to HideBySig.
16958 * expression.cs (PropertyExpr): Make this into an
16959 ExpressionStatement, and support the EmitStatement code path.
16961 Perform get/set error checking, clean up the interface.
16963 * assign.cs: recognize PropertyExprs as targets, and if so, turn
16964 them into toplevel access objects.
16966 2001-10-12 Miguel de Icaza <miguel@ximian.com>
16968 * expression.cs: PropertyExpr::PropertyExpr: use work around the
16971 * typemanager.cs: Keep track here of our PropertyBuilders again to
16972 work around lameness in SRE.
16974 2001-10-11 Miguel de Icaza <miguel@ximian.com>
16976 * expression.cs (LValue::LValueResolve): New method in the
16977 interface, used to perform a second resolution pass for LValues.
16979 (This::DoResolve): Catch the use of this in static methods.
16981 (This::LValueResolve): Implement.
16983 (This::Store): Remove warning, assigning to `this' in structures
16986 (Invocation::Emit): Deal with invocation of
16987 methods on value types. We need to pass the address to structure
16988 methods rather than the object itself. (The equivalent code to
16989 emit "this" for structures leaves the entire structure on the
16990 stack instead of a pointer to it).
16992 (ParameterReference::DoResolve): Compute the real index for the
16993 argument based on whether the method takes or not a `this' pointer
16994 (ie, the method is static).
16996 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
16997 value types returned from functions when we need to invoke a
16998 method on the sturcture.
17001 2001-10-11 Ravi Pratap <ravi@ximian.com>
17003 * class.cs (TypeContainer::DefineType): Method to actually do the business of
17004 defining the type in the Modulebuilder or Typebuilder. This is to take
17005 care of nested types which need to be defined on the TypeBuilder using
17006 DefineNestedMethod.
17008 (TypeContainer::GetClassBases): Implement. Essentially the code from the
17009 methods in RootContext, only ported to be part of TypeContainer.
17011 (TypeContainer::GetInterfaceOrClass): Ditto.
17013 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
17015 * interface.cs (Interface::DefineInterface): New method. Does exactly
17016 what RootContext.CreateInterface did earlier, only it takes care of nested types
17019 (Interface::GetInterfaces): Move from RootContext here and port.
17021 (Interface::GetInterfaceByName): Same here.
17023 * rootcontext.cs (ResolveTree): Re-write.
17025 (PopulateTypes): Re-write.
17027 * class.cs (TypeContainer::Populate): Populate nested types too.
17028 (TypeContainer::Emit): Emit nested members too.
17030 * typemanager.cs (AddUserType): Do not make use of the FullName property,
17031 instead just use the name argument passed in as it is already fully
17034 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
17035 to TypeContainer mapping to see if a type is user-defined.
17037 * class.cs (TypeContainer::CloseType): Implement.
17039 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
17040 the default constructor.
17042 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
17045 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
17047 * interface.cs (CloseType): Create the type here.
17049 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
17052 Remove all the methods which are now in TypeContainer.
17054 2001-10-10 Ravi Pratap <ravi@ximian.com>
17056 * delegate.cs (Define): Re-write bits to define the delegate
17059 2001-10-10 Miguel de Icaza <miguel@ximian.com>
17061 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
17063 * expression.cs (ImplicitReferenceConversion): handle null as well
17064 as a source to convert to any reference type.
17066 * statement.cs (Return): Perform any implicit conversions to
17067 expected return type.
17069 Validate use of return statement.
17071 * codegen.cs (EmitContext): Pass the expected return type here.
17073 * class.cs (Method, Constructor, Property): Pass expected return
17074 type to EmitContext.
17076 2001-10-09 Miguel de Icaza <miguel@ximian.com>
17078 * expression.cs: Make DoResolve take an EmitContext instead of a
17081 Replaced `l' and `location' for `loc', for consistency.
17083 (Error, Warning): Remove unneeded Tc argument.
17085 * assign.cs, literal.cs, constant.cs: Update to new calling
17088 * codegen.cs: EmitContext now contains a flag indicating whether
17089 code is being generated in a static method or not.
17091 * cs-parser.jay: DecomposeQI, new function that replaces the old
17092 QualifiedIdentifier. Now we always decompose the assembled
17093 strings from qualified_identifier productions into a group of
17096 2001-10-08 Miguel de Icaza <miguel@ximian.com>
17098 * rootcontext.cs: Deal with field-less struct types correctly now
17099 by passing the size option to Define Type.
17101 * class.cs: Removed hack that created one static field.
17103 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17105 * statement.cs: Moved most of the code generation here.
17107 2001-10-09 Ravi Pratap <ravi@ximian.com>
17109 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
17112 (ElementAccess): Remove useless bits for now - keep checks as the spec
17115 2001-10-08 Ravi Pratap <ravi@ximian.com>
17117 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17118 and start performing checks according to the spec.
17120 2001-10-07 Ravi Pratap <ravi@ximian.com>
17122 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17123 rank_specifiers instead.
17125 (rank_specifiers): Change the order in which the rank specifiers are stored
17127 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17129 * expression.cs (ElementAccess): Implement the LValue interface too.
17131 2001-10-06 Ravi Pratap <ravi@ximian.com>
17133 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17134 except that user defined conversions are not included.
17136 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17137 perform the conversion of the return type, if necessary.
17139 (New::DoResolve): Check whether we are creating an array or an object
17140 and accordingly do the needful.
17142 (New::Emit): Same here.
17144 (New::DoResolve): Implement guts of array creation.
17146 (New::FormLookupType): Helper function.
17148 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17150 * codegen.cs: Removed most of the code generation here, and move the
17151 corresponding code generation bits to the statement classes.
17153 Added support for try/catch/finalize and throw.
17155 * cs-parser.jay: Added support for try/catch/finalize.
17157 * class.cs: Catch static methods having the flags override,
17158 virtual or abstract.
17160 * expression.cs (UserCast): This user cast was not really doing
17161 what it was supposed to do. Which is to be born in fully resolved
17162 state. Parts of the resolution were being performed at Emit time!
17166 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17168 * expression.cs: Implicity convert the result from UserCast.
17170 2001-10-05 Ravi Pratap <ravi@ximian.com>
17172 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17173 prevented it from working correctly.
17175 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17176 merely ConvertImplicit.
17178 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17180 * typemanager.cs: Make the LookupTypeContainer function static,
17181 and not per-instance.
17183 * class.cs: Make static FindMembers (the one that takes a Type
17186 * codegen.cs: Add EmitForeach here.
17188 * cs-parser.jay: Make foreach a toplevel object instead of the
17189 inline expansion, as we need to perform semantic analysis on it.
17191 2001-10-05 Ravi Pratap <ravi@ximian.com>
17193 * expression.cs (Expression::ImplicitUserConversion): Rename to
17194 UserDefinedConversion.
17196 (Expression::UserDefinedConversion): Take an extra argument specifying
17197 whether we look for explicit user conversions too.
17199 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17201 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17203 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17204 with the appropriate arguments.
17206 * cs-parser.jay (cast_expression): Record location too.
17208 * expression.cs (Cast): Record location info.
17210 (Expression::ConvertExplicit): Take location argument.
17212 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17213 to determine if we are doing explicit conversions.
17215 (UserCast::Emit): Update accordingly.
17217 (Expression::ConvertExplicit): Report an error if everything fails.
17219 * ../errors/cs0030.cs : Add.
17221 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17223 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17224 virtual and newslot bits.
17226 * class.cs (TypeContainer::RegisterRequiredImplementations):
17227 Record methods we need.
17229 (TypeContainer::MakeKey): Helper function to make keys for
17230 MethodBases, since the Methodbase key is useless.
17232 (TypeContainer::Populate): Call RegisterRequiredImplementations
17233 before defining the methods.
17235 Create a mapping for method_builders_to_methods ahead of time
17236 instead of inside a tight loop.
17238 (::RequireMethods): Accept an object as the data to set into the
17239 hashtable so we can report interface vs abstract method mismatch.
17241 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17243 * report.cs: Make all of it static.
17245 * rootcontext.cs: Drop object_type and value_type computations, as
17246 we have those in the TypeManager anyways.
17248 Drop report instance variable too, now it is a global.
17250 * driver.cs: Use try/catch on command line handling.
17252 Add --probe option to debug the error reporting system with a test
17255 * report.cs: Add support for exiting program when a probe
17256 condition is reached.
17258 2001-10-03 Ravi Pratap <ravi@ximian.com>
17260 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17261 we do a forcible conversion regardless of type, to check if
17262 ForceConversion returns a null.
17264 (Binary::error19): Use location to report error.
17266 (Unary::error23): Use location here too.
17268 * ../errors/cs0019.cs : Check in.
17270 * ../errors/cs0023.cs : Check in.
17272 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17273 case of a non-null MethodInfo object with a length of 0 !
17275 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17276 an applicable member - according to the spec :-)
17277 Also fix logic to find members in base types.
17279 (Unary::ResolveOperator): Same here.
17281 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17282 as I was getting thoroughly confused between this and error19 :-)
17284 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17285 (::FindMostEncompassedType): Implement.
17286 (::FindMostEncompassingType): Implement.
17287 (::StandardConversionExists): Implement.
17289 (UserImplicitCast): Re-vamp. We now need info about most specific
17290 source and target types so that we can do the necessary conversions.
17292 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17293 mathematical union with no duplicates.
17295 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17297 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17298 in order from base classes to child classes, so that we can in
17299 child classes look up in our parent for method names and
17300 attributes (required for handling abstract, virtual, new, override
17301 constructs: we need to instrospect our base class, and if we dont
17302 populate the classes in order, the introspection might be
17303 incorrect. For example, a method could query its parent before
17304 the parent has any methods and would determine that the parent has
17305 no abstract methods (while it could have had them)).
17307 (RootContext::CreateType): Record the order in which we define the
17310 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17312 * class.cs (TypeContainer::Populate): Also method definitions can
17313 fail now, keep track of this.
17315 (TypeContainer::FindMembers): Implement support for
17316 DeclaredOnly/noDeclaredOnly flag.
17318 (Constructor::Emit) Return the ConstructorBuilder.
17320 (Method::Emit) Return the MethodBuilder.
17321 Check for abstract or virtual methods to be public.
17323 * rootcontext.cs (RootContext::CreateType): Register all the
17324 abstract methods required for the class to be complete and the
17325 interface methods that must be implemented.
17327 * cs-parser.jay: Report error 501 (method requires body if it is
17328 not marked abstract or extern).
17330 * expression.cs (TypeOf::Emit): Implement.
17332 * typemanager.cs: runtime_handle_type, new global type.
17334 * class.cs (Property::Emit): Generate code for properties.
17336 2001-10-02 Ravi Pratap <ravi@ximian.com>
17338 * expression.cs (Unary::ResolveOperator): Find operators on base type
17339 too - we now conform exactly to the spec.
17341 (Binary::ResolveOperator): Same here.
17343 * class.cs (Operator::Define): Fix minor quirk in the tests.
17345 * ../errors/cs0215.cs : Added.
17347 * ../errors/cs0556.cs : Added.
17349 * ../errors/cs0555.cs : Added.
17351 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17353 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17354 single integer which is really efficient
17356 2001-10-01 Ravi Pratap <ravi@ximian.com>
17358 * expression.cs (Expression::ImplicitUserConversion): Use location
17359 even in the case when we are examining True operators.
17361 * class.cs (Operator::Define): Perform extensive checks to conform
17362 with the rules for operator overloading in the spec.
17364 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17365 some of the other conversions mentioned in the spec.
17367 * typemanager.cs (array_type): New static member for the System.Array built-in
17370 (cloneable_interface): For System.ICloneable interface.
17372 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17373 we start resolving the tree and populating types.
17375 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17377 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17379 * expression.cs (Expression::ExprClassFromMemberInfo,
17380 Expression::Literalize): Create literal expressions from
17381 FieldInfos which are literals.
17383 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17384 type casts, because they were wrong. The test suite in tests
17387 (ImplicitNumericConversion): ushort to ulong requires a widening
17390 Int32 constant to long requires widening cast as well.
17392 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17393 for integers because the type on the stack is not i4.
17395 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17397 * expression.cs (report118): require location argument.
17399 * parameter.cs: Do not dereference potential null value.
17401 * class.cs: Catch methods that lack the `new' keyword when
17402 overriding a name. Report warnings when `new' is used without
17403 anything being there to override.
17405 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17407 * class.cs: Only add constructor to hashtable if it is non-null
17408 (as now constructors can fail on define).
17410 (TypeManager, Class, Struct): Take location arguments.
17412 Catch field instance initialization in structs as errors.
17414 accepting_filter: a new filter for FindMembers that is static so
17415 that we dont create an instance per invocation.
17417 (Constructor::Define): Catch errors where a struct constructor is
17420 * cs-parser.jay: Pass location information for various new
17423 * delegate.cs (Delegate): take a location argument.
17425 * driver.cs: Do not call EmitCode if there were problesm in the
17426 Definition of the types, as many Builders wont be there.
17428 * decl.cs (Decl::Decl): Require a location argument.
17430 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17431 into integers, and find the most appropiate integer for it.
17433 * literal.cs: Implement ULongLiteral.
17435 * rootcontext.cs: Provide better information about the location of
17436 failure when CreateType fails.
17438 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17440 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17443 * expression.cs (Binary::CheckShiftArguments): Add missing type
17445 (Binary::ResolveOperator): Add type to the logical and and logical
17446 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17449 (Binary::DoNumericPromotions): In the case where either argument
17450 is ulong (and most signed types combined with ulong cause an
17451 error) perform implicit integer constant conversions as well.
17453 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17455 * expression.cs (UserImplicitCast): Method should always be
17457 (Invocation::BetterConversion): Simplified test for IntLiteral.
17459 (Expression::ImplicitNumericConversion): Split this routine out.
17460 Put the code that performs implicit constant integer conversions
17463 (Expression::Resolve): Become a wrapper around DoResolve so we can
17464 check eclass and type being set after resolve.
17466 (Invocation::Badness): Remove this dead function
17468 (Binary::ResolveOperator): Do not compute the expensive argumnets
17469 unless we have a union for it.
17471 (Probe::Emit): Is needs to do an isinst and then
17472 compare against null.
17474 (::CanConvert): Added Location argument. If the Location argument
17475 is null (Location.Null), then we do not report errors. This is
17476 used by the `probe' mechanism of the Explicit conversion. We do
17477 not want to generate an error for something that the user
17478 explicitly requested to be casted. But the pipeline for an
17479 explicit cast first tests for potential implicit casts.
17481 So for now, if the Location is null, it means `Probe only' to
17482 avoid adding another argument. Might have to revise this
17485 (ClassCast): New class used to type cast objects into arbitrary
17486 classes (used in Explicit Reference Conversions).
17488 Implement `as' as well.
17490 Reverted all the patches from Ravi below: they were broken:
17492 * The use of `level' as a mechanism to stop recursive
17493 invocations is wrong. That was there just to catch the
17494 bug with a strack trace but not as a way of addressing
17497 To fix the problem we have to *understand* what is going
17498 on and the interactions and come up with a plan, not
17499 just get things going.
17501 * The use of the type conversion cache that I proposed
17502 last night had an open topic: How does this work across
17503 protection domains. A user defined conversion might not
17504 be public in the location where we are applying the
17505 conversion, a different conversion might be selected
17506 (ie, private A->B (better) but public B->A (worse),
17507 inside A, A->B applies, but outside it, B->A will
17510 * On top of that (ie, even if the above is solved),
17511 conversions in a cache need to be abstract. Ie, `To
17512 convert from an Int to a Short use an OpcodeCast', not
17513 `To convert from an Int to a Short use the OpcodeCast on
17514 the variable 5' (which is what this patch was doing).
17516 2001-09-28 Ravi Pratap <ravi@ximian.com>
17518 * expression.cs (Invocation::ConversionExists): Re-write to use
17519 the conversion cache
17521 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17522 cache all conversions done, not just user-defined ones.
17524 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17525 to determine if a conversion exists instead of acutually trying to
17526 perform the conversion. It's faster too.
17528 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17529 and only then attempt the implicit conversion.
17531 2001-09-28 Ravi Pratap <ravi@ximian.com>
17533 * expression.cs (ConvertImplicit): Use a cache for conversions
17534 already found. Check level of recursion and bail out if necessary.
17536 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17538 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17539 Export standard methods that we expect for string operations.
17541 * statement.cs (Block::UsageWarning): Track usage of variables and
17542 report the errors for not used variables.
17544 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17547 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17549 * codegen.cs: remove unnneded code
17551 * expression.cs: Removed BuiltinTypeAccess class
17553 Fix the order in which implicit conversions are
17556 The previous fixed dropped support for boxed conversions (adding a
17557 test to the test suite now)
17559 (UserImplicitCast::CanConvert): Remove test for source being null,
17560 that code is broken. We should not feed a null to begin with, if
17561 we do, then we should track the bug where the problem originates
17562 and not try to cover it up here.
17564 Return a resolved expression of type UserImplicitCast on success
17565 rather than true/false. Ravi: this is what I was talking about,
17566 the pattern is to use a static method as a "constructor" for
17569 Also, do not create arguments until the very last minute,
17570 otherwise we always create the arguments even for lookups that
17571 will never be performed.
17573 (UserImplicitCast::Resolve): Eliminate, objects of type
17574 UserImplicitCast are born in a fully resolved state.
17576 * typemanager.cs (InitCoreTypes): Init also value_type
17577 (System.ValueType).
17579 * expression.cs (Cast::Resolve): First resolve the child expression.
17581 (LValue): Add new method AddressOf to be used by
17584 Change the argument of Store to take an EmitContext instead of an
17585 ILGenerator, because things like FieldExpr need to be able to call
17586 their children expression to generate the instance code.
17588 (Expression::Error, Expression::Warning): Sugar functions for
17591 (Expression::MemberLookup): Accept a TypeContainer instead of a
17592 Report as the first argument.
17594 (Expression::ResolvePrimary): Killed. I still want to improve
17595 this as currently the code is just not right.
17597 (Expression::ResolveMemberAccess): Simplify, but it is still
17600 (Unary::Resolve): Catch errors in AddressOf operators.
17602 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
17603 index to a byte for the short-version, or the compiler will choose
17604 the wrong Emit call, which generates the wrong data.
17606 (ParameterReference::Emit, ::Store): same.
17608 (FieldExpr::AddressOf): Implement.
17610 * typemanager.cs: TypeManager: made public variable instead of
17613 * driver.cs: document --fatal.
17615 * report.cs (ErrorMessage, WarningMessage): new names for the old
17616 Error and Warning classes.
17618 * cs-parser.jay (member_access): Turn built-in access to types
17619 into a normal simplename
17621 2001-09-27 Ravi Pratap <ravi@ximian.com>
17623 * expression.cs (Invocation::BetterConversion): Fix to cope
17624 with q being null, since this was introducing a bug.
17626 * expression.cs (ConvertImplicit): Do built-in conversions first.
17628 2001-09-27 Ravi Pratap <ravi@ximian.com>
17630 * expression.cs (UserImplicitCast::Resolve): Fix bug.
17632 2001-09-27 Ravi Pratap <ravi@ximian.com>
17634 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
17635 I had introduced long ago (what's new ?).
17637 * expression.cs (UserImplicitCast::CanConvert): Static method to do
17638 the work of all the checking.
17639 (ConvertImplicit): Call CanConvert and only then create object if necessary.
17640 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
17642 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
17643 that is the right way.
17645 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
17646 overloading resolution. Use everywhere instead of cutting and pasting code.
17648 (Binary::ResolveOperator): Use MakeUnionSet.
17650 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
17651 we have to convert to bool types. Not complete yet.
17653 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17655 * typemanager.cs (TypeManager::CSharpName): support ushort.
17657 * expression.cs (Expression::TryImplicitIntConversion): Attempts
17658 to provide an expression that performsn an implicit constant int
17659 conversion (section 6.1.6).
17660 (Expression::ConvertImplicitRequired): Reworked to include
17661 implicit constant expression conversions.
17663 (Expression::ConvertNumericExplicit): Finished.
17665 (Invocation::Emit): If InstanceExpression is null, then it means
17666 that we perform a call on this.
17668 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17670 * expression.cs (Unary::Emit): Remove some dead code.
17671 (Probe): Implement Resolve and Emit for `is'.
17672 (Expression::ConvertImplicitRequired): Attempt to do constant
17673 expression conversions here. Maybe should be moved to
17674 ConvertImplicit, but I am not sure.
17675 (Expression::ImplicitLongConstantConversionPossible,
17676 Expression::ImplicitIntConstantConversionPossible): New functions
17677 that tell whether is it possible to apply an implicit constant
17678 expression conversion.
17680 (ConvertNumericExplicit): Started work on explicit numeric
17683 * cs-parser.jay: Update operator constants.
17685 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
17686 (Parameters::GetSignature): Hook up VerifyArgs here.
17687 (Parameters::VerifyArgs): Verifies that no two arguments have the
17690 * class.cs (Operator): Update the operator names to reflect the
17691 ones that the spec expects (as we are just stringizing the
17694 * expression.cs (Unary::ResolveOperator): Fix bug: Use
17695 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
17696 previous usage did only work for our methods.
17697 (Expression::ConvertImplicit): Handle decimal implicit numeric
17698 conversions as well.
17699 (Expression::InternalTypeConstructor): Used to invoke constructors
17700 on internal types for default promotions.
17702 (Unary::Emit): Implement special handling for the pre/post
17703 increment/decrement for overloaded operators, as they need to have
17704 the same semantics as the other operators.
17706 (Binary::ResolveOperator): ditto.
17707 (Invocation::ConversionExists): ditto.
17708 (UserImplicitCast::Resolve): ditto.
17710 2001-09-26 Ravi Pratap <ravi@ximian.com>
17712 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
17713 operator, return after emitting body. Regression tests pass again !
17715 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
17716 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
17717 (Invocation::OverloadResolve): Ditto.
17718 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
17720 * everywhere : update calls to the above methods accordingly.
17722 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17724 * assign.cs (Assign): Make it inherit from ExpressionStatement.
17726 * expression.cs (ExpressionStatement): New base class used for
17727 expressions that can appear in statements, so that we can provide
17728 an alternate path to generate expression that do not leave a value
17731 (Expression::Emit, and all the derivatives): We no longer return
17732 whether a value is left on the stack or not. Every expression
17733 after being emitted leaves a single value on the stack.
17735 * codegen.cs (EmitContext::EmitStatementExpression): Use the
17736 facilties of ExpressionStatement if possible.
17738 * cs-parser.jay: Update statement_expression.
17740 2001-09-25 Miguel de Icaza <miguel@ximian.com>
17742 * driver.cs: Change the wording of message
17744 2001-09-25 Ravi Pratap <ravi@ximian.com>
17746 * expression.cs (Binary::ResolveOperator): Had forgottten to set
17747 the type of the expression to the return type of the method if
17748 we have an overloaded operator match ! The regression tests pass again !
17749 (Unary::ResolveOperator): Ditto.
17751 * expression.cs (Invocation::ConversionExists): Correct the member lookup
17752 to find "op_Implicit", not "implicit" ;-)
17753 (UserImplicitCast): New class to take care of user-defined implicit conversions.
17754 (ConvertImplicit, ForceConversion): Take TypeContainer argument
17756 * everywhere : Correct calls to the above accordingly.
17758 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
17759 (ConvertImplicit): Do user-defined conversion if it exists.
17761 2001-09-24 Miguel de Icaza <miguel@ximian.com>
17763 * assign.cs: track location.
17764 (Resolve): Use implicit conversions on assignment.
17766 * literal.cs: Oops. Not good, Emit of short access values should
17767 pass (Bytes) or the wrong argument will be selected.
17769 * expression.cs (Unary::Emit): Emit code for -expr.
17771 (Unary::ResolveOperator): Handle `Substract' for non-constants
17772 (substract from zero from the non-constants).
17773 Deal with Doubles as well.
17775 (Expression::ConvertImplicitRequired): New routine that reports an
17776 error if no implicit conversion exists.
17778 (Invocation::OverloadResolve): Store the converted implicit
17779 expressions if we make them
17781 2001-09-24 Ravi Pratap <ravi@ximian.com>
17783 * class.cs (ConstructorInitializer): Take a Location argument.
17784 (ConstructorBaseInitializer): Same here.
17785 (ConstructorThisInitializer): Same here.
17787 * cs-parser.jay : Update all calls accordingly.
17789 * expression.cs (Unary, Binary, New): Take location argument.
17790 Update accordingly everywhere.
17792 * cs-parser.jay : Update all calls to the above to take a location
17795 * class.cs : Ditto.
17797 2001-09-24 Ravi Pratap <ravi@ximian.com>
17799 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
17800 (Invocation::BetterConversion): Same here
17801 (Invocation::ConversionExists): Ditto.
17803 (Invocation::ConversionExists): Implement.
17805 2001-09-22 Ravi Pratap <ravi@ximian.com>
17807 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
17808 Also take an additional TypeContainer argument.
17810 * All over : Pass in TypeContainer as argument to OverloadResolve.
17812 * typemanager.cs (CSharpName): Update to check for the string type and return
17815 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
17818 2001-09-21 Ravi Pratap <ravi@ximian.com>
17820 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
17821 (Invocation::BetterFunction): Implement.
17822 (Invocation::BetterConversion): Implement.
17823 (Invocation::ConversionExists): Skeleton, no implementation yet.
17825 Okay, things work fine !
17827 2001-09-21 Miguel de Icaza <miguel@ximian.com>
17829 * typemanager.cs: declare and load enum_type, delegate_type and
17832 * expression.cs (Expression::Emit): Now emit returns a value that
17833 tells whether a value is left on the stack or not. This strategy
17834 might be reveted tomorrow with a mechanism that would address
17835 multiple assignments.
17836 (Expression::report118): Utility routine to report mismatches on
17839 (Unary::Report23): Report impossible type/operator combination
17842 (Unary::IsIncrementableNumber): Whether the type can be
17843 incremented or decremented with add.
17844 (Unary::ResolveOperator): Also allow enumerations to be bitwise
17846 (Unary::ResolveOperator): Implement ++, !, ~,
17848 (Invocation::Emit): Deal with new Emit convetion.
17850 * All Expression derivatives: Updated their Emit method to return
17851 whether they leave values on the stack or not.
17853 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
17854 stack for expressions that are statements.
17856 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17858 * expression.cs (LValue): New interface. Must be implemented by
17860 (LocalVariableReference, ParameterReference, FieldExpr): Implement
17863 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
17864 interface for generating code, simplifies the code.
17866 2001-09-20 Ravi Pratap <ravi@ximian.com>
17868 * expression.cs (everywhere): Comment out return statements in ::Resolve
17869 methods to avoid the warnings.
17871 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17873 * driver.cs (parse): Report error 2001 if we can not open the
17876 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
17879 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
17882 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
17883 otherwise nested blocks end up with the same index.
17885 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
17887 * expression.cs: Instead of having FIXMEs in the Resolve
17888 functions, throw exceptions so it is obvious that we are facing a
17891 * cs-parser.jay (invocation_expression): Pass Location information.
17893 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
17894 Use a basename for those routines because .NET does not like paths
17897 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
17900 2001-09-19 Miguel de Icaza <miguel@ximian.com>
17902 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
17903 are loading the correct data types (throws an exception if not).
17904 (TypeManager::InitCoreTypes): Use CoreLookupType
17906 * expression.cs (Unary::ResolveOperator): return the child
17907 expression for expressions which are just +expr.
17908 (Unary::ResolveOperator): Return negative literals for -LITERAL
17909 expressions (otherwise they are Unary {Literal}).
17910 (Invocation::Badness): Take into account `Implicit constant
17911 expression conversions'.
17913 * literal.cs (LongLiteral): Implement long literal class.
17914 (IntLiteral): export the `Value' of the intliteral.
17916 2001-09-19 Ravi Pratap <ravi@ximian.com>
17918 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
17920 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
17921 instead of 'Operator'
17923 * expression.cs (Binary::ResolveOperator): Update accordingly.
17924 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
17927 * cs-parser.jay (unary_expression): Update to use the new names.
17929 * gen-treedump.cs (GetUnary): Same here.
17931 * expression.cs (Unary::Resolve): Implement.
17932 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
17933 operators are found instead of making noise ;-)
17934 (Unary::ResolveOperator): New method to do precisely the same thing which
17935 Binary::ResolveOperator does for Binary expressions.
17936 (Unary.method, .Arguments): Add.
17937 (Unary::OperName): Implement.
17938 (Unary::ForceConversion): Copy and Paste !
17940 * class.cs (Operator::Define): Fix a small bug for the case when we have
17943 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
17944 for the inbuilt operators. Only overloading works for now ;-)
17946 2001-09-18 Miguel de Icaza <miguel@ximian.com>
17948 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
17949 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
17951 * expression.cs (This::Emit): Implement.
17952 (This::Resolve): Implement.
17953 (TypeOf:Resolve): Implement.
17954 (Expression::ResolveSimpleName): Add an implicit this to instance
17956 (MemberAccess::Resolve): Deal with Parameters and Fields.
17957 Bind instance variable to Field expressions.
17958 (FieldExpr::Instance): New field used to track the expression that
17959 represents the object instance.
17960 (FieldExpr::Resolve): Track potential errors from MemberLookup not
17962 (FieldExpr::Emit): Implement.
17964 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
17965 the last instruction contains a return opcode to avoid generating
17966 the last `ret' instruction (this generates correct code, and it is
17967 nice to pass the peverify output).
17969 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
17970 initializer for static and instance variables.
17971 (Constructor::Emit): Allow initializer to be null in the case of
17972 static constructors. Only emit initializer for instance
17975 (TypeContainer::FindMembers): Return a null array if there are no
17978 Also fix the code for the MemberTypes.Method branch, as it was not
17979 scanning that for operators (or tried to access null variables before).
17981 * assign.cs (Assign::Emit): Handle instance and static fields.
17985 * driver.cs: Stop compilation if there are parse errors.
17987 * cs-parser.jay (constructor_declaration): Provide default base
17988 initializer for non-static constructors.
17989 (constructor_declarator): Do not provide a default base
17990 initializers if none was specified.
17991 Catch the fact that constructors should not have parameters.
17993 * class.cs: Do not emit parent class initializers for static
17994 constructors, that should be flagged as an error.
17996 2001-09-18 Ravi Pratap <ravi@ximian.com>
17998 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
17999 Move back code into TypeContainer::Populate.
18001 2001-09-18 Ravi Pratap <ravi@ximian.com>
18003 * class.cs (TypeContainer::AddConstructor): Fix the check to
18004 compare against Name, not Basename.
18005 (Operator::OpType): Change Plus and Minus to Add and Subtract.
18007 * cs-parser.jay : Update accordingly.
18009 * class.cs (TypeContainer::FindMembers): For the case where we are searching
18010 for methods, don't forget to look into the operators too.
18011 (RegisterMethodBuilder): Helper method to take care of this for
18012 methods, constructors and operators.
18013 (Operator::Define): Completely revamp.
18014 (Operator.OperatorMethod, MethodName): New fields.
18015 (TypeContainer::Populate): Move the registering of builders into
18016 RegisterMethodBuilder.
18017 (Operator::Emit): Re-write.
18019 * expression.cs (Binary::Emit): Comment out code path to emit method
18020 invocation stuff for the case when we have a user defined operator. I am
18021 just not able to get it right !
18023 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18025 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
18028 (Expression::MemberLookup): Provide a version that allows to
18029 specify the MemberTypes and BindingFlags.
18031 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
18032 so it was not fetching variable information from outer blocks.
18034 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
18035 Beforefieldinit as it was buggy.
18037 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
18038 that Ravi put here.
18040 * class.cs (Constructor::Emit): Only emit if block is not null.
18041 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
18042 deal with this by semantically definining it as if the user had
18045 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
18046 constructors as we now "emit" them at a higher level.
18048 (TypeContainer::DefineDefaultConstructor): Used to define the
18049 default constructors if none was provided.
18051 (ConstructorInitializer): Add methods Resolve and Emit.
18053 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
18055 2001-09-17 Ravi Pratap <ravi@ximian.com>
18057 * class.cs (TypeContainer::EmitDefaultConstructor): Register
18058 the default constructor builder with our hashtable for methodbuilders
18061 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
18062 and argument_count is 0 in which case we have a match.
18063 (Binary::ResolveOperator): More null checking and miscellaneous coding
18066 2001-09-17 Ravi Pratap <ravi@ximian.com>
18068 * rootcontext.cs (IsNameSpace): Compare against null.
18070 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
18072 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
18073 and Unary::Operator.
18075 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
18078 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
18079 we have overloaded operators.
18080 (Binary::ResolveOperator): Implement the part which does the operator overload
18083 * class.cs (Operator::Emit): Implement.
18084 (TypeContainer::Emit): Emit the operators we have too.
18086 * expression.cs (Binary::Emit): Update to emit the appropriate code for
18087 the case when we have a user-defined operator.
18089 2001-09-17 Miguel de Icaza <miguel@ximian.com>
18091 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
18093 2001-09-16 Ravi Pratap <ravi@ximian.com>
18095 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
18096 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
18097 (Constructor::Emit): Implement.
18098 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
18099 if we have no work to do.
18100 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
18103 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
18104 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
18106 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
18109 2001-09-15 Ravi Pratap <ravi@ximian.com>
18111 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
18113 (Tree::RecordNamespace): Method to do what the name says ;-)
18114 (Tree::Namespaces): Property to get at the namespaces hashtable.
18116 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18119 * rootcontext.cs (IsNamespace): Fixed it :-)
18121 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18123 * class.cs (TypeContainer::FindMembers): Add support for
18125 (MethodCore): New class that encapsulates both the shared aspects
18126 of a Constructor and a Method.
18127 (Method, Constructor): Factored pieces into MethodCore.
18129 * driver.cs: Added --fatal which makes errors throw exceptions.
18130 Load System assembly as well as part of the standard library.
18132 * report.cs: Allow throwing exceptions on errors for debugging.
18134 * modifiers.cs: Do not use `parent', instead use the real type
18135 container to evaluate permission settings.
18137 * class.cs: Put Ravi's patch back in. He is right, and we will
18138 have to cope with the
18140 2001-09-14 Ravi Pratap <ravi@ximian.com>
18142 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18143 FamORAssem, not FamANDAssem.
18145 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18147 * driver.cs: Added --parse option that only parses its input files
18150 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18151 incorrect. IsTopLevel is not used to tell whether an object is
18152 root_types or not (that can be achieved by testing this ==
18153 root_types). But to see if this is a top-level *class* (not
18154 necessarly our "toplevel" container).
18156 2001-09-14 Ravi Pratap <ravi@ximian.com>
18158 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18159 parent instead of a direct call to GetType.
18161 2001-09-14 Ravi Pratap <ravi@ximian.com>
18163 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18164 Modifiers.TypeAttr. This should just be a call to that method.
18166 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18167 object so that we can determine if we are top-level or not.
18169 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18172 * enum.cs (Enum::Define): Ditto.
18174 * modifiers.cs (FieldAttr): Re-write.
18176 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18177 (TypeContainer::HaveStaticConstructor): New property to provide access
18178 to precisely that info.
18180 * modifiers.cs (MethodAttr): Re-write.
18181 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18183 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18184 of top-level types as claimed.
18186 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18188 * expression.cs (MemberLookup): Fruitless attempt to lookup
18189 constructors. Maybe I need to emit default constructors? That
18190 might be it (currently .NET emits this for me automatically).
18191 (Invocation::OverloadResolve): Cope with Arguments == null.
18192 (Invocation::EmitArguments): new function, shared by the new
18193 constructor and us.
18194 (Invocation::Emit): Handle static and instance methods. Emit
18195 proper call instruction for virtual or non-virtual invocations.
18196 (New::Emit): Implement.
18197 (New::Resolve): Implement.
18198 (MemberAccess:Resolve): Implement.
18199 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18200 to track instances.
18201 (FieldExpr::Resolve): Set type.
18203 * support.cs: Handle empty arguments.
18205 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18206 SimpleLookup): Auxiliary routines to help parse a qualifier
18209 Update qualifier_identifier rule.
18211 * codegen.cs: Removed debugging messages.
18213 * class.cs: Make this a global thing, this acts just as a "key" to
18214 objects that we might have around.
18216 (Populate): Only initialize method_builders_to_methods once.
18218 * expression.cs (PropertyExpr): Initialize type from the
18221 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18222 Resolve pattern. Attempt to implicitly convert value to boolean.
18225 * expression.cs: Set the type for the int32/int32 argument case.
18226 (Binary::ResolveOperator): Set the return type to boolean for
18227 comparission operators
18229 * typemanager.cs: Remove debugging print code.
18231 (Invocation::Resolve): resolve type.
18233 * class.cs: Allocate a MemberInfo of the correct size, as the code
18234 elsewhere depends on the test to reflect the correct contents.
18236 (Method::) Keep track of parameters, due to System.Reflection holes
18238 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18241 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18242 of the exact size and return that.
18244 (Class::LookupMethodByBuilder): New function that maps
18245 MethodBuilders to its methods. Required to locate the information
18246 on methods because System.Reflection bit us again.
18248 * support.cs: New file, contains an interface ParameterData and
18249 two implementations: ReflectionParameters and InternalParameters
18250 used to access Parameter information. We will need to grow this
18253 * expression.cs (Invocation::GetParameterData): implement a cache
18254 and a wrapper around the ParameterData creation for methods.
18255 (Invocation::OverloadResolve): Use new code.
18257 2001-09-13 Ravi Pratap <ravi@ximian.com>
18259 * class.cs (TypeContainer::EmitField): Remove and move into
18260 (Field::Define): here and modify accordingly.
18261 (Field.FieldBuilder): New member.
18262 (TypeContainer::Populate): Update accordingly.
18263 (TypeContainer::FindMembers): Implement.
18265 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18267 * statement.cs: (VariableInfo::VariableType): New field to be
18268 initialized with the full type once it is resolved.
18270 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18272 * parameter.cs (GetParameterInfo): Use a type cache to compute
18273 things only once, and to reuse this information
18275 * expression.cs (LocalVariableReference::Emit): Implement.
18276 (OpcodeCast::Emit): fix.
18278 (ParameterReference::Resolve): Implement.
18279 (ParameterReference::Emit): Implement.
18281 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18282 that are expressions need to stay as Expressions.
18284 * typemanager.cs (CSharpName): Returns the C# name of a type if
18287 * expression.cs (Expression::ConvertImplicit): New function that
18288 implements implicit type conversions.
18290 (Expression::ImplicitReferenceConversion): Implements implicit
18291 reference conversions.
18293 (EmptyCast): New type for transparent casts.
18295 (OpcodeCast): New type for casts of types that are performed with
18296 a sequence of bytecodes.
18298 (BoxedCast): New type used for casting value types into reference
18299 types. Emits a box opcode.
18301 (Binary::DoNumericPromotions): Implements numeric promotions of
18302 and computation of the Binary::Type.
18304 (Binary::EmitBranchable): Optimization.
18306 (Binary::Emit): Implement code emission for expressions.
18308 * typemanager.cs (TypeManager): Added two new core types: sbyte
18311 2001-09-12 Ravi Pratap <ravi@ximian.com>
18313 * class.cs (TypeContainer::FindMembers): Method which does exactly
18314 what Type.FindMembers does, only we don't have to use reflection. No
18315 implementation yet.
18317 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18318 typecontainer objects as we need to get at them.
18319 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18321 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18322 typecontainer object.
18324 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18325 of just a Report object.
18327 2001-09-11 Ravi Pratap <ravi@ximian.com>
18329 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18331 (TypeContainer::Populate): Now define the delegates of the type too.
18332 (TypeContainer.Delegates): Property to access the list of delegates defined
18335 * delegates.cs (Delegate::Define): Implement partially.
18337 * modifiers.cs (TypeAttr): Handle more flags.
18339 2001-09-11 Ravi Pratap <ravi@ximian.com>
18341 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18343 (Operator::Define): Re-write logic to get types by using the LookupType method
18344 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18345 (Indexer::Define): Ditto.
18346 (Event::Define): Ditto.
18347 (Property::Define): Ditto.
18349 2001-09-10 Ravi Pratap <ravi@ximian.com>
18351 * class.cs (TypeContainer::Populate): Now define operators too.
18352 (TypeContainer.Operators): New property to access the list of operators
18354 (Operator.OperatorMethodBuilder): New member to hold the method builder
18355 for the operator we are defining.
18356 (Operator::Define): Implement.
18358 2001-09-10 Ravi Pratap <ravi@ximian.com>
18360 * class.cs (Event::Define): Make the prefixes of the accessor methods
18361 addOn_ and removeOn_
18363 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18364 of the location being passed in too. Ideally, this should go later since all
18365 error reporting should be done through the Report object.
18367 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18368 (Populate): Iterate thru the indexers we have and define them too.
18369 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18370 for the get and set accessors.
18371 (Indexer::Define): Implement.
18373 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18375 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18376 my previous implementation, did not work.
18378 * typemanager.cs: Add a couple of missing types (the longs).
18380 * literal.cs: Use TypeManager.bool_type instead of getting it.
18382 * expression.cs (EventExpr): New kind of expressions.
18383 (Expressio::ExprClassFromMemberInfo): finish
18385 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18387 * assign.cs: Emit stores to static fields differently.
18389 2001-09-08 Ravi Pratap <ravi@ximian.com>
18391 * Merge in changes and adjust code to tackle conflicts. Backed out my
18392 code in Assign::Resolve ;-)
18394 2001-09-08 Ravi Pratap <ravi@ximian.com>
18396 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18397 instead Report.Error and also pass in the location.
18398 (CSharpParser::Lexer): New readonly property to return the reference
18399 to the Tokenizer object.
18400 (declare_local_variables): Use Report.Error with location instead of plain
18404 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18405 (Operator.CheckBinaryOperator): Ditto.
18407 * cs-parser.jay (operator_declarator): Update accordingly.
18409 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18410 (CheckBinaryOperator): Same here.
18412 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18413 on the name without any prefixes of namespace names etc. This is because we
18414 already might have something already fully qualified like
18415 'System.Console.WriteLine'
18417 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18419 2001-09-07 Ravi Pratap <ravi@ximian.com>
18421 * cs-tokenizer.cs (location): Return a string which also contains
18424 * expression.cs (ElementAccess): New class for expressions of the
18425 type 'element access.'
18426 (BaseAccess): New class for expressions of the type 'base access.'
18427 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18430 * cs-parser.jay (element_access): Implement action.
18431 (base_access): Implement actions.
18432 (checked_expression, unchecked_expression): Implement.
18434 * cs-parser.jay (local_variable_type): Correct and implement.
18435 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18437 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18439 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18440 name and the specifiers.
18442 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18444 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18445 making them all public ;-)
18447 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18450 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18452 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18454 (FieldExpr, PropertyExprs): New resolved expressions.
18455 (SimpleName::MemberStaticCheck): Perform static checks for access
18456 to non-static fields on static methods. Maybe this should be
18457 generalized for MemberAccesses.
18458 (SimpleName::ResolveSimpleName): More work on simple name
18461 * cs-parser.jay (primary_expression/qualified_identifier): track
18462 the parameter index.
18464 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18465 (EmitContext::EmitBoolExpression): Chain to expression generation
18466 instead of temporary hack.
18467 (::EmitStatementExpression): Put generic expression code generation.
18469 * assign.cs (Assign::Emit): Implement variable assignments to
18470 local variables, parameters and fields.
18472 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18474 * statement.cs (Block::GetVariableInfo): New method, returns the
18475 VariableInfo for a variable name in a block.
18476 (Block::GetVariableType): Implement in terms of GetVariableInfo
18478 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18479 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18481 2001-09-06 Ravi Pratap <ravi@ximian.com>
18483 * cs-parser.jay (operator_declaration): Continue on my quest : update
18484 to take attributes argument.
18485 (event_declaration): Ditto.
18486 (enum_declaration): Ditto.
18487 (indexer_declaration): Ditto.
18489 * class.cs (Operator::Operator): Update constructor accordingly.
18490 (Event::Event): Ditto.
18492 * delegate.cs (Delegate::Delegate): Same here.
18494 * enum.cs (Enum::Enum): Same here.
18496 2001-09-05 Ravi Pratap <ravi@ximian.com>
18498 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18500 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18502 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18503 being passed around as an arraylist.
18504 (Attributes::AddAttribute): Method to add attribute sections.
18506 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18507 (struct_declaration): Update accordingly.
18508 (constant_declaration): Update.
18509 (field_declaration): Update.
18510 (method_header): Update.
18511 (fixed_parameter): Update.
18512 (parameter_array): Ditto.
18513 (property_declaration): Ditto.
18514 (destructor_declaration): Ditto.
18516 * class.cs (Struct::Struct): Update constructors accordingly.
18517 (Class::Class): Ditto.
18518 (Field::Field): Ditto.
18519 (Method::Method): Ditto.
18520 (Property::Property): Ditto.
18521 (TypeContainer::OptAttribute): update property's return type.
18523 * interface.cs (Interface.opt_attributes): New member.
18524 (Interface::Interface): Update to take the extra Attributes argument.
18526 * parameter.cs (Parameter::Parameter): Ditto.
18528 * constant.cs (Constant::Constant): Ditto.
18530 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18531 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18532 the attributes as a parameter.
18533 (InterfaceProperty): Update constructor call.
18534 (InterfaceEvent): Ditto.
18535 (InterfaceMethod): Ditto.
18536 (InterfaceIndexer): Ditto.
18538 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18539 pass the attributes too.
18540 (interface_event_declaration): Ditto.
18541 (interface_property_declaration): Ditto.
18542 (interface_method_declaration): Ditto.
18543 (interface_declaration): Ditto.
18545 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18547 * class.cs (Method::Define): Track the "static Main" definition to
18548 create an entry point.
18550 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18551 EntryPoint if we find it.
18553 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18554 (EmitContext::ig): Make this variable public.
18556 * driver.cs: Make the default output file be the first file name
18557 with the .exe extension.
18559 Detect empty compilations
18561 Handle various kinds of output targets. Handle --target and
18562 rename -t to --dumper.
18564 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
18565 methods inherited from Expression return now an Expression. This
18566 will is used during the tree rewriting as we resolve them during
18569 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
18570 the spec. Missing entirely is the information about
18571 accessability of elements of it.
18573 (Expression::ExprClassFromMemberInfo): New constructor for
18574 Expressions that creates a fully initialized Expression based on
18575 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
18578 (Invocation::Resolve): Begin implementing resolution of invocations.
18580 * literal.cs (StringLiteral): Implement Emit.
18582 2001-09-05 Ravi Pratap <ravi@ximian.com>
18584 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
18587 2001-09-04 Ravi Pratap <ravi@ximian.com>
18589 * cs-parser.jay (attribute_arguments): Implement actions.
18590 (attribute): Fix bug in production. Implement action.
18591 (attribute_list): Implement.
18592 (attribute_target): Implement.
18593 (attribute_target_specifier, opt_target_specifier): Implement
18594 (CheckAttributeTarget): New method to check if the attribute target
18596 (attribute_section): Implement.
18597 (opt_attributes): Implement.
18599 * attribute.cs : New file to handle attributes.
18600 (Attribute): Class to hold attribute info.
18602 * cs-parser.jay (opt_attribute_target_specifier): Remove production
18603 (attribute_section): Modify production to use 2 different rules to
18604 achieve the same thing. 1 s/r conflict down !
18605 Clean out commented, useless, non-reducing dimension_separator rules.
18607 * class.cs (TypeContainer.attributes): New member to hold list
18608 of attributes for a type.
18609 (Struct::Struct): Modify to take one more argument, the attribute list.
18610 (Class::Class): Ditto.
18611 (Field::Field): Ditto.
18612 (Method::Method): Ditto.
18613 (Property::Property): Ditto.
18615 * cs-parser.jay (struct_declaration): Update constructor call to
18616 pass in the attributes too.
18617 (class_declaration): Ditto.
18618 (constant_declaration): Ditto.
18619 (field_declaration): Ditto.
18620 (method_header): Ditto.
18621 (fixed_parameter): Ditto.
18622 (parameter_array): Ditto.
18623 (property_declaration): Ditto.
18625 * constant.cs (Constant::Constant): Update constructor similarly.
18626 Use System.Collections.
18628 * parameter.cs (Parameter::Parameter): Update as above.
18630 2001-09-02 Ravi Pratap <ravi@ximian.com>
18632 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
18633 (TypeContainer.delegates): New member to hold list of delegates.
18635 * cs-parser.jay (delegate_declaration): Implement the action correctly
18636 this time as I seem to be on crack ;-)
18638 2001-09-02 Miguel de Icaza <miguel@ximian.com>
18640 * rootcontext.cs (RootContext::IsNamespace): new function, used to
18641 tell whether an identifier represents a namespace.
18643 * expression.cs (NamespaceExpr): A namespace expression, used only
18644 temporarly during expression resolution.
18645 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
18646 utility functions to resolve names on expressions.
18648 2001-09-01 Miguel de Icaza <miguel@ximian.com>
18650 * codegen.cs: Add hook for StatementExpressions.
18652 * class.cs: Fix inverted test for static flag in methods.
18654 2001-09-02 Ravi Pratap <ravi@ximian.com>
18656 * class.cs (Operator::CheckUnaryOperator): Correct error number used
18657 to make it coincide with MS' number.
18658 (Operator::CheckBinaryOperator): Ditto.
18660 * ../errors/errors.txt : Remove error numbers added earlier.
18662 * ../errors/cs1019.cs : Test case for error # 1019
18664 * ../errros/cs1020.cs : Test case for error # 1020
18666 * cs-parser.jay : Clean out commented cruft.
18667 (dimension_separators, dimension_separator): Comment out. Ostensibly not
18668 used anywhere - non-reducing rule.
18669 (namespace_declarations): Non-reducing rule - comment out.
18671 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
18672 with TypeContainer::AddEnum.
18674 * delegate.cs : New file for delegate handling classes.
18675 (Delegate): Class for declaring delegates.
18677 * makefile : Update.
18679 * cs-parser.jay (delegate_declaration): Implement.
18681 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
18683 * class.cs (Event::Define): Implement.
18684 (Event.EventBuilder): New member.
18686 * class.cs (TypeContainer::Populate): Update to define all enums and events
18688 (Events): New property for the events arraylist we hold. Shouldn't we move to using
18689 readonly fields for all these cases ?
18691 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18693 * class.cs (Property): Revamp to use the convention of making fields readonly.
18694 Accordingly modify code elsewhere.
18696 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
18697 the Define method of the Property class.
18699 * class.cs : Clean up applied patch and update references to variables etc. Fix
18701 (TypeContainer::Populate): Update to define all the properties we have. Also
18702 define all enumerations.
18704 * enum.cs (Define): Implement.
18706 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18708 * cs-parser.jay (overloadable_operator): The semantic value is an
18709 enum of the Operator class.
18710 (operator_declarator): Implement actions.
18711 (operator_declaration): Implement.
18713 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
18714 validity of definitions.
18715 (Operator::CheckBinaryOperator): Static method to check for binary operators
18716 (TypeContainer::AddOperator): New method to add an operator to a type.
18718 * cs-parser.jay (indexer_declaration): Added line to actually call the
18719 AddIndexer method so it gets added ;-)
18721 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
18722 already taken care of by the MS compiler ?
18724 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18726 * class.cs (Operator): New class for operator declarations.
18727 (Operator::OpType): Enum for the various operators.
18729 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18731 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
18732 ostensibly handle this in semantic analysis.
18734 * cs-parser.jay (general_catch_clause): Comment out
18735 (specific_catch_clauses, specific_catch_clause): Ditto.
18736 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
18737 (catch_args, opt_catch_args): New productions.
18738 (catch_clause): Rewrite to use the new productions above
18739 (catch_clauses): Modify accordingly.
18740 (opt_catch_clauses): New production to use in try_statement
18741 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
18742 and re-write the code in the actions to extract the specific and
18743 general catch clauses by being a little smart ;-)
18745 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
18746 Hooray, try and catch statements parse fine !
18748 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18750 * statement.cs (Block::GetVariableType): Fix logic to extract the type
18751 string from the hashtable of variables.
18753 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
18754 I end up making that mistake ;-)
18755 (catch_clauses): Fixed gross error which made Key and Value of the
18756 DictionaryEntry the same : $1 !!
18758 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18760 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
18762 * cs-parser.jay (event_declaration): Correct to remove the semicolon
18763 when the add and remove accessors are specified.
18765 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18767 * cs-parser.jay (IndexerDeclaration): New helper class to hold
18768 information about indexer_declarator.
18769 (indexer_declarator): Implement actions.
18770 (parsing_indexer): New local boolean used to keep track of whether
18771 we are parsing indexers or properties. This is necessary because
18772 implicit_parameters come into picture even for the get accessor in the
18773 case of an indexer.
18774 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
18776 * class.cs (Indexer): New class for indexer declarations.
18777 (TypeContainer::AddIndexer): New method to add an indexer to a type.
18778 (TypeContainer::indexers): New member to hold list of indexers for the
18781 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18783 * cs-parser.jay (add_accessor_declaration): Implement action.
18784 (remove_accessor_declaration): Implement action.
18785 (event_accessors_declaration): Implement
18786 (variable_declarators): swap statements for first rule - trivial.
18788 * class.cs (Event): New class to hold information about event
18790 (TypeContainer::AddEvent): New method to add an event to a type
18791 (TypeContainer::events): New member to hold list of events.
18793 * cs-parser.jay (event_declaration): Implement actions.
18795 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18797 * cs-parser.jay (dim_separators): Implement. Make it a string
18798 concatenating all the commas together, just as they appear.
18799 (opt_dim_separators): Modify accordingly
18800 (rank_specifiers): Update accordingly. Basically do the same
18801 thing - instead, collect the brackets here.
18802 (opt_rank_sepcifiers): Modify accordingly.
18803 (array_type): Modify to actually return the complete type string
18804 instead of ignoring the rank_specifiers.
18805 (expression_list): Implement to collect the expressions
18806 (variable_initializer): Implement. We make it a list of expressions
18807 essentially so that we can handle the array_initializer case neatly too.
18808 (variable_initializer_list): Implement.
18809 (array_initializer): Make it a list of variable_initializers
18810 (opt_array_initializer): Modify accordingly.
18812 * expression.cs (New::NType): Add enumeration to help us
18813 keep track of whether we have an object/delegate creation
18814 or an array creation.
18815 (New:NewType, New::Rank, New::Indices, New::Initializers): New
18816 members to hold data about array creation.
18817 (New:New): Modify to update NewType
18818 (New:New): New Overloaded contructor for the array creation
18821 * cs-parser.jay (array_creation_expression): Implement to call
18822 the overloaded New constructor.
18824 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
18826 * class.cs (TypeContainer::Constructors): Return member
18827 constructors instead of returning null.
18829 2001-08-26 Miguel de Icaza <miguel@ximian.com>
18831 * typemanager.cs (InitCoreTypes): Initialize the various core
18832 types after we have populated the type manager with the user
18833 defined types (this distinction will be important later while
18834 compiling corlib.dll)
18836 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
18837 on Expression Classification. Now all expressions have a method
18838 `Resolve' and a method `Emit'.
18840 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
18841 generation from working. Also add some temporary debugging
18844 2001-08-24 Miguel de Icaza <miguel@ximian.com>
18846 * codegen.cs: Lots of code generation pieces. This is only the
18847 beginning, will continue tomorrow with more touches of polish. We
18848 handle the fundamentals of if, while, do, for, return. Others are
18849 trickier and I need to start working on invocations soon.
18851 * gen-treedump.cs: Bug fix, use s.Increment here instead of
18854 * codegen.cs (EmitContext): New struct, used during code
18855 emission to keep a context. Most of the code generation will be
18858 * cs-parser.jay: Add embedded blocks to the list of statements of
18859 this block. So code generation proceeds in a top down fashion.
18861 2001-08-23 Miguel de Icaza <miguel@ximian.com>
18863 * statement.cs: Add support for multiple child blocks.
18865 2001-08-22 Miguel de Icaza <miguel@ximian.com>
18867 * codegen.cs (EmitCode): New function, will emit the code for a
18868 Block of code given a TypeContainer and its ILGenerator.
18870 * statement.cs (Block): Standard public readonly optimization.
18871 (Block::Block constructors): Link children.
18872 (Block::Child): Child Linker.
18873 (Block::EmitVariables): Emits IL variable declarations.
18875 * class.cs: Drop support for MethodGroups here, delay until
18877 (Method::): Applied the same simplification that I did before, and
18878 move from Properties to public readonly fields.
18879 (Method::ParameterTypes): Returns the parameter types for the
18880 function, and implements a cache that will be useful later when I
18881 do error checking and the semantic analysis on the methods is
18883 (Constructor::GetCallingConvention): Renamed from CallingConvetion
18884 and made a method, optional argument tells whether this is a class
18885 or a structure to apply the `has-this' bit.
18886 (Method::GetCallingConvention): Implement, returns the calling
18888 (Method::Define): Defines the type, a second pass is performed
18889 later to populate the methods.
18891 (Constructor::ParameterTypes): implement a cache similar to the
18892 one on Method::ParameterTypes, useful later when we do semantic
18895 (TypeContainer::EmitMethod): New method. Emits methods.
18897 * expression.cs: Removed MethodGroup class from here.
18899 * parameter.cs (Parameters::GetCallingConvention): new method.
18901 2001-08-21 Miguel de Icaza <miguel@ximian.com>
18903 * class.cs (TypeContainer::Populate): Drop RootContext from the
18906 (Constructor::CallingConvention): Returns the calling convention.
18907 (Constructor::ParameterTypes): Returns the constructor parameter
18910 (TypeContainer::AddConstructor): Keep track of default constructor
18911 and the default static constructor.
18913 (Constructor::) Another class that starts using `public readonly'
18914 instead of properties.
18916 (Constructor::IsDefault): Whether this is a default constructor.
18918 (Field::) use readonly public fields instead of properties also.
18920 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
18921 track of static constructors; If none is used, turn on
18922 BeforeFieldInit in the TypeAttributes.
18924 * cs-parser.jay (opt_argument_list): now the return can be null
18925 for the cases where there are no arguments.
18927 (constructor_declarator): If there is no implicit `base' or
18928 `this', then invoke the default parent constructor.
18930 * modifiers.cs (MethodAttr): New static function maps a set of
18931 modifiers flags into a MethodAttributes enum
18932 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
18933 MethodAttr, TypeAttr to represent the various mappings where the
18934 modifiers are used.
18935 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
18937 2001-08-19 Miguel de Icaza <miguel@ximian.com>
18939 * parameter.cs (GetParameterInfo): Fix bug where there would be no
18942 * interface.cs (PopulateIndexer): Implemented the code generator
18943 for interface indexers.
18945 2001-08-17 Miguel de Icaza <miguel@ximian.com>
18947 * interface.cs (InterfaceMemberBase): Now we track the new status
18950 (PopulateProperty): Implement property population. Woohoo! Got
18951 Methods and Properties going today.
18953 Removed all the properties for interfaces, and replaced them with
18954 `public readonly' fields.
18956 2001-08-16 Miguel de Icaza <miguel@ximian.com>
18958 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
18959 initialize their hashtables/arraylists only when they are needed
18960 instead of doing this always.
18962 * parameter.cs: Handle refs and out parameters.
18964 * cs-parser.jay: Use an ArrayList to construct the arguments
18965 instead of the ParameterCollection, and then cast that to a
18968 * parameter.cs: Drop the use of ParameterCollection and use
18969 instead arrays of Parameters.
18971 (GetParameterInfo): Use the Type, not the Name when resolving
18974 2001-08-13 Miguel de Icaza <miguel@ximian.com>
18976 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
18977 and instead use public readonly fields.
18979 * class.cs: Put back walking code for type containers.
18981 2001-08-11 Miguel de Icaza <miguel@ximian.com>
18983 * class.cs (MakeConstant): Code to define constants.
18985 * rootcontext.cs (LookupType): New function. Used to locate types
18988 2001-08-08 Miguel de Icaza <miguel@ximian.com>
18990 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
18991 this System.Reflection code is. Kudos to Microsoft
18993 * typemanager.cs: Implement a type cache and avoid loading all
18994 types at boot time. Wrap in LookupType the internals. This made
18995 the compiler so much faster. Wow. I rule!
18997 * driver.cs: Make sure we always load mscorlib first (for
18998 debugging purposes, nothing really important).
19000 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
19001 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
19003 * rootcontext.cs: Lookup types on their namespace; Lookup types
19004 on namespaces that have been imported using the `using' keyword.
19006 * class.cs (TypeContainer::TypeAttr): Virtualize.
19007 (Class::TypeAttr): Return attributes suitable for this bad boy.
19008 (Struct::TypeAttr): ditto.
19009 Handle nested classes.
19010 (TypeContainer::) Remove all the type visiting code, it is now
19011 replaced with the rootcontext.cs code
19013 * rootcontext.cs (GetClassBases): Added support for structs.
19015 2001-08-06 Miguel de Icaza <miguel@ximian.com>
19017 * interface.cs, statement.cs, class.cs, parameter.cs,
19018 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
19019 Drop use of TypeRefs, and use strings instead.
19021 2001-08-04 Miguel de Icaza <miguel@ximian.com>
19025 * class.cs (Struct::Struct): set the SEALED flags after
19026 checking the modifiers.
19027 (TypeContainer::TypeAttr): new property, returns the
19028 TypeAttributes for a class.
19030 * cs-parser.jay (type_list): Oops, list production was creating a
19031 new list of base types.
19033 * rootcontext.cs (StdLib): New property.
19034 (GetInterfaceTypeByName): returns an interface by type name, and
19035 encapsulates error handling here.
19036 (GetInterfaces): simplified.
19037 (ResolveTree): Encapsulated all the tree resolution here.
19038 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
19041 * driver.cs: Add support for --nostdlib, to avoid loading the
19042 default assemblies.
19043 (Main): Do not put tree resolution here.
19045 * rootcontext.cs: Beginning of the class resolution.
19047 2001-08-03 Miguel de Icaza <miguel@ximian.com>
19049 * rootcontext.cs: Provide better error reporting.
19051 * cs-parser.jay (interface_base): set our $$ to be interfaces.
19053 * rootcontext.cs (CreateInterface): Handle the case where there
19054 are no parent interfaces.
19056 (CloseTypes): Routine to flush types at the end.
19057 (CreateInterface): Track types.
19058 (GetInterfaces): Returns an array of Types from the list of
19059 defined interfaces.
19061 * typemanager.c (AddUserType): Mechanism to track user types (puts
19062 the type on the global type hash, and allows us to close it at the
19065 2001-08-02 Miguel de Icaza <miguel@ximian.com>
19067 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
19068 RecordInterface instead.
19070 * cs-parser.jay: Updated to reflect changes above.
19072 * decl.cs (Definition): Keep track of the TypeBuilder type that
19073 represents this type here. Not sure we will use it in the long
19074 run, but wont hurt for now.
19076 * driver.cs: Smaller changes to accomodate the new code.
19078 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
19081 * rootcontext.cs (CreateInterface): New method, used to create
19082 the System.TypeBuilder type for interfaces.
19083 (ResolveInterfaces): new entry point to resolve the interface
19085 (CodeGen): Property, used to keep track of the code generator.
19087 2001-07-26 Miguel de Icaza <miguel@ximian.com>
19089 * cs-parser.jay: Add a second production for delegate_declaration
19092 (enum_body): Put an opt_comma here instead of putting it on
19093 enum_body or enum_member_declarations so we can handle trailing
19094 commas on enumeration members. Gets rid of a shift/reduce.
19096 (type_list): Need a COMMA in the middle.
19098 (indexer_declaration): Tell tokenizer to recognize get/set
19100 * Remove old targets.
19102 * Re-add the parser target.
19104 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19106 * cs-parser.jay: Add precendence rules for a number of operators
19107 ot reduce the number of shift/reduce conflicts in the grammar.
19109 2001-07-17 Miguel de Icaza <miguel@ximian.com>
19111 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
19114 Get rid of old crufty code.
19116 * rootcontext.cs: Use this to keep track of the parsed
19117 representation and the defined types available to the program.
19119 * gen-treedump.cs: adjust for new convention.
19121 * type.cs: Split out the type manager, and the assembly builder
19124 * typemanager.cs: the type manager will live here now.
19126 * cil-codegen.cs: And the code generator here.
19128 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19130 * makefile: Fixed up for easy making.
19132 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19134 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19137 (unary_expression): Expand pre_increment_expression and
19138 post_decrement_expression to reduce a shift/reduce.
19140 2001-07-11 Simon Cozens
19142 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19144 Improve allow_keyword_as_indent name.
19146 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19148 * Adjustments for Beta2.
19150 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19152 * decl.cs: Added `Define' abstract method.
19153 (InTransit): new property, used to catch recursive definitions.
19155 * interface.cs: Implement `Define'.
19157 * modifiers.cs: Map Modifiers.constants to
19158 System.Reflection.TypeAttribute flags.
19160 * class.cs: Keep track of types and user-defined types.
19161 (BuilderInit): New method for creating an assembly
19162 (ResolveType): New function to launch the resolution process, only
19163 used by interfaces for now.
19165 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19166 that are inserted into the name space.
19168 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19170 * ARGH. I have screwed up my tree so many times due to the use of
19171 rsync rather than using CVS. Going to fix this at once.
19173 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19176 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19178 * Experiment successful: Use System.Type rather that our own
19181 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19183 * cs-parser.jay: Removed nsAliases from here.
19185 Use new namespaces, handle `using XXX;'
19187 * namespace.cs: Reimplemented namespace handling, use a recursive
19188 definition of the class. Now we can keep track of using clauses
19189 and catch invalid using clauses.
19191 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19193 * gen-treedump.cs: Adapted for all the renaming.
19195 * expression.cs (Expression): this class now has a Type property
19196 which returns an expression Type.
19198 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19199 `Type', as this has a different meaning now in the base
19201 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19203 * interface.cs, class.cs: Removed from all the sources the
19204 references to signature computation, as we can not do method
19205 signature computation during the parsing time, as we are not
19206 trying to solve at that point distinguishing:
19210 void a (NS.Blah x) {}
19213 Which depending on the context might be valid or not, as we do not
19214 know if Blah is the same thing as NS.Blah at that point.
19216 * Redid everything so the code uses TypeRefs now instead of
19217 Types. TypeRefs are just temporary type placeholders, that need
19218 to be resolved. They initially have a pointer to a string and the
19219 current scope in which they are used. This is used later by the
19220 compiler to resolve the reference to an actual Type.
19222 * DeclSpace is no longer a CIR.Type, and neither are
19223 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19224 are all DeclSpaces, but no Types.
19226 * type.cs (TypeRefManager): This implements the TypeRef manager,
19227 which keeps track of all the types that need to be resolved after
19228 the parsing has finished.
19230 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19232 * ARGH. We are going to have to store `foreach' as a class rather
19233 than resolving it, as we need to verify error 1579 after name
19234 resolution. *OR* we could keep a flag that says `This request to
19235 IEnumerator comes from a foreach statement' which we can then use
19236 to generate the error.
19238 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19240 * class.cs (TypeContainer.AddMethod): we now add methods to the
19241 MethodGroup instead of the method hashtable.
19243 * expression.cs: Add MethodGroup abstraction, which gets us one
19244 step closer to the specification in the way we handle method
19247 * cs-parser.jay (primary_expression): qualified_identifier now
19248 tried to match up an identifier to a local variable reference or
19249 to a parameter reference.
19251 current_local_parameters is now a parser global variable that
19252 points to the current parameters for the block, used during name
19255 (property_declaration): Now creates an implicit `value' argument to
19258 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19260 * parameter.cs: Do not use `param' arguments as part of the
19261 signature, per the spec.
19263 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19265 * decl.cs: Base class for classes, structs and interfaces. This
19266 is the "Declaration Space"
19268 * cs-parser.jay: Use CheckDef for checking declaration errors
19269 instead of having one on each function.
19271 * class.cs: Factor out some code for handling error handling in
19272 accordance to the "Declarations" section in the "Basic Concepts"
19273 chapter in the ECMA C# spec.
19275 * interface.cs: Make all interface member classes derive from
19276 InterfaceMemberBase.
19278 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19280 * Many things: all interfaces are parsed and generated in
19281 gen-treedump. Support for member variables, constructors,
19282 destructors, properties, constants is there.
19284 Beginning of the IL backend, but very little done, just there for
19287 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19289 * cs-parser.jay: Fix labeled statement.
19291 * cs-tokenizer.cs (escape): Escape " and ' always.
19292 ref_line, ref_name: keep track of the line/filename as instructed
19293 by #line by the compiler.
19296 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19298 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19299 to match the values in System.CodeDOM.
19301 Divid renamed to Divide.
19303 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19305 (Statements.set): remove.
19307 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19310 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19311 falseStatements always have valid values.
19313 * cs-parser.jay: Use System.CodeDOM now.