1 2004-12-08 Martin Baulig <martin@ximian.com>
3 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Make
6 * class.cs (MethodCore.MayUnify): Use
7 TypeManager.MayBecomeEqualGenericTypes().
9 2004-12-08 Martin Baulig <martin@ximian.com>
11 * expression.cs (Is.DoResolve, As.DoResolve): If we're a type
12 parameter, box it. Fixes #69233.
14 2004-12-08 Martin Baulig <martin@ximian.com>
16 * generic.cs (ConstructedType.CheckConstraints): Valuetypes always
17 have the ctor constraint. Fixes #68326.
19 2004-12-07 Atsushi Enomoto <atsushi@ximian.com>
21 * cs-parser.jay : interface comment was not consumed because of
22 extra opt_semicolon before doc handling.
24 2004-12-03 Raja R Harinath <rharinath@novell.com>
26 Fix test-327.cs, test-328.cs, and put in early infrastructure
27 for eventually fixing #52697.
28 * namespace.cs (NamespaceEntry.LookupForUsing): New method.
29 (NamespaceEntry.LookupNamespaceOrType): New method, refactored
31 (NamespaceEntry.Lookup): Remove 'ignore_using' flag.
32 (AliasEntry.Resolve, UsingEntry.Resolve): Use 'LookupForUsing'.
33 (VerifyUsing, error246): Update.
34 * rootcontext.cs (RootContext.NamespaceLookup): Just use
35 'NamespaceEntry.LookupNamespaceOrType'.
37 2004-12-07 Martin Baulig <martin@ximian.com>
39 * driver.cs: Call it "BETA SOFTWARE" :-)
41 2004-12-06 Raja R Harinath <rharinath@novell.com>
43 Fix crash on cs0657-17.cs.
44 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
45 Use RootContext.Tree.Types, not 'new RootTypes ()'.
46 * attribute.cs (GlobalAttribute.CheckAttributeType): Narrow down
47 the case where the NamespaceEntry gets overwritten.
49 2004-12-06 Marek Safar <marek.safar@seznam.cz>
52 * ecore.cs (ResolveBoolean): Tiny refactoring.
54 * expression.cs (Binary.DoResolve): Add warning 429 and skipping
55 of right expression resolving when left is false constant and
56 operator is LogicalAnd OR true constant and operator is LogicalOr.
58 * statement.cs (ResolveUnreachable): Always reports warning.
60 2004-12-05 Miguel de Icaza <miguel@ximian.com>
62 * class.cs: Distinguish between 1721 and 1722 (just a little help
65 2004-12-03 Miguel de Icaza <miguel@ximian.com>
67 * delegate.cs: Only allow this on new versions of the language.
69 2004-12-02 Duncan Mak <duncan@ximian.com>
71 * ecore.cs (PropertyExpr.IsAccessorAccessible): Moved to
73 (Expression.IsAccessorAccessible): Moved from the PropertyExpr to
74 here as a static method. Take an additional bool out parameter
75 `must_do_cs1540_check' for signaling to InstanceResolve.
76 (PropertyExpr.InstanceResolve): Removed the `must_do_cs1540_check'
77 member field from PropertyExpr class and made it an argument of
79 (EventExpr.InstanceResolve): Copied from PropertyExpr, removed the
80 check for MarshalByRefObject, and report CS0122 instead of CS1540.
81 (EventExpr.DoResolve): Call IsAccessorAccessible on `add_accessor'
82 and `remove_accessor' as well as InstanceResolve: report CS0122
87 2004-12-07 Martin Baulig <martin@ximian.com>
89 * decl.cs (DeclSpace.AddToContainer): Report correct errors CS0694
90 and CS0692 where appropriate.
92 2004-12-06 Martin Baulig <martin@ximian.com>
94 * class.cs (MethodCore.MayUnify): Moved the CS0408 check here from
95 IsDuplicateImplementation() and improved it.
97 * expression.cs (Invocation.InferTypeArguments): Added
98 `Type[] inferred_class_types' argument (for MethodCore.MayUnify)
99 and removed the "ref" modifier from `infered_types'.
101 * decl.cs (MemberName.ToString): Removed the exception.
103 2004-12-03 Atsushi Enomoto <atsushi@ximian.com>
105 * cs-tokenizer.cs : Only '////' is rejected. Other non-whitespace
106 comments are allowed.
108 2004-12-03 Carlos Alberto Cortez <calberto.cortez@gmail.com>
110 * delegate.cs: Add checks for subtypes in paramaters and return values
111 in VerifyMethod () to add support for Covariance/Contravariance
114 2004-12-02 Miguel de Icaza <miguel@ximian.com>
116 * report.cs: Remove extra closing parenthesis.
118 * convert.cs (Error_CannotImplicitConversion): If the name of the
119 types are the same, provide some extra information.
121 2004-12-02 Marek Safar <marek.safar@seznam.cz>
124 * attribute.cs (Resolve): Improved implementation of params
127 * support.cs (ParameterData): Add HasParams to be faster.
129 2004-12-02 Atsushi Enomoto <atsushi@ximian.com>
131 all things are for /doc support:
133 * doc.cs: new file that supports XML documentation generation.
134 * mcs.exe.sources: added doc.cs.
136 Handle /doc command line option.
137 Report error 2006 instead of 5 for missing file name for /doc.
138 Generate XML documentation when required, after type resolution.
140 Added support for picking up documentation (/// and /** ... */),
141 including a new XmlCommentState enumeration.
143 Added lines to fill Documentation element for field, constant,
144 property, indexer, method, constructor, destructor, operator, event
145 and class, struct, interface, delegate, enum.
146 Added lines to warn incorrect comment.
148 Added Documentation field (passed only when /doc was specified).
150 Added DocComment, DocCommentHeader, GenerateDocComment() and
151 OnGenerateDocComment() and some supporting private members for
152 /doc feature to MemberCore.
154 Added GenerateDocComment() on TypeContainer, MethodCore and Operator.
156 Added overriden DocCommentHeader.
158 Added overriden DocCommentHeader and GenerateDocComment().
160 2004-12-01 Miguel de Icaza <miguel@ximian.com>
162 * cfold.cs (ConstantFold.DoConstantNumericPromotions): After
163 unwrapping the enumeration values, chain to
164 DoConstantNumericPromotions again, so we can promote things to the
165 fundamental types (takes care of enums that are bytes, sbytes).
169 2004-12-01 Raja R Harinath <rharinath@novell.com>
171 * attribute.cs (Attribute.CheckAttributeType): Remove complain flag.
172 Fix long-standing bug in type-lookup. Use FindType instead of
173 LookupType when ec.ResolvingTypeTree.
174 (Attribute.ResolveType, Attribute.Resolve)
175 (Attribute.DefinePInvokeMethod,GlobalAttribute.CheckAttributeType):
177 (Attributes.Search): Remove internal version. Update.
178 (Attributes.SearchMulti): Update.
179 (Attributes.GetClsCompliantAttribute): Remove.
180 (Attributes.GetIndexerNameAttribute): Remove.
181 * decl.cs (MemberCore.GetClsCompliantAttributeValue): Update to changes.
182 (DeclSpace.GetClsCompliantAttributeValue): Likewise.
183 * class.cs (Indexer.Define): Likewise.
185 2004-12-01 Marek Safar <marek.safar@seznam.cz>
188 * ecore.cs: CheckMarshallByRefAccess new virtual method for testing
189 MarshallByReference members access.
191 * expression.cs: Use CheckMarshallByRefAccess;
192 Better error CS0197 message.
194 * report.cs: Print whole related error message.
196 2004-11-29 Marek Safar <marek.safar@seznam.cz>
198 * class (GetClassBases): Better error 60 report.
199 (EventProperty): Disabled warning 67 detection.
201 2004-11-29 Marek Safar <marek.safar@seznam.cz>
204 * cfold.cs (Assign.DoResolve): Add subtraction for DecimalConstant.
206 * constant.cs (DecimalConstant.Emit): Don't use int ctor for
209 2004-11-29 Marek Safar <marek.safar@seznam.cz>
212 * assign.cs (Assign.DoResolve): Add error 1648, 1650 report.
214 * decl.cs (MemberCore.MemberName): Error 1648 in compiler.
216 2004-11-26 Miguel de Icaza <miguel@ximian.com>
218 * attribute.cs (Attribute.Resolve): Refine error reporting and
219 report a cs0117 if the identifier does not exist, to distinguish
220 from 0617 which is a miss-use of the actual identifier.
222 * ecore.cs (EventExpr.Emit): Refine error report and distinguish
223 between cs0070 and cs0079.
225 * class.cs (MemberBase.DoDefine): When reporting a wrong
226 accessibility level, we use MethodCore to compare instead of
227 Method (this was a regression in some refactoring effort).
229 So now we correctly report cs0056 again.
231 * convert.cs (ImplicitReferenceConversion): Corrected typo, I was
232 testing the target_type (which was known to be object_type) and
233 not the source type (which is anonymous_method).
235 Fixed reporting of error cs1660.
237 * expression.cs (UserCast.Source): Expose the underlying cast.
239 * statement.cs (Switch.SwitchGoverningType): Sort the list of
240 allowed types to find a match to int32 first (most common).
242 In addition, it ignores any ImplicitUserConversions that did an
243 internal implicit conversion (as the switch statement allows only
244 one integral conversion to exist).
246 * class.cs (PartialContainer.Create): rename `name' to
247 `member_name' for clarity. Then replace the string calls with a
248 call to MemberName.GetPartialName, as now using
249 MemberName.ToString is an error (this is due to the side effects
250 it had, that were fixed in the past).
252 This will restore the error reporting on a number of partial class
253 errors that were missusing this (and getting an exception as a
254 results, which is now just a plain textual warning, because
255 yyparse debug output would crash otherwise).
257 2004-11-26 Raja R Harinath <rharinath@novell.com>
259 * Makefile (PROGRAM_INSTALL_DIR): Remove.
261 2004-11-25 Ben Maurer <bmaurer@ximian.com>
263 * rootcontext.cs (LookupType): Make sure to cache lookups that
264 don't give us a negative result. This saves about 5% of corlib
267 2004-11-25 Miguel de Icaza <miguel@ximian.com>
269 * report.cs (AbstractMessage.Print): messages are sent to stderr
271 * class.cs (TypeContainer.GetClassBases): It is an error to have a
272 non-interface in the list of interfaces (at this point, either
273 parent was properly set, or a base class is being listed in the
276 This flags error 1722, and resolves the crash from bug 69259.
278 2004-11-25 Ben Maurer <bmaurer@ximian.com>
280 * statement.cs (Using.EmitExpressionFinally): make this work right
281 for valuetypes. Fixes 69926.
283 2004-11-25 Miguel de Icaza <miguel@ximian.com>
285 * const.cs (Const.ChangeType): Cope with the "0 literal can be
286 converted to an enum" here, before we try to change the underlying
287 type. This code exists, but it is a different code path than the
288 one used while encoding constants.
290 (ImplicitReferenceConversionExists): In addition, resynchronized
291 the code here, so it matches the same code in
292 ImplicitReferenceConversionExists for the `from any class-type S
293 to any interface-type T'.
295 2004-11-25 Marek Safar <marek.safar@seznam.cz>
297 * cfold.cs (BinaryFold): Add addition for DecimalConstant.
299 2004-11-24 Miguel de Icaza <miguel@ximian.com>
301 * cs-parser.jay: Use verbosity accordingly.
303 2004-11-24 Marek Safar <marek.safar@seznam.cz>
305 * expression.cs (Unary.ResolveOperator): Do not report warning;
306 AddressOf reads from variable.
308 (LocalVariableReferences.DoResolveBase): Improved my previous fix.
310 2004-11-24 Marek Safar <marek.safar@seznam.cz>
314 * attribute.cs (Attributable): Removed CheckTargets.
315 (Attributes.Emit): Explicit attribute targets are tested here.
317 * class.cs (EventField.ValidAttributeTargets): Explicit target "field" is
318 not enabled for interfaces.
320 * codegen.cs (CommonAssemblyModulClass.AddAttributes): Removed CheckTargets.
321 (GetAssemblyName): Ouch next bug there.
323 2004-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
325 * expression.cs: Error 275 added.
327 2004-11-23 Marek Safar <marek.safar@seznam.cz>
329 Fix bug #69177 (Implemented decimal constant support)
331 * cfold.cs (DoConstantNumericPromotions: Add DecimalConstant.
332 (BinaryFold): Add DecimalConstant.
334 * const.cs (Define): Decimal constant
336 (ChangeType): Add decimal type handling.
337 (LookupConstantValue): Don't set value for decimal type but
338 emit DecimalConstantAttribute. Needed for constant optimization.
340 * constant.cs (ToDecimal): New method.
341 (ConvertToDecimal): New method.
342 (IntConstant): Implemented ConvertToDecimal.
343 (DecimalConstant.Emit): Emit optimized version for decimals in
346 * expression.cs (ResolveOperator): Changed order of constant
347 reduction to work correctly with native types which have
348 overloaded operators.
349 (ResolveMemberAccess): Extract constant value from attribute
352 * rootcontext.cs (ResolveCore): Add DecimalConstantAttribute.
354 * typemanager.cs (TypeManager): Add decimal_constant_attribute_type,
355 void_decimal_ctor_int_arg, decimal_constant_attribute_ctor.
356 (ChangeType): Decimal is special.
357 (TypeToCoreType): Add decimal type.
359 2004-11-22 Marek Safar <marek.safar@seznam.cz>
361 * convert.cs (ImplicitConversionRequired): Add error cs0642 for
364 2004-11-22 Marek Safar <marek.safar@seznam.cz>
366 * class.cs (EventField.ApplyAttributeBuilder): Fix error
369 2004-11-19 Marek Safar <marek.safar@seznam.cz>
371 * class.cs (MemberBase.DoDefine): Fix error cs0508 report.
373 * pending.cs (PendingImplementation): Grab only interfaces.
375 2004-11-19 Marek Safar <marek.safar@seznam.cz>
377 * statement.cs (ForeachHelperMethods): Add location member and
380 2004-11-18 Marek Safar <marek.safar@seznam.cz>
382 * expression.cs (DoResolveBase): Fixed wrong warning for out
385 2004-12-04 Martin Baulig <martin@ximian.com>
387 * convert.cs (Convert.TypeParameter_to_Null): Use the constraints
388 to check whether the conversion is ok.
390 * typemanager.cs (TypeManager.GetTypeArguments): Just return
391 `Type.EmptyTypes' if we're not a generic TypeContainer.
393 2004-11-25 Miguel de Icaza <miguel@ximian.com>
395 * convert.cs (ImplicitReferenceConversionExists): A surprisingly
396 old bug: when converting from the null literal to a pointer,
397 return an EmptyCast, not the NullLiteral.
399 This fixes #69921, the recent null_type changes probably made this
402 2004-12-03 Martin Baulig <martin@ximian.com>
404 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
405 method as our child, call AnonymousMethod.Compatible() on it.
407 2004-12-02 Miguel de Icaza <miguel@ximian.com>
409 * class.cs (FieldBase): Use an unused bit field from the field to
410 encode the `has_offset' property from the FieldMember. This saves
411 a couple of Ks on bootstrap compilation.
413 * delegate.cs (NewDelegate.DoResolve): If we have an anonymous
414 method as our child, return the AnonymousMethod resolved
417 * expression.cs (New.DoResolve): Allow return values from
418 NewDelegate to also include AnonymousMethods.
422 2004-11-29 Raja R Harinath <rharinath@novell.com>
424 * decl.cs (MemberCore.MemberName): Remove readonly to fix an error
426 * rootcontext.cs (ResolveCore::interfaces_first_stage): Add
427 System.Runtime.InteropServices._Exception, since it's a base
428 interface of the core type System.Exception in the net_2_0 profile.
430 2004-11-27 Martin Baulig <martin@ximian.com>
432 * ecore.cs (Expression.StoreFromPtr): Use `stobj' for generic parameters.
434 2004-11-26 Raja R Harinath <rharinath@novell.com>
436 * Makefile: Convert to use executable.make.
437 * gmcs.exe.sources: New.
439 2004-11-25 Martin Baulig <martin@ximian.com>
441 * expression.cs (Invocation.InferType): Added support for byref types.
443 2004-11-25 Martin Baulig <martin@ximian.com>
445 * statement.cs (Foreach.FetchMethodMoveNext): Wrap `mi.ReturnType'
446 in TypeManager.TypeToCoreType().
448 2004-11-25 Martin Baulig <martin@ximian.com>
450 * iterators.cs (Iterator.DoDefineMembers): Override and lookup the
451 "Dispose" method from the `current_type'.
452 (Iterator.EmitMoveNext): Use the `dispose_method' we looked up in
453 DoDefineMembers() instead of using the MethodBuilder; this is
454 required for generic iterators.
456 * class.cs (TypeContainer.DoDefineMembers): Make this virtual.
458 2004-11-24 Martin Baulig <martin@ximian.com>
460 * ecore.cs (Expression.LoadFromPtr): Use `ldobj' for generic parameters.
462 2004-11-20 Martin Baulig <martin@ximian.com>
464 * expression.cs (Invocation.InferType): Correctly infer generic
465 instances; see gen-103.cs.
466 (Invocation.InferTypeArguments): If a generic method doesn't have
467 any unbound type parameters, we don't need to infer anything.
469 2004-11-19 Raja R Harinath <rharinath@novell.com>
471 * Makefile (gmcs.exe): Update to new location of bootstrap mcs.exe.
473 2004-11-17 Raja R Harinath <rharinath@novell.com>
475 * typemanager.cs (TypeHandle.GetTypeHandle): Make private.
476 (TypeHandle.GetMemberCache): New.
477 (TypeHandle.TypeHandle): Update.
478 (TypeManager.LookupMemberCache): Rewritten from LookupMemberContainer.
479 (TypeManager.LookupParentInterfacesCache):
480 Rename from LookupInterfaceCache. Optimize slightly.
481 (TypeManager.MemberLookup_FindMembers): Update.
482 * decl.cs (MemberCache.MemberCache): Set Container to null in the
484 (AddCacheContents): Rename from AddHashtable.
485 * class.cs (TypeContainer.parent_container): Remove.
486 (TypeContainer.VerifyClsCompliance): Don't use parent_container.
487 (TypeContainer.DoDefineMembers): Don't initialize it.
488 Update to name changes.
490 2004-11-17 Miguel de Icaza <miguel@ximian.com>
492 * class.cs (MethodCore.CheckAccessModifiers): New helper routine
493 that factors the code to check access modifiers on override.
495 (PropertyBase): Use the code here.
497 Patch from Lluis S'anchez, fixes bug #69361.
499 2004-11-15 Miguel de Icaza <miguel@ximian.com>
501 * anonymous.cs (AnonymousMethod.Error_AddressOfCapturedVar): New
502 routine that is used to report the use of a captured variable
503 whose address has been taken.
505 There are two checks: one when variables are being captured and
506 the other check is when the address of a variable is taken.
508 (because an anonymous methods might be resolved before *or* after
509 the address has been taken) and
511 * expression.cs (Conditional.DoResolve): Remove the special
512 casing that Martin added to trueExpr and falseExpr being both
513 NullLiteral. We get the right behavior now just by introducing
514 the null_type into the compiler.
516 * convert.cs (ExplicitConversion): Change the code to use
517 null_type instead of testing `expr is NullLiteral'.
518 (ImplicitConversionStandard): use null_type too.
519 (ImplicitReferenceConversionExists): use null_type too.
520 (ImplicitReferenceConversion): use null_type too.
522 * literal.cs: The type of `NullLiteral' is now null_type instead
524 (Resolve): Set the type here.
526 * typemanager.cs: Introduce null_type.
528 2004-11-18 Martin Baulig <martin@ximian.com>
531 (RootContext.LookupType): Return a `Type', not a `TypeExpr'.
533 2004-11-18 Martin Baulig <martin@ximian.com>
535 * ecore.cs (TypeExpr.DoResolveAsTypeStep): Make this protected.
537 2004-11-18 Martin Baulig <martin@ximian.com>
539 * generic.cs (Constraints.Resolve): Take an `EmitContext' instead
540 of a `DeclSpace'. If one of our constraints is a `ConstructedType',
541 call ResolveConstructedType() on it to resolve it without checking
543 (Constraints.ResolveTypes): Check them here.
544 (ConstructedType.DoResolveAsTypeStep): Fully resolve ourselves,
545 but don't check constraints.
546 (ConstructedType.ResolveAsTypeTerminal): Override this and also
547 check constraints here.
548 (ConstructedType.ResolveConstructedType): New public method. This
549 is called from DoResolveAsTypeStep() and Constraints.Resolve() to
550 resolve ourselves without checking constraints.
552 * ecore.cs (Expression.ResolveAsTypeTerminal): Make this virtual.
554 2004-11-18 Martin Baulig <martin@ximian.com>
557 (DeclSpace.CurrentType): Changed type from `TypeExpr' to `Type'.
559 * delegate.cs (Delegate.DefineType): Always create the EmitContext.
561 2004-11-18 Martin Baulig <martin@ximian.com>
563 * ecore.cs (TypeExpr.ResolveType): Removed.
564 (Expression.ResolveAsTypeTerminal): We always return a fully
565 resolved `TypeExpr', so we can just access its `Type'.
567 * class.cs (TypeContainer.DefineType): Resolve `CurrentType' here.
569 2004-11-17 Martin Baulig <martin@ximian.com>
571 * ecore.cs (IAlias.Type): Replaced with ResolveAsType() to make
572 sure we don't return any unresolved TypeExpr's.
573 (TypeAliasExpression): The .ctor now takes an `IAlias' instead of
575 (Expression.ResolveAsTypeTerminal): Make sure `te.Type != null'.
577 * expression.cs (MemberAccess.ResolveAsTypeStep): Don't return any
578 unresolved `ConstructedType's.
580 2004-11-17 Martin Baulig <martin@ximian.com>
582 * ecore.cs (TypeExpr.ResolveType): Don't make this virtual.
584 2004-11-17 Martin Baulig <martin@ximian.com>
587 (Expression.ResolveAsTypeTerminal): Removed the `bool silent' argument.
589 * decl.cs (DeclSpace.ResolveType): Removed.
590 (DeclSpace.ResolveTypeExpr): Removed the `bool silent' argument.
592 2004-11-17 Martin Baulig <martin@ximian.com>
594 * decl.cs (MemberCache.AddHashtable): Add entries in the opposite
595 direction, like FindMembers() does. Fixes #69546, testcase is in
598 2004-11-16 Martin Baulig <martin@ximian.com>
600 This is based on a patch from Marek Safar, see bug #69082.
601 Fixes bugs #63705 and #67130.
603 * typemanager.cs (TypeManager.LookupInterfaceCache): New public
604 method; create a MemberCache for an interface type and cache the
607 * decl.cs (IMemberContainer.ParentContainer): Removed.
608 (IMemberContainer.ParentCache): New property.
609 (MemberCache.SetupCacheForInterface): Removed.
610 (MemberCache..ctor): Added .ctor which takes a `Type[]'; use this
611 to create a cache for an interface's "parent".
613 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
616 2004-11-14 Ben Maurer <bmaurer@ximian.com>
618 * statement.cs: Avoid adding bools to a hashtable.
620 2004-11-15 Martin Baulig <martin@ximian.com>
622 * decl.cs (MemberName.GetPartialName): Removed, use GetTypeName() instead.
624 2004-11-11 Martin Baulig <martin@ximian.com>
626 * typemanager.cs (TypeManager.GetMethodName): New method.
628 * class.cs (MethodData.Define): Include the generic arity in the
629 name of an explicit interface; also add it to the method name.
631 * pending.cs (PendingImplementation.InterfaceMethod): The method
632 name now includes the generic arity.
634 2004-11-07 Miguel de Icaza <miguel@ximian.com>
636 * expression.cs (Invocation.OverloadResolve): Flag error if we are
637 calling an unsafe method from a safe location.
639 2004-11-06 Marek Safar <marek.safar@seznam.cz>
642 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
644 2004-11-06 Miguel de Icaza <miguel@ximian.com>
646 * namespace.cs (VerifyUsing): use GetPartialName instead of
649 2004-11-05 Miguel de Icaza <miguel@ximian.com>
651 * statement.cs (Return.Resolve): Fix regression in typo: if
652 `in_exc', we have to request a NeedReturnLabel, this was a typo
653 introduced in the anonymous method check-in. Fixes #69131.
655 * Indexers were using the ShortName when defining themselves,
656 causing a regression in the compiler bootstrap when applying the
657 patch from 2004-11-02 (first part), now they use their full name
660 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
662 * driver.cs: Strip the path from the names of embedded resources. Fixes
665 2004-11-04 Raja R Harinath <rharinath@novell.com>
667 Fix error message regression: cs0104-2.cs.
668 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
669 (AliasEntry.Resolve): Update.
670 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
672 (RootContext.LookupType): Update.
674 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
676 * cs-parser.jay: Add support for handling accessor modifiers
677 * class: Add support port accessor modifiers and error checking,
678 define PropertyMethod.Define as virtual (not abstract anymore)
679 * ecore.cs: Add checking for proeprties access with access modifiers
680 * iterators.cs: Modify Accessor constructor call based in the modified
682 2004-11-02 Ben Maurer <bmaurer@ximian.com>
684 * expression.cs (StringConcat): Handle being called twice,
685 as when we have a concat in a field init with more than two
688 2004-11-02 Miguel de Icaza <miguel@ximian.com>
690 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
691 special case explicit implementations, we should always produce
692 the .property or .event declaration.
694 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
695 since it will not return correct data if people use this
696 unresolved in the presence of using statements (see test-313).
698 * class.cs (MethodData.Define): If we are an explicit interface
699 implementation, set the method name to the full name of the
700 interface plus the name of the method.
702 Notice that using the method.MethodName.GetFullName() does not
703 work, as it will only contain the name as declared on the source
704 file (it can be a shorthand in the presence of using statements)
705 and not the fully qualifed type name, for example:
709 class D : ICloneable {
710 object ICloneable.Clone () {
714 Would produce a method called `ICloneable.Clone' instead of
715 `System.ICloneable.Clone'.
717 * namespace.cs (Alias.Resolve): Use GetPartialName.
719 2004-11-01 Marek Safar <marek.safar@seznam.cz>
721 * cs-parser.jay: Add error 1055 report.
723 2004-11-01 Miguel de Icaza <miguel@ximian.com>
725 * assign.cs (Assign.DoResolve): Only do the transform of
726 assignment into a New if the types are compatible, if not, fall
727 through and let the implicit code deal with the errors and with
728 the necessary conversions.
730 2004-11-01 Marek Safar <marek.safar@seznam.cz>
732 * cs-parser.jay: Add error 1031 report.
734 * cs-tokenizer.cs: Add location for error 1038.
736 2004-10-31 Marek Safar <marek.safar@seznam.cz>
738 * cs-parser.jay: Add error 1016 report.
740 2004-10-31 Marek Safar <marek.safar@seznam.cz>
742 * cs-parser.jay: Add errors 1575,1611 report.
744 2004-10-31 Marek Safar <marek.safar@seznam.cz>
746 * cs-parser.jay: Add error 1001 report.
748 2004-10-31 Marek Safar <marek.safar@seznam.cz>
751 * attribute.cs (GetMarshal): Add method argument for
752 caller identification.
754 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
755 agument for GetMarshal and RuntimeMissingSupport.
757 2004-10-31 Marek Safar <marek.safar@seznam.cz>
759 * attribute.cs (ExtractSecurityPermissionSet): Removed
760 TypeManager.code_access_permission_type.
762 * typemanager.cs: Removed TypeManager.code_access_permission_type.
764 2004-10-27 Miguel de Icaza <miguel@ximian.com>
766 * expression.cs (LocalVariableReference.DoResolveLValue): Check
767 for obsolete use of a variable here. Fixes regression on errors
768 cs0619-25 and cs0619-26.
770 2004-10-27 Marek Safar <marek.safar@seznam.cz>
772 Fix #62358, implemented security attribute encoding.
774 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
775 Tests permitted SecurityAction for assembly or other types.
776 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
777 data from SecurityPermissionAttribute to PermisionSet class.
779 * class.cs (ApplyAttributeBuilder): Added special handling
780 for System.Security.Permissions.SecurityAttribute based types.
782 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
783 special handling for System.Security.Permissions.SecurityAttribute
786 * enum.cs (ApplyAttributeBuilder): Added special handling
787 for System.Security.Permissions.SecurityAttribute based types.
789 * parameter.cs (ApplyAttributeBuilder): Added special handling
790 for System.Security.Permissions.SecurityAttribute based types.
792 * rootcontext.cs: Next 2 core types.
794 * typemanager.cs (TypeManager.security_permission_attr_type):
795 Built in type for the SecurityPermission Attribute.
796 (code_access_permission_type): Build in type.
798 2004-10-17 Miguel de Icaza <miguel@ximian.com>
800 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
801 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
802 all of this information into
803 EmitContext.EmitCapturedVariableInstance.
805 * codegen.cs (EmitCapturedVariableInstance): move here the
806 funcionality of emitting an ldarg.0 in the presence of a
807 remapping. This centralizes the instance emit code.
809 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
810 then emit a load of this: it means that we have reached the
811 topmost ScopeInfo: the one that contains the pointer to the
812 instance of the class hosting the anonymous method.
814 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
815 captures to the topmost CaptureContext.
817 2004-10-12 Miguel de Icaza <miguel@ximian.com>
819 * expression.cs (LocalVariableReference): Move the knowledge about
820 the iterators into codegen's EmitCapturedVariableInstance.
822 2004-10-11 Miguel de Icaza <miguel@ximian.com>
824 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
825 all code paths return a value from an anonymous method (it is the
826 same as the 161 error, but for anonymous methods).
828 2004-10-08 Miguel de Icaza <miguel@ximian.com>
830 The introduction of anonymous methods in the compiler changed
831 various ways of doing things in the compiler. The most
832 significant one is the hard split between the resolution phase
833 and the emission phases of the compiler.
835 For instance, routines that referenced local variables no
836 longer can safely create temporary variables during the
837 resolution phase: they must do so from the emission phase,
838 since the variable might have been "captured", hence access to
839 it can not be done with the local-variable operations from the runtime.
843 (Block.Flags): New flag `IsTopLevel' to indicate that this block
846 (ToplevelBlock): A new kind of Block, these are the blocks that
847 are created by the parser for all toplevel method bodies. These
848 include methods, accessors and anonymous methods.
850 These contain some extra information not found in regular blocks:
851 A pointer to an optional CaptureContext (for tracking captured
852 local variables and parameters). A pointer to the parent
855 (Return.Resolve): Catch missmatches when returning a value from an
856 anonymous method (error 1662).
857 Invoke NeedReturnLabel from the Resolve phase instead of the emit
860 (Break.Resolve): ditto.
862 (SwitchLabel): instead of defining the labels during the
863 resolution phase, we now turned the public ILLabel and ILLabelCode
864 labels into methods called GetILLabelCode() and GetILLabel() that
865 only define the label during the Emit phase.
867 (GotoCase): Track the SwitchLabel instead of the computed label
868 (its contained therein). Emit the code by using
869 SwitchLabel.GetILLabelCode ().
871 (LocalInfo.Flags.Captured): A new flag has been introduce to track
872 whether the Local has been captured or not.
874 (LocalInfo.IsCaptured): New property, used to tell whether the
875 local has been captured.
877 * anonymous.cs: Vastly updated to contain the anonymous method
880 The main classes here are: CaptureContext which tracks any
881 captured information for a toplevel block and ScopeInfo used to
882 track the activation frames for various local variables.
884 Each toplevel block has an optional capture context associated
885 with it. When a method contains an anonymous method both the
886 toplevel method and the anonymous method will create a capture
887 context. When variables or parameters are captured, they are
888 recorded on the CaptureContext that owns them, for example:
892 MyDelegate d = delegate {
897 Here `a' will be recorded as captured on the toplevel
898 CapturedContext, the inner captured context will not have anything
899 (it will only have data if local variables or parameters from it
900 are captured in a nested anonymous method.
902 The ScopeInfo is used to track the activation frames for local
903 variables, for example:
905 for (int i = 0; i < 10; i++)
906 for (int j = 0; j < 10; j++){
907 MyDelegate d = delegate {
912 At runtime this captures a single captured variable `i', but it
913 captures 10 different versions of the variable `j'. The variable
914 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
917 The toplevel ScopeInfo will also track information like the `this'
918 pointer if instance variables were referenced (this is necessary
919 as the anonymous method lives inside a nested class in the host
922 (AnonymousMethod): Expanded to track the Toplevel, implement
923 `AnonymousMethod.Compatible' to tell whether an anonymous method
924 can be converted to a target delegate type.
926 The routine now also produces the anonymous method content
928 (AnonymousDelegate): A helper class that derives from
929 DelegateCreation, this is used to generate the code necessary to
930 produce the delegate for the anonymous method that was created.
932 * assign.cs: API adjustments for new changes in
933 Convert.ImplicitStandardConversionExists.
935 * class.cs: Adjustments to cope with the fact that now toplevel
936 blocks are of type `ToplevelBlock'.
938 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
939 insteda of standard blocks.
941 Flag errors if params arguments are passed to anonymous methods.
943 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
944 `CurrentAnonymousMethod' which points to the current Anonymous
945 Method. The variable points to the AnonymousMethod class that
946 holds the code being compiled. It is set in the new EmitContext
947 created for the anonymous method.
949 (EmitContext.Phase): Introduce a variable and an enumeration to
950 assist in enforcing some rules about when and where we are allowed
951 to invoke certain methods (EmitContext.NeedsReturnLabel is the
952 only one that enfonces this right now).
954 (EmitContext.HaveCaptureInfo): new helper method that returns
955 whether we have a CapturedContext initialized.
957 (EmitContext.CaptureVariable): New method used to register that a
958 LocalInfo must be flagged for capturing.
960 (EmitContext.CapturedParameter): New method used to register that a
961 parameters must be flagged for capturing.
963 (EmitContext.CapturedField): New method used to register that a
964 field must be flagged for capturing.
966 (EmitContext.HaveCapturedVariables,
967 EmitContext.HaveCapturedFields): Return whether there are captured
970 (EmitContext.EmitMethodHostInstance): This is used to emit the
971 instance for the anonymous method. The instance might be null
972 (static methods), this (for anonymous methods that capture nothing
973 and happen to live side-by-side with the current method body) or a
974 more complicated expression if the method has a CaptureContext.
976 (EmitContext.EmitTopBlock): Routine that drives the emission of
977 code: it will first resolve the top block, then emit any metadata
978 and then emit the code. The split is done so that we can extract
979 any anonymous methods and flag any captured variables/parameters.
981 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
982 during this phase, the ILGenerator should not be used as labels
983 and local variables declared here might not be accessible to any
984 code that is part of an anonymous method.
986 Exceptions to this include the temporary variables that are
987 created by some statements internally for holding temporary
990 (EmitContext.EmitMeta): New routine, in charge of emitting all the
993 (EmitContext.TemporaryReturn): This method is typically called
994 from the Emit phase, and its the only place where we allow the
995 ReturnLabel to be defined other than the EmitMeta. The reason is
996 that otherwise we would have to duplicate a lot of logic in the
997 Resolve phases of various methods that today is on the Emit
1000 (EmitContext.NeedReturnLabel): This no longer creates the label,
1001 as the ILGenerator is not valid during the resolve phase.
1003 (EmitContext.EmitThis): Extended the knowledge in this class to
1004 work in anonymous methods in addition to iterators.
1006 (EmitContext.EmitCapturedVariableInstance): This emits whatever
1007 code is necessary on the stack to access the instance to a local
1008 variable (the variable will be accessed as a field).
1010 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
1011 EmitContext.EmitAddressOfParameter): Routines to support
1012 parameters (not completed at this point).
1014 Removals: Removed RemapLocal and RemapLocalLValue. We probably
1015 will also remove the parameters.
1017 * convert.cs (Convert): Define a `ConstantEC' which points to a
1018 null. This is just to prefity some code that uses
1019 ImplicitStandardConversion code and do not have an EmitContext
1022 The idea is to flag explicitly that at that point in time, it is
1023 known that the conversion will not trigger the delegate checking
1024 code in implicit conversions (which requires a valid
1027 Everywhere: pass new EmitContext parameter since
1028 ImplicitStandardConversionExists now requires it to check for
1029 anonymous method conversions.
1031 (Convert.ImplicitStandardConversionExists): If the type of an
1032 expression is the anonymous_method_type, and the type is a
1033 delegate, we invoke the AnonymousMethod.Compatible method to check
1034 whether an implicit conversion is possible.
1036 (Convert.ImplicitConversionStandard): Only do implicit method
1037 group conversions if the language level is not ISO_1.
1039 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
1040 MethodInfo for the Invoke method. used by Delegate and
1043 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
1044 method conversions if the target type is a delegate.
1046 Removed extra debugging nops.
1048 (LocalVariableReference): Turn the `local_info' into a public
1051 Add `prepared' field, the same hack used for FieldExprs to cope
1052 with composed assignments, as Local variables do not necessarily
1053 operate purely on the stack as they used to: they can be captured
1056 Add `temp' for a temporary result, like fields.
1058 Refactor DoResolve and DoResolveLValue into DoResolveBase.
1060 It now copes with Local variables that are captured and emits the
1061 proper instance variable to load it from a field in the captured
1064 (ParameterReference.DoResolveBase): During the resolve phase,
1065 capture parameters if we are in an anonymous method.
1067 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
1068 anonymous method, use the EmitContext helper routines to emit the
1069 parameter reference.
1071 * iterators.cs: Set RemapToProxy to true/false during the
1074 * parameters.cs (GetParameterByName): New helper method.
1076 * typemanager.cs (anonymous_method_type) a new type that
1077 represents an anonyous method. This is always an internal type,
1078 used as a fencepost to test against the anonymous-methodness of an
1081 2004-10-20 Marek Safar <marek.safar@seznam.cz>
1083 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
1085 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
1087 2004-11-10 Martin Baulig <martin@ximian.com>
1089 * expression.cs (Invocation.BetterFunction): If two methods have
1090 equal parameter types, but only one of them is generic, the
1091 non-generic one wins.
1092 (New.DoResolve): Don't set `is_struct' to false if we're a generic
1093 instance; just use `Type.IsValueType' to determine whether
1094 something is a struct or not.
1095 (MemberAccess.DoResolveAsTypeStep): Don't modify the `args' field,
1096 so we can be called multiple times.
1098 2004-11-10 Martin Baulig <martin@ximian.com>
1100 * generic.cs (TypeParameter.DefineConstraints): New public method.
1101 (TypeParameter.CheckAccessLevel): Override this and return true.
1102 (ConstructedType.ResolveType): Renamed to DoResolveType(), don't
1103 override ResolveType() anymore.
1104 (ConstructedType.DoResolveAsTypeStep): Call DoResolveType() here.
1106 2004-11-10 Martin Baulig <martin@ximian.com>
1108 * rootcontext.cs (RootContext.LookupType): If we're a nested type,
1109 call DeclSpace.ResolveNestedType() on it.
1111 2004-11-10 Martin Baulig <martin@ximian.com>
1113 * support.cs (ReflectionParameters.ParameterModifier): If `gpd' is
1114 non-null, call ParameterModifier() on it.
1116 2004-11-10 Martin Baulig <martin@ximian.com>
1119 (Iterators): Added `current_type' and `this_type' fields.
1120 (Iterators.DefineIterator): Create a new EmitContext and store it
1121 in `ec'; compute `this_type'.
1123 2004-11-10 Martin Baulig <martin@ximian.com>
1126 (TypeManager.IsPrivateAccessible): New public method.
1127 (Closure.Filter): Use IsPrivateAccessible() instead of IsEqual().
1129 2004-11-10 Martin Baulig <martin@ximian.com>
1131 * class.cs (TypeContainer.DefineType): Call
1132 TypeBuilder.DefineGenericParameters() before resolving the type
1134 (MethodData.parent_method): New protected field.
1135 (MethodData..ctor): Added `MethodInfo parent_method' argument.
1136 (MethodData.Define): Compute `parent_method'.
1139 (MemberCore.GetObsoleteAttribute): Don't create a new EmitContext.
1140 (MemberCore.GetClsCompliantAttributeValue): Likewise.
1141 (DeclSpace.ec): New protected field; store the EmitContext here.
1142 (DeclSpace.EmitContext): New public property.
1143 (DeclSpace.ResolveType): Un-comment from the [Obsolte] attribute.
1144 (DeclSpace.ResolveNestedType): New public method.
1145 (DeclSpace.ResolveTypeExpr): Just call ResolveAsTypeTerminal() here.
1146 (DeclSpace.NestedAccessible): Added `Type tb' argument.
1147 (DeclSpace.FamilyAccessible): Likewise.
1148 (DeclSpace.FindType): Call ResolveNestedType() for nested types.
1149 (DeclSpace.GetClsCompliantAttributeValue): Don't create a new
1152 * delegate.cs (Delegate.Define): Store the EmitContext in the `ec'
1155 * enum.cs (Enum.Define): Store the EmitContext in the `ec' field.
1156 (Enum.Emit): Don't create a new EmitContext.
1158 2004-10-18 Martin Baulig <martin@ximian.com>
1160 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
1161 `Type' directly, but call ResolveType() on it.
1162 (Catch.Resolve): Likewise.
1163 (Foreach.Resolve): Likewise.
1165 2004-10-18 Martin Baulig <martin@ximian.com>
1167 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
1168 `Type' directly, but call ResolveType() on it.
1169 (Probe.DoResolve): Likewise.
1170 (ArrayCreation.LookupType): Likewise.
1171 (TypeOf.DoResolve): Likewise.
1172 (SizeOf.DoResolve): Likewise.
1174 2004-10-18 Raja R Harinath <rharinath@novell.com>
1176 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
1179 2004-10-17 John Luke <john.luke@gmail.com>
1181 * class.cs (Operator.GetSignatureForError): use CSharpName
1183 * parameter.cs (Parameter.GetSignatureForError): Returns
1184 correct name even if was not defined.
1186 2004-10-13 Raja R Harinath <rharinath@novell.com>
1189 * class.cs (TypeContainer.EmitContext): New property.
1190 (DefineNestedTypes): Create an emitcontext for each part.
1191 (MethodCore.DoDefineParameters): Use container's emitcontext.
1192 Pass type array to InternalParameters.
1193 (MemberBase.DoDefine): Use container's emitcontext.
1194 (FieldMember.Define): Likewise.
1195 (Event.Define): Likewise.
1196 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1197 Pass type array to InternalParameters.
1198 (SetIndexerMethod.GetParameterInfo): Likewise.
1199 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1200 * delegate.cs (Define): Pass emitcontext to
1201 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1202 array to InternalParameters.
1203 * expression.cs (ParameterReference.DoResolveBase): Pass
1204 emitcontext to GetParameterInfo.
1205 (ComposedCast.DoResolveAsTypeStep): Remove check on
1206 ec.ResolvingTypeTree.
1207 * parameter.cs (Parameter.Resolve): Change argument to
1208 EmitContext. Use ResolveAsTypeTerminal.
1209 (Parameter.GetSignature): Change argument to EmitContext.
1210 (Parameters.ComputeSignature): Likewise.
1211 (Parameters.ComputeParameterTypes): Likewise.
1212 (Parameters.GetParameterInfo): Likewise.
1213 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1214 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1215 * support.cs (InternalParameters..ctor): Remove variant that takes
1217 * typemanager.cs (system_intptr_expr): New.
1218 (InitExpressionTypes): Initialize it.
1220 2004-10-12 Chris Toshok <toshok@ximian.com>
1222 * cs-parser.jay: fix location for try_statement and catch_clause.
1224 2004-10-18 Martin Baulig <martin@ximian.com>
1226 * class.cs (FieldMember.Define): Don't access the TypeExpr's
1227 `Type' directly, but call ResolveType() on it.
1228 (MemberBase.DoDefine): Likewise.
1230 * expression.cs (New.DoResolve): Don't access the TypeExpr's
1231 `Type' directly, but call ResolveType() on it.
1232 (ComposedCast.DoResolveAsTypeStep): Likewise.
1234 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
1235 `Type' directly, but call ResolveType() on it.
1237 2004-10-17 John Luke <john.luke@gmail.com>
1239 * class.cs (Operator.GetSignatureForError): use CSharpName
1241 * parameter.cs (Parameter.GetSignatureForError): Returns
1242 correct name even if was not defined.
1244 2004-10-13 Raja R Harinath <rharinath@novell.com>
1247 * class.cs (TypeContainer.EmitContext): New property.
1248 (DefineNestedTypes): Create an emitcontext for each part.
1249 (MethodCore.DoDefineParameters): Use container's emitcontext.
1250 Pass type array to InternalParameters.
1251 (MemberBase.DoDefine): Use container's emitcontext.
1252 (FieldMember.Define): Likewise.
1253 (Event.Define): Likewise.
1254 (SetMethod.GetParameterInfo): Change argument to EmitContext.
1255 Pass type array to InternalParameters.
1256 (SetIndexerMethod.GetParameterInfo): Likewise.
1257 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
1258 * delegate.cs (Define): Pass emitcontext to
1259 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
1260 array to InternalParameters.
1261 * expression.cs (ParameterReference.DoResolveBase): Pass
1262 emitcontext to GetParameterInfo.
1263 (ComposedCast.DoResolveAsTypeStep): Remove check on
1264 ec.ResolvingTypeTree.
1265 * parameter.cs (Parameter.Resolve): Change argument to
1266 EmitContext. Use ResolveAsTypeTerminal.
1267 (Parameter.GetSignature): Change argument to EmitContext.
1268 (Parameters.ComputeSignature): Likewise.
1269 (Parameters.ComputeParameterTypes): Likewise.
1270 (Parameters.GetParameterInfo): Likewise.
1271 (Parameters.ComputeAndDefineParameterTypes): Likewise.
1272 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
1273 * support.cs (InternalParameters..ctor): Remove variant that takes
1275 * typemanager.cs (system_intptr_expr): New.
1276 (InitExpressionTypes): Initialize it.
1278 2004-10-12 Chris Toshok <toshok@ximian.com>
1280 * cs-parser.jay: fix location for try_statement and catch_clause.
1282 2004-10-07 Raja R Harinath <rharinath@novell.com>
1284 More DeclSpace.ResolveType avoidance.
1285 * decl.cs (MemberCore.InUnsafe): New property.
1286 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
1287 with newly created EmitContext.
1288 (FieldMember.Define): Likewise.
1289 * delegate.cs (Delegate.Define): Likewise.
1290 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
1291 only if normal name-lookup fails.
1292 (TypeExpr.DoResolve): Enable error-checking.
1293 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
1294 (SizeOf.DoResolve): Likewise.
1295 (ComposedCast.DoResolveAsTypeStep): Likewise.
1296 (StackAlloc.DoResolve): Likewise.
1297 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
1298 (Block.Unsafe): New property.
1299 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
1300 (Unsafe): Set 'unsafe' flag of contained block.
1301 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
1302 (Fixed.Resolve): Likewise.
1303 (Catch.Resolve): Likewise.
1304 (Using.ResolveLocalVariableDecls): Likewise.
1305 (Foreach.Resolve): Likewise.
1307 2004-10-05 John Luke <john.luke@gmail.com>
1309 * cs-parser.jay: add location to error CS0175
1311 2004-10-04 Miguel de Icaza <miguel@ximian.com>
1313 * ecore.cs (Expression.Constantity): Add support for turning null
1316 * const.cs (Const.Define): Allow constants to be reference types
1317 as long as the value is Null.
1319 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
1321 * namespace.cs (NamespaceEntry.Using): No matter which warning
1322 level is set, check if this namespace name has already been added.
1324 2004-10-03 Ben Maurer <bmaurer@ximian.com>
1326 * expression.cs: reftype [!=]= null should always use br[true,false].
1329 2004-10-03 Marek Safar <marek.safar@seznam.cz>
1332 * attribute.cs: Enum conversion moved to
1333 GetAttributeArgumentExpression to be applied to the all
1336 2004-10-01 Raja R Harinath <rharinath@novell.com>
1338 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
1339 * class.c (TypeContainer.DefineType): Flag error if
1340 base types aren't accessible due to access permissions.
1341 * decl.cs (DeclSpace.ResolveType): Move logic to
1342 Expression.ResolveAsTypeTerminal.
1343 (DeclSpace.ResolveTypeExpr): Thin layer over
1344 Expression.ResolveAsTypeTerminal.
1345 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
1346 Refactor code into NestedAccess. Use it.
1347 (DeclSpace.NestedAccess): New.
1348 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
1349 argument to silence errors. Check access permissions.
1350 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
1351 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
1352 (Cast.DoResolve): Likewise.
1353 (New.DoResolve): Likewise.
1354 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
1355 (TypeOf.DoResolve): Likewise.
1357 * expression.cs (Invocation.BetterConversion): Return the Type of
1358 the better conversion. Implement section 14.4.2.3 more faithfully.
1359 (Invocation.BetterFunction): Make boolean. Make correspondence to
1360 section 14.4.2.2 explicit.
1361 (Invocation.OverloadResolve): Update.
1362 (Invocation): Remove is_base field.
1363 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
1364 (Invocation.Emit): Likewise.
1366 2004-09-24 Marek Safar <marek.safar@seznam.cz>
1368 * cs-parser.jay: Reverted 642 warning fix.
1370 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1373 * decl.cs (FindMemberWithSameName): Indexer can have more than
1376 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1378 * expression.cs (LocalVariableReference.DoResolveLValue):
1379 Do not report warning 219 for out values.
1380 (EmptyExpression.Null): New member to avoid extra allocations.
1382 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1384 * cs-parser.jay: Fix wrong warning 642 report.
1386 * cs-tokenizer.cs (CheckNextToken): New helper;
1387 Inspect next character if is same as expected.
1389 2004-09-23 Martin Baulig <martin@ximian.com>
1391 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
1392 (Convert.ImplicitReferenceConversionExists): Likewise.
1394 2004-11-09 Raja R Harinath <rharinath@novell.com>
1396 * Makefile (DISTFILES): Comment out a few missing files.
1398 2004-10-29 Raja R Harinath <rharinath@novell.com>
1400 * Makefile (bootstrap_libs,bootstrap_libfiles): New.
1401 (bootstrap-libs): New target. Invokes the net_2_0_bootstrap profile.
1402 (gmcs.exe): Invoke bootstrap-libs.
1403 (clean-local): Clean the net_2_0_bootstrap profile too.
1404 (PROGRAM_INSTALL_DIR): New.
1405 (install-local): Use it.
1407 2004-10-13 Martin Baulig <martin@ximian.com>
1409 * generic.cs (TypeManager.InflatedConstraints): New nested class.
1410 (TypeParameter.DefineType): If we're a method type parameter and
1411 that method is overriding something, "inflate" its constraints.
1413 2004-10-12 Martin Baulig <martin@ximian.com>
1415 * expression.cs (MemberAccess.DoResolve): If we're a SimpleName
1416 and have type arguments, create and resolve a ConstructedType.
1418 2004-10-12 Martin Baulig <martin@ximian.com>
1420 * decl.cs (MemberCache.FindMemberToOverride): Use
1421 TypeManager.IsEqual() to compare the parameters and Type.Equals()
1422 to compare the invocationType.
1424 * typemanager.cs (TypeManager.IsEqual): Added support for arrays.
1425 When comparing two type parameters, only do the signature-only
1426 comparision for method type parameters.
1428 2004-10-11 Martin Baulig <martin@ximian.com>
1430 * report.cs: Don't make --fatal abort on warnings, we have
1431 -warnaserror for that.
1433 2004-10-11 Martin Baulig <martin@ximian.com>
1436 (TypeManager.IsEqualGenericType): Removed, use IsEqual() instead.
1437 (TypeManager.IsEqual): Call ourself recursively instead of using
1440 2004-10-11 Martin Baulig <martin@ximian.com>
1442 * class.cs (TypeContainer.DefineType): Only call TypeParameter.Define()
1443 on our own type parameters, not on the ones we inherit from a containing
1446 * expression.cs (Invocation.InferType): Use `==', not `Equals()' for
1449 * generic.cs (TypeParameter.Define): We may only be called once.
1451 * pending.cs (Pending.InterfaceMethod): Call TypeManager.Real_IsEqual()
1452 instead of TypeManager.IsEqual().
1454 2004-09-28 Martin Baulig <martin@ximian.com>
1457 (GenericConstraints.EffectiveBaseClass): New public property.
1458 (TypeParameter.GenericConstraints): New public property.
1459 (ConstructedType.CheckConstraints): Improved.
1461 * convert.cs (Convert.TypeParam_EffectiveBaseType): New private method.
1462 (Convert.TypeParameterConversion): New private method; use this in
1463 ImplicitReferenceConversion() and ImplicitReferenceConversionExists()
1464 for all conversions related to type parameters.
1466 2004-09-24 Martin Baulig <martin@ximian.com>
1468 * convert.cs (Convert.ImplicitReferenceConversion): Added implicit
1469 type parameter conversions for type parameters which are known to
1472 2004-09-24 Martin Baulig <martin@ximian.com>
1474 * generic.cs (GenericConstraints): Added `IsReferenceType' and
1475 `IsValueType' properties.
1477 * support.cs (ReflectionConstraints): Use
1478 Type.GetGenericParameterConstraints() instead of the old hack.
1480 2004-09-24 Martin Baulig <martin@ximian.com>
1482 * generic.cs (GenericConstraints): Moved here and made it an
1485 * support.cs (GenericConstraints): Moved to generic.cs.
1487 2004-09-24 Martin Baulig <martin@ximian.com>
1490 (ReflectionConstraints): Un-nested this class and made it public.
1493 (TypeManager.GetTypeParameterConstraints): New public method.
1494 (TypeManager.HasConstructorConstraint): Use the attributes.
1496 2004-09-24 Martin Baulig <martin@ximian.com>
1498 * support.cs (GenericConstraints): Replaced `HasConstructor',
1499 `IsReferenceType' and `IsValueType' with `Attributes'.
1500 (ReflectionParameters.ReflectionConstraints): Removed the Create()
1501 method and made the .ctor public.
1503 * generic.cs (Constraints.Attributes): New public property.
1504 (Constraints): Renamed `HasConstructor' -> `HasConstructorConstraint',
1505 `IsReferenceType' -> `HasReferenceTypeConstraint' and
1506 `IsValueType' -> `HasValueTypeConstraint'.
1508 2004-09-23 Martin Baulig <martin@ximian.com>
1510 * generic.cs (Constraints): Reflect latest runtime changes.
1512 2004-09-23 Martin Baulig <martin@ximian.com>
1514 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
1515 (Convert.ImplicitReferenceConversionExists): Likewise.
1517 2004-09-23 Marek Safar <marek.safar@seznam.cz>
1519 * class.cs (Operator.Define): Add error 448 and 559 report.
1521 2004-09-22 Marek Safar <marek.safar@seznam.cz>
1523 * class.cs (MemberBase.IsTypePermitted): New protected
1524 method for checking error CS0610.
1526 2004-09-22 Marek Safar <marek.safar@seznam.cz>
1528 * class.cs (TypeContainer.HasExplicitLayout): New property
1529 Returns whether container has StructLayout attribute set Explicit.
1530 (FieldMember): New abstract class for consts and fields.
1531 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
1532 (Field): Reuse FieldMember.
1534 * const.cs (Const): Reuse FieldMember.
1536 * rootcontext.cs: EmitConstants call moved to class.
1538 2004-09-22 Martin Baulig <martin@ximian.com>
1540 Marek and me just fixed one of our oldest bugs: #28562 :-)
1542 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
1544 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
1545 we're an EnumConstant, just return that.
1546 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
1547 an EnumConstant. In this case, we need to use GetValueAsEnumType()
1548 to get the value which'll actually be written into the attribute.
1549 However, we have to use GetValue() to access the attribute's value
1552 2004-09-22 Marek Safar <marek.safar@seznam.cz>
1554 * constant.cs (Constant.IsNegative): New abstract property
1557 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
1558 (StackAlloc.DoResolve): Reused IsNegative.
1560 2004-09-22 Martin Baulig <martin@ximian.com>
1562 * typemanager.cs (TypeManager.LookupGenericTypeContainer): New
1563 public method; like LookupTypeContainer, but also works for
1566 * report.cs (Report.SymbolRelatedToPreviousError): Use
1567 TypeManager.LookupGenericTypeContainer().
1569 2004-09-22 Martin Baulig <martin@ximian.com>
1571 Thanks to Peter Sestoft for this bug report.
1573 * expression.cs (Conditional): If both the `trueExpr' and the
1574 `falseExpr' is a NullLiteral, return a NullLiteral.
1576 2004-09-22 Martin Baulig <martin@ximian.com>
1578 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
1579 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
1580 for the "get_Current" call.
1582 2004-09-21 Martin Baulig <martin@ximian.com>
1584 * convert.cs (Convert.ImplicitReferenceConversion): When
1585 converting to an interface type, first check whether we're
1586 converting from a reference type.
1588 2004-09-14 Martin Baulig <martin@ximian.com>
1590 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
1592 2004-09-14 Marek Safar <marek.safar@seznam.cz>
1595 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
1596 called and is obsolete then this member suppress message
1597 when call is inside next [Obsolete] method or type.
1599 * expression.cs: Use TestObsoleteMethodUsage member.
1601 2004-09-14 Martin Baulig <martin@ximian.com>
1603 * genericparser.cs: Removed.
1605 2004-09-13 Marek Safar <marek.safar@seznam.cz>
1607 * class.cs (MethodCore.CheckBase): Fix bug #65757.
1609 2004-09-12 Marek Safar <marek.safar@seznam.cz>
1611 * attribute.cs (Attribute.Resolve): Add error 653 report.
1613 * class.cs (Class.ApplyAttributeBuilder): Add error 641
1615 (Method.ApplyAttributeBuilder): Add error 685 report.
1616 (Operator.Define): Add error 564 report.
1618 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
1620 * expression.cs (Invocation.DoResolve): Add error
1623 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
1626 2004-09-11 Marek Safar <marek.safar@seznam.cz>
1628 * class.cs (ConstructorInitializer.Resolve):
1629 Wrong error number (515->516).
1631 2004-09-11 Marek Safar <marek.safar@seznam.cz>
1633 * class.cs (Indexer.Define): Add error 631 report.
1635 2004-09-11 Marek Safar <marek.safar@seznam.cz>
1637 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
1639 2004-09-11 Marek Safar <marek.safar@seznam.cz>
1641 * expression.cs (Probe.DoResolve): Add error CS0241 report.
1643 2004-09-10 Marek Safar <marek.safar@seznam.cz>
1645 * cs-parser.jay: Added error CS0241 report.
1647 2004-09-10 Raja R Harinath <rharinath@novell.com>
1649 * cs-parser.jay (fixed_statement): Introduce a scope for the
1650 declaration in the 'fixed' statement.
1652 2004-09-09 Marek Safar <marek.safar@seznam.cz>
1654 * cs-parser.jay: Added CS0230 error report.
1656 2004-09-09 Marek Safar <marek.safar@seznam.cz>
1658 * cs-parser.jay: Added errors CS0231 and CS0257 report.
1660 2004-09-09 Marek Safar <marek.safar@seznam.cz>
1662 * expression.cs (Argument.Resolve): Added error CS0192 and
1665 2004-09-09 Marek Safar <marek.safar@seznam.cz>
1667 C# 2.0 #pragma warning feature
1669 * cs-tokenizer.cs (PreProcessPragma): New method;
1670 Handles #pragma directive.
1672 * report.cs (WarningRegions): New class; Support
1673 class for #pragma warning directive. It tests whether
1674 warning is enabled for a given line.
1676 2004-09-08 Miguel de Icaza <miguel@ximian.com>
1678 * const.cs: Add more descriptive error report, tahnks to
1681 2004-09-08 Marek Safar <marek.safar@seznam.cz>
1683 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
1685 2004-09-07 Miguel de Icaza <miguel@ximian.com>
1687 * expression.cs: Apply patch from Ben: Remove dead code from
1688 ArrayCreation, and remove the TurnintoConstant call in const.cs,
1689 as that code just threw an exception anwyays.
1691 * const.cs: Remove the call to the turnintoconstant, for details
1694 * literal.cs: The type of the null-literal is the null type; So
1695 we use a placeholder type (literal.cs:System.Null, defined here)
1698 * expression.cs (Conditional.DoResolve): Remove some old code that
1699 is no longer needed, conversions have been fixed.
1701 (ArrayCreationExpression.DoResolve): Return false if we fail to
1702 resolve the inner expression.
1704 2004-09-07 Raja R Harinath <rharinath@novell.com>
1707 * cs-parser.jay (delegate_declaration): Record a delegate
1708 declaration as a type declaration.
1709 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
1711 2004-09-06 Miguel de Icaza <miguel@ximian.com>
1713 * parameter.cs: Do not crash if the type can not be resolved.
1715 * expression.cs: Report errors with unsafe pointers, fixes #64896
1717 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
1719 * expression.cs: Pointer arith always needs to do a conv.i
1720 if the operand is a long. fix 65320
1722 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1724 Fixed cs0619-37.cs, cs0619-38.cs
1726 * enum.cs (GetObsoleteAttribute): Removed.
1728 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
1729 on Enum member is double staged. The first is tested member
1732 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1734 Fixed #56986, #63631, #65231
1736 * class.cs: (TypeContainer.AddToMemberContainer): New method,
1737 adds member to name container.
1738 (TypeContainer.AddToTypeContainer): New method, adds type to
1740 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
1741 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
1742 AddOperator): Simplified by reusing AddToMemberContainer.
1743 (TypeContainer.UserDefinedStaticConstructor): Changed to property
1745 (Method.CheckForDuplications): Fixed implementation to test all
1747 (MemberBase): Detection whether member is explicit interface
1748 implementation is now in constructor.
1749 (MemberBase.UpdateMemberName): Handles IndexerName.
1750 (Accessor): Changed to keep also location information.
1751 (AbstractPropertyEventMethod): Is derived from MemberCore.
1752 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
1753 will be emited or not.
1754 (PropertyBase.AreAccessorsDuplicateImplementation):
1755 Tests whether accessors are not in collision with some method.
1756 (Operator): Is derived from MethodCore to simplify common
1759 * decl.cs (Flags.TestMethodDuplication): Test for duplication
1761 (DeclSpace.AddToContainer): Adds the member to defined_names
1762 table. It tests for duplications and enclosing name conflicts.
1764 * enum.cs (EnumMember): Clean up to reuse the base structures
1766 2004-09-03 Martin Baulig <martin@ximian.com>
1768 Merged latest changes into gmcs. Please keep this comment in
1769 here, it makes it easier for me to see what changed in MCS since
1770 the last time I merged.
1772 2004-09-03 Martin Baulig <martin@ximian.com>
1774 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
1775 into TypeContainer, to make partial classes work again.
1777 2004-09-03 Martin Baulig <martin@ximian.com>
1779 * rootcontext.cs (RootContext.V2): Removed.
1781 2004-03-23 Martin Baulig <martin@ximian.com>
1783 * expression.cs (Invocation.OverloadResolve): Added `bool
1784 may_fail' argument and use it instead of the Location.IsNull() hack.
1786 2004-09-09 Martin Baulig <martin@ximian.com>
1788 * cs-parser.jay (namespace_declaration): Fixed CS0134 reporting.
1790 2004-09-09 Martin Baulig <martin@ximian.com>
1792 * generic.cs (TypeParameter.DefineType): Added support for
1793 explicit interface methods.
1795 2004-09-09 Martin Baulig <martin@ximian.com>
1797 * README.Changes: New document. Started to list important changes
1798 between MCS and GMCS here.
1800 2004-09-08 Martin Baulig <martin@ximian.com>
1803 (TypeContainer.CheckRecursiveDefinition): New protected method.
1804 (TypeContainer.DefineType): Move the CS0146 check into
1805 CheckRecursiveDefinition().
1807 2004-09-06 Martin Baulig <martin@ximian.com>
1809 * generic.cs (ConstructedType.CheckConstraints): Allow builtin
1810 types for the constructor constraint.
1812 2004-09-03 Martin Baulig <martin@ximian.com>
1814 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
1815 into TypeContainer, to make partial classes work again.
1817 2004-09-03 Martin Baulig <martin@ximian.com>
1819 * rootcontext.cs (RootContext.V2): Removed.
1821 2004-03-23 Martin Baulig <martin@ximian.com>
1823 * expression.cs (Invocation.OverloadResolve): Added `bool
1824 may_fail' argument and use it instead of the Location.IsNull() hack.
1826 2004-09-03 Martin Baulig <martin@ximian.com>
1828 Merged latest changes into gmcs. Please keep this comment in
1829 here, it makes it easier for me to see what changed in MCS since
1830 the last time I merged.
1832 2004-09-03 Raja R Harinath <rharinath@novell.com>
1835 * expression.cs (BetterConversion): Don't allow either conversion
1836 to be null. Remove redundant implicit conversion test when 'q ==
1837 null' -- when this function is invoked, we already know that the
1838 implicit conversion exists.
1839 (BetterFunction): Assume that 'best' is non-null. Remove
1840 redundant reimplementation of IsApplicable when 'best' is null.
1841 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
1842 number of arguments.
1843 (IsAncestralType): Extract from OverloadResolve.
1844 (OverloadResolve): Make robust to the MethodGroupExpr being
1845 unsorted. Implement all the logic of Section 14.5.5.1, and
1846 support overloading of methods from multiple applicable types.
1847 Clean up logic somewhat. Don't pass null methods to BetterFunction.
1849 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
1850 (RealError, Warning): Append type of report to related symbol.
1852 2004-09-03 Marek Safar <marek.safar@seznam.cz>
1854 * enum.cs: Fixed CLS-Compliance checks for enum members.
1855 Error tests cs3008-8.cs, cs3014-8.cs
1857 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1859 Fixed bug #62342, #63102
1860 * class.cs: ImplementIndexer uses member.IsExplicitImpl
1861 like ImplementMethod.
1863 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1865 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1868 2004-09-02 Martin Baulig <martin@ximian.com>
1870 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
1871 TypeManager.GetArgumentTypes() rather than calling GetParameters()
1874 2004-09-01 Marek Safar <marek.safar@seznam.cz>
1876 C# 2.0 Static classes implemented
1878 * class.cs (TypeContainer): instance_constructors,
1879 initialized_fields, initialized_static_fields,
1880 default_constructor, base_inteface_types are protected to be
1881 accessible from StaticClass.
1882 (TypeContainer.DefineDefaultConstructor): New virtual method
1883 for custom default constructor generating
1884 (StaticClass): New class to handle "Static classes" feature.
1886 * cs-parser.jay: Handle static keyword on class like instance
1889 * driver.cs: Added "/langversion" command line switch with two
1890 options (iso-1, default).
1892 2004-08-31 Marek Safar <marek.safar@seznam.cz>
1894 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
1896 2004-08-31 Miguel de Icaza <miguel@ximian.com>
1898 * delegate.cs: Style.
1900 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
1902 * delegate.cs: Add seperate instance expr field for miguel.
1904 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1906 * PointerArithmetic (Resolve): make sure we are not doing
1907 pointer arith on void*. Also, make sure we are resolved
1908 by not setting eclass until resolve.
1910 All callers: Make sure that PointerArithmetic gets resolved.
1912 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1914 * ArrayCreation (LookupType): If the type does not resolve
1915 to an array, give an error.
1917 2004-08-27 Marek Safar <marek.safar@seznam.cz>
1919 * statement.cs (Try.Resolve): Fixed bug #64222
1921 2004-08-27 Martin Baulig <martin@ximian.com>
1924 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
1927 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1929 * ecore.cs (Constantify): Get underlying type via
1930 System.Enum.GetUnderlyingType to avoid StackOverflow on the
1931 Windows in special cases.
1933 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1935 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
1936 for obtaining also private methods.
1937 (GetRemoveMethod): Used GetRemoveMethod (true)
1938 for obtaining also private methods.
1940 2004-09-02 Martin Baulig <martin@ximian.com>
1942 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
1943 TypeManager.GetArgumentTypes() rather than calling GetParameters()
1946 2004-08-27 Martin Baulig <martin@ximian.com>
1949 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
1952 2004-08-25 Martin Baulig <martin@ximian.com>
1954 * support.cs (ReflectionParameters..ctor): If this is a generic
1955 method, retrieve and store its type parameters.
1956 (InternalParameters..ctor): Added `TypeParameter[]' argument.
1957 (ReflectionParameters.GenericConstraints): The argument specifies
1958 the type parameter, not the method parameter.
1959 (InternalParameters.GenericConstraints): Likewise.
1961 * generic.cs (TypeParameter.DefineType): Correctly handle
1962 constraints wrt. generic methods in interfaces and their
1965 2004-08-24 Martin Baulig <martin@ximian.com>
1967 * generic.cs (TypeParameter.IsSubclassOf): New public method.
1968 (Constraints.IsSubclassOf): New internal method.
1970 * typemanager.cs (TypeManager.FindMembers): Added special support
1971 for GenericTypeParameterBuilder's.
1972 (TypeManager.IsSubclassOf, IsFamilyAccessible): Added support for
1975 2004-08-24 Martin Baulig <martin@ximian.com>
1978 (TypeManager.IsSubclassOf): Renamed to IsFamilyAccessible; use
1979 this for accessibility checks.
1980 (TypeManager.IsSubclassOrNestedChildOf): Renamed to
1981 IsNestedFamilyAccessible.
1982 (TypeManager.IsSubclassOf): New method, do what the name actually
1985 2004-08-24 Martin Baulig <martin@ximian.com>
1987 * expression.cs (MemberAccess.DoResolve): When resolving ourselves
1988 as a SimpleName, include the generic arity.
1990 2004-08-24 Martin Baulig <martin@ximian.com>
1992 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
1993 MethodAttributes.HideBySig for operators.
1995 2004-08-23 Martin Baulig <martin@ximian.com>
1997 Back to the old error reporting system :-)
1999 * report.cs (Message): Removed.
2000 (Report.MessageData, ErrorData, WarningData): Removed.
2001 (Report.Error, Warning): Back to the old system.
2003 2004-08-23 Martin Baulig <martin@ximian.com>
2005 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
2007 * class.cs (TypeContainer.ParentContainer): New public virtual
2008 method; replaces the explicit interface implementation.
2009 (ClassPart.ParentContainer): Override.
2011 2004-08-23 Martin Baulig <martin@ximian.com>
2013 * statement.cs (Switch): Added support for constant switches; see
2014 #59428 or test-285.cs.
2016 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2019 * statement.cs (GetEnumeratorFilter): Removed useless
2020 logic because C# specs is strict. GetEnumerator must be
2023 2004-08-22 Martin Baulig <martin@ximian.com>
2025 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2026 a switch and may break, reset the barrier. Fixes #59867.
2028 2004-08-22 Marek Safar <marek.safar@seznam.cz>
2030 CLS-Compliance speed up (~5% for corlib)
2032 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
2033 New method. Tests container for CLS-Compliant names
2035 * class.cs (TypeContainer.VerifyClsName): New method.
2036 Checks whether container name is CLS Compliant.
2037 (Constructor): Implements IMethodData.
2039 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
2040 low-case table for CLS Compliance test.
2041 (MemberCache.VerifyClsParameterConflict): New method.
2042 Checks method parameters for CS3006 error.
2044 * enum.cs (EnumMember): Is derived from MemberCore.
2045 (Enum.VerifyClsName): Optimized for better performance.
2047 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2049 * report.cs: Renamed Error_T to Error and changed all
2052 2004-08-06 Marek Safar <marek.safar@seznam.cz>
2054 * class.cs (TypeContainer.IndexerArrayList): New inner class
2055 container for indexers.
2056 (TypeContainer.DefaultIndexerName): New constant for default
2057 indexer name. Replaced all "Item" with this constant.
2058 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
2060 * typemanager.cs (TypeManager.default_member_ctor): Cache here
2061 DefaultMemberAttribute constructor.
2063 2004-08-05 Martin Baulig <martin@ximian.com>
2065 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
2068 2004-08-05 Marek Safar <marek.safar@seznam.cz>
2070 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
2071 multi platforms problem.
2073 * compiler.csproj: Included shared files.
2075 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2077 Fix bug 60333, 55971 in the more general way
2078 * attribute.cs (Attribute.GetAttributeArgumentExpression):
2079 Added arg_type argument for constant conversion.
2080 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
2082 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2085 * class.cs (TypeContainer ): New inner classes MethodArrayList,
2086 OperatorArrayList, MethodCoreArrayList for typecontainer
2087 containers. Changed class member types to these new types.
2088 (MethodArrayList.DefineMembers): Added test for CS0659.
2090 2004-08-04 Miguel de Icaza <miguel@ximian.com>
2092 * cfold.cs: Synchronize the folding with the code in expression.cs
2093 Binary.DoNumericPromotions for uint operands.
2095 * attribute.cs: Revert patch from Raja, it introduced a regression
2096 while building Blam-1.2.1 (hard to isolate a test case).
2098 2004-08-04 Marek Safar <marek.safar@seznam.cz>
2102 (TypeContainer.Define): Renamed to DefineContainerMembers because of
2104 (MethodCore.parent_method): New member. The method we're overriding
2105 if this is an override method.
2106 (MethodCore.CheckBase): Moved from Method class and made common.
2107 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
2109 (MethodCore.CheckForDuplications): New abstract method. For custom
2110 member duplication search in a container
2111 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
2112 method and its return type.
2113 (Event.conflict_symbol): New member. Symbol with same name in the
2117 (MemberCache.FindMemberWithSameName): New method. The method
2118 is looking for conflict with inherited symbols.
2120 2004-08-04 Martin Baulig <martin@ximian.com>
2122 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2124 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2126 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2128 * report.cs (Message): New enum for better error, warning reference in
2130 (MessageData): New inner abstract class. It generally handles printing of
2131 error and warning messages.
2132 Removed unused Error, Warning, Message methods.
2134 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2136 Fix for cs0592-8.cs test
2138 (Attributable.ValidAttributeTargets): Made public.
2139 (Attribute.ExplicitTarget): New member for explicit target value.
2140 (Attribute.CheckTargets): Now we translate explicit attribute
2141 target to Target here.
2143 2004-08-03 Ben Maurer <bmaurer@ximian.com>
2145 * ecore.cs (MethodGroupExpr): new IsBase property.
2147 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
2149 * delegate.cs (DelegateCreation): store a MethodGroupExpr
2150 rather than an instance expr.
2152 (DelegateCreation.Emit): Use the method group rather than
2153 the instance expression. Also, if you have base.Foo as the
2154 method for a delegate, make sure to emit ldftn, not ldftnvirt.
2156 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
2158 (NewDelegate.DoResolve): Only check for the existance of Invoke
2159 if the method is going to be needed. Use MethodGroupExpr.
2161 (NewDelegate.Emit): Remove, DelegateCreation implements this.
2163 * expression.cs: For pointer arith., make sure to use
2164 the size of the type, not the size of the pointer to
2167 2004-08-03 Marek Safar <marek.safar@seznam.cz>
2170 * class.cs (Class): Added error CS0502 test.
2172 2004-08-03 John Luke <jluke@cfl.rr.com>
2173 Raja R Harinath <rharinath@novell.com>
2176 * attribute.cs (Attribute.complained_before): New flag.
2177 (Attribute.ResolveType, Attribute.Resolve),
2178 (Attribute.DefinePInvokeMethod): Set it.
2179 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
2181 2004-08-03 Martin Baulig <martin@ximian.com>
2183 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2184 use a user-defined operator; we still need to do numeric
2185 promotions in case one argument is a builtin type and the other
2186 one has an implicit conversion to that type. Fixes #62322.
2188 2004-08-18 Martin Baulig <martin@ximian.com>
2190 * class.cs (Method.Define): Use the correct method name when
2191 creating the MethodBuilder for a generic method.
2193 2004-08-17 Martin Baulig <martin@ximian.com>
2195 * generic.cs (Constraints): Support type parameter constraints.
2197 2004-08-16 Martin Baulig <martin@ximian.com>
2199 * cs-tokenizer.cs (Tokenizer.TypeOfParsing): New public property.
2200 (Token.GENERIC_DIMENSION): New token; this is returned if we
2201 encounter an unbound generic type in a typeof() expression.
2203 * cs-parser.jay (opt_type_argument_list): Added GENERIC_DIMENSION;
2204 this token is only generated while parsing a typeof() expression.
2205 (typeof_expression): Removed the old unbound_type hack.
2207 * generic.cs (TypeArguments.IsUnbound): New public property.
2209 * decl.cs (MemberName): Added support for unbound types.
2211 2004-08-14 Martin Baulig <martin@ximian.com>
2214 (TypeManager.IsEqualGenericInstance): New static method.
2215 (TypeManager.IsSubclassOrNestedChildOf, IsSubclassOf): This is
2216 just used to check accessibility, so follow the rules of 26.1.6.
2218 * expression.cs (MemberAccess.ResolveAsTypeStep): Return a
2219 ConstructedType instead of a TypeExpression if we have type arguments.
2221 * cs-parser.jay (typeof_expression): Support unbound generic types.
2223 * ecore.cs (UnboundTypeExpression): New public class.
2225 2004-08-12 Martin Baulig <martin@ximian.com>
2227 * typemanager.cs (TypeManager.IsNestedChildOf): Use
2228 TypeManager.IsEqual() rather than `=='.
2230 * decl.cs (DeclSpace.CheckAccessLevel): Use `tb.FullName' for
2231 generic instances as well.
2233 2004-08-12 Martin Baulig <martin@ximian.com>
2235 * expression.cs (Invocation.InferType): We can only infer method
2236 type parameters. Fixes #62647.
2238 2004-08-11 Martin Baulig <martin@ximian.com>
2240 * class.cs (TypeContainer.DefineType): Create the TypeBuilder
2241 before resolving the base classes.
2243 2004-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2245 * Makefile: install .mdb file too.
2247 2004-08-05 Martin Baulig <martin@ximian.com>
2249 * ecore.cs (FieldExpr.DoResolveLValue): If we're resolving a field
2250 initializer, the current type is just the TypeBuilder, not the
2251 instantiated generic type.
2252 (FieldExpr.IsFieldInitializer): New public property.
2254 2004-08-04 Martin Baulig <martin@ximian.com>
2256 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
2258 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
2260 2004-08-03 Martin Baulig <martin@ximian.com>
2262 * class.cs (MethodData.Define): If we're an explicit
2263 implementation, remove the generic arity from the type name.
2265 2004-08-03 Martin Baulig <martin@ximian.com>
2267 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
2268 use a user-defined operator; we still need to do numeric
2269 promotions in case one argument is a builtin type and the other
2270 one has an implicit conversion to that type. Fixes #62322.
2272 2004-08-02 Martin Baulig <martin@ximian.com>
2274 * class.cs (TypeContainer.ifaces): Make this a `Type[]', not a
2276 (TypeContainer.GetClassBases): Return the unexpanded list of
2277 interfaces; we expand them later.
2278 (TypeContainer.DefineType): After creating the TypeBuilder, call
2279 TypeManager.ExpandInterfaces() to get an expanded and resolved
2282 * ecore.cs (TypeExpr.GetInterfaces): Removed
2284 * generics.cs (Constraints.InterfaceConstraints): Remove.
2285 (TypeParameter.DefineType): Call TypeManager.RegisterBuilder() to
2286 register the interface constraints.
2289 (TypeManager.AddUserType): Removed the `ifaces' argument.
2290 (TypeManager.AddTypeParameter): Likewise.
2291 (TypeManager.AddUserInterface): Removed, was unused.
2292 (TypeManager.RegisterBuilder): Take a `Type[]' instead of a
2293 `TypeExpr[]' array for the interfaces.
2294 (TypeManager.ExpandInterfaces): Call this after the TypeBuilder
2295 has been defined, returns a list of the resolved interfaces types.
2296 (TypeManager.GetInterfaces): Return a `Type[]', not a `TypeExpr[]'.
2297 (TypeManager.GetExplicitInterfaces): Likewise.
2299 2004-08-02 Martin Baulig <martin@ximian.com>
2301 * expression.cs (Invocation.EmitCall): If we're invoking a method
2302 on a type parameter, use the new `Constrained' prefix opcode.
2304 2004-08-02 Martin Baulig <martin@ximian.com>
2306 * statement.cs (LocalInfo.Flags): Added `IsThis'.
2307 (LocalInfo.IsThis): New public property.
2308 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
2310 2004-08-01 Martin Baulig <martin@ximian.com>
2312 * class.cs (TypeContainer.GetClassBases): Don't set the default
2313 here since we may get called from GetPartialBases().
2314 (TypeContainer.DefineType): If GetClassBases() didn't return a
2315 parent, use the default one.
2317 2004-07-30 Martin Baulig <martin@ximian.com>
2319 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
2321 * class.cs (SourceMethod): New public class, derive from the
2322 symbol writer's ISourceMethod.
2323 (Method): Use the new symbol writer API.
2325 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
2326 as argument and use the new symbol writer.
2329 (SourceFile): Implement the symbol writer's ISourceFile.
2330 (Location.SymbolDocument): Removed.
2331 (Location.SourceFile): New public property.
2333 * symbolwriter.cs: Use the new symbol writer API.
2335 2004-07-30 Raja R Harinath <rharinath@novell.com>
2337 * Makefile (install-local): Remove. Functionality moved to
2340 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
2342 * Makefile: Install mcs.exe.config file together with mcs.exe.
2343 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
2344 correct runtime version.
2346 2004-07-25 Martin Baulig <martin@ximian.com>
2349 (TypeContainer.RegisterOrder): Removed, this was unused.
2350 (TypeContainer, interface_order): Removed.
2351 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
2352 TypeContainer as argument since we can also be called with a
2353 `PartialContainer' for a partial class/struct/interface.
2354 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
2355 of checking whether we're an `Interface' - we could be a
2357 (PartialContainer.Register): Override; call
2358 AddClass()/AddStruct()/AddInterface() on our parent.
2360 * cs-parser.jay (interface_member_declaration): Add things to the
2361 `current_container', not the `current_class'.
2363 * rootcontext.cs (RegisterOrder): The overloaded version which
2364 takes an `Interface' was unused, removed.
2366 * typemanager.cs (TypeManager.LookupInterface): Return a
2367 `TypeContainer', not an `Interface'.
2368 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
2369 contain a `PartialContainer' for an interface, so check it's
2370 `Kind' to figure out what it is.
2372 2004-07-25 Martin Baulig <martin@ximian.com>
2374 * class.cs (Class.DefaultTypeAttributes): New public constant.
2375 (Struct.DefaultTypeAttributes): Likewise.
2376 (Interface.DefaultTypeAttributes): Likewise.
2377 (PartialContainer.TypeAttr): Override this and add the
2378 DefaultTypeAttributes.
2380 2004-07-25 Martin Baulig <martin@ximian.com>
2382 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
2383 we can just use the `Parent' field instead.
2385 2004-07-25 Martin Baulig <martin@ximian.com>
2387 * class.cs (TypeContainer.Emit): Renamed to EmitType().
2389 2004-07-25 Martin Baulig <martin@ximian.com>
2391 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
2392 our parts before defining any methods.
2393 (TypeContainer.VerifyImplements): Make this virtual.
2394 (ClassPart.VerifyImplements): Override and call VerifyImplements()
2395 on our PartialContainer.
2397 2004-07-25 Martin Baulig <martin@ximian.com>
2399 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
2401 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
2402 argument, we can just use the `Parent' field instead.
2405 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
2406 (MemberBase.DoDefine): Likewise.
2408 2004-07-24 Martin Baulig <martin@ximian.com>
2410 * decl.cs (MemberCore.Parent): New public field.
2411 (DeclSpace.Parent): Moved to MemberCore.
2413 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
2414 (MemberBase.ctor): Added TypeContainer argument, pass it to our
2416 (FieldBase, Field, Operator): Likewise.
2417 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
2418 (EventField, Event): Likewise.
2420 2004-07-23 Martin Baulig <martin@ximian.com>
2422 * class.cs (PartialContainer): New public class.
2423 (ClassPart): New public class.
2424 (TypeContainer): Added support for partial classes.
2425 (TypeContainer.GetClassBases): Splitted some of the functionality
2426 out into GetNormalBases() and GetPartialBases().
2428 * cs-tokenizer.cs (Token.PARTIAL): New token.
2429 (Tokenizer.consume_identifier): Added some hacks to recognize
2430 `partial', but only if it's immediately followed by `class',
2431 `struct' or `interface'.
2433 * cs-parser.jay: Added support for partial clases.
2435 2004-07-23 Martin Baulig <martin@ximian.com>
2437 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
2438 a `DeclSpace' and also made it readonly.
2439 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
2440 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
2441 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
2443 * cs-parser.jay: Pass the `current_class', not the
2444 `current_container' (at the moment, this is still the same thing)
2445 to a new Method, Property, Event, Indexer or Constructor.
2447 2004-07-23 Martin Baulig <martin@ximian.com>
2449 * cs-parser.jay (CSharpParser): Added a new `current_class' field
2450 and removed the `current_interface' one.
2451 (struct_declaration, class_declaration, interface_declaration):
2452 Set `current_class' to the newly created class/struct/interface;
2453 set their `Bases' and call Register() before parsing their body.
2455 2004-07-23 Martin Baulig <martin@ximian.com>
2457 * class.cs (Kind): New public enum.
2458 (TypeContainer): Made this class abstract.
2459 (TypeContainer.Kind): New public readonly field.
2460 (TypeContainer.CheckDef): New public method; moved here from
2462 (TypeContainer.Register): New public abstract method.
2463 (TypeContainer.GetPendingImplementations): New public abstract
2465 (TypeContainer.GetClassBases): Removed the `is_class' and
2466 `is_iface' parameters.
2467 (TypeContainer.DefineNestedTypes): Formerly known as
2469 (ClassOrStruct): Made this class abstract.
2471 * tree.cs (RootTypes): New public type.
2473 2004-07-20 Martin Baulig <martin@ximian.com>
2475 * tree.cs (Tree.RecordNamespace): Removed.
2476 (Tree.Namespaces): Removed.
2478 * rootcontext.cs (RootContext.IsNamespace): Removed.
2480 * cs-parser.jay (namespace_declaration): Just create a new
2481 NamespaceEntry here.
2483 2004-07-21 Lluis Sanchez Gual <lluis@novell.com>
2485 * Makefile: Install gmcs.exe.config file together with gmcs.exe.
2486 * gmcs.exe.config: Renamed from mcs.exe.config. Added supportedRuntime
2487 entry to make sure it runs in the correct runtime version.
2489 2004-07-18 Martin Baulig <martin@ximian.com>
2491 * generic.cs (ConstructedType.CheckConstraints): Improved
2492 constraints checking.
2494 2004-07-18 Martin Baulig <martin@ximian.com>
2496 * expression.cs (Invocation.BetterMethod): Call
2497 TypeManager.TypeToCoreType() on all types and removed my previous
2498 hack; we're already doig the right thing here.
2500 2004-07-17 Martin Baulig <martin@ximian.com>
2502 * decl.cs (MemberName.MakeName): Create the "class`1" names here.
2504 2004-07-16 Martin Baulig <martin@ximian.com>
2506 * iterators.cs: Added generics support.
2508 2004-07-16 Martin Baulig <martin@ximian.com>
2510 * iterators.cs: Rewrote this. We're now using one single Proxy
2511 class for both the IEnumerable and the IEnumerator interface and
2512 `Iterator' derives from Class so we can use the high-level API.
2514 * class.cs (TypeContainer.AddIterator): New method.
2515 (TypeContainer.DoDefineType): New protected virtual method, which
2516 is called from DefineType().
2517 (TypeContainer.DoDefineMembers): Call DefineType() and
2518 DefineMembers() on all our iterators.
2519 (TypeContainer.Emit): Call Emit() on all our iterators.
2520 (TypeContainer.CloseType): Call CloseType() on all our iterators.
2522 * codegen.cs (EmitContext.CurrentIterator): New public field.
2524 2004-07-15 Martin Baulig <martin@ximian.com>
2527 (TypeManager.not_supported_exception_type): New type.
2529 2004-07-14 Martin Baulig <martin@ximian.com>
2532 (TypeManager.generic_ienumerable_type): New type.
2533 (TypeManager.generic_ienumerator_type): New type.
2536 (RootContext.interfaces_first_stage): Added
2537 "System.Collections.Generic.IEnumerator`1" and
2538 "System.Collections.Generic.IEnumerable`1".
2540 2004-07-14 Martin Baulig <martin@ximian.com>
2542 * iterators.cs: Use real error numbers.
2544 2004-07-14 Martin Baulig <martin@ximian.com>
2546 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
2547 requires this to be a System.Collection.IEnumerable and not a
2548 class implementing that interface.
2549 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
2551 2004-07-13 Marek Safar <marek.safar@seznam.cz>
2553 * class.cs: Fixed previous fix, it broke some error tests.
2555 2004-07-12 Martin Baulig <martin@ximian.com>
2557 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
2560 2004-07-14 Martin Baulig <martin@ximian.com>
2562 * decl.cs, expression.cs, generic.cs: Use a backqoute (`) and not
2563 an exclamation mark (!) for the generic arity to reflect the
2564 latest spec changes; ie. use "System.Collections.Generic.IList`1".
2566 2004-07-13 Martin Baulig <martin@ximian.com>
2568 * cs-tokenizer.cs (Tokenizer.parse_less_than): Allow array rank
2569 specifiers being part of a type argument.
2571 2004-07-13 Martin Baulig <martin@ximian.com>
2573 * expression.cs (MemberAccess.ResolveAsTypeStep): Use the full `!'
2574 name for generic types.
2576 2004-07-13 Martin Baulig <martin@ximian.com>
2578 * assign.cs (Assign.DoResolve): Moved the CS0131 check up a little
2581 2004-07-09 Miguel de Icaza <miguel@ximian.com>
2583 * assign.cs (LocalTemporary): Add new argument: is_address,If
2584 `is_address' is true, then the value that we store is the address
2585 to the real value, and not the value itself.
2587 * ecore.cs (PropertyExpr): use the new local temporary
2588 stuff to allow us to handle X.Y += z (where X is a struct)
2590 2004-07-08 Martin Baulig <martin@ximian.com>
2592 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
2593 not always return, just like we're doing in Using.Resolve().
2595 2004-07-07 Miguel de Icaza <miguel@ximian.com>
2597 * cs-parser.jay (fixed_statement): flag this as Pinned.
2599 2004-07-06 Miguel de Icaza <miguel@ximian.com>
2601 * typemanager.cs (TypeManager): Removed MakePinned method, this
2602 mechanism is replaced with the .NET 2.x compatible mechanism of
2603 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
2605 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
2606 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
2607 `IsFixed' property which has a different meaning.
2609 2004-07-02 Raja R Harinath <rharinath@novell.com>
2611 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
2612 visible from inside a nested class, not just the names of the
2613 immediately enclosing class.
2616 2004-06-24 Raja R Harinath <rharinath@novell.com>
2618 * expression.cs (BetterConversion): Remove buggy special-case
2619 handling of "implicit constant expression conversions". At this
2620 point, we already know that the conversion is possible -- we're
2621 only checking to see which is better.
2623 2004-06-24 Marek Safar <marek.safar@seznam.cz>
2625 * cs-parser.jay: Added error CS0210 test.
2627 2004-06-24 Marek Safar <marek.safar@seznam.cz>
2629 * cs-parser.jay: Added error CS0134 test.
2631 2004-06-24 Marek Safar <marek.safar@seznam.cz>
2634 * cs-parser.jay: Added error CS0145 test.
2636 2004-06-24 Marek Safar <marek.safar@seznam.cz>
2638 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
2640 2004-06-23 Ben Maurer <bmaurer@ximian.com>
2642 * expression.cs (StackAlloc.Resolve): The argument may not
2643 be a constant; deal with this case.
2645 2004-06-23 Marek Safar <marek.safar@seznam.cz>
2647 * attribute.cs (IndexerName_GetIndexerName): Renamed to
2648 GetIndexerAttributeValue.
2649 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
2651 * class.cs (Indexer.Define): Added error tests for CS0415,
2654 2004-06-23 Miguel de Icaza <miguel@ximian.com>
2656 * attribute.cs (Attribute.Resolve): Keep field code in sync with
2659 2004-06-23 Martin Baulig <martin@ximian.com>
2661 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
2662 neither return nor throw, reset the barrier as well. Fixes #60457.
2664 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
2666 * class.cs : EventAttributes is now set to None by default.
2667 This fixes bug #60459.
2669 2004-06-18 Marek Safar <marek.safar@seznam.cz>
2672 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
2673 Don't throw exception but return null (it's sufficient now).
2675 2004-06-18 Marek Safar <marek.safar@seznam.cz>
2677 * typemanager.cs (GetArgumentTypes): Faster implementation.
2679 2004-06-18 Martin Baulig <martin@ximian.com>
2681 * attribute.cs (Attribute.Resolve): Check whether we're an
2682 EmptyCast which a Constant child. Fixes #60333.
2684 2004-06-17 Ben Maurer <bmaurer@ximian.com>
2686 * statement.cs (EmitCollectionForeach): Account for the fact that
2687 not all valuetypes are in areas which we can take the address of.
2688 For these variables, we store to a temporary variable. Also, make
2689 sure that we dont emit a `callvirt' on a valuetype method.
2691 2004-06-15 Marek Safar <marek.safar@seznam.cz>
2693 * expression.cs (StackAlloc.DoReSolve): Added test for
2694 negative parameter (CS0247).
2696 2004-06-15 Marek Safar <marek.safar@seznam.cz>
2699 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
2701 2004-06-15 Marek Safar <marek.safar@seznam.cz>
2704 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
2707 2004-06-14 Marek Safar <marek.safar@seznam.cz>
2709 Fix bug #58254 & cs1555.cs, cs1556.cs
2710 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
2712 2004-06-14 Marek Safar <marek.safar@seznam.cz>
2714 * cs-parser.jay: Added error CS1669 test for indexers.
2716 2004-06-18 Martin Baulig <martin@ximian.com>
2718 * generics.cs (GenericMethod.ctor): Don't take an Attributes
2719 argument. Fixes #60441.
2721 2004-06-16 Ben Maurer <bmaurer@ximian.com>
2722 * ecore.cs (MethodGroupExpr.Name): Revert Martin's patch.
2723 The name needs to have the actual name of the method in order
2724 for other tests (such as the one in OverloadResolve for Invoke
2725 on a delegate) to work. As well, it does not really help
2726 error reporting because the method group had multiple methods.
2727 * Makefile: Remove MCS_DEBUG, you can enable with the DEBUG_FLAGS.
2728 Make profiling work.
2730 2004-06-13 Martin Baulig <martin@ximian.com>
2732 * cs-parser.jay: Don't allow generic attributes.
2734 2004-06-13 Martin Baulig <martin@ximian.com>
2736 * class.cs (MemberBase.DoDefineBase): New protected method.
2737 (MemberBase.DoDefine): Compute the `flags' in the new
2738 DoDefineBase() which must be called first.
2739 (Method.Define): Call DoDefineBase() first so we have the flags
2740 when defining the generic method.
2742 * cs-parser.jay (interface_method_declaration): Support generic methods.
2744 2004-06-13 Martin Baulig <martin@ximian.com>
2746 * decl.cs (TypeName): Removed.
2747 (MemberName): Removed TypeName and MemberNow; now we just have
2750 * cs-parser.jay: Don't distinguish between type arguments and type
2751 parameters in the grammar and simplified the rules a bit. The
2752 reduce/reduce conflicts are now gone (except the one we inherited
2755 2004-06-11 Martin Baulig <martin@ximian.com>
2757 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
2758 call this twice: for params and varargs methods.
2760 2004-06-11 Marek Safar <marek.safar@seznam.cz>
2763 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
2765 2004-06-11 Marek Safar <marek.safar@seznam.cz>
2767 * attribute.cs (Attribute.GetValidTargets): Made public.
2770 (AbstractPropertyEventMethod): New class for better code sharing.
2771 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
2773 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
2775 2004-06-09 Martin Baulig <martin@ximian.com>
2777 * cs-parser.jay: Removed a reduce/reduce conflict.
2779 2004-06-03 Martin Baulig <martin@ximian.com>
2781 * generic.cs (ConstructedType.GetMemberAccess): Renamed to
2782 GetSimpleName() and return a SimpleName.
2784 * ecore.cs (SimpleName.Arguments): New public field.
2785 (SimpleName): Added overloaded ctor which takes an additional
2786 TypeArguments argument.
2787 (SimpleName.SimpleNameResolve): Added support for generic methods.
2788 (MethodGroupExpr.ResolveGeneric): New public method. The code was
2789 formerly in MemberAccess.DoResolve(), but we also need it in
2790 SimpleNameResolve().
2792 * expression.cs (MemberAccess.DoResolve): Use the new
2793 MethodGroupExpr.ResolveGeneric().
2795 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2797 * decl.cs: If possible, use lookuptypedirect here. We can only do
2798 this if there is no `.' after the namespace. Avoids using
2799 LookupType, which does lots of slow processing.
2800 (FindNestedType) New method, does what it says :-).
2801 * namespace.cs: use LookupTypeDirect.
2802 * rootcontext.cs: use membercache, if possible.
2803 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
2805 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2808 According to the spec,
2810 In a member access of the form E.I, if E is a single identifier,
2811 and if the meaning of E as a simple-name (§7.5.2) is a constant,
2812 field, property, localvariable, or parameter with the same type as
2813 the meaning of E as a type-name (§3.8), then both possible
2814 meanings of E are permitted.
2816 We did not check that E as a simple-name had the same type as E as
2819 This trivial check gives us 5-7% on bootstrap time.
2821 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2823 * expression.cs (Invocation.OverloadResolve): Avoid the
2824 use of hashtables and boxing here by allocating on demand.
2826 2004-05-30 Martin Baulig <martin@ximian.com>
2828 * rootcontext.cs (RootContext.LookupType): Don't cache things if
2829 we're doing a silent lookup. Don't try to lookup nested types in
2830 TypeManager.object_type (thanks to Ben Maurer).
2832 2004-05-30 Martin Baulig <martin@ximian.com>
2834 Committing a patch from Ben Maurer.
2836 * rootcontext.cs (RootContext.LookupType): Cache negative results.
2838 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2840 * convert.cs: add a trivial cache for overload operator resolution.
2842 2004-05-31 Marek Safar <marek.safar@seznam.cz>
2845 (AttributeTester.GetObsoleteAttribute): Returns instance of
2846 ObsoleteAttribute when type is obsolete.
2849 (TypeContainer.VerifyObsoleteAttribute): Override.
2850 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
2851 (MethodCode.VerifyObsoleteAttribute): Override.
2852 (MemberBase.VerifyObsoleteAttribute): Override.
2855 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
2856 and report proper error.
2859 (Delegate.VerifyObsoleteAttribute): Override.
2862 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
2863 and report proper error.
2864 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
2867 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
2871 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
2872 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
2873 Added test for ObsoleteAttribute.
2876 (Catch): Derived from Statement.
2878 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2880 * decl.cs: If possible, use lookuptypedirect here. We can only do
2881 this if there is no `.' after the namespace. Avoids using
2882 LookupType, which does lots of slow processing.
2883 (FindNestedType) New method, does what it says :-).
2884 * namespace.cs: use LookupTypeDirect.
2885 * rootcontext.cs: use membercache, if possible.
2886 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
2888 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2891 According to the spec,
2893 In a member access of the form E.I, if E is a single identifier,
2894 and if the meaning of E as a simple-name (§7.5.2) is a constant,
2895 field, property, localvariable, or parameter with the same type as
2896 the meaning of E as a type-name (§3.8), then both possible
2897 meanings of E are permitted.
2899 We did not check that E as a simple-name had the same type as E as
2902 This trivial check gives us 5-7% on bootstrap time.
2904 2004-05-30 Marek Safar <marek.safar@seznam.cz>
2906 Fixed bug #59071 & cs0160.cs
2907 * statement.cs (Try.Resolve): Check here whether order of catch
2908 clauses matches their dependencies.
2910 2004-05-30 Marek Safar <marek.safar@seznam.cz>
2913 * ecore.cs (SimpleName.SimpleNameResolve): Added test for
2916 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2918 * expression.cs (Invocation.OverloadResolve): Avoid the
2919 use of hashtables and boxing here by allocating on demand.
2921 2004-05-30 Martin Baulig <martin@ximian.com>
2923 * rootcontext.cs (RootContext.LookupType): Don't cache things if
2924 we're doing a silent lookup. Don't try to lookup nested types in
2925 TypeManager.object_type (thanks to Ben Maurer).
2927 2004-05-30 Martin Baulig <martin@ximian.com>
2929 Committing a patch from Ben Maurer.
2931 * rootcontext.cs (RootContext.LookupType): Cache negative results.
2933 2004-05-29 Martin Baulig <martin@ximian.com>
2935 * class.cs (IMethodData.ShouldIgnore): New method.
2937 * typemanager.cs (TypeManager.MethodFlags): Don't take a
2938 `Location' argument, we don't need it anywhere. Use
2939 `IMethodData.ShouldIgnore ()' instead of
2940 `MethodData.GetMethodFlags ()'.
2941 (TypeManager.AddMethod): Removed.
2942 (TypeManager.AddMethod2): Renamed to AddMethod.
2944 2004-05-29 Martin Baulig <martin@ximian.com>
2946 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
2948 * convert.cs (Convert.ImplicitReferenceConversion): If we're
2949 converting from a class type S to an interface type and we already
2950 have an object on the stack, don't box it again. Fixes #52578.
2952 2004-05-29 Martin Baulig <martin@ximian.com>
2954 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
2955 Added support for `params' parameters. Fixes #59267.
2957 2004-05-29 Martin Baulig <martin@ximian.com>
2959 * literal.cs (NullPointer): Provide a private .ctor which sets
2960 `type' to TypeManager.object_type. Fixes #59048.
2962 2004-05-29 Martin Baulig <martin@ximian.com>
2964 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
2965 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
2967 * ecore.cs (EventExpr.instance_expr): Make the field private.
2969 2004-05-26 Marek Safar <marek.safar@seznam.cz>
2971 Fixed bug #50080 & cs0214-2.cs
2972 * expression.cs (Cast.DoResolve): Check unsafe context here.
2974 * statement.cs (Resolve.DoResolve): Likewise.
2976 2004-05-26 Martin Baulig <martin@ximian.com>
2978 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
2980 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
2981 (RootContext.LookupType): Pass down the `silent' flag.
2983 2004-05-25 Martin Baulig <martin@ximian.com>
2986 (MethodGroupExpr.IdenticalTypeName): New public property.
2987 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
2988 expression actually refers to a type.
2990 2004-05-25 Martin Baulig <martin@ximian.com>
2992 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
2993 for #56176 and made it actually work.
2995 2004-05-25 Martin Baulig <martin@ximian.com>
2997 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
2998 (FieldExpr, PropertyExpr): Override and implement
2999 CacheTemporaries. Fixes #52279.
3001 2004-05-25 Miguel de Icaza <miguel@ximian.com>
3003 * location.cs: In the new compiler listing a file twice is a
3004 warning, not an error.
3006 2004-05-24 Martin Baulig <martin@ximian.com>
3008 * enum.cs (Enum.DefineType): For the `BaseType' to be a
3009 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
3011 2004-05-24 Martin Baulig <martin@ximian.com>
3013 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
3014 walking the `using' list. Fixes #53921.
3016 2004-05-24 Martin Baulig <martin@ximian.com>
3018 * const.cs (Const.LookupConstantValue): Added support for
3019 EmptyCast's; fixes #55251.
3021 2004-05-24 Martin Baulig <martin@ximian.com>
3023 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
3024 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
3025 which does the CS0135 check. The reason is that we first need to
3026 check whether the variable actually exists.
3028 2004-05-24 Martin Baulig <martin@ximian.com>
3030 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
3031 than RootContext.LookupType() to find the explicit interface
3034 2004-05-24 Raja R Harinath <rharinath@novell.com>
3036 * Makefile: Simplify. Use executable.make.
3037 * mcs.exe.sources: New file. List of sources of mcs.exe.
3039 2004-05-24 Anders Carlsson <andersca@gnome.org>
3043 Use the invariant culture when doing String.Compare for CLS case
3046 2004-05-23 Martin Baulig <martin@ximian.com>
3048 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
3049 don't have any dots. Fixes #52622, added cs0246-8.cs.
3051 * namespace.cs (NamespaceEntry.Lookup): Likewise.
3053 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3055 * class.cs (MemberBase.Define): Reuse MemberType member for
3056 resolved type. Other methods can use it too.
3058 2004-05-23 Martin Baulig <martin@ximian.com>
3060 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
3061 the variable also exists in the current block (otherwise, we need
3062 to report a CS0103). Fixes #58670.
3064 2004-05-23 Martin Baulig <martin@ximian.com>
3066 * flowanalysis.cs (Reachability.Reachable): Compute this
3067 on-the-fly rather than storing it as a field.
3069 2004-05-23 Martin Baulig <martin@ximian.com>
3071 * flowanalysis.cs (Reachability.And): Manually compute the
3072 resulting `barrier' from the reachability.
3074 2004-05-23 Marek Safar <marek.safar@seznam.cz>
3077 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
3078 instance of ObsoleteAttribute when symbol is obsolete.
3081 (IMethodData): Extended interface for ObsoleteAttribute support.
3083 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3085 * attribute.cs: Fix bug #55970
3087 2004-05-22 Marek Safar <marek.safar@seznam.cz>
3091 (GetObsoleteAttribute): New method. Creates the instance of
3093 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
3094 ObsoleteAttribute when member is obsolete.
3095 (AttributeTester.Report_ObsoleteMessage): Common method for
3096 Obsolete error/warning reporting.
3099 (TypeContainer.base_classs_type): New member for storing parent type.
3102 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
3103 for this MemberCore.
3105 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3107 * attribute.cs, const.cs: Fix bug #58590
3109 2004-05-21 Martin Baulig <martin@ximian.com>
3111 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
3112 out parameters if the end of the method is unreachable. Fixes
3115 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3117 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
3118 Hari was right, why extra method.
3120 2004-05-21 Marek Safar <marek.safar@seznam.cz>
3122 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
3124 2004-05-20 Martin Baulig <martin@ximian.com>
3126 * delegate.cs: Convert this file to Unix mode - like the original
3129 2004-05-20 Martin Baulig <martin@ximian.com>
3131 * attribute.cs: Convert this file to Unix mode - like the original
3134 2004-05-19 Marek Safar <marek.safar@seznam.cz>
3136 Fix bug #58688 (MCS does not report error when the same attribute
3139 * attribute.cs (Attribute.Emit): Distinction between null and default.
3141 2004-05-19 Raja R Harinath <rharinath@novell.com>
3143 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
3144 of a top-level attribute without an attribute target.
3145 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
3147 (Attribute.Conditional_GetConditionName),
3148 (Attribute.Obsolete_GetObsoleteMessage): Update.
3149 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
3150 part of ScanForIndexerName.
3151 (Attribute.CanIgnoreInvalidAttribute): New function.
3152 (Attribute.ScanForIndexerName): Move to ...
3153 (Attributes.ScanForIndexerName): ... here.
3154 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
3155 (Attributes.Search): New internal variant that can choose not to
3156 complain if types aren't resolved. The original signature now
3158 (Attributes.GetClsCompliantAttribute): Use internal variant, with
3159 complaints suppressed.
3160 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
3161 only if it not useful.
3162 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
3163 top-level for attributes that are shared between the assembly
3164 and a top-level class.
3165 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
3166 * class.cs: Update to reflect changes.
3167 (DefineIndexers): Fuse loops.
3168 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
3169 a couple more variants of attribute names.
3171 2004-05-18 Marek Safar <marek.safar@seznam.cz>
3173 Fix bug #52585 (Implemented explicit attribute declaration)
3176 (Attributable.ValidAttributeTargets): New abstract method. It gets
3177 list of valid attribute targets for explicit target declaration.
3178 (Attribute.Target): It holds target itself.
3179 (AttributeSection): Removed.
3180 (Attribute.CheckTargets): New method. It checks whether attribute
3181 target is valid for the current element.
3184 (EventProperty): New class. For events that are declared like
3185 property (with add and remove accessors).
3186 (EventField): New class. For events that are declared like field.
3189 * cs-parser.jay: Implemented explicit attribute target declaration.
3191 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
3192 Override ValidAttributeTargets.
3195 (ReturnParameter): Class for applying custom attributes on
3197 (ParameterAtribute): New class. Class for applying custom
3198 attributes on the parameter type.
3200 2004-05-17 Miguel de Icaza <miguel@ximian.com>
3202 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
3205 (Method): Allow UNSAFE here.
3207 * modifiers.cs: Support unsafe reporting.
3209 2004-05-17 Marek Safar <marek.safar@seznam.cz>
3211 * decl.cs: Fix bug #58478.
3213 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3215 * statement.cs: When checking for unreachable code on an EmptyStatement,
3216 set the location. Fixes bug #58488.
3218 2004-05-13 Miguel de Icaza <miguel@ximian.com>
3220 * driver.cs: Add -pkg handling.
3222 From Gonzalo: UseShelLExecute=false
3224 2004-05-12 Marek Safar <marek.safar@seznam.cz>
3227 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
3229 (Attribute.IsClsCompliaceRequired): Moved to base for better
3231 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
3232 when attribute is AttributeUsageAttribute.
3233 (Attribute.GetValidTargets): Simplified.
3234 (Attribute.GetAttributeUsage): New method returns AttributeUsage
3235 attribute for this type.
3236 (Attribute.ApplyAttributes): Method renamed to Emit and make
3238 (GlobalAttributeSection): New class for special handling of global
3239 attributes (assembly, module).
3240 (AttributeSection.Emit): New method.
3242 * class.cs: Implemented Attributable abstract methods.
3243 (MethodCore.LabelParameters): Moved to Parameter class.
3244 (Accessor): Is back simple class.
3245 (PropertyMethod): Implemented Attributable abstract class.
3246 (DelegateMethod): Implemented Attributable abstract class.
3247 (Event): New constructor for disctintion between normal Event
3248 and Event with accessors.
3250 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
3252 * codegen.cs, const.cs, decl.cs, delegate.cs:
3253 (CommonAssemblyModulClass): Implemented Attributable abstract class
3256 * enum.cs: Implement IAttributeSupport interface.
3257 (EnumMember): New class for emum members. Implemented Attributable
3261 (ParameterBase): Is abstract.
3262 (ReturnParameter): New class for easier [return:] attribute handling.
3264 * typemanager.cs: Removed builder_to_attr.
3266 2004-05-11 Raja R Harinath <rharinath@novell.com>
3269 * attribute.cs (Attribute.GetPositionalValue): New function.
3270 * class.cs (TypeContainer.VerifyMembers): New function.
3271 (TypeContainer.Emit): Use it.
3272 (ClassOrStruct): New base class for Class and Struct.
3273 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
3274 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
3276 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
3277 then each non-static field should have a FieldOffset attribute.
3278 Otherwise, none of the fields should have a FieldOffset attribute.
3279 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
3280 and FieldOffset attributes.
3281 * typemanager.cs (TypeManager.struct_layout_attribute_type)
3282 (TypeManager.field_offset_attribute_type): New core types.
3283 (TypeManager.InitCoreTypes): Initialize them.
3285 2004-05-11 Michal Moskal <malekith@pld-linux.org>
3287 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
3288 Return correct type.
3291 2004-05-09 Miguel de Icaza <miguel@ximian.com>
3293 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
3294 be implicitly converted to ulong.
3296 * expression.cs: The logic for allowing operator &, | and ^ worked
3297 was wrong, it worked before because we did not report an error in
3298 an else branch. Fixes 57895.
3300 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
3301 allow volatile fields to be reference types.
3303 2004-05-07 Miguel de Icaza <miguel@ximian.com>
3305 * driver.cs: Add support for /debug-
3307 2004-05-07 Raja R Harinath <rharinath@novell.com>
3309 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
3310 Add a 'complain' parameter to silence errors.
3311 (Attribute.Resolve): Update to changes. Put in sanity check to catch
3312 silently overlooked type-resolutions.
3313 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
3315 (Attributes.Search): New function.
3316 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
3317 (Attributes.GetAttributeFullName): Remove hack.
3318 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
3319 Update to reflect changes.
3320 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
3321 Use Attributes.Search instead of nested loops.
3323 2004-05-07 Marek Safar <marek.safar@seznam.cz>
3326 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
3327 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
3328 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
3330 * report.cs: (Report.Warning): Renamed to Warning_T because of
3331 parameter collision.
3333 2004-05-05 Raja R Harinath <rharinath@novell.com>
3335 * expression.cs (MemberAccess.ResolveMemberAccess):
3336 Exit with non-zero status after Report.Error.
3337 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
3339 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
3341 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3343 * support.cs: Don't hang when the file is empty.
3345 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
3347 * support.cs: In SeekableStreamReader, compute the preamble size of the
3348 underlying stream. Position changes should take into account that initial
3351 2004-05-03 Todd Berman <tberman@sevenl.net>
3353 * driver.cs: remove unused GetSysVersion function.
3355 2004-05-03 Todd Berman <tberman@sevenl.net>
3357 * driver.cs: Remove the hack from saturday, as well as the hack
3358 from jackson (LoadAssemblyFromGac), also adds the CWD to the
3359 link_paths to get that bit proper.
3361 2004-05-01 Todd Berman <tberman@sevenl.net>
3363 * driver.cs: Try a LoadFrom before a Load, this checks the current
3364 path. This is currently a bug in mono that is be fixed, however, this
3365 provides a workaround for now. This will be removed when the bug
3368 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
3370 * CryptoConvert.cs: Updated to latest version. Fix issue with
3371 incomplete key pairs (#57941).
3373 2004-05-01 Todd Berman <tberman@sevenl.net>
3375 * driver.cs: Remove '.' from path_chars, now System.* loads properly
3378 2004-04-30 Jackson Harper <jackson@ximian.com>
3380 * codegen.cs: Open keys readonly.
3382 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3384 * typemanager.cs: don't report cyclic struct layout when a struct
3385 contains 2 or more fields of the same type. Failed for Pango.AttrShape
3386 which has 2 Pango.Rectangle fields.
3388 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
3390 * expression.cs: Handle IntPtr comparisons with IL code
3391 rather than a method call.
3393 2004-04-29 Martin Baulig <martin@ximian.com>
3395 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
3396 the list of PropertyInfo's in class hierarchy and find the
3397 accessor. Fixes #56013.
3399 2004-04-29 Martin Baulig <martin@ximian.com>
3401 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
3403 2004-04-29 Martin Baulig <martin@ximian.com>
3405 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3407 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
3409 2004-04-29 Martin Baulig <martin@ximian.com>
3411 * class.cs (ConstructorInitializer.Resolve): Check whether the
3412 parent .ctor is accessible. Fixes #52146.
3414 2004-04-29 Martin Baulig <martin@ximian.com>
3416 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
3418 * statement.cs (Using.EmitLocalVariableDecls): Use
3419 TypeManager.idisposable_type, not typeof (IDisposable).
3420 (Foreach.EmitCollectionForeach): Added support for valuetypes.
3422 2004-04-29 Martin Baulig <martin@ximian.com>
3424 * class.cs (Event.Define): Don't emit the field and don't set
3425 RTSpecialName and SpecialName for events on interfaces. Fixes
3428 2004-04-29 Raja R Harinath <rharinath@novell.com>
3430 Refactor Attribute.ApplyAttributes.
3431 * attribute.cs (Attributable): New base class for objects that can
3432 have Attributes applied on them.
3433 (Attribute): Make AttributeUsage fields public.
3434 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
3435 (Attribute.IsInternalCall): New property.
3436 (Attribute.UsageAttr): Convert to a public read-only property.
3437 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
3438 (Attribute.ResolveType, Attribute.Resolve)
3439 (Attribute.ScanForIndexerName): Update to reflect changes.
3440 (Attribute.CheckAttributeTarget): Re-format.
3441 (Attribute.ApplyAttributes): Refactor, to various
3442 Attributable.ApplyAttributeBuilder methods.
3443 * decl.cs (MemberCore): Make Attributable.
3444 * class.cs (Accessor): Make Attributable.
3445 (MethodData.ApplyAttributes): Use proper attribute types, not
3447 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
3448 (TypeContainer.ApplyAttributeBuilder)
3449 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
3450 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
3451 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
3452 (Operator.ApplyAttributeBuilder): New factored-out methods.
3453 * const.cs (Const.ApplyAttributeBuilder): Likewise.
3454 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
3455 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
3456 * parameter.cs (ParameterBase): New Attributable base class
3457 that can also represent Return types.
3458 (Parameter): Update to the changes.
3460 2004-04-29 Jackson Harper <jackson@ximian.com>
3462 * driver.cs: Prefer the corlib system version when looking for
3463 assemblies in the GAC. This is still a hack, but its a better hack
3466 2004-04-29 Marek Safar <marek.safar@seznam.cz>
3468 * decl.cs, enum.cs: Improved error 3005 reporting.
3470 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
3471 (related_symbols): New private member for list of symbols
3472 related to reported error/warning.
3474 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
3476 2004-04-29 Martin Baulig <martin@ximian.com>
3478 * ecore.cs (Expression.Constantify): If we're an enum and
3479 TypeManager.TypeToCoreType() doesn't give us another type, use
3480 t.UnderlyingSystemType. Fixes #56178.
3482 2004-04-29 Martin Baulig <martin@ximian.com>
3484 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
3485 interfaces and for each interface, only add members directly
3486 declared in that interface. Fixes #53255.
3488 2004-04-28 Martin Baulig <martin@ximian.com>
3490 * expression.cs (ConditionalLogicalOperator): Use a temporary
3491 variable for `left' to avoid that we evaluate it more than once;
3494 2004-04-28 Martin Baulig <martin@ximian.com>
3496 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
3499 2004-04-28 Martin Baulig <martin@ximian.com>
3501 * statement.cs (LocalInfo.Resolve): Check whether the type is not
3504 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
3505 whether the type is not void (CS1547).
3507 2004-04-28 Martin Baulig <martin@ximian.com>
3509 * expression.cs (Unary.DoResolveLValue): Override this and report
3510 CS0131 for anything but Operator.Indirection.
3512 2004-04-28 Martin Baulig <martin@ximian.com>
3514 Committing a patch from Ben Maurer; see bug #50820.
3516 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
3519 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
3522 2004-04-28 Martin Baulig <martin@ximian.com>
3524 Committing a patch from Ben Maurer; see bug #50820.
3526 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
3529 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
3532 2004-04-28 Martin Baulig <martin@ximian.com>
3534 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
3535 (Block.AddLabel): Call DoLookupLabel() to only search in the
3538 2004-04-28 Martin Baulig <martin@ximian.com>
3540 * cfold.cs (ConstantFold.BinaryFold): Added special support for
3541 comparing StringConstants and NullLiterals in Equality and Inequality.
3543 2004-04-28 Jackson Harper <jackson@ximian.com>
3545 * driver.cs: Attempt to load referenced assemblies from the
3546 GAC. This is the quick and dirty version of this method that
3547 doesnt take into account versions and just takes the first
3548 canidate found. Will be good enough for now as we will not have more
3549 then one version installed into the GAC until I update this method.
3551 2004-04-28 Martin Baulig <martin@ximian.com>
3553 * typemanager.cs (TypeManager.CheckStructCycles): New public
3554 static method to check for cycles in the struct layout.
3556 * rootcontext.cs (RootContext.PopulateTypes): Call
3557 TypeManager.CheckStructCycles() for each TypeContainer.
3558 [Note: We only need to visit each type once.]
3560 2004-04-28 Martin Baulig <martin@ximian.com>
3562 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
3564 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
3565 success and added `out object value'. Use a `bool resolved' field
3566 to check whether we've already been called rather than
3567 `ConstantValue != null' since this breaks for NullLiterals.
3569 2004-04-28 Raja R Harinath <rharinath@novell.com>
3571 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
3572 setting of this flag, since the 'set' method may be non-public.
3574 2004-04-28 Raja R Harinath <rharinath@novell.com>
3576 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
3577 check on current_vector.Block.
3579 2004-04-27 Martin Baulig <martin@ximian.com>
3581 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
3582 a field initializer. Fixes #56459.
3584 2004-04-27 Martin Baulig <martin@ximian.com>
3586 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
3587 we're not attempting to use an indexer. Fixes #52154.
3589 2004-04-27 Martin Baulig <martin@ximian.com>
3591 * statement.cs (Return): Don't create a return label if we don't
3592 need it; reverts my change from January 20th. Thanks to Ben
3595 2004-04-27 Martin Baulig <martin@ximian.com>
3597 According to the spec, `goto' can only leave a nested scope, but
3600 * statement.cs (Block.LookupLabel): Only lookup in the current
3601 block, don't recurse into parent or child blocks.
3602 (Block.AddLabel): Check in parent and child blocks, report
3603 CS0140/CS0158 if we find a duplicate.
3604 (Block): Removed this indexer for label lookups.
3605 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
3606 this already does the error reporting for us.
3609 (FlowBranching.UsageVector.Block): New public variable; may be null.
3610 (FlowBranching.CreateSibling): Added `Block' argument.
3611 (FlowBranching.LookupLabel): New public virtual method. Lookup a
3612 label for the target of a `goto' and check whether we're not
3613 leaving a `finally'.
3615 2004-04-27 Martin Baulig <martin@ximian.com>
3617 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
3618 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
3621 2004-04-27 Martin Baulig <martin@ximian.com>
3623 * statement.cs (Block.AddLabel): Also check for implicit blocks
3624 and added a CS0158 check.
3626 2004-04-27 Martin Baulig <martin@ximian.com>
3628 * flowanalysis.cs (FlowBranchingLoop): New class.
3629 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
3630 UsageVector's instead of an ArrayList.
3631 (FlowBranching.Label): Likewise.
3632 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
3633 (FlowBranching.AddBreakVector): New method.
3635 2004-04-27 Miguel de Icaza <miguel@ximian.com>
3637 * attribute.cs: Small regression fix: only convert the type if we
3638 the type is different, fixes System.Drawing build.
3640 2004-04-27 Martin Baulig <martin@ximian.com>
3642 * attribute.cs (Attribute.Resolve): If we have a constant value
3643 for a named field or property, implicity convert it to the correct
3646 2004-04-27 Raja R Harinath <rharinath@novell.com>
3648 * statement.cs (Block.Block): Implicit blocks share
3649 'child_variable_names' fields with parent blocks.
3650 (Block.AddChildVariableNames): Remove.
3651 (Block.AddVariable): Mark variable as "used by a child block" in
3652 every surrounding block.
3653 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
3654 been used in a child block, complain about violation of "Invariant
3655 meaning in blocks" rule.
3656 * cs-parser.jay (declare_local_variables): Don't use
3657 AddChildVariableNames.
3658 (foreach_statement): Don't create an implicit block: 'foreach'
3661 2004-04-23 Miguel de Icaza <miguel@ximian.com>
3663 * convert.cs (ImplicitNumericConversion): 0 is also positive when
3664 converting from 0L to ulong. Fixes 57522.
3666 2004-04-22 Marek Safar <marek.safar@seznam.cz>
3668 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
3669 derived class hides via 'new' keyword field from base class (test-242.cs).
3670 TODO: Handle this in the more general way.
3672 * class.cs (CheckBase): Ditto.
3674 2004-04-22 Marek Safar <marek.safar@seznam.cz>
3676 * decl.cs (caching_flags): New member for storing cached values
3678 (MemberCore.Flags): New enum where bit flags for caching_flags
3680 (MemberCore.cls_compliance): Moved to caching_flags.
3681 (DeclSpace.Created): Moved to caching_flags.
3683 * class.cs: Use caching_flags instead of DeclSpace.Created
3685 2004-04-21 Miguel de Icaza <miguel@ximian.com>
3687 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
3688 if we are only a derived class, not a nested class.
3690 * typemanager.cs: Same as above, but do this at the MemberLookup
3691 level (used by field and methods, properties are handled in
3692 PropertyExpr). Allow for the qualified access if we are a nested
3695 2004-04-21 Marek Safar <marek.safar@seznam.cz>
3697 * class.cs: Refactoring.
3698 (IMethodData): New inteface; Holds links to parent members
3699 to avoid member duplication (reduced memory allocation).
3700 (Method): Implemented IMethodData interface.
3701 (PropertyBase): New inner classes for get/set methods.
3702 (PropertyBase.PropertyMethod): Implemented IMethodData interface
3703 (Event): New inner classes for add/remove methods.
3704 (Event.DelegateMethod): Implemented IMethodData interface.
3706 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
3707 EmitContext (related to class.cs refactoring).
3709 2004-04-21 Raja R Harinath <rharinath@novell.com>
3711 * delegate.cs (Delegate.VerifyApplicability): If the number of
3712 arguments are the same as the number of parameters, first try to
3713 verify applicability ignoring any 'params' modifier on the last
3717 2004-04-08 Martin Baulig <martin@ximian.com>
3719 Merged latest changes into gmcs. Please keep this comment in
3720 here, it makes it easier for me to see what changed in MCS since
3721 the last time I merged.
3723 2004-04-16 Raja R Harinath <rharinath@novell.com>
3725 * class.cs (TypeContainer.AddIndexer): Use
3726 'ExplicitInterfaceName' to determine if interface name was
3727 explicitly specified. 'InterfaceType' is not initialized at this time.
3728 (TypeContainer.DefineIndexers): Remove use of temporary list. The
3729 Indexers array is already in the required order. Initialize
3730 'IndexerName' only if there are normal indexers.
3731 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
3732 (TypeContainer.Emit): Emit DefaultMember attribute only if
3733 IndexerName is initialized.
3736 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
3738 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
3741 2004-04-15 Raja R Harinath <rharinath@novell.com>
3743 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
3747 * attribute.cs (Attribute.Resolve): Check for duplicate named
3751 2004-04-15 Miguel de Icaza <miguel@ximian.com>
3753 * iterators.cs (MarkYield): track whether we are in an exception,
3754 and generate code accordingly. Use a temporary value to store the
3755 result for our state.
3757 I had ignored a bit the interaction of try/catch with iterators
3758 since their behavior was not entirely obvious, but now it is
3759 possible to verify that our behavior is the same as MS .NET 2.0
3763 2004-04-14 Miguel de Icaza <miguel@ximian.com>
3765 * iterators.cs: Avoid creating temporaries if there is no work to
3768 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
3769 Enumerations, use TypeManager.EnumToUnderlying and call
3772 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
3775 (This.Emit): Use EmitContext.EmitThis to emit our
3778 (This.EmitAssign): Ditto.
3780 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
3781 codepaths, we will move all the functionality into
3784 (FieldExpr.EmitAssign): Ditto.
3786 This fixes several hidden bugs that I uncovered while doing a code
3787 review of this today.
3789 * codegen.cs (EmitThis): reworked so the semantics are more clear
3790 and also support value types "this" instances.
3792 * iterators.cs: Changed so that for iterators in value types, we
3793 do not pass the value type as a parameter.
3795 Initialization of the enumerator helpers is now done in the caller
3796 instead of passing the parameters to the constructors and having
3797 the constructor set the fields.
3799 The fields have now `assembly' visibility instead of private.
3801 2004-04-11 Miguel de Icaza <miguel@ximian.com>
3803 * expression.cs (Argument.Resolve): Check if fields passed as ref
3804 or out are contained in a MarshalByRefObject.
3806 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
3807 another compiler type.
3809 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
3811 * class.cs (Indexer.Define): use the new name checking method.
3812 Also, return false on an error.
3813 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
3814 (is_identifier_[start/part]_character): make static.
3816 2004-04-10 Miguel de Icaza <miguel@ximian.com>
3818 * expression.cs (Binary.ResolveOperator): Do no append strings
3819 twice: since we can be invoked more than once (array evaluation)
3820 on the same concatenation, take care of this here. Based on a fix
3821 from Ben (bug #56454)
3823 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
3825 * codegen.cs: Fix another case where CS1548 must be reported (when
3826 delay-sign isn't specified and no private is available #56564). Fix
3827 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
3828 error when MCS is used on the MS runtime and we need to delay-sign
3829 (which seems unsupported by AssemblyBuilder - see #56621).
3831 2004-04-08 Marek Safar <marek.safar@seznam.cz>
3833 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
3834 (TypeManager.ComputeNamespaces): Faster implementation for
3837 * compiler.csproj: Updated AssemblyName to mcs.
3839 2004-05-11 Jackson Harper <jackson@ximian.com>
3841 * Makefile: Preserve MONO_PATH
3843 2004-05-11 Jackson Harper <jackson@ximian.com>
3845 * Makefile: Use mono and mcs to build gmcs
3847 2004-05-03 Miguel de Icaza <miguel@ximian.com>
3849 * codegen.cs: Add patch from Robert Shade
3850 <rshade@dvsconsulting.com>, use FileAccess.Read on the keyfile, to
3853 2004-05-02 Sebastien Pouliot <sebastien@ximian.com>
3855 * CryptoConvert.cs: Updated to latest version. Fix issue with
3856 incomplete key pairs (#57941).
3858 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
3860 * codegen.cs: Fix another case where CS1548 must be reported (when
3861 delay-sign isn't specified and no private is available #56564). Fix
3862 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
3863 error when MCS is used on the MS runtime and we need to delay-sign
3864 (which seems unsupported by AssemblyBuilder - see #56621).
3866 2004-04-29 Jackson Harper <jackson@ximian.com>
3868 * Makefile: Set MONO_PATH to use the bootstrap corlib
3869 * driver.cs: Check the GAC for referenced assemblies.
3871 2004-04-29 Martin Baulig <martin@ximian.com>
3873 * Makefile (gmcs.exe): Set MONO_PATH to use `../class/lib/net_2_0'.
3875 2004-04-07 Martin Baulig <martin@ximian.com>
3877 * expression.cs (Binary.ResolveOperator): Added special case for
3878 Equality/Inequality between a type parameter and a null literal.
3880 2004-04-07 Martin Baulig <martin@ximian.com>
3882 * convert.cs: Check null literal -> type parameter conversions.
3884 2004-04-07 Martin Baulig <martin@ximian.com>
3886 * generic.cs (ConstructedType.CheckConstraints): Enforce the
3887 `class' and `struct' constraints.
3889 2004-04-07 Martin Baulig <martin@ximian.com>
3891 * generic.cs (SpecialConstraint): New public enum.
3892 (Constraints.Resolve): Added support for the `class' and `struct'
3895 * cs-parser.jay (type_parameter_constraint): Added support for the
3896 `class' and `struct' constraints.
3898 2004-04-07 Martin Baulig <martin@ximian.com>
3900 * support.cs (GenericConstraints): Replaced `Types' by
3901 `ClassConstraint' and `InterfaceConstraints'; added
3902 `HasClassConstraint'.
3904 2004-04-07 Martin Baulig <martin@ximian.com>
3907 (Constraints.InterfaceConstraints): New public property.
3908 (Constraints.Types): Make this property public
3909 (TypeParameter): Implement IMemberContainer.
3910 (TypeParameter.Define): Take a `GenericTypeParameterBuilder'
3911 instead of a TypeBuilder/MethodBuilder; pass the interface
3912 constraints to TypeManager.AddTypeParameter().
3913 (TypeParameter.DefineType): Just take an EmitContext and no
3914 TypeBuilder/MethodBuilder. Use the new public API.
3916 * typemanager.cs (TypeManager.AddTypeParameter): Added
3917 `TypeExpr[]' argument; add the interfaces to the
3918 `builder_to_ifaces' hash.
3919 (TypeManager.LookupMemberContainer): For
3920 GenericTypeParameterBuilders, get the TypeParameter from the
3921 `builder_to_type_param'.
3922 (TypeManager.FindMembers): For GenericTypeParameterBuilders, get
3923 the TypeParameter and call FindMembers on it.
3925 2004-04-07 Martin Baulig <martin@ximian.com>
3928 (MethodCore.GenericMethod): Moved this field here from Method.
3929 (MethodCore.IsDuplicateImplementation): Take the number of type
3930 parameters into account if we're a generic method.
3932 * expression.cs (Invocation.InferTypeArguments): Don't return true
3933 if `arguments' is null; we still need to check whether we actually
3934 don't need to infer anything in this case.
3935 (MemberAccess): Merged the functionality from GenericMemberAccess
3938 * generic.cs (GenericMemberAccess): Removed.
3940 2004-04-05 Martin Baulig <martin@ximian.com>
3942 * decl.cs (MemberCore): For generic classes, interfaces and
3943 structs, `Name' now includes the number of type parameters
3945 (DeclSpace.FindType): Removed the `num_type_args' argument; we now
3946 encode the number of type arguments in the type name.
3948 * expression.cs (Expression.MemberLookup): Removed the
3949 `num_type_args' argument; we now encode the number of type
3950 arguments in the type name.
3952 * ecore.cs (SimpleName): Encode the number of type arguments in
3953 the type name itself.
3955 * generic.cs (ConstructedType): Likewise.
3957 * tree.cs (Tree.RecordDecl): Take a `string' instead of a
3958 `MemberName'; we now include the number of type parameters in the
3961 * typemanager.cs (TypeManager.CheckGeneric): Removed.
3962 (TypeManager.MemberLookup): Removed the
3963 `num_type_args' argument; we now encode the number of type
3964 arguments in the type name.
3966 2004-04-03 Martin Baulig <martin@ximian.com>
3968 * decl.cs (MemberCore.ctor): Take a MemberName instead of a sting.
3969 (MemberCore.MemberName): Moved here from MemberBase.
3970 (DeclSpace.SetParameterInfo): Just take the constraints as an
3971 ArrayList; we already have the type parameters in our
3972 `MemberName'; also do the CS0080 reporting here.
3974 * cs-parser.jay (struct_declaration): Use `member_name' instead of
3975 `IDENTIFIER opt_type_parameter_list'; when constructing our
3976 `MemberName', it'll already include our type parameters.
3977 (class_declaration, interface_declaration): Likewise.
3978 (delegate_declaration): Likewise.
3979 (MakeName): Take a MemberName and return a MemberName.
3980 The following two changes are required to avoid shift/reduce conflicts:
3981 (member_name): Don't include a TypeName anymore; ie. this is now
3982 just 'IDENTIFIER opt_type_parameter_list'.
3983 (property_declaration, event_declaration): Use a
3984 `namespace_or_type_name' instead of a `member_name'.
3986 2004-04-03 Martin Baulig <martin@ximian.com>
3988 * decl.cs (MemberName): Renamed to `TypeName' and created a new
3990 (TypeName): Formerly known as MemberName.
3992 * namespace.cs (NamespaceEntry.UsingAlias): Take a `TypeName'
3993 instead of a `MemberName'.
3995 * cs-parser.jay (namespace_or_type_name): Create a TypeName.
3996 (member_name): New rule; create a MemberName.
3998 2004-04-02 Martin Baulig <martin@ximian.com>
4000 * namespace.cs (NamespaceEntry.VerifyUsing): Added error checking
4001 (CS0305 and CS0308).
4003 2004-04-02 Martin Baulig <martin@ximian.com>
4005 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Added
4006 support for nested types.
4008 2004-04-02 Martin Baulig <martin@ximian.com>
4010 * ecore.cs (IAlias): New public interface.
4011 (TypeExpr, TypeExpression): Implement IAlias.
4012 (TypeAliasExpression): New public class.
4014 * namespace.cs (Namespace): Implement IAlias.
4015 (Namespace.Lookup): Return an IAlias instead on an object.
4016 (Namespace.DefineName): Take an IAlias instead of an object.
4017 (NamespaceEntry.AliasEntry.Resolve): Return an IAlias instead of
4019 (NamespaceEntry.UsingAlias): Take a Membername instead of an
4021 (NamespaceEntry.LookupAlias): Return an IAlias instead on an
4023 (NamespaceEntry.Lookup): Likewise.
4025 * rootcontext.cs (RootContext.LookupType): Return a TypeExpr
4028 * decl.cs (DeclSpace): Implement IAlias.
4029 (DeclSpace.LookupAlias): Return an IAlias instead of a string.
4031 * generic.cs (ConstructedType): Improved error checking.
4033 2004-04-02 Martin Baulig <martin@ximian.com>
4035 * convert.cs: Added type parameter conversions.
4038 (UnboxCast.Emit): Emit an `unbox.any' for type params.
4039 (ClassCast.Emit): If the source type is a type parameter, box it.
4040 If the target type is a type parameter, emit an `unbox.any'
4041 instead of a `classcast'.1
4043 2004-04-01 Martin Baulig <martin@ximian.com>
4045 * cs-tokenizer.cs (parse_less_than): Allow Token.DOT.
4047 2004-04-01 Martin Baulig <martin@ximian.com>
4049 * generic.cs (ConstructedType.CheckConstraints): Use
4050 Convert.ImplicitStandardConversionExists(); user-defined implicit
4051 conversions are not allowed according to the spec.
4053 2004-03-30 Martin Baulig <martin@ximian.com>
4055 * expression.cs (New): Added support for type parameters.
4058 (TypeManager.activator_type): New public static field.
4059 (TypeManager.activator_create_instance): Likewise.
4061 2004-03-30 Martin Baulig <martin@ximian.com>
4063 * typemanager.cs (TypeManager.HasConstructorConstraint): New
4066 2004-03-30 Martin Baulig <martin@ximian.com>
4068 * generic.cs (ConstructedType.CheckConstraints): Actually follow
4069 the spec here: the argument type must be convertible to the
4072 2004-03-30 Martin Baulig <martin@ximian.com>
4075 (TypeParameter.Define, TypeParameter.DefineMethod): Call
4076 TypeManager.AddTypeParameter().
4077 (ConstructedType.CheckConstraints): Re-enable this and actually
4078 check whether we have a constructor constraint.
4081 (TypeManager.builder_to_type_param): New static field.
4082 (TypeManager.AddTypeParameter): New static method.
4083 (TypeManager.LookupTypeParameter): New public method.
4085 2004-03-30 Martin Baulig <martin@ximian.com>
4087 * generic.cs (TypeParameter.DefineType): Return a boolean and use
4088 the new API to actually define the constructor constraint.
4091 (TypeManager.new_constraint_attr_type): New static field.
4092 (TypeManager.InitCoreTypes): Initialize it.
4094 2004-03-30 Martin Baulig <martin@ximian.com>
4096 * generic.cs (Constraints): Completed error checking, use correct
4099 2004-03-29 Martin Baulig <martin@ximian.com>
4101 * delegate.cs (Delegate.VerifyMethod): Infer type arguments.
4103 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4104 public version which takes a `ParameterData pd' instead of an
4107 2004-03-29 Martin Baulig <martin@ximian.com>
4109 * typemanager.cs (TypeManager.IsGenericMethod): Take a MethodBase,
4112 2004-03-29 Martin Baulig <martin@ximian.com>
4114 * expression.cs (Argument.ResolveMethodGroup): If we're a
4115 ConstructedType, call GetMemberAccess() on it.
4117 2004-03-29 Martin Baulig <martin@ximian.com>
4119 * class.cs (MethodBase.CheckGenericOverride): New abstract method.
4120 (MethodCore.CheckGenericOverride): When overriding a generic
4121 method, check whether the constraints match.
4123 * support.cs (GenericConstraints): New public interface.
4124 (ParameterData.GenericConstraints): New public method.
4126 * parameter.cs (Parameter.Resolve): Check whether we're a generic
4127 method parameter and compute our constraints if appropriate.
4128 (Parameter.GenericConstraints): New public property.
4130 * generic.cs (Constraints): Implement GenericConstraints.
4132 2004-03-29 Martin Baulig <martin@ximian.com>
4134 * decl.cs (MemberCache.FindMemberToOverride): Use
4135 `paramTypes [j].Equals (cmpAttrs [j])' instead of `=='.
4137 2004-03-29 Martin Baulig <martin@ximian.com>
4139 * generic.cs (GenericMethod.Define): Resolve our type parameters.
4141 2004-03-29 Martin Baulig <martin@ximian.com>
4143 * cs-parser.jay: Report CS0080 instead of -200 ("Constraints are
4144 not allowed on non-generic declarations").
4146 2004-03-29 Martin Baulig <martin@ximian.com>
4148 * expression.cs (Invocation.InferTypeArguments): Added overloaded
4149 public version of this method.
4151 * class.cs (MethodCore.IsDuplicateImplementation): Use
4152 Invocation.InferTypeArguments() to check this.
4154 2004-03-29 Martin Baulig <martin@ximian.com>
4156 * convert.cs: Use TypeManager.IsDelegateType() instead of
4157 comparing types correctly.
4159 2004-03-29 Martin Baulig <martin@ximian.com>
4161 * convert.cs: Use TypeManager.IsSubclassOf() instead of comparing
4162 types directly to make it work for generic instances.
4164 * typemanager.cs (TypeManager.IsSubclassOf): New static method.
4166 2004-03-29 Martin Baulig <martin@ximian.com>
4168 * typemanager.cs (TypeManager.MayBecomeEqualGenericTypes): Added
4171 2004-03-24 Martin Baulig <martin@ximian.com>
4173 * decl.cs (DeclSpace.FindType): Also use
4174 TypeManager.CheckGeneric() for types from the using clauses.
4176 2004-03-23 Martin Baulig <martin@ximian.com>
4178 * expression.cs (Invocation.OverloadResolve): Added `bool
4179 may_fail' argument and use it instead of the Location.IsNull() hack.
4181 2004-03-23 Martin Baulig <martin@ximian.com>
4183 * expression.cs (Invocation.InferType): Use correct type inference
4186 2004-03-23 Martin Baulig <martin@ximian.com>
4188 * ecore.cs (MethodGroupExpr.Name): Use
4189 TypeManager.CSharpSignature() instead of just the name.
4191 * expression.cs (Invocation.OverloadResolve): Provide better error
4193 (Invocation.DoResolve): OverloadResolve() never returns null
4194 without reporting an error, so removed the error -6 reporting here.
4196 2004-03-23 Martin Baulig <martin@ximian.com>
4198 * typemanager.cs (TypeManager.GetMethodFlags): Fixed the FIXME for
4201 * cs-parser.jay (delegate_declaration): Support generic delegates.
4203 * delegate.cs: Support generic delegates.
4205 2004-03-22 Martin Baulig <martin@ximian.com>
4207 * expression.cs (Invocation.InferParamsTypeArguments): New static
4208 method; does type inference for params arguments.
4210 2004-03-21 Martin Baulig <martin@ximian.com>
4212 * typemanager.cs (TypeManager.IsGenericMethod): New public static
4213 method; checks whether a method is a generic method.
4215 * expression.cs (Invocation.InferTypeArguments): New static method;
4216 infer type arguments for generic method invocation.
4218 * ecore.cs (MethodGroupExpr.HasTypeArguments): New public
4219 property; we set this to true if we're resolving a generic method
4220 invocation and the user specified type arguments, ie. we're not
4221 doing type inference.
4223 2004-03-20 Martin Baulig <martin@ximian.com>
4225 * class.cs (MethodData.DeclaringType): New public property.
4226 (MethodData.Define): Set DeclaringType here.
4227 (Operator.Define): Use OperatorMethod.MethodData.DeclaringType
4228 instead of OperatorMethodBuilder.DeclaringType.
4230 2004-03-20 Martin Baulig <martin@ximian.com>
4232 * cs-tokenizer.cs (xtoken): Return a special
4233 Token.DEFAULT_OPEN_PARENS for "`default' followed by open parens".
4235 * cs-parser.jay (default_value_expression): Switch to the new
4238 2004-03-19 Martin Baulig <martin@ximian.com>
4240 * decl.cs (MemberName): New class. We use this to "construct"
4241 namespace_or_type_name's.
4243 * generics.cs (TypeArguments.GetDeclarations): New public method;
4244 returns the type arguments as a string[] and reports a CS0081 if
4245 one of them is not an identifier.
4247 * class.cs (MemberBase): The .ctor now takes the name as a
4248 MemberName instead of a string.
4249 (MemberBase.ExplicitInterfaceName): Changed type from string to
4251 (MemberBase.DoDefine): If we're an explicit implementation, the
4252 InterfaceType may be a generic instance.
4254 * cs-parser.jay (namespace_or_type_name): Return a MemberName.
4255 (namespace_name): Call MemberName.GetName () to transform the
4256 MemberName into a string and ensure we don't have any type
4258 (type_name): Call MemberName.GetTypeExpression() to transfrom the
4259 MemberName into an expression.
4260 (method_header): Use namespace_or_type_name instead of member_name.
4262 2004-04-07 Miguel de Icaza <miguel@ximian.com>
4264 * rootcontext.cs: Add new types to the boot resolution.
4266 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
4267 MulticastDelegate is not allowed.
4269 * typemanager.cs: Add new types to lookup: System.TypedReference
4272 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
4273 check for TypedReference or ArgIterator, they are not allowed.
4275 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
4276 makes us properly catch 1510 in some conditions (see bug 56016 for
4279 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
4281 * CryptoConvert.cs: update from corlib version
4284 2004-04-05 Miguel de Icaza <miguel@ximian.com>
4286 * class.cs (Indexer.Define): Check indexername declaration
4288 2004-04-05 Marek Safar <marek.safar@seznam.cz>
4290 * attribute.cs (IsClsCompliant): Fixed problem with handling
4291 all three states (compliant, not-compliant, undetected).
4293 2004-03-30 Marek Safar <marek.safar@seznam.cz>
4295 * attribute.cs (Attribute): Location is now public.
4296 (Resolve): Store resolved arguments (pos_values) in attribute class.
4297 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
4298 (GetClsCompliantAttributeValue): New method that gets
4299 CLSCompliantAttribute value.
4300 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
4301 if exists else null.
4302 (AttributeTester): New class for CLS-Compliant verification routines.
4304 * class.cs (Emit): Add CLS-Compliant verification.
4305 (Method.GetSignatureForError): Implemented.
4306 (Constructor.GetSignatureForError): Implemented
4307 (Constructor.HasCompliantArgs): Returns if constructor has
4308 CLS-Compliant arguments.
4309 (Constructor.Emit): Override.
4310 (Construcor.IsIdentifierClsCompliant): New method; For constructors
4311 is needed to test only parameters.
4312 (FieldBase.GetSignatureForError): Implemented.
4313 (TypeContainer): New member for storing base interfaces.
4314 (TypeContainer.FindMembers): Search in base interfaces too.
4316 * codegen.cs (GetClsComplianceAttribute): New method that gets
4317 assembly or module CLSCompliantAttribute value.
4318 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
4320 (ModuleClass.Emit): Add error 3012 test.
4322 * const.cs (Emit): Override and call base for CLS-Compliant tests.
4324 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
4325 state for all decl types.
4326 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
4327 if CLS-Compliant tests are required.
4328 (IsClsCompliaceRequired): New method. Analyze whether code
4329 must be CLS-Compliant.
4330 (IsExposedFromAssembly): New method. Returns true when MemberCore
4331 is exposed from assembly.
4332 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
4333 value or gets cached value.
4334 (HasClsCompliantAttribute): New method. Returns true if MemberCore
4335 is explicitly marked with CLSCompliantAttribute.
4336 (IsIdentifierClsCompliant): New abstract method. This method is
4337 used to testing error 3005.
4338 (IsIdentifierAndParamClsCompliant): New method. Common helper method
4339 for identifier and parameters CLS-Compliant testing.
4340 (VerifyClsCompliance): New method. The main virtual method for
4341 CLS-Compliant verifications.
4342 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
4343 null. I don't know why is null (too many public members !).
4344 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
4345 and get value of first CLSCompliantAttribute that found.
4347 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
4348 (VerifyClsCompliance): Override and add extra tests.
4350 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
4351 clscheck- disable CLS-Compliant verification event if assembly is has
4352 CLSCompliantAttribute(true).
4354 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
4355 ApllyAttribute is now called in emit section as in the other cases.
4356 Possible future Emit integration.
4357 (IsIdentifierClsCompliant): New override.
4358 (VerifyClsCompliance): New override.
4359 (GetEnumeratorName): Returns full enum name.
4361 * parameter.cs (GetSignatureForError): Implemented.
4363 * report.cs (WarningData): New struct for Warning message information.
4364 (LocationOfPreviousError): New method.
4365 (Warning): New method. Reports warning based on the warning table.
4366 (Error_T): New method. Reports error based on the error table.
4368 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
4369 verifications are done here.
4371 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
4373 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
4374 CLSCompliantAttribute.
4375 (all_imported_types): New member holds all imported types from other
4377 (LoadAllImportedTypes): New method fills static table with exported types
4378 from all referenced assemblies.
4379 (Modules): New property returns all assembly modules.
4381 2004-03-30 Miguel de Icaza <miguel@ximian.com>
4383 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
4384 throwing a parser error.
4386 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
4387 which removes the hardcoded get_/set_ prefixes for properties, as
4388 IL allows for the properties to be named something else.
4392 * expression.cs: Do not override operand before we know if it is
4395 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4397 * typemanager.cs: support for pinned variables.
4399 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4401 * decl.cs, typemanager.cs: Avoid using an arraylist
4402 as a buffer if there is only one result set.
4404 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
4406 * expression.cs: Make sure you cant call a static method
4407 with an instance expression, bug #56174.
4409 2004-03-29 Miguel de Icaza <miguel@ximian.com>
4411 * class.cs (IsDuplicateImplementation): Improve error reporting to
4412 flag 663 (method only differs in parameter modifier).
4414 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
4415 in preprocessor directives.
4417 * location.cs (LookupFile): Allow for the empty path.
4419 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
4420 better approach for some of that patch, but its failing with the
4421 CharSet enumeration. For now try/catch will do.
4423 * typemanager.cs: Do not crash if a struct does not have fields.
4426 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4428 * expression.cs: cs0213, cant fix a fixed expression.
4431 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4433 * cs-parser.jay: detect invalid embeded statements gracefully.
4436 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
4438 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
4441 the invocation type may not be a subclass of the tye of the item/
4442 The type of the item must be a subclass of the invocation item.
4447 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
4449 * attribute.cs: Added methods to get a string and a bool from an
4450 attribute. Required to information from AssemblyKeyFileAttribute,
4451 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
4452 * codegen.cs: Modified AssemblyName creation to include support for
4453 strongnames. Catch additional exceptions to report them as CS1548.
4454 * compiler.csproj: Updated include CryptoConvert.cs.
4455 * compiler.csproj.user: Removed file - user specific configuration.
4456 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
4457 Mono.Security assembly. The original class is maintained and tested in
4458 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
4459 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
4460 like CSC 8.0 (C# v2) supports.
4461 * Makefile: Added CryptoConvert.cs to mcs sources.
4462 * rootcontext.cs: Added new options for strongnames.
4464 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
4466 * driver.cs: For --expect-error, report error code `2'
4467 if the program compiled with no errors, error code `1' if
4468 it compiled with an error other than the one expected.
4470 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
4472 * compiler.csproj: Updated for Visual Studio .NET 2003.
4473 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
4474 * compiler.sln: Updated for Visual Studio .NET 2003.
4476 2004-03-24 Ravi Pratap M <ravi@ximian.com>
4478 * expression.cs: Fix bug #47234. We basically need to apply the
4479 rule that we prefer the conversion of null to a reference type
4480 when faced with a conversion to 'object' (csc behaviour).
4482 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
4484 * statement.cs: Shorter form for foreach, eliminates
4485 a local variable. r=Martin.
4487 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
4489 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
4490 checks if we can use brtrue/brfalse to test for 0.
4491 * expression.cs: use the above in the test for using brtrue/brfalse.
4494 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
4496 * expression.cs: Rewrite string concat stuff. Benefits:
4498 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
4499 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
4500 rather than a concat chain.
4502 * typemanager.cs: Add lookups for more concat overloads.
4504 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
4506 * expression.cs: Emit shorter il code for array init.
4523 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
4525 * statement.cs: Before, two switch blocks would be merged if the
4526 total size of the blocks (end_item - begin_item + 1) was less than
4527 two times the combined sizes of the blocks.
4529 Now, it will only merge if after the merge at least half of the
4534 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
4536 * class.cs : csc build fix for GetMethods(). See bug #52503.
4538 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
4540 * expression.cs: Make sure fp comparisons work with NaN.
4541 This fixes bug #54303. Mig approved this patch a long
4542 time ago, but we were not able to test b/c the runtime
4545 2004-03-19 Miguel de Icaza <miguel@ximian.com>
4547 * ecore.cs (TypExpr.GetHashCode): implement this overload.
4549 2004-03-19 Martin Baulig <martin@ximian.com>
4551 * class.cs (MemberCore.IsDuplicateImplementation): Check whether
4552 two overloads may unify for some type parameter substitutions and
4553 report a CS0408 if appropriate.
4555 2004-03-19 Martin Baulig <martin@ximian.com>
4557 * class.cs (MemberCore.IsDuplicateImplementation): Report the
4558 error here and not in our caller.
4560 2004-03-19 Martin Baulig <martin@ximian.com>
4562 * interface.cs: Completely killed this file.
4563 (Interface): We're now a TypeContainer and live in class.cs.
4565 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
4566 argument; we're now also called for interfaces.
4567 (TypeContainer.DefineMembers): Allow this method being called
4569 (TypeContainer.GetMethods): New public method; formerly known as
4570 Interface.GetMethod(). This is used by PendingImplementation.
4571 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
4572 it's now private and non-static.
4573 (Interface): Moved this here; it's now implemented similar to
4575 (Method, Property, Event, Indexer): Added `bool is_interface'
4576 argument to their .ctor's.
4577 (MemberBase.IsInterface): New public field.
4579 * cs-parser.jay: Create normal Method, Property, Event, Indexer
4580 instances instead of InterfaceMethod, InterfaceProperty, etc.
4581 (opt_interface_base): Removed; we now use `opt_class_base' instead.
4582 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
4584 2004-03-19 Martin Baulig <martin@ximian.com>
4586 * class.cs (MethodCore.IsDuplicateImplementation): New private
4587 method which does the CS0111 checking.
4588 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
4589 Use IsDuplicateImplementation().
4591 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
4593 * decl.cs (FindMemberToOverride): New method to find the correct
4594 method or property to override in the base class.
4596 - Make Method/Property use the above method to find the
4597 version in the base class.
4598 - Remove the InheritableMemberSignatureCompare as it is now
4601 This patch makes large code bases much faster to compile, as it is
4602 O(n) rather than O(n^2) to do this validation.
4604 Also, it fixes bug 52458 which is that nested classes are not
4605 taken into account when finding the base class member.
4607 Reviewed/Approved by Martin.
4609 2004-03-17 Martin Baulig <martin@ximian.com>
4611 * expression.cs (MemberAccess.DoResolve): Take the parent's number
4612 of type arguments into account; use the `real_num_type_args'
4613 approach like in DoResolveAsTypeStep().
4615 * generic.cs (GenericMemberAccess.DoResolve): Make this work for
4618 2004-03-17 Marek Safar <marek.safar@seznam.cz>
4620 * interface.cs: In all interface classes removed redundant
4621 member initialization.
4623 2004-03-16 Martin Baulig <martin@ximian.com>
4625 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
4627 2004-03-15 Miguel de Icaza <miguel@ximian.com>
4629 * decl.cs (DefineTypeAndParents): New helper method to define a
4630 type's containers before the type itself is defined; This is a
4631 bug exposed by the recent changes to Windows.Forms when an
4632 implemented interface was defined inside a class that had not been
4635 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
4637 (Check): Loop correctly to report errors modifiers
4638 (UNSAFE was not in the loop, since it was the same as TOP).
4640 * interface.cs: Every interface member now takes a ModFlags,
4641 instead of a "is_new" bool, which we set on the base MemberCore.
4643 Every place where we called "UnsafeOk" in the interface, now we
4644 call the proper member (InterfaceMethod.UnsafeOK) instead to get
4645 the unsafe settings from the member declaration instead of the
4646 container interface.
4648 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
4650 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
4651 `set_indexer_name' to the pending bits (one per type).
4653 We fixed a bug today that was picking the wrong method to
4654 override, since for properties the existing InterfaceMethod code
4655 basically ignored the method name. Now we make sure that the
4656 method name is one of the valid indexer names.
4658 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
4660 * support.cs (SeekableStreamReader): Keep track of stream byte
4661 positions and don't mix them with character offsets to the buffer.
4663 Patch from Gustavo Giráldez
4665 2004-03-15 Marek Safar <marek.safar@seznam.cz>
4667 * interface.cs (InterfaceSetGetBase): Removed double member
4668 initialization, base class does it as well.
4670 2004-03-13 Martin Baulig <martin@ximian.com>
4672 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
4673 when compiling corlib.
4675 2004-03-13 Miguel de Icaza <miguel@ximian.com>
4677 * convert.cs (ExplicitConversion): We were reporting an error on
4678 certain conversions (object_type source to a value type, when the
4679 expression was `null') before we had a chance to pass it through
4680 the user defined conversions.
4682 * driver.cs: Replace / and \ in resource specifications to dots.
4685 * class.cs: Add check for duplicate operators. Fixes 52477
4687 2004-03-11 Miguel de Icaza <miguel@ximian.com>
4689 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
4690 that are in the middle of the statements, not only at the end.
4693 * class.cs (TypeContainer.AddField): No longer set the
4694 `HaveStaticConstructor' flag, now we call it
4695 `UserDefineStaticConstructor' to diferentiate the slightly
4696 semantic difference.
4698 The situation is that we were not adding BeforeFieldInit (from
4699 Modifiers.TypeAttr) to classes that could have it.
4700 BeforeFieldInit should be set to classes that have no static
4705 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
4707 And most importantly Zoltan's comment:
4709 http://bugzilla.ximian.com/show_bug.cgi?id=44229
4711 "I think beforefieldinit means 'it's ok to initialize the type sometime
4712 before its static fields are used', i.e. initialization does not need
4713 to be triggered by the first access to the type. Setting this flag
4714 helps the JIT to compile better code, since it can run the static
4715 constructor at JIT time, and does not need to generate code to call it
4716 (possibly lots of times) at runtime. Unfortunately, mcs does not set
4717 this flag for lots of classes like String.
4719 csc sets this flag if the type does not have an explicit static
4720 constructor. The reasoning seems to be that if there are only static
4721 initalizers for a type, and no static constructor, then the programmer
4722 does not care when this initialization happens, so beforefieldinit
4725 This bug prevents the AOT compiler from being usable, since it
4726 generates so many calls to mono_runtime_class_init that the AOT code
4727 is much slower than the JITted code. The JITted code is faster,
4728 because it does not generate these calls if the vtable is type is
4729 already initialized, which is true in the majority of cases. But the
4730 AOT compiler can't do this."
4732 2004-03-10 Miguel de Icaza <miguel@ximian.com>
4734 * class.cs (MethodData.Emit): Refactor the code so symbolic
4735 information is generated for destructors; For some reasons we
4736 were taking a code path that did not generate symbolic information
4739 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
4741 * class.cs: Create a Constructor.CheckBase method that
4742 takes care of all validation type code. The method
4743 contains some code that was moved from Define.
4745 It also includes new code that checks for duplicate ctors.
4746 This fixes bug #55148.
4748 2004-03-09 Joshua Tauberer <tauberer@for.net>
4750 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
4751 a { ... }-style array creation invokes EmitStaticInitializers
4752 which is not good for reference-type arrays. String, decimal
4753 and now null constants (NullCast) are not counted toward
4754 static initializers.
4756 2004-03-05 Martin Baulig <martin@ximian.com>
4758 * location.cs (SourceFile.HasLineDirective): New public field;
4759 specifies whether the file contains or is referenced by a "#line"
4761 (Location.DefineSymbolDocuments): Ignore source files which
4762 either contain or are referenced by a "#line" directive.
4764 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
4766 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
4767 direct access to our parent, so check the method inline there.
4769 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
4771 * expression.cs (Invocation.EmitCall): Miguel's last commit
4772 caused a regression. If you had:
4777 In Foo the implict this would be null.
4779 2004-02-27 Miguel de Icaza <miguel@ximian.com>
4781 * expression.cs (Invocation.EmitCall): If the method is not
4782 virtual, do not emit a CallVirt to it, use Call.
4784 * typemanager.cs (GetFullNameSignature): Improve the method to
4785 cope with ".ctor" and replace it with the type name.
4787 * class.cs (ConstructorInitializer.Resolve): Now the method takes
4788 as an argument the ConstructorBuilder where it is being defined,
4789 to catch the recursive constructor invocations.
4791 2004-03-16 Martin Baulig <martin@ximian.com>
4793 * expression.cs (MemberAccess.DoResolve): If `expr' resolved to a
4794 ConstructedType, call ResolveType() on it to get the type rather
4795 than just using `expr.Type'.
4797 2004-03-16 Martin Baulig <martin@ximian.com>
4799 * generics.cs (ConstructedType.GetMemberAccess): Take the
4800 EmitContext instead on the TypeExpr and use
4801 ec.TypeContainer.CurrentType/ec.ContainerType.
4803 2004-03-16 Martin Baulig <martin@ximian.com>
4805 * ecore.cs (SimpleName.DoResolveAsTypeStep): Lookup type
4806 parameters before aliases.
4808 2004-03-16 Martin Baulig <martin@ximian.com>
4810 * typemanager.cs (TypeManager.MayBecomeEqualGenericInstances):
4811 New oublic function; checks whether two generic instances may become
4812 equal under some instantiations (26.3.1).
4814 * class.cs (TypeContainer.Define): Call
4815 TypeManager.MayBecomeEqualGenericInstances() and report CS0695 on
4818 2004-03-16 Martin Baulig <martin@ximian.com>
4820 * class.cs (TypeContainer.GetClassBases): Moved
4821 Error_TypeParameterAsBase() here and also check whether the base
4822 class is not an attribute.
4824 2004-03-16 Martin Baulig <martin@ximian.com>
4826 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
4828 2004-03-16 Martin Baulig <martin@ximian.com>
4830 * class.cs (Error_TypeParameterAsBase): Use correct error number
4833 2004-03-16 Martin Baulig <martin@ximian.com>
4835 * decl.cs (DeclSpace.ResolveTypeExpr): Added more error checking
4838 * generics.cs (ConstructedType.DoResolveAsTypeStep): Added better
4841 2004-03-15 Martin Baulig <martin@ximian.com>
4843 * typemanager.cs (TypeManager.GetFullName): New public method.
4844 (TypeManager.MemberLookup): Added `int_num_type_arguments'
4845 argument; only return members with the correct number of type
4847 (TypeManager.CheckGeneric): Allow -1 to bypass the check.
4848 (TypeManager.FilterWithClosure): Call CheckGeneric() to check
4849 whether the number of type arguments matches.
4851 * generic.cs (GenericMemberAccess.ResolveAsTypeStep): Allow `expr'
4852 not being a ConstructedType; we can now do "typeof (Foo.Bar<U>)".
4854 * expression.cs (MemberAccess): Added public `NumTypeArguments'
4855 field; it's set by the protected .ctor when we're actually a
4856 GenericMemberAccess.
4857 (MemberAccess.ResolveAsTypeStep): Compute the total number of type
4858 arguments and pass it to MemberLookupFinal ().
4860 * ecore.cs (Expression.MemberLookup): Added `int
4861 num_type_arguments' argument; only return members with the correct
4862 number of type arguments.
4863 (Expression.MemberLookupFailed): Check whether the MemberLookup
4864 failed because we did not have the correct number of type
4865 arguments; report CS0305 in this case.
4867 * decl.cs (DeclSpace.ResolveTypeExpr): Don't report an error if
4868 `e.ResolveAsTypeTerminal()' already did so.
4870 2004-03-15 Martin Baulig <martin@ximian.com>
4872 * ecore.cs (Expression.ResolveLValue): Allow e.type being null if
4873 we're a ConstructedType; in this case, the caller must report an
4874 error (for instance CS0131).
4876 * generic.cs (TypeArguments): Added Location argument to the .ctor.
4877 (TypeArguments.Resolve): Actually report errors here.
4879 2004-03-15 Miguel de Icaza <miguel@ximian.com>
4881 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
4882 `set_indexer_name' to the pending bits (one per type).
4884 We fixed a bug today that was picking the wrong method to
4885 override, since for properties the existing InterfaceMethod code
4886 basically ignored the method name. Now we make sure that the
4887 method name is one of the valid indexer names.
4889 2004-03-15 Martin Baulig <martin@ximian.com>
4891 * typemanager.cs (TypeManager.IndexerPropertyName): Added support
4892 for generic instances.
4894 2004-03-13 Martin Baulig <martin@ximian.com>
4896 * class.cs (TypeContainer.DefineType): Call
4897 TypeManager.AddUserType() immediately after creating the
4898 TypeBuilder; pass all type parameters when creating the
4901 * decl.cs (DeclSpace.FindNestedType): New public method.
4902 (DeclSpace.FindType): Added `int num_type_args' argument; only
4903 return types with the correct number of type parameters.
4904 (DeclSpace.CountTypeParams): New public property.
4906 * ecore.cs (SimpleName.ctor): Added overloaded version which takes
4907 the number of type parameters; defaults to zero.
4909 * generic.cs (TypeArguments.Count): New public property.
4910 (ConstructedType.DoResolveAsTypeStep): First call
4911 ds.FindNestedType() to find out whether we're nested in the
4912 current generic type; in this case, we inherit all type parameters
4913 from the current class.
4915 * rootcontext.cs (RootContext.NamespaceLookup): Added `int
4916 num_type_args' argument.
4917 (RootContext.LookupType): Added overloaded version which takes the
4918 number of type arguments; only return types with the correct
4919 number of type arguments.
4921 * typemanager.cs (TypeManager.CheckGeneric): New public function;
4922 checks whether `Type t' has `int num_type_args'.
4924 2004-03-13 Martin Baulig <martin@ximian.com>
4926 * generic.cs (GenericMethod.DefineType): New method; calls
4927 DefineType() on all the type parameters.
4929 * class.cs (MethodData.ctor): Added `GenericMethod generic' argument.
4930 (MethodData.Define): If we're a generic method, call
4931 GenericMethod.DefineType() to define the type parameters.
4933 2004-03-10 Martin Baulig <martin@ximian.com>
4935 * pending.cs (Pending.InterfaceMethod): Use TypeManager.IsEqual()
4936 instead of IsAssignableFrom.
4938 2004-03-10 Martin Baulig <martin@ximian.com>
4940 * ecore.cs (FieldExpr.ctor): Use TypeManager.TypeToCoreType().
4942 * support.cs (ParameterData.HasArrayParameter): New property.
4943 (ReflectionParameters.ctor): Take a MethodBase instead of a
4944 ParameterInfo[]. If we have any type parameters, get the generic
4945 method definition and ask it whether we have variable arguments.
4947 2004-02-26 Miguel de Icaza <miguel@ximian.com>
4949 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
4950 routines to check if a type is an enumerable/enumerator allow
4951 classes that implement the IEnumerable or IEnumerator interfaces.
4953 * class.cs (Property, Operator): Implement IIteratorContainer, and
4954 implement SetYields.
4956 (Property.Define): Do the block swapping for get_methods in the
4957 context of iterators. We need to check if Properties also
4958 include indexers or not.
4960 (Operator): Assign the Block before invoking the
4961 OperatorMethod.Define, so we can trigger the Iterator code
4964 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
4965 Property and Operator classes are not created when we parse the
4966 declarator but until we have the block completed, so we use a
4967 singleton SimpleIteratorContainer.Simple to flag whether the
4968 SetYields has been invoked.
4970 We propagate this setting then to the Property or the Operator to
4971 allow the `yield' to function.
4973 2004-02-25 Marek Safar <marek.safar@seznam.cz>
4975 * codegen.cs: Implemented attribute support for modules.
4976 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
4977 Assembly/Module functionality.
4979 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
4980 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
4981 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
4983 2004-02-16 Marek Safar <marek.safar@seznam.cz>
4985 * interface.cs (FindMembers): The operation is performed on all base
4986 interfaces and not only on the first. It is required for future CLS Compliance patch.
4988 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
4990 * statement.cs, codegen.cs:
4991 This patch deals with patterns such as:
4993 public class List : IEnumerable {
4995 public MyEnumerator GetEnumerator () {
4996 return new MyEnumerator(this);
4999 IEnumerator IEnumerable.GetEnumerator () {
5003 public struct MyEnumerator : IEnumerator {
5008 Before, there were a few things we did wrong:
5009 1) we would emit callvirt on a struct, which is illegal
5010 2) we emited ldarg when we needed to emit ldarga
5011 3) we would mistakenly call the interface methods on an enumerator
5012 type that derived from IEnumerator and was in another assembly. For example:
5014 public class MyEnumerator : IEnumerator
5016 Would have the interface methods called, even if there were public impls of the
5017 method. In a struct, this lead to invalid IL code.
5019 2004-02-11 Marek Safar <marek.safar@seznam.cz>
5021 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
5024 * delegate.cs (Define): Fixed crash when delegate type is undefined.
5026 2004-02-11 Miguel de Icaza <miguel@ximian.com>
5028 * cs-parser.jay: Fix small regression: we were not testing V2
5029 compiler features correctly.
5031 * interface.cs: If the emit context is null, then create one
5033 2004-02-09 Marek Safar <marek.safar@seznam.cz>
5035 * decl.cs (GetSignatureForError): New virtual method to get full name
5038 * attribute.cs (IAttributeSupport): New interface for attribute setting.
5039 Now it is possible to rewrite ApplyAttributes method to be less if/else.
5041 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
5042 Duplicated members and code in these classes has been removed.
5043 Better encapsulation in these classes.
5045 2004-02-07 Miguel de Icaza <miguel@ximian.com>
5047 * assign.cs (Assign.DoResolve): When dealing with compound
5048 assignments, there is a new rule in ECMA C# 2.4 (might have been
5049 there before, but it is documented here) that states that in:
5053 If b is of type int, and the `op' is a shift-operator, then the
5054 above is evaluated as:
5058 * expression.cs (Binary.ResolveOperator): Instead of testing for
5059 int/uint/long/ulong, try to implicitly convert to any of those
5060 types and use that in pointer arithmetic.
5062 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
5063 method to print information for from the type, not from the
5064 null-method we were given.
5066 2004-02-01 Duncan Mak <duncan@ximian.com>
5068 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
5069 parsing for cmd, fixes bug #53694.
5071 2004-02-04 Marek Safar <marek.safar@seznam.cz>
5073 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
5074 in the member name duplication tests. Property and operator name duplication
5075 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
5077 2004-02-03 Marek Safar <marek.safar@seznam.cz>
5079 * interface.cs (PopulateMethod): Fixed crash when interface method
5080 returns not existing type (error test cs0246-3.cs).
5082 2004-02-02 Ravi Pratap M <ravi@ximian.com>
5084 * cs-parser.jay (interface_accessors): Re-write actions to also
5085 store attributes attached to get and set methods. Fix spelling
5088 (inteface_property_declaration): Modify accordingly.
5090 (InterfaceAccessorInfo): New helper class to store information to pass
5091 around between rules that use interface_accessors.
5093 * interface.cs (Emit): Apply attributes on the get and set
5094 accessors of properties and indexers too.
5096 * attribute.cs (ApplyAttributes): Modify accordingly to use the
5097 right MethodBuilder when applying attributes to the get and set accessors.
5099 2004-01-31 Miguel de Icaza <miguel@ximian.com>
5101 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
5103 2004-01-26 Miguel de Icaza <miguel@ximian.com>
5105 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
5107 2004-01-25 Miguel de Icaza <miguel@ximian.com>
5109 * cs-parser.jay: Remove YIELD token, instead use the new grammar
5110 changes that treat `yield' specially when present before `break'
5113 * cs-tokenizer.cs: yield is no longer a keyword.
5115 2004-01-23 Marek Safar <marek.safar@seznam.cz>
5117 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
5118 setting for default constructors.
5119 For default constructors are almost every time set wrong Modifier. The
5120 generated IL code has been alright. But inside mcs this values was
5121 wrong and this was reason why several of my CLS Compliance tests
5124 2004-02-27 Martin Baulig <martin@ximian.com>
5126 * generics.cs (ConstructedType.ResolveType): Make the nested type
5127 stuff actually work.
5129 2004-02-25 Martin Baulig <martin@ximian.com>
5131 * decl.cs (DeclSpace.CurrentTypeParameters): New protected
5132 property; returns the type parameters just from the current type,
5133 ie. with the ones from outer classes.
5134 (DeclSpace.LookupGeneric): First search in the current class, then
5136 (DeclSpace.initialize_type_params): When hiding a type parameter
5137 from an outer class, put it into the `type_param_list' anyways.
5139 * expression.cs (MemberAccess.expr): Made this field protected.
5141 * class.cs (TypeContainer.Define): The `CurrentType' just contains
5142 the type parameters from the current class.
5144 * generic.cs (ConstructedType.ResolveType): Support nested generic
5145 types by taking the type parameters which we inherit from outer
5146 classes into account.
5147 (GenericMemberAccess.ResolveAsTypeStep): Override this and added
5148 support for nested generic types.
5150 2004-02-23 Martin Baulig <martin@ximian.com>
5152 * decl.cs (DeclSpace.IsGeneric): Make this a property instead of a
5153 field and check whether we're nested inside a generic type.
5154 (DeclSpace.ResolveType): If we're resolving to a generic type
5155 definition, create a ConstructedType and return its resolved type.
5156 (DeclSpace.initialize_type_params): New private method;
5157 initializes the `type_param_list' field from the type parameters
5158 from this and all enclosing classes.
5159 (DeclSpace.TypeParameters): Call initialize_type_params() unless
5160 we're already initialized.
5162 2004-02-23 Martin Baulig <martin@ximian.com>
5164 * class.cs (Method.Define): Create the generic method before
5166 (Memberbase.DoDefine): Added DeclSpace argument (in addition to
5167 the TypeContainer one); we use this for generic methods.
5169 * decl.cs (CheckAccessLevel): If we're a GenericMethod, use our
5170 parent's TypeBuilder.
5172 2004-02-18 Martin Baulig <martin@ximian.com>
5174 * ecore.cs (FieldExpr.DoResolveLValue): Use TypeManager.IsEqual()
5175 to check for equality.
5177 2004-02-05 Martin Baulig <martin@ximian.com>
5179 * ecore.cs (FieldExpr.DoResolveLValue): If we have an
5180 `ec.TypeContainer.CurrentType', use it instead of
5181 `ec.ContainerType' to check whether we're in the type's ctor.
5183 2004-01-29 Martin Baulig <martin@ximian.com>
5185 * expression.cs (Invocation.DoResolve): If we're a
5186 `ConstructedType', then we're actually a generic method, so
5187 rewrite the expr as a GenericMemberAccess.
5189 * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
5190 here; manually parse it into a string.
5192 2004-01-28 Martin Baulig <martin@ximian.com>
5194 * typemanager.cs (TypeManager.IsEqual): New static method.
5195 (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
5196 check for equality instead of using `=='.
5198 2004-01-26 Martin Baulig <martin@ximian.com>
5200 * decl.cs (DeclSpace.CurrentType): New public field.
5202 * expression.cs (This.ResolveBase): If we have an
5203 `ec.TypeContainer.CurrentType', use it instead of
5206 * class.cs (TypeContainer.DefineType): If we're a generic type,
5207 create the `CurrentType' (unresolved).
5208 (TypeContainer.GenericType): New private field.
5209 (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
5210 it and store it in `GenericType' before creating the MemberCache.
5211 (TypeContainer.GetMembers): If we have a `GenericType', call
5212 TypeManager.FindMembers() on it.
5214 * interface.cs (Interface.GenericType): New private field.
5215 (Interface.DefineType): If we're a generic type, create the
5216 `CurrentType' (unresolved).
5217 (Interface.DefineMembers): If we have a `CurrentType', resolve it
5218 and store it in `GenericType' before creating the MemberCache.
5219 (Interface.GetMembers): If we have a `GenericType', call
5220 TypeManager.FindMembers() on it.
5222 2004-01-22 Martin Baulig <martin@ximian.com>
5224 * cs-parser.jay (namespace_or_type_name): Return an Expression,
5225 not a QualifiedIdentifier. This is what `type_name_expression'
5226 was previously doing.
5227 (type_name_expression): Removed; the code is now in
5228 `namespace_or_type_name'.
5229 (qualified_identifier): Removed, use `namespace_or_type_name'
5231 (QualifiedIdentifier): Removed this class.
5233 2004-01-22 Martin Baulig <martin@ximian.com>
5235 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
5236 not a string as alias name.
5238 2004-01-21 Miguel de Icaza <miguel@ximian.com>
5240 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
5241 #52730 bug, and instead compute correctly the need to use a
5242 temporary variable when requesting an address based on the
5243 static/instace modified of the field and the constructor.
5245 2004-01-21 Martin Baulig <martin@ximian.com>
5247 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
5248 class and namespace before looking up aliases. Fixes #52517.
5250 2004-01-21 Martin Baulig <martin@ximian.com>
5252 * flowanalysis.cs (UsageVector.Merge): Allow variables being
5253 assinged in a 'try'; fixes exception4.cs.
5255 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5256 * class.cs : Implemented parameter-less constructor for TypeContainer
5258 * decl.cs: Attributes are now stored here. New property OptAttributes
5260 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
5262 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
5264 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5266 * typemanager.cs (CSharpSignature): Now reports also inner class name.
5267 (CSharpSignature): New method for indexer and property signature.
5269 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5271 * pending.cs (IsVirtualFilter): Faster implementation.
5273 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5275 * typemanager.cs: Avoid inclusion of same assembly more than once.
5277 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5279 * cs-parser.jay: Fixed problem where the last assembly attribute
5280 has been applied also to following declaration (class, struct, etc.)
5282 2004-01-21 Marek Safar <marek.safar@seznam.cz>
5284 * class.cs: Added error CS0538, CS0539 reporting.
5285 Fixed crash on Microsoft runtime when field type is void.
5287 * cs-parser.jay: Added error CS0537 reporting.
5289 * pending.cs: Added error CS0535 reporting.
5290 Improved error report for errors CS0536, CS0534.
5292 2004-01-20 Miguel de Icaza <miguel@ximian.com>
5294 Merge a few bits from the Anonymous Method MCS tree.
5296 * statement.cs (ToplevelBlock): New class for toplevel methods,
5297 will hold anonymous methods, lifted variables.
5299 * cs-parser.jay: Create toplevel blocks for delegates and for
5300 regular blocks of code.
5302 2004-01-20 Martin Baulig <martin@ximian.com>
5304 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
5305 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
5306 and `NeedExplicitReturn'; added `IsLastStatement'.
5307 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
5308 have a `ReturnLabel' or we're not unreachable.
5310 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
5311 child's reachability; don't just override ours with it. Fixes
5312 #58058 (lluis's example).
5313 (FlowBranching): Added public InTryOrCatch(), InCatch(),
5314 InFinally(), InLoop(), InSwitch() and
5315 BreakCrossesTryCatchBoundary() methods.
5317 * statement.cs (Return): Do all error checking in Resolve().
5318 Unless we are the last statement in a top-level block, always
5319 create a return label and jump to it.
5320 (Break, Continue): Do all error checking in Resolve(); also make
5321 sure we aren't leaving a `finally'.
5322 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
5323 statement in a top-level block.
5324 (Block.Flags): Added `IsDestructor'.
5325 (Block.IsDestructor): New public property.
5327 2004-01-20 Martin Baulig <martin@ximian.com>
5329 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
5331 2004-01-20 Martin Baulig <martin@ximian.com>
5333 * statement.cs (Statement.ResolveUnreachable): New public method.
5334 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
5335 (Block.Resolve): Resolve unreachable statements.
5337 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5339 * expression.cs: We need to fix the case where we do
5340 not have a temp variable here.
5342 * assign.cs: Only expression compound assignments need
5343 temporary variables.
5345 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
5347 * flowanalysis.cs: Reduce memory allocation in a few ways:
5348 - A block with no variables should not allocate a bit
5350 - A method with no out parameters does not need any tracking
5351 for assignment of the parameters, so we need not allocate
5354 public readonly Type[] VariableTypes;
5355 public readonly string[] VariableNames;
5356 Are redundant. The data is already stored in the variable
5357 map, so we need not allocate another array for it.
5358 - We need to add alot of checks for if (params | locals) == null
5359 due to the first two changes.
5361 2004-01-18 Miguel de Icaza <miguel@ximian.com>
5363 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
5364 implement IMemoryLocation, we store a copy on a local variable and
5365 take the address of it. Patch from Benjamin Jemlich
5367 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
5368 to use a special "type_name_expression" rule which reduces the
5369 number of "QualifiedIdentifier" classes created, and instead
5370 directly creates MemberAccess expressions.
5372 2004-01-17 Miguel de Icaza <miguel@ximian.com>
5374 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
5375 that fixes #52853. Null literal assignment to ValueType
5377 * class.cs (MethodData.Emit): Instead of checking the name of the
5378 method to determine if its a destructor, create a new derived
5379 class from Method called Destructor, and test for that.
5381 * cs-parser.jay: Create a Destructor object instead of a Method.
5383 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
5387 2004-01-16 Miguel de Icaza <miguel@ximian.com>
5389 * expression.cs (Binary.ResolveOperator): Perform an implicit
5390 conversion from MethodGroups to their delegate types on the
5393 * delegate.cs: Introduce a new class DelegateCreation that is the
5394 base class for `NewDelegate' and `ImplicitDelegateCreation',
5395 factor some code in here.
5397 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
5398 conversion from MethodGroups to compatible delegate types.
5400 * ecore.cs (Expression.Resolve): Do not flag error 654
5401 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
5402 we allow conversions from MethodGroups to delegate types now.
5404 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
5405 assignments in v2 either.
5407 2004-01-10 Miguel de Icaza <miguel@ximian.com>
5409 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
5410 static read-only fields in ctors.
5412 Applied patch from Benjamin Jemlich
5414 * expression.cs (UnaryMutator): Avoid leaking local variables.
5416 2004-01-09 Miguel de Icaza <miguel@ximian.com>
5418 * cs-tokenizer.cs (IsCastToken): Allow the various native types
5419 here to return true, as they can be used like this:
5423 Fixed 49836 and all the other dups
5425 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
5427 * driver.cs: Implement /win32res and /win32icon.
5429 2004-01-08 Miguel de Icaza <miguel@ximian.com>
5431 * cs-parser.jay: Add a rule to improve error handling for the
5432 common mistake of placing modifiers after the type.
5434 2004-01-07 Miguel de Icaza <miguel@ximian.com>
5436 * cs-parser.jay (interface_event_declaration): Catch
5437 initialization of events on interfaces, and report cs0068
5439 * cs-parser.jay (interface_event_declaration): Catch
5440 initialization of events.
5442 * ecore.cs: Better report missing constructors.
5444 * expression.cs (Binary.ResolveOperator): My previous bug fix had
5445 the error reporting done in the wrong place. Fix.
5447 * expression.cs (Binary.ResolveOperator): Catch the
5448 operator + (E x, E y) error earlier, and later allow for implicit
5449 conversions in operator +/- (E e, U x) from U to the underlying
5452 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
5453 52596, if the container class is abstract, the default constructor
5454 is protected otherwise its public (before, we were always public).
5456 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
5459 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
5460 Jemlich that fixes bug #52597, MCS was generating invalid code for
5461 idisposable structs. Thanks to Ben for following up with this
5464 2004-01-06 Miguel de Icaza <miguel@ximian.com>
5466 * driver.cs: Allow assemblies without code to be generated, fixes
5469 2004-01-07 Nick Drochak <ndrochak@gol.com>
5471 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
5473 2004-01-05 Miguel de Icaza <miguel@ximian.com>
5475 * cs-parser.jay: Add rules to improve error reporting if fields or
5476 methods are declared at the namespace level (error 116)
5478 * Add rules to catch event add/remove
5480 2004-01-04 David Sheldon <dave-mono@earth.li>
5482 * expression.cs: Added matching ")" to error message for
5485 2004-01-03 Todd Berman <tberman@gentoo.org>
5487 * ecore.cs, attribute.cs:
5488 Applying fix from #52429.
5490 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5492 * ecore.cs, expression.cs, statement.cs:
5493 Total rewrite of how we handle branching. We
5494 now handle complex boolean expressions with fewer
5495 jumps. As well if (x == 0) no longer emits a ceq.
5497 if (x is Foo) is much faster now, because we generate
5500 Overall, we get a pretty big improvement on our benchmark
5501 tests. The code we generate is smaller and more readable.
5503 I did a full two-stage bootstrap. The patch was reviewed
5504 by Martin and Miguel.
5506 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5508 * cs-parser.jay: Make primary_expression not take a QI.
5509 we dont need this because the member_access rule covers
5510 us here. So we replace the rule with just IDENTIFIER.
5512 This has two good effects. First, we remove a s/r conflict.
5513 Second, we allocate many fewer QualifiedIdentifier objects.
5515 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5517 * attribute.cs: Handle MarshalAs attributes as pseudo, and
5518 set the correct information via SRE. This prevents
5519 hanging on the MS runtime. Fixes #29374.
5521 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
5523 * convert.cs: correctly handle conversions to value types
5524 from Enum and ValueType as unboxing conversions.
5526 Fixes bug #52569. Patch by Benjamin Jemlich.
5528 2004-01-02 Ravi Pratap <ravi@ximian.com>
5530 * expression.cs (BetterConversion): Prefer int -> uint
5531 over int -> ulong (csc's behaviour). This fixed bug #52046.
5533 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
5535 * decl.cs (MemberCache.FindMembers): now returns a
5538 * typemanager.cs: In general, go with with ^^.
5539 (CopyNewMethods): take an IList.
5540 (RealMemberLookup): Only allocate an arraylist
5541 if we copy from two sets of methods.
5543 This change basically does two things:
5544 1) Fewer array lists allocated due to CopyNewMethods.
5545 2) the explicit cast in MemberList costed ALOT.
5547 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
5549 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
5550 a hashtable to avoid needless string allocations when an identifier is
5551 used more than once (the common case).
5553 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
5555 * pending.cs: MS's TypeBuilder.GetInterfaces ()
5556 is broken, it will not return anything. So, we
5557 have to use the information we have in mcs to
5560 * typemanager.cs: Add a cache for GetInterfaces,
5561 since this will now be used more often (due to ^^)
5563 (GetExplicitInterfaces) New method that gets the
5564 declared, not effective, interfaces on a type
5565 builder (eg, if you have interface IFoo, interface
5566 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
5569 This patch makes MCS able to bootstrap itself on
5572 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
5574 * expression.cs: Remove the Nop's that Miguel put
5577 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5579 * report.cs, codegen.cs: Give the real stack trace to
5580 the error when an exception is thrown.
5582 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5584 * decl.cs: only allocate hashtables for ifaces if
5587 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
5589 * expression.cs: fix the error from cs0121-2.cs
5590 (a parent interface has two child interfaces that
5591 have a function with the same name and 0 params
5592 and the function is called through the parent).
5594 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
5596 * class.cs, rootcontext.cs, typmanager.cs: do not
5599 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
5601 * codegen.cs: remove stack for the ec flow branching.
5602 It is already a linked list, so no need.
5604 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
5606 * Makefile: Allow custom profiler here.
5608 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
5610 * typemanager.cs (LookupType):
5611 - Use a static char [], because split takes
5612 a param array for args, so it was allocating
5614 - Do not store true in a hashtable, it boxes.
5616 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
5618 * flowanalysis.cs: bytify common enums.
5620 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5622 * modifiers.cs: Add a new set of flags for the
5623 flags allowed on explicit interface impls.
5624 * cs-parser.jay: catch the use of modifiers in
5625 interfaces correctly.
5626 * class.cs: catch private void IFoo.Blah ().
5628 All related to bug #50572.
5630 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5632 * decl.cs: Rewrite the consistant accessability checking.
5633 Accessability is not linear, it must be implemented in
5634 a tableish way. Fixes #49704.
5636 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
5638 * expression.cs: Handle negation in a checked context.
5639 We must use subtraction from zero. Fixes #38674.
5641 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
5643 * class.cs: Ignore static void main in DLLs.
5644 * rootcontext.cs: Handle the target type here,
5645 since we are have to access it from class.cs
5646 * driver.cs: account for the above.
5648 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
5650 * report.cs: Give line numbers and files if available.
5652 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
5654 * driver.cs: Implement /addmodule.
5656 * typemanager.cs: Change 'modules' field so it now contains Modules not
5659 2003-12-20 Martin Baulig <martin@ximian.com>
5661 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
5662 (FieldBase.IsAssigned): Removed this field.
5663 (FieldBase.SetAssigned): New public method.
5664 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
5666 2003-12-20 Martin Baulig <martin@ximian.com>
5668 * expression.cs (LocalVariableReference.DoResolve): Don't set
5669 `vi.Used' if we're called from DoResolveLValue().
5671 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
5672 returns the usage vector it just merged into the current one -
5673 pass this one to UsageWarning().
5674 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
5675 of the `EmitContext', don't call this recursively on our children.
5677 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
5679 * driver.cs: Implement /target:module.
5681 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
5683 * support.cs (CharArrayHashtable): New helper class.
5685 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
5686 char arrays, not strings, so we can avoid creating a string in
5687 consume_identifier if the identifier is a keyword.
5689 2003-12-16 Martin Baulig <martin@ximian.com>
5691 * statement.cs (LocalInfo.Assigned): Removed this property.
5692 (LocalInfo.Flags): Removed `Assigned'.
5693 (LocalInfo.IsAssigned): New public method; takes the EmitContext
5694 and uses flow analysis.
5695 (Block.UsageWarning): Made this method private.
5696 (Block.Resolve): Call UsageWarning() if appropriate.
5698 * expression.cs (LocalVariableReference.DoResolve): Always set
5699 LocalInfo.Used here.
5701 2003-12-13 Martin Baulig <martin@ximian.com>
5703 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
5704 any value here; we're now using flow analysis to figure out
5705 whether a statement/block returns a value.
5707 2003-12-13 Martin Baulig <martin@ximian.com>
5709 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
5711 (FlowBranching.MergeFinally): Don't call
5712 `branching.CheckOutParameters()' here, this is called in
5714 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
5715 when adding the `finally' vector.
5717 2003-12-13 Martin Baulig <martin@ximian.com>
5720 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
5721 actually work and also fix #48962.
5723 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
5725 * decl.cs: Do not check System.Object for nested types,
5726 since we know it does not have any. Big bang for buck:
5731 corlib: 17.99 seconds
5735 corlib: 17.39 seconds
5737 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
5739 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
5740 time we are returning 0 members, so we save alot here.
5742 2003-12-11 Martin Baulig <martin@ximian.com>
5744 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
5745 `MergeChild()', also just take the `FlowBranching' as argument;
5746 call Merge() on it and return the result.
5747 (FlowBranching.Merge): We don't need to do anything if we just
5750 2003-12-11 Martin Baulig <martin@ximian.com>
5752 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
5753 them in an `ArrayList' to reduce memory usage. Thanks to Ben
5754 Maurer for this idea.
5756 2003-12-11 Martin Baulig <martin@ximian.com>
5758 * flowanalysis.cs (MergeResult): This class is now gone; we now
5759 use the `UsageVector' for this. The reason for this is that if a
5760 branching just has one sibling, we don't need to "merge" them at
5761 all - that's the next step to do.
5762 (FlowBranching.Merge): We now return a `UsageVector' instead of a
5765 2003-12-11 Martin Baulig <martin@ximian.com>
5767 Reworked flow analyis and made it more precise and bug-free. The
5768 most important change is that we're now using a special `Reachability'
5769 class instead of having "magic" meanings of `FlowReturns'. I'll
5770 do some more cleanups and optimizations and also add some more
5771 documentation this week.
5773 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
5774 largely reworked this class.
5775 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
5776 the new `Reachability' class instead of having "magic" values here.
5777 (FlowBranching): We're now using an instance of `Reachability'
5778 instead of having separate `Returns', `Breaks' etc. fields.
5780 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
5781 based on flow analysis; ignore the return value of block.Emit ().
5783 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
5785 * driver.cs typemanager.cs: Find the mono extensions to corlib even
5786 if they are private.
5788 2003-12-09 Martin Baulig <martin@ximian.com>
5790 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
5791 call them directly on the UsageVector.
5793 2003-12-09 Martin Baulig <martin@ximian.com>
5795 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
5796 Changed return type from `FlowReturns' to `Reachability'.
5798 2003-12-09 Martin Baulig <martin@ximian.com>
5800 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
5801 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
5802 `Reachable' fields with a single `Reachability' one.
5804 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
5806 * class.cs (FindMembers): Remove foreach's.
5819 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
5824 This patch does a few things:
5825 1. EmptyStatement is now a singleton, so it is never reallocated.
5826 2. All blah is EmptyStatement constructs have been changed to
5827 blah == EmptyStatement.Value, which is much faster and valid
5828 now that EmptyStatement is a singleton.
5829 3. When resolving a block, rather than allocating a new array for
5830 the non-empty statements, empty statements are replaced with
5831 EmptyStatement.Value
5832 4. Some recursive functions have been made non-recursive.
5833 Mainly the performance impact is from (3), however (1) and (2) are needed for
5834 this to work. (4) does not make a big difference in normal situations, however
5835 it makes the profile look saner.
5840 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
5841 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
5842 Total memory allocated: 56397 KB
5845 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
5846 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
5847 Total memory allocated: 55666 KB
5849 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
5851 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
5852 than the hashtable in a hashtable version
5854 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
5855 we always end up concating a string. This results in a huge perf
5856 loss, because many strings have to be tracked by the GC. In this
5857 patch, we first use a hashtable that works with two keys, so that
5858 the strings do not need to be concat'ed.
5869 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
5871 * Makefile: Add a new target `do-time' that does a quick and simple
5872 profile, leaving easy to parse output.
5874 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
5876 * codegen.cs (Init): Create the dynamic assembly with
5877 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
5879 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
5881 * support.cs: Make the PtrHashtable use only one
5882 instance of its comparer.
5884 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
5886 * typemanager.cs: Fix lookup of GetNamespaces.
5888 2003-11-29 Miguel de Icaza <miguel@ximian.com>
5890 * expression.cs: Removed redundant line.
5892 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
5893 ArrayLists, use for loops with bounds.
5895 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
5898 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
5899 arraylists, use for loop with bounds.
5901 The above three changes give us a 0.071 second performance
5902 improvement out of 3.294 seconds down to 3.223. On my machine
5903 the above changes reduced the memory usage by 1,387 KB during
5906 * cs-parser.jay (QualifiedIdentifier): New class used to represent
5907 QualifiedIdentifiers. Before we created a new string through
5908 concatenation, and mostly later on, the result would be
5909 manipulated by DecomposeQI through string manipulation.
5911 This reduced the compiler memory usage for bootstrapping from
5912 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
5913 compile times in 0.05 seconds.
5915 2003-11-28 Dick Porter <dick@ximian.com>
5917 * support.cs: Do string compares with the Invariant culture.
5925 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
5926 the comparison is done with the Invariant culture.
5928 2003-11-27 Miguel de Icaza <miguel@ximian.com>
5930 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
5931 GetEnumerator method.
5933 (ProbeCollectionType): Iterate starting at the most specific type
5934 upwards looking for a GetEnumerator
5936 * expression.cs: Shift count can be up to 31 for int/uint and 63
5939 2003-11-26 Miguel de Icaza <miguel@ximian.com>
5941 * statement.cs (Block.LookupLabel): Also look for the label on the
5942 children blocks. Use a hash table to keep track of visited
5945 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
5946 we actually did transform the other operand, otherwise fall back
5947 to the common codepath that casts to long.
5949 * cs-tokenizer.cs: Use the same code pattern as the int case.
5950 Maybe I should do the parsing myself, and avoid depending on the
5951 Parse routines to get this done.
5953 2003-11-25 Miguel de Icaza <miguel@ximian.com>
5955 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
5956 which fixes bug 51347. This time test it.
5958 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
5959 attributes for example can not tell the difference between these.
5960 The difference was only a syntax feature of the language.
5962 * attribute.cs: Apply attributes to delegates.
5964 * delegate.cs: Call the apply attributes method.
5966 2003-11-24 Miguel de Icaza <miguel@ximian.com>
5968 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
5969 comparing 0 vs Byte.MinValue, not the value
5971 (ImplicitConversionRequired): When reporting a conversion error,
5972 use error 31 to print out the constant error instead of the
5975 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
5976 which fixes bug 51347.
5978 2003-11-22 Miguel de Icaza <miguel@ximian.com>
5980 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
5981 which fixes the -warnaserror command line option.
5983 2003-11-21 Miguel de Icaza <miguel@ximian.com>
5985 * cfold.cs (DoNumericPromotions): During constant folding of
5986 additions on UIntConstant, special case intconstants with
5987 IntConstants like we do on the expression binary operator.
5989 2003-11-12 Miguel de Icaza <miguel@ximian.com>
5991 * convert.cs (ImplicitReferenceConversion): We were missing a case
5992 (System.Enum are not value types or class types, so we need to
5993 classify them separatedly).
5995 * driver.cs: We do not support error 2007.
5997 2003-11-12 Jackson Harper <jackson@ximian.com>
5999 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
6000 system directory. Also use the full file name so users can
6001 libraries names mscorlib-o-tron.dll in a non system dir.
6003 2004-01-04 David Sheldon <dave-mono@earth.li>
6005 * expression.cs: Added matching ")" to error message for CS0077.
6007 2003-12-19 Martin Baulig <martin@ximian.com>
6009 * typemanager.cs (TypeManager.IsEqualGenericType): New public
6010 static method; see documentation in the method.
6011 (TypeManager.IsSubclassOrNestedChild): Allow IsEqualGenericType().
6013 * convert.cs (Convert.ImplicitReferenceConversion,
6014 Convert.ImplicitReferenceConversionExists): Add support for
6015 generic type declarations; see gen-36.cs.
6017 2003-12-19 Martin Baulig <martin@ximian.com>
6019 * pending.cs (Pending.InterfaceMethod): Use
6020 `Type.IsAssignableFrom()' instead of `=='.
6022 2003-12-18 Martin Baulig <martin@ximian.com>
6024 * decl.cs (DeclSpace.AsAccessible): Check for array, pointer and
6027 * convert.cs (Convert.ImplicitStandardConversionExists): Use
6028 `expr_type.Equals (target_type)' instead of `=='.
6030 2003-12-08 Martin Baulig <martin@ximian.com>
6032 * generics.cs (Constraints.Types): Removed.
6033 (Constraints.Resolve): Just resolve everything to TypeExpr's, not
6035 (Constraints.ResolveTypes): New public method; resolves the
6036 TypeExpr's to Type's.
6037 (TypeParameter.Define): TypeBuilder.DefineGenericParameter() no
6038 longer takes the constraints.
6039 (TypeParameter.DefineMethod): Likewise.
6040 (TypeParameter.DefineType): New public method. Calls
6041 `TypeBuilder/MethodBuilder.SetGenericParameterConstraints()' to set
6044 2003-12-08 Martin Baulig <martin@ximian.com>
6046 * convert.cs (Convert.ImplicitConversionStandard): Use
6047 `expr_type.Equals (target_type)' instead of `=='.
6049 2003-12-08 Martin Baulig <martin@ximian.com>
6051 * typemanager.cs (TypeManager.GetReferenceType): Call
6052 `Type.MakeByRefType ()'.
6054 2003-12-08 Martin Baulig <martin@ximian.com>
6056 * cs-parser.jay, cs-tokenizer.cs: `where' is not a keyword, it
6057 just has some special meaning in some situations. For instance,
6058 it is allowed to use `where' as the name of a variable etc.
6060 2003-12-04 Martin Baulig <martin@ximian.com>
6062 * expression.cs (ComposedCast.DoResolveAsTypeStep): Use
6063 `Type.MakeArrayType()' for array types.
6065 2003-11-18 Miguel de Icaza <miguel@ximian.com>
6067 * expression.cs (Invocation.VerifyArgumentsCompat): Remove
6070 (SizeOf.DoResolve): assign the `type_queried' field. This gets
6073 2003-11-16 Martin Baulig <martin@ximian.com>
6075 * codegen.cs (EmitContext.IsGeneric): Removed.
6077 * ecore.cs (SimpleName.ResolveAsTypeStep): Always call
6078 ResolveGeneric() on the DeclSpace.
6080 2003-11-16 Martin Baulig <martin@ximian.com>
6082 * generic.cs (TypeArguments.Resolve):
6083 `Expression.ResolveAsTypeTerminal()' returns a TypeExpr; call
6084 `ResolveType()' on it to get the Type.
6086 2003-11-15 Martin Baulig <martin@ximian.com>
6088 * generic.cs (ConstructedType.GetInterfaces): Override this.
6090 2003-11-14 Martin Baulig <martin@ximian.com>
6092 * interface.cs (Interface.DefineType): Define all type parameters
6093 before adding the interfaces we inherit.
6095 2003-11-11 Martin Baulig <martin@ximian.com>
6097 * generic.cs (ConstructedType.ResolveType): Always call
6098 `gt.BindGenericParameters (atypes)'; also if `args.HasTypeArguments'.
6100 2003-11-10 Martin Baulig <martin@ximian.com>
6102 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
6103 (TypeManager.InitCoreTypes): Initialize them here, but instead of
6104 calling `ResolveType()' on them, directly assign their `Type'.
6106 2003-11-08 Martin Baulig <martin@ximian.com>
6108 * generic.cs (ConstructedType): Override `IsClass' etc.
6110 2003-11-08 Martin Baulig <martin@ximian.com>
6112 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
6113 return value and the `out parent' parameter.
6114 (TypeContainer.DefineType): Moved the CS0644 check into
6115 GetClassBases(). Don't pass the interface types to the
6116 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
6117 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
6119 * ecore.cs (TypeExpr.IsAttribute): New property.
6120 (TypeExpr.GetInterfaces): New method.
6122 * interface.cs (Interface.GetInterfaceTypeByName): Return a
6123 TypeExpr instead of a Type.
6124 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
6125 (Interface.DefineType): Don't pass the interface types to the
6126 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
6127 them later and then call `TypeBulider.AddInterfaceImplementation()'.
6129 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
6130 instead of a `Type[]'.
6131 (TypeManager.RegisterBuilder): Likewise.
6132 (TypeManager.AddUserInterface): Likewise.
6133 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
6134 `Type[]' and also return a `TypeExpr[]'.
6135 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
6137 2003-11-08 Martin Baulig <martin@ximian.com>
6139 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
6142 2003-11-08 Martin Baulig <martin@ximian.com>
6144 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
6145 TypeManager.ResolveExpressionTypes().
6147 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
6148 instead of an Expression.
6149 (TypeExpr): This is now an abstract base class for `TypeExpression'.
6150 (TypeExpression): New public class; formerly known as `TypeExpr'.
6152 * expression.cs (ComposedCast): Derive from TypeExpr.
6154 * typemanager.cs (TypeManager.system_*_expr): These are now
6155 TypExpr's instead of Expression's.
6156 (TypeManager.ResolveExpressionTypes): New public static function;
6157 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
6160 2003-11-06 Miguel de Icaza <miguel@ximian.com>
6162 * expression.cs (New.DoResolve): Do not dereference value that
6163 might be a null return.
6165 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
6166 sure that the constant value has the right type. Fixes an
6167 unreported bug, similar to 50425.
6169 * const.cs (Const.LookupConstantValue): Call
6170 ImplicitStandardConversionExists before doing a conversion to
6171 avoid havng the TypeManager.ChangeType do conversions.
6173 Reduced the number of casts used
6175 (Const.ChangeType): New routine to enable reuse of the constant
6176 type changing code from statement.
6178 * typemanager.cs (ChangeType): Move common initialization to
6179 static global variables.
6183 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
6184 every value type to go through, even if it was void. Fix that.
6186 * cs-tokenizer.cs: Use is_identifier_start_character on the start
6187 character of the define, and the is_identifier_part_character for
6188 the rest of the string.
6190 2003-11-05 Miguel de Icaza <miguel@ximian.com>
6192 * expression.cs (UnaryMutator.EmitCode): When I updated
6193 LocalVariableReference.DoResolve, I overdid it, and dropped an
6194 optimization done on local variable references.
6196 2003-11-04 Miguel de Icaza <miguel@ximian.com>
6198 * ecore.cs: Convert the return from Ldlen into an int.
6200 2003-10-20 Miguel de Icaza <miguel@ximian.com>
6202 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
6203 the accessibility, this is a special case for toplevel non-public
6204 classes (internal for instance).
6206 2003-10-20 Nick Drochak <ndrochak@gol.com>
6208 * ecore.cs: Fix typo and build. Needed another right paren.
6210 2003-10-19 Miguel de Icaza <miguel@ximian.com>
6212 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
6213 `internal' case regular and protected, but not allowing protected
6214 to be evaluated later. Bug 49840
6216 2003-10-15 Miguel de Icaza <miguel@ximian.com>
6218 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
6219 to kb.Nlast, and not the kb.nFirst to isolate the switch
6222 Extract the underlying type, so enumerations of long/ulong are
6223 treated like long/ulong.
6225 2003-10-14 Miguel de Icaza <miguel@ximian.com>
6227 * expression.cs (New): Overload the meaning of RequestedType to
6228 track the possible creation of the NewDelegate type, since
6229 DoResolve is invoked more than once for new constructors on field
6232 See bugs: #48800 and #37014
6234 * cs-parser.jay (declare_local_constants): Take an arraylist
6235 instead of a single constant.
6237 (local_constant_declaration): It should take a
6238 constant_declarators, not a constant_declarator. Fixes 49487
6240 * convert.cs: Fix error report.
6242 2003-10-13 Jackson Harper <jackson@ximian.com>
6244 * typemanager.cs (TypeToCoreType): Add float and double this fixes
6247 2003-11-03 Martin Baulig <martin@ximian.com>
6249 * expression.cs (ArrayAccess.GetStoreOpcode): Added
6250 `out bool has_type_arg'; if set, we need to pass the type to
6252 (ArrayAccess.GetStoreOpcode, ArrayAccess.EmitLoadOpcode): Use
6253 Stelem_Any/Ldelem_Any for generic parameters.
6255 2003-11-02 Martin Baulig <martin@ximian.com>
6257 * expression.cs (Invocation.EmitCall): Use
6258 `TypeManager.IsValueType()' to check whether it's a value type.
6259 Don't set `struct_call' when calling a method on a type parameter.
6261 2003-11-02 Martin Baulig <martin@ximian.com>
6263 * generics.cs (ConstructedType.Resolve): Renamed to ResolveType()
6264 and removed the TypeBuilder argument.
6266 * typemanager.cs (TypeManager.IsValueType): Return
6267 `t.IsGenericParameter || t.IsValueType'.
6269 2003-10-25 Martin Baulig <martin@ximian.com>
6271 * decl.cs (DeclSpace.ResolveType): If we're a ConstructedType,
6272 call ConstructedType.Resolve() on it.
6274 * generic.cs (ConstructedType.Resolve): Set `type' on success.
6276 2003-10-25 Martin Baulig <martin@ximian.com>
6278 * class.cs (TypeContainer.GetClassBases): Changed
6279 `out Type parent' into `out TypeExpr parent'. Moved CS0644 and
6280 CS8214 reporting here.
6281 (TypeContainer.DefineType): GetClassBases() gives us a `TypeExpr'
6282 instead of a `Type' for our parent. In case of a recursive
6283 declaration (see tests/gen-23.cs for an example), our parent is a
6284 ConstructedType and it doesn't have its type set. So, first
6285 create our own TypeBuilder, then call constructed.Resolve() to get
6286 the parent's type and finally TypeBuilder.SetParent() it.
6288 * ecore.cs (TypeExpr.Name): New public virtual property.
6291 (ConstructedType): We're now a TypeExpr and not just an Expression.
6292 (ConstructedType.ResolveAsTypeStep): Don't resolve our type
6293 arguments here; this is done later.
6294 (ConstructedType.Resolve): New public method to resolve the type
6295 arguments and bind them.
6297 2003-10-21 Martin Baulig <martin@ximian.com>
6299 * convert.cs: Use `TypeManager.IsValueType' instead of
6300 'type.IsValueType' everywhere.
6302 * typemanager.cs (TypeManager.IsValueType): Return true for type
6303 parameters. The reason for this is that we need to box a type
6304 parameter when converting it to a reference type.
6306 * cs-parser.jay: Added support for default value expressions.
6308 * generics.cs (DefaultValueExpression): New public class.
6310 2003-10-17 Martin Baulig <martin@ximian.com>
6312 * generic.cs (Constraints.Resolve): Take a DecpSpace instead of a
6313 TypeContainer so we can also use this for Interfaces.
6314 (TypeParameter.Resolve): Likewise.
6316 * interface.cs (Interface.DefineType): Added support for generic
6319 * cs-parser.jay: Added support for generic structs and interfaces.
6321 2003-10-17 Martin Baulig <martin@ximian.com>
6323 * generic.cs (GenericMemberAccess.DoResolve): We can now actually
6324 call generic methods :-)
6326 2003-10-16 Martin Baulig <martin@ximian.com>
6328 * cs-parser.jay (namespace_or_type_name): Only create a
6329 GenericMemberAccess if we actually have type arguments.
6331 2003-10-13 Martin Baulig <martin@ximian.com>
6333 * class.cs (Method.Define): If we're a generic method, call
6334 TypeBuilder.DefineGenericMethod () before resolving
6336 (MethodData): Added .ctor which takes an additional MethodBuilder
6337 argument; this is used for generic methods.
6338 (MethodData.Define): Call `builder.SetGenericMethodSignature()' if
6339 we already have a MethodBuilder.
6341 2003-10-10 Martin Baulig <martin@ximian.com>
6343 * class.cs (Method): Added .ctor which takes a `GenericMethod'
6344 instead of a `DeclSpace'. This is used for generic methods.
6346 * cs-parser.jay (method_header): Added support for generic
6347 methods; create a `GenericMethod' instance and pass it to the
6348 `Method's .ctor; it'll be used as the `DeclSpace' to lookup
6349 parameters and locals.
6351 * decl.cs (DeclSpace.SetParameterInfo): Removed Location argument
6352 since we already have the location. Check whether we're a generic
6353 type declaration or a generic method and create the correct type
6356 * generic.cs (TypeParameter.DefineMethod): New public method.
6357 (GenericMethod): New public class; derives from DeclSpace and is
6358 used for generic methods.
6360 2003-10-09 Martin Baulig <martin@ximian.com>
6362 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
6364 (MethodCore.DoDefineParameters): Removed the TypeContainer
6365 argument; use the DeclSpace which was passed to the .ctor instead.
6366 (MethodCore.CheckParameter): Take a DeclSpace instead of a
6367 TypeContainer; we only need a DeclSpace here.
6369 2003-10-09 Martin Baulig <martin@ximian.com>
6371 * class.cs (MethodData): Added additional `DeclSpace ds' argument
6373 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
6374 EmitContext's .ctor.
6376 2003-10-09 Martin Baulig <martin@ximian.com>
6378 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
6379 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
6380 AsAccessible(), moved them as well.
6382 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
6384 2003-10-07 Miguel de Icaza <miguel@ximian.com>
6386 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
6387 generation for >=, as spotted by Paolo, bug 48679.
6388 Patch from David Waite.
6390 * cs-tokenizer.cs: Add handling for #pragma.
6392 * cs-parser.jay: Allow for both yield and yield return in the
6393 syntax. The anti-cobolization of C# fight will go on!
6395 * class.cs (TypeBuilder.DefineType): Catch error condition here
6396 (Parent.DefineType erroring out and returning null).
6398 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
6399 coping with enumerations variables, we were mistakenly processing
6400 them as a regular value type instead of built-in types. Fixes the
6403 * typemanager.cs (IsBuiltinOrEnum): New method.
6405 2003-09-30 Miguel de Icaza <miguel@ximian.com>
6407 * cs-parser.jay: Upgrade: yield now needs the return clause.
6409 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6411 * cs-parser.jay : Renamed yyName to yyNames related to jay.
6413 2003-09-29 Martin Baulig <martin@ximian.com>
6415 * typemanager.cs (TypeManager.GetMethodFlags): Added support for
6416 inflated generic methods.
6418 * generics.cs (ConstructedType): Distinguish between open and
6419 closed constructed types; correctly resolve the arguments.
6421 2003-09-22 Martin Baulig <martin@ximian.com>
6423 * generic.cs (ConstructedType.ResolveAsTypeCheck): Check whether
6424 all type arguments meet their constraints.
6426 2003-09-19 Martin Baulig <martin@ximian.com>
6428 * decl.cs (MemberCache.SetupCacheForInterface): Take a
6429 `MemberCache parent' argument. Normally, an interface doesn't
6430 have a parent type except System.Object, but we use this in gmcs
6431 for generic type parameters.
6433 2003-09-18 Martin Baulig <martin@ximian.com>
6435 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
6436 on `type.IsInterface'; don't check whether the type has a parent
6437 to determine whether it's an interface.
6439 2003-09-17 Martin Baulig <martin@ximian.com>
6441 * generic.cs (ConstructedType.ToString): Always use `name' as the
6444 2003-09-15 Martin Baulig <martin@ximian.com>
6446 * cs-parser.jay: Fix grammar wrt. type_parameter_constraints.
6448 * generic.cs (Constraints.Resolve): New public method; this is
6449 called to resolve the constraint types and to check whether all
6450 the constraints are correct.
6451 (Constraints.Types): New public property.
6452 (TypeParameter.Resolve): New public method; resolves all the
6455 * class.cs (TypeContainer.DefineType): Call
6456 TypeParameter.Resolve() before actually defining the type.
6458 2003-09-15 Martin Baulig <martin@ximian.com>
6460 * class.cs (TypeContainer.DefineType): Added an error flag to
6461 avoid reporting duplicate CS0146's ("class definition is
6464 * driver.cs (Driver.MainDriver): Abort if
6465 RootContext.ResolveTree() reported any errors.
6467 2003-09-07 Martin Baulig <martin@ximian.com>
6469 * report.cs (Error, Warning): Added overloaded versions which take
6470 a `params object[] args' and call String.Format().
6472 2003-09-07 Martin Baulig <martin@ximian.com>
6474 * decl.cs (DeclSpace..ctor): Don't call
6475 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
6476 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
6477 (DeclSpace.RecordDecl): New method.
6479 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
6481 2003-09-02 Ravi Pratap <ravi@ximian.com>
6483 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
6484 value attributes to be applied to ParameterBuilders.
6486 * class.cs (MethodCore.LabelParameters): Make static and more
6487 generic so that it can be used from other places - like interface
6488 methods, for instance.
6490 * interface.cs (Interface.Emit): Call LabelParameters before
6491 emitting attributes on the InterfaceMethod.
6493 2003-09-07 Martin Baulig <martin@ximian.com>
6495 * generic.cs (ConstructedType.ResolveAsTypeStep): Report a CS8217
6496 if the number of type parameters doesn't match.
6498 2003-09-04 Martin Baulig <martin@ximian.com>
6500 * expression.cs (ComposedCast.ResolveAsTypeStep): Added support
6501 for arrays of generic type params (ie. `!0[]').
6503 2003-09-04 Martin Baulig <martin@ximian.com>
6505 * class.cs (TypeContainer.AsAccessible): Ignore generic parameters
6508 2003-09-04 Martin Baulig <martin@ximian.com>
6510 * decl.cs (DeclSpace.LookupGeneric): New method.
6511 (DeclSpace.CheckAccessLevel): Ignore generic parameters for the
6514 * generic.cs (TypeParameterExpr): Take a TypeParameter as
6515 argument, not just a string.
6516 (TypeParameter.Define): New public method; this is called to
6517 actually define the generic parameter; after this, you can use the
6518 new `Type' property to get the type.
6520 2003-09-04 Martin Baulig <martin@ximian.com>
6522 * decl.cs (DeclSpace.SetParameterInfo): The `constraints' argument
6523 is now an ArrayList; initialize the result of the `TypeParameters'
6525 (DeclSpace.GetGenericData): Removed.
6526 (DeclSpace.LookupGeneric): Temporarily removed; we need to
6527 implement this in a different way.
6528 (DeclSpace.GetTypeParameters): Removed; there's now a
6529 `TypeParameters' property.
6530 (DeclSpace.TypeParameters): New public property.
6532 * generic.cs (Constraints): Make this class public.
6533 (TypeParameter): New public class.
6535 2003-09-04 Martin Baulig <martin@ximian.com>
6537 * decl.cs (DeclSpace.GetTypeParameters): New method to return the
6540 * class.cs (TypeContainer.DefineType): Call
6541 TypeBuilder.DefineGenericParameter () on all generic parameters if
6542 this is a generic type.
6544 2003-08-28 Martin Baulig <martin@ximian.com>
6546 * sample-stack.il: Compile this with ilasm: "ilasm /dll
6549 * sample-hello.cs: Compile this with gmcs: "gmcs
6550 /r:sample-stack.dll sample-hello.cs".
6552 2003-08-28 Martin Baulig <martin@ximian.com>
6554 * generic.cs (ConstructedType.ResolveAsTypeStep): Actually bind
6555 the parameters to the generic type.
6557 2003-08-28 Martin Baulig <martin@ximian.com>
6559 * cs-tokenizer.cs (parse_less_than): Also allow all builtin types.
6561 2003-08-28 Martin Baulig <martin@ximian.com>
6563 * cs-parser.jay (opt_type_argument_list): Use
6564 `OP_GENERICS_LT type_arguments OP_GENERICS_GT'.
6565 (primary_expression): Replace `qualified_identifier' with `type_name'.
6566 (type_parameter_list): Use `OP_GENERICS_LT type_parameters OP_GENERICS_GT'.
6568 * cs-tokenizer.cs (is_punct): When reading a `<', invoke a custom
6569 parser to check whether it is syntactically a type parameter list;
6570 return OP_GENERICS_LT/OP_GENERICS_GT instead of OP_LT/OP_GT in
6573 2003-08-26 Martin Baulig <martin@ximian.com>
6575 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
6576 resolving aliases; fixes #47927.
6578 2003-08-26 Martin Baulig <martin@ximian.com>
6580 * statement.cs (Using.DoResolve): This is internally emitting a
6581 try/finally clause, so we need to set ec.NeedExplicitReturn if we
6582 do not always return. Fixes #47681.
6584 2003-08-26 Martin Baulig <martin@ximian.com>
6586 * decl.cs (MemberCore): Moved WarningNotHiding(),
6587 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
6589 (AdditionResult): Make this nested in DeclSpace.
6590 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
6591 argument; call NamespaceEntry.Define() unless we're nested in a
6594 * namespace.cs (Namespace.DefineName): New public function. This
6595 is called from DeclSpace's .ctor to add
6596 (Namespace.Lookup): Include DeclSpaces in the lookup.
6598 * class.cs (Operator): Derive from MemberBase, not MemberCore.
6600 * const.cs (Const): Derive from MemberBase, not MemberCore.
6602 2003-08-25 Martin Baulig <martin@ximian.com>
6604 * convert.cs (Convert.ExplicitReferenceConversion): When
6605 converting from an interface type to a class, unbox if the target
6606 type is a struct type. Fixes #47822.
6608 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6610 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
6613 2003-08-22 Martin Baulig <martin@ximian.com>
6615 * class.cs (TypeManager.DefineType): When defining a nested type,
6616 call DefineType() on our parent; fixes #47801.
6618 2003-08-22 Martin Baulig <martin@ximian.com>
6620 * class.cs (MethodData.Define): While checking if a method is an
6621 interface implementation, improve the test a bit more to fix #47654.
6623 2003-08-22 Martin Baulig <martin@ximian.com>
6625 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
6626 correctly; fixes #47722.
6628 2003-08-22 Martin Baulig <martin@ximian.com>
6630 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
6631 LocalVariableReference, ensure it's not read-only. Fixes #47536.
6633 * statement.cs (Fixed.DoResolve): Make all variables read-only.
6635 2003-08-22 Martin Baulig <martin@ximian.com>
6637 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
6638 can only be assigned in static constructors. Fixes #47161.
6640 2003-08-22 Martin Baulig <martin@ximian.com>
6642 Rewrote and improved the flow analysis code.
6644 * flowbranching.cs (FlowBranching): Make this class abstract.
6645 (FlowBranching.CreateBranching): New static function to create a
6647 (FlowBranchingBlock, FlowBranchingException): New classes.
6648 (FlowBranching.UsageVector.Type): New public readonly field.
6649 (FlowBranching.UsageVector.Breaks): Removed the setter.
6650 (FlowBranching.UsageVector.Returns): Removed the setter.
6651 (FlowBranching.UsageVector): Added Break(), Return(),
6652 NeverReachable() and Throw() methods to modify the reachability.
6653 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
6654 done by FlowBranching.Merge().
6655 (FlowBranching.UsageVector.MergeChild): New method; merges the
6656 merge result into the current vector.
6657 (FlowBranching.Merge): New abstract method to merge a branching.
6659 2003-08-12 Martin Baulig <martin@ximian.com>
6661 * expression.cs (Indirection.CacheTemporaries): Create the
6662 LocalTemporary with the pointer type, not its element type.
6664 2003-08-10 Miguel de Icaza <miguel@ximian.com>
6666 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
6667 token was a keyword or not.
6669 Add `error' options where an IDENTIFIER was expected; Provide
6670 CheckToken and CheckIdentifierToken convenience error reporting
6673 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
6675 * decl.cs: Rename `NamespaceEntry Namespace' public field into
6676 NameSpaceEntry NameSpaceEntry.
6678 (LookupInterfaceOrClass): Avoid creating a full qualified name
6679 from namespace and name: avoid doing lookups when we know the
6680 namespace is non-existant. Use new Tree.LookupByNamespace which
6681 looks up DeclSpaces based on their namespace, name pair.
6683 * driver.cs: Provide a new `parser verbose' to display the
6684 exception thrown during parsing. This is turned off by default
6685 now, so the output of a failure from mcs is more graceful.
6687 * namespace.cs: Track all the namespaces defined in a hashtable
6690 (IsNamespace): New method
6692 2003-08-09 Miguel de Icaza <miguel@ximian.com>
6694 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
6695 we know that we need to concatenate (full typename can never be
6700 * statement.cs: Use a bitfield; Do not initialize to null things
6701 which are done by the constructor by default.
6703 * cs-parser.jay: bug fix, parameter was 4, not 3.
6705 * expression.cs: Just use the property;
6707 * statement.cs: No need for GetVariableInfo method.
6709 2003-08-08 Martin Baulig <martin@ximian.com>
6711 * flowanalysis.cs (FlowReturns): This is now nested in the
6712 `FlowBranching' class.
6713 (MyBitVector): Moved this here from statement.cs.
6714 (FlowBranching.SiblingType): New enum type.
6715 (FlowBranching.CreateSibling): Added `SiblingType' argument.
6717 2003-08-07 Martin Baulig <martin@ximian.com>
6719 * flowanalysis.cs (FlowBranchingType): This is now nested in the
6720 `FlowBranching' class and called `BranchingType'.
6722 2003-08-07 Martin Baulig <martin@ximian.com>
6724 * flowanalysis.cs: Moved all the control flow analysis code into
6727 2003-08-07 Martin Baulig <martin@ximian.com>
6729 * assign.cs (Assign.DoResolve): `target' must either be an
6730 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
6733 2003-08-07 Miguel de Icaza <miguel@ximian.com>
6735 * expression.cs (BinaryMethod): This kind of expression is created by the
6736 Binary class if it determines that the operator has to be handled
6739 (BinaryDelegate): This kind of expression is created if we are
6740 dealing with a + or - operator on delegates.
6742 (Binary): remove method, argumetns, and DelegateOperator: when
6743 dealing with methods,
6745 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
6747 * statement.cs (Block): use bitfields for the three extra booleans
6748 we had in use. Remove unused topblock parameter.
6750 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
6752 * assign.cs: Drop extra unneeded tests.
6754 2003-08-06 Miguel de Icaza <miguel@ximian.com>
6756 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
6758 * statement.cs (Foreach): Use VariableStorage instead of
6761 * codegen.cs (VariableStorage): New class used by clients that
6762 require a variable stored: locals or fields for variables that
6763 need to live across yield.
6765 Maybe provide a convenience api for EmitThis+EmitLoad?
6767 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
6770 2003-08-05 Miguel de Icaza <miguel@ximian.com>
6772 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
6773 RemapParameterLValue): New methods that are used to turn a
6774 precomputed FieldInfo into an expression like this:
6778 The idea is to use this instead of making LocalVariableReference
6779 have more than one meaning.
6781 * cs-parser.jay: Add error production to BASE.
6783 * ecore.cs: Deal with TypeManager.GetField returning null, which
6784 is now a valid return value.
6786 (FieldExprNoAddress): New expression for Fields whose address can
6789 * expression.cs (LocalVariableReference): During the resolve
6790 phases, create new expressions if we are in a remapping context.
6791 Remove code that dealt with remapping here.
6793 (ParameterReference): same.
6795 (ProxyInstance): New expression, like the `This' expression, but
6796 it is born fully resolved. We know what we are doing, so remove
6797 the errors that are targeted to user-provided uses of `this'.
6799 * statement.cs (Foreach): our variable is now stored as an
6800 Expression; During resolution, follow the protocol, dont just
6801 assume it will return this.
6803 2003-08-06 Martin Baulig <martin@ximian.com>
6805 * support.cs (SeekableStreamReader.cs): New public class.
6807 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
6808 SeekableStreamReader instead of the normal StreamReader.
6810 2003-08-04 Martin Baulig <martin@ximian.com>
6812 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
6813 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
6814 deambiguate casts and delegate invocations.
6815 (parenthesized_expression): Use the new tokens to ensure this is
6816 not a cast of method invocation.
6818 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
6819 when reading a `)' and Deambiguate_CloseParens () was previously
6822 * expression.cs (ParenthesizedExpression): New class. This is
6823 just used for the CS0075 test.
6824 (Binary.DoResolve): Check for CS0075.
6826 2003-07-29 Ravi Pratap <ravi@ximian.com>
6828 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
6829 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
6830 reference comparison.
6832 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
6833 examine the ReturnType for equality - this is necessary in the
6834 cases of implicit and explicit operators whose signature also
6835 includes the return type.
6837 2003-07-26 Miguel de Icaza <miguel@ximian.com>
6839 * namespace.cs: Cache the result of the namespace computation,
6840 instead of computing it every time.
6842 2003-07-24 Miguel de Icaza <miguel@ximian.com>
6844 * decl.cs: Use a global arraylist that we reuse over invocations
6845 to avoid excesive memory consumption. Reduces memory usage on an
6846 mcs compile by one meg (45 average).
6848 * typemanager.cs (LookupTypeReflection): In .NET pointers are
6849 private, work around that.
6851 2003-07-23 Miguel de Icaza <miguel@ximian.com>
6853 * literal.cs (IntLiteral): Define Zero and One static literals.
6855 * cs-parser.jay (integer_literal): use static literals to reduce
6856 memory usage for the most used literals (0, 1 and -1). 211kb
6857 reduced in memory usage.
6859 Replace all calls to `new ArrayList' with `new
6860 ArrayList(4)' which is a good average number for most allocations,
6861 and also requires only 16 bytes of memory for its buffer by
6864 This reduced MCS memory usage in seven megabytes for the RSS after
6867 2003-07-28 Ravi Pratap <ravi@ximian.com>
6869 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
6870 handle params methods the correct way by forming only one
6871 applicable set with params and normal methods in them. Earlier we
6872 were looking at params methods only if we found no normal methods
6873 which was not the correct thing to do.
6875 (Invocation.BetterFunction): Take separate arguments indicating
6876 when candidate and the best method are params methods in their
6879 This fixes bugs #43367 and #46199.
6881 * attribute.cs: Documentation updates.
6883 (CheckAttribute): Rename to CheckAttributeTarget.
6884 (GetValidPlaces): Rename to GetValidTargets.
6886 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
6887 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
6891 2003-07-28 Miguel de Icaza <miguel@ximian.com>
6893 * codegen.cs: Compute IsGeneric correctly.
6895 * cs-parser.jay: Introduce OP_GENERIC_LT for the grammar ambiguity
6898 Bring back (temporarily) OP_LEFT_SHIFT, OP_RIGHT_SHIFT,
6899 OP_SHIFT_RIGHT_ASSIGN, OP_SHIFT_LEFT_ASSIGN. There were too many
6900 regressions, and I was chasing more bugs than I required.
6902 * interface.cs: Use expressions for base type names (like classes
6903 and structs have been doing for a while now), and resolve that.
6904 This patch should probably go into head as well.
6906 This makes it one less user of FindType.
6908 2003-07-24 Miguel de Icaza <miguel@ximian.com>
6910 This compiler can not self host currently. Need to fix that.
6912 * Makefile: compile to `gmcs.exe'
6914 * driver.cs: Turn on v2 by default on gmcs.
6916 * generic.cs (ConstructedType): Does no longer take a container
6917 type argument; That will be taken care of later.
6919 (ConstructedType.DoResolve, ConstructedType.ResolveAsTypeStep):
6920 Use SimpleName to resolve for now, so we can continue the work on
6921 the parser, until we get Type.GetType that understands generics.
6923 (ConstructedType.ToString): Implement
6925 (TypeArguments.Resolve): Resolve the child expressions as types.
6927 * cs-parser.jay: Rename interface_constraints to
6928 type_parameter_constraints
6930 (namespace_or_type_name): Only use constructed types for the basic
6931 construction, we will deal with identifier<...> later.
6933 (type/type_name): No longer call DecomposeQI, as
6934 namespace_or_type_name is always decoded now.
6936 2003-07-22 Ravi Pratap <ravi@ximian.com>
6938 * expression.cs (Invocation.OverloadResolve): Follow the spec more
6939 closely: we eliminate methods in base types when we have an
6940 applicable method in a top-level type.
6942 Please see section 14.5.5.1 for an exact description of what goes
6945 This fixes bug #45127 and a host of other related to corlib compilation.
6947 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
6948 array is the method corresponding to the top-level type (this is
6949 because of the changes made to icall.c) so we change this
6952 (MethodGroupExpr.Name): This too.
6954 * typemanager.cs (GetElementType): New method which does the right
6955 thing when compiling corlib.
6957 * everywhere: Make use of the above in the relevant places.
6959 2003-07-22 Martin Baulig <martin@ximian.com>
6961 * cs-parser.jay (invocation_expression): Moved
6962 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
6963 `cast_expression', but create a InvocationOrCast which later
6964 resolves to either an Invocation or a Cast.
6966 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
6967 method; call this before EmitStatement() to make sure that this
6968 expression can be used as a statement.
6970 * expression.cs (InvocationOrCast): New class; resolves to either
6971 an Invocation or a Cast.
6973 * statement.cs (StatementExpression): Call ResolveStatement() on
6974 the ExpressionStatement before emitting it.
6976 2003-07-21 Martin Baulig <martin@ximian.com>
6978 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
6979 `ref' and `out' attributes match; fixes #46220.
6980 (MemberAccess.ResolveMemberAccess): You can't reference a type
6981 through an expression; fixes #33180.
6982 (Indexers.GetIndexersForType): Don't return the indexers from
6983 interfaces the class implements; fixes #46502.
6985 2003-07-21 Martin Baulig <martin@ximian.com>
6987 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
6988 CS0661 checks; fixes bug #30442.
6990 2003-07-21 Martin Baulig <martin@ximian.com>
6992 * decl.cs (AdditionResult): Added `Error'.
6994 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
6996 * typemanager.cs (TypeManager.ChangeType): Catch exceptions; makes
6997 cs0031.cs actually work.
6999 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7001 * cs-parser.jay (namespace_name): do not use
7002 namespace_or_type_name, use qualified_identifier, because
7003 namespace_or_type_name will soon return a composed expression
7004 instead of a string.
7006 (namespace_or_type_name): Instead of returning a string, now this
7007 production returns an expression.
7009 * codegen.cs (EmitContext): Setup IsGeneric property based on
7010 whether our DeclSpace is generic, our the method is generic.
7012 * modifier.cs (Modifiers.METHOD_GENERIC): New definition, use if
7013 the method is generic.
7015 * cs-parser.jay (type_arguments, opt_type_argument_list,
7016 type_parameters, type_parameter_list, opt_type_parameter_list,
7017 type_parameter,, opt_type_parameter_constraints_clauses,
7018 type_parameter_constraints_clauses,
7019 type_parameter_constraint_clause, type_parameter_constraint,
7020 interface_constraints): Add new production
7022 * decl.cs (DeclSpace): IsGeneric, flag to track whether this
7023 DeclSpace is generic or not.
7025 (DeclSpace.SetParameterInfo): New routine, used to set the
7026 parameter info for a type.
7028 (DeclSpace.LookupGeneric): Lookups a name, and if it is a generic,
7029 returns a GenericTypeExpr
7031 * ecore.cs (SimpleName.ResolveAsTypeStep): If our container is
7032 generic, lookup the generic argument.
7034 * attribute.cs: Do not allow TypeParameterExpressions in
7037 * class.cs: Do not allow the Main method to be defined in a
7040 * expression.cs (SizeOf): Do not allow generic types to be used as
7041 arguments to sizeof.
7043 * typemanager.cs (IsGeneric): Wrapper for Reflection when we have
7044 it: whether a type is generic or not. Only works for types we are
7045 currently building for now.
7047 2003-07-20 Martin Baulig <martin@ximian.com>
7049 * namespace.cs: Fixed that bug which caused a crash when compiling
7052 2003-07-20 Miguel de Icaza <miguel@ximian.com>
7054 * typemanager.cs (LookupTypeReflection): Never expose types which
7055 are NotPublic, NestedPrivate, NestedAssembly, or
7056 NestedFamANDAssem. We used to return these, and later do a check
7057 that would report a meaningful error, but the problem is that we
7058 would not get the real match, if there was a name override.
7060 2003-07-18 Miguel de Icaza <miguel@ximian.com>
7062 * namespace.cs (Namespace, Name): Do not compute the namespace
7063 name dynamically, compute it in the constructor. This reduced
7064 memory usage by 1697 KB.
7066 * driver.cs: Use --pause to pause at the end.
7068 2003-07-17 Peter Williams <peter@newton.cx>
7070 * Makefile: Change the name of the test target so that it doesn't
7071 conflict with the recursive test target.
7073 2003-07-17 Miguel de Icaza <miguel@ximian.com>
7075 * expression.cs (LocalVariableReference.Emit, EmitAssign,
7076 AddressOf): Do not use EmitThis, that was wrong, use the actual
7079 2003-07-15 Miguel de Icaza <miguel@ximian.com>
7081 * class.cs (MethodData.Define): While checking if a method is an
7082 interface implementation, improve the test: If we are not public
7083 (use new test here: use the computed MethodAttributes directly,
7084 instead of the parsed modifier flags) check if the `implementing'
7085 method comes from an interface or not.
7087 * pending.cs (VerifyPendingMethods): Slightly better error
7090 * makefile: add test target that does the mcs bootstrap.
7092 2003-07-16 Ravi Pratap <ravi@ximian.com>
7094 * interface.cs (Define): Do nothing here since there are no
7095 members to populate etc. Move the attribute emission out of here
7096 since this was just totally the wrong place to put it. Attribute
7097 application happens during the 'Emit' phase, not in the 'Define'
7100 (Emit): Add this method and move the attribute emission here
7102 * rootcontext.cs (EmitCode): Call the Emit method on interface
7105 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7107 * expression.cs (OverloadResolve): Report error only if Location
7108 is not 'Null' which means that there was a probe going on.
7110 2003-07-14 Martin Baulig <martin@ximian.com>
7112 * expression.cs (ConditionalLogicalOperator): New public class to
7113 implement user defined conditional logical operators.
7114 This is section 14.11.2 in the spec and bug #40505.
7116 2003-07-14 Martin Baulig <martin@ximian.com>
7118 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
7120 2003-07-14 Martin Baulig <martin@ximian.com>
7122 * codegen.cs (EmitContext.InFixedInitializer): New public field.
7124 * ecore.cs (IVariable.VerifyFixed): New interface method.
7126 * expression.cs (Unary.ResolveOperator): When resolving the `&'
7127 operator, check whether the variable is actually fixed. Fixes bug
7128 #36055. Set a variable definitely assigned when taking its
7129 address as required by the spec.
7131 * statement.cs (LocalInfo.IsFixed): New field.
7132 (LocalInfo.MakePinned): Set `IsFixed' to true.
7134 2003-07-14 Ravi Pratap M <ravi@ximian.com>
7136 * attribute.cs (Attribute.Resolve): While doing a Member lookup
7137 for .ctors, ensure that we only ask for members declared in the
7138 attribute type (BindingFlags.DeclaredOnly).
7142 * expression.cs (Error_WrongNumArguments): Report error 1501
7143 correctly the way CSC does.
7145 2003-07-13 Martin Baulig <martin@ximian.com>
7147 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
7148 lookup on the fully qualified name, to make things like "X.X" work
7149 where "X.X" is a fully qualified type name, but we also have a
7150 namespace "X" in the using list. Fixes #41975.
7152 2003-07-13 Martin Baulig <martin@ximian.com>
7154 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
7155 function. If we're a CompoundAssign, we need to create an embedded
7156 CompoundAssign, not an embedded Assign.
7157 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
7160 2003-07-13 Martin Baulig <martin@ximian.com>
7162 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
7163 work to fix bug #46088.
7165 2003-07-13 Ravi Pratap <ravi@ximian.com>
7167 * class.cs (Operator.Emit): Do not emit attributes here - it is
7168 taken care of by the Method class that we delegate too. This takes
7171 2003-07-10 Martin Baulig <martin@ximian.com>
7173 * expression.cs (TypeOfVoid): New class.
7174 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
7176 2003-07-10 Martin Baulig <martin@ximian.com>
7178 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
7181 2003-07-10 Martin Baulig <martin@ximian.com>
7183 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
7184 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
7186 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
7188 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
7190 2003-07-10 Martin Baulig <martin@ximian.com>
7192 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
7193 of decimal. Fixes #42850.
7195 NOTE: I also fixed the created byte blob, but this doesn't work on
7196 the MS runtime and csc never produces any byte blobs for decimal
7199 2003-07-10 Martin Baulig <martin@ximian.com>
7201 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
7202 structs; fixes #32068.
7203 (Block.AddChildVariableNames): Fixed #44302.
7205 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7207 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
7209 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7211 * attribute.cs: And this test is onger needed.
7213 2003-07-08 Martin Baulig <martin@ximian.com>
7215 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
7216 inaccessible types. Fixes #36313.
7218 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
7220 * namespace.cs (NamespaceEntry): Create implicit entries for all
7221 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
7222 implicit entries for N1.N2 and N1.
7224 2003-07-08 Martin Baulig <martin@ximian.com>
7226 Rewrote the handling of namespaces to fix a lot of the issues
7227 wrt. `using' aliases etc.
7229 * namespace.cs (Namespace): Splitted this class into a
7230 per-assembly `Namespace' and a per-file `NamespaceEntry'.
7232 * typemanager.cs (TypeManager.IsNamespace): Removed.
7233 (TypeManager.ComputeNamespaces): Only compute namespaces from
7234 loaded assemblies here, not the namespaces from the assembly we're
7235 currently compiling.
7237 2003-07-08 Martin Baulig <martin@ximian.com>
7239 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
7241 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7243 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
7246 I thought about the memory savings here, but LookupTypeReflection
7247 is used under already very constrained scenarios. Compiling
7248 corlib or mcs only exposes one hit, so it would not really reduce
7249 any memory consumption.
7251 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7253 * typemanager.cs: fixes bug #45889 by only adding public types from
7254 other assemblies to the list of known types.
7256 2003-07-07 Miguel de Icaza <miguel@ximian.com>
7258 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
7259 on the type we resolved.
7261 2003-07-05 Martin Baulig <martin@ximian.com>
7263 * pending.cs (PendingImplementation.ParentImplements): Don't
7264 create the proxy if the parent is abstract.
7266 * class.cs (TypeContainer.DefineIndexers): Process explicit
7267 interface implementations first. Fixes #37714.
7269 2003-07-04 Miguel de Icaza <miguel@ximian.com>
7271 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
7272 defined recursively; but since we modify the input parameters
7273 (left is set to `this' temporarily), we reset this value if the
7274 left_is_explicit is false, which gives the original semantics to
7277 * literal.cs (NullPointer): new class used to represent a null
7278 literal in a pointer context.
7280 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
7281 type is a pointer, use a NullPointer object instead of a
7282 NullLiteral. Closes 43687
7284 (ExplicitConversion): Convert pointer values using
7285 the conv opcode to the proper type.
7287 * ecore.cs (New): change ValueTypeVariable property into a method,
7288 that returns whether the valuetype is suitable for being used.
7290 * expression.cs (Binary.DoNumericPromotions): Only return if we
7291 the int constant was a valid uint, and we can return both left and
7292 right as uints. If not, we continue processing, to trigger the
7293 type conversion. This fixes 39018.
7295 * statement.cs (Block.EmitMeta): During constant resolution, set
7296 the CurrentBlock property on the emitcontext, so that we resolve
7297 constants propertly.
7299 2003-07-02 Martin Baulig <martin@ximian.com>
7301 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
7302 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
7304 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
7305 than emitting it here.
7307 * statement.cs: Fixed some more flow analysis bugs.
7309 2003-07-02 Martin Baulig <martin@ximian.com>
7311 * class.cs (MethodData.Define): When implementing interface
7312 methods, set Final unless we're Virtual.
7314 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
7315 check work for interface methods.
7317 2003-07-01 Martin Baulig <martin@ximian.com>
7319 * ecore.cs (EmitContext.This): Replaced this property with a
7320 GetThis() method which takes a Location argument. This ensures
7321 that we get the correct error location for a CS0188.
7323 2003-07-01 Miguel de Icaza <miguel@ximian.com>
7325 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
7326 ImplicitStandardConversion.
7328 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
7330 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
7332 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
7335 2003-06-30 Miguel de Icaza <miguel@ximian.com>
7337 * class.cs (Constructor.Define): Turn off initlocals for unsafe
7340 (MethodData.Define): Turn off initlocals for unsafe methods.
7342 2003-06-29 Miguel de Icaza <miguel@ximian.com>
7344 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
7345 complete; Fixes #37521.
7347 * delegate.cs: Use Modifiers.TypeAttr to compute the
7348 TypeAttributes, instead of rolling our own. This makes the flags
7349 correct for the delegates.
7351 2003-06-28 Miguel de Icaza <miguel@ximian.com>
7353 * class.cs (Constructor.Define): Set the private flag for static
7354 constructors as well.
7356 * cs-parser.jay (statement_expression): Set the return value to
7357 null, to avoid a crash when we catch an error.
7359 2003-06-24 Miguel de Icaza <miguel@ximian.com>
7361 * cs-parser.jay: Applied patch from Jackson that adds support for
7362 extern and unsafe modifiers to destructor declarations.
7364 * expression.cs: Report error 21 if the user is trying to index a
7367 * driver.cs: Add an error message, suggested by the bug report.
7369 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
7370 if we do not have a ": this ()" constructor initializer. Fixes 45149
7372 2003-06-14 Miguel de Icaza <miguel@ximian.com>
7374 * namespace.cs: Add some information to reduce FAQs.
7376 2003-06-13 Miguel de Icaza <miguel@ximian.com>
7378 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
7379 underlying enumeration types. Fixes #43915.
7381 * expression.cs: Treat ushort/short as legal values to be used in
7384 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
7386 * delegate.cs: transfer custom attributes for paramenters from
7387 the delegate declaration to Invoke and BeginInvoke.
7389 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
7391 * attribute.cs: handle custom marshalers and emit marshal info
7394 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
7396 * makefile.gnu: Added anonymous.cs to the compiler sources.
7398 2003-05-28 Miguel de Icaza <miguel@ximian.com>
7400 * iterators.cs: Change the name of the proxy class to include two
7403 * cs-parser.jay: Update grammar to include anonymous methods.
7405 * anonymous.cs: new file.
7407 2003-05-27 Miguel de Icaza <miguel@ximian.com>
7409 * class.cs (Field.Define): Add missing test for pointers and
7412 2003-05-27 Ravi Pratap <ravi@ximian.com>
7414 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
7415 we use the stobj opcode.
7417 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
7418 since it wasn't the correct fix.
7420 It still is puzzling that we are required to use stobj for IntPtr
7421 which seems to be a ValueType.
7423 2003-05-26 Miguel de Icaza <miguel@ximian.com>
7425 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
7426 during regular simple name resolution. Now, the trick is that
7427 instead of returning for processing the simplename, we do a
7428 TypeManager.LookupType (ie, a rooted lookup as opposed to a
7429 contextual lookup type). If a match is found, return that, if
7430 not, return for further composition.
7432 This fixes long-standing 30485.
7434 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
7435 using the address to initialize an object, do an Stobj instead of
7436 using the regular Stelem.
7438 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
7439 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
7440 Because if we are a BaseIndexerAccess that value will be true.
7443 * statement.cs (GotoCase.Resolve): Return after reporting an
7444 error, do not attempt to continue.
7446 * expression.cs (PointerArithmetic.Emit): If our operand is a
7447 long, convert our constants to match the operand before
7448 multiplying. Convert to I type before adding. Fixes 43670.
7450 2003-05-14 Ravi Pratap <ravi@ximian.com>
7452 * enum.cs (ImplicitConversionExists) : Rename to
7453 ImplicitEnumConversionExists to remove ambiguity.
7455 * ecore.cs (NullCast): New type of cast expression class which
7456 basically is very similar to EmptyCast with the difference being
7457 it still is a constant since it is used only to cast a null to
7461 * convert.cs (ImplicitReferenceConversion): When casting a null
7462 literal, we return a NullCast.
7464 * literal.cs (NullLiteralTyped): Remove - I don't see why this
7465 should be around anymore.
7467 The renaming (reported was slightly wrong). Corrections:
7469 ConvertImplicitStandard -> ImplicitConversionStandard
7470 ConvertExplicitStandard -> ExplicitConversionStandard
7472 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
7473 before passing them in !
7475 * convert.cs (ImplicitConversionStandard): When comparing for
7476 equal expr and target types, ensure that expr is not a
7479 In general, we must not be checking (expr_type ==
7480 target_type) in the top level conversion methods
7481 (ImplicitConversion, ExplicitConversion etc). This checking is
7482 done in the methods that they delegate to.
7484 2003-05-20 Miguel de Icaza <miguel@ximian.com>
7486 * convert.cs: Move Error_CannotConvertType,
7487 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
7488 ImplicitNumericConversion, ImplicitConversionExists,
7489 ImplicitUserConversionExists, StandardConversionExists,
7490 FindMostEncompassedType, FindMostSpecificSource,
7491 FindMostSpecificTarget, ImplicitUserConversion,
7492 ExplicitUserConversion, GetConversionOperators,
7493 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
7494 TryImplicitIntConversion, Error_CannotConvertImplicit,
7495 ConvertImplicitRequired, ConvertNumericExplicit,
7496 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
7497 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
7500 Perform the following renames:
7502 StandardConversionExists -> ImplicitStandardConversionExists
7503 ConvertImplicit -> ImplicitConversion
7504 ConvertImplicitStandard -> ImplicitStandardConversion
7505 TryImplicitIntConversion -> ImplicitIntConversion
7506 ConvertImplicitRequired -> ImplicitConversionRequired
7507 ConvertNumericExplicit -> ExplicitNumericConversion
7508 ConvertReferenceExplicit -> ExplicitReferenceConversion
7509 ConvertExplicit -> ExplicitConversion
7510 ConvertExplicitStandard -> ExplicitStandardConversion
7512 2003-05-19 Martin Baulig <martin@ximian.com>
7514 * statement.cs (TypeInfo.StructInfo): Made this type protected.
7515 (TypeInfo): Added support for structs having structs as fields.
7517 * ecore.cs (FieldExpr): Implement IVariable.
7518 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
7519 VariableInfo for the field.
7521 2003-05-18 Martin Baulig <martin@ximian.com>
7523 * expression.cs (This.DoResolve): Report a CS0027 if we're
7524 emitting a field initializer.
7526 2003-05-18 Martin Baulig <martin@ximian.com>
7528 * expression.cs (This.ResolveBase): New public function.
7529 (This.DoResolve): Check for CS0188.
7531 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
7534 * ecore.cs (MethodGroupExpr.DoResolve): Set the
7535 `instance_expression' to null if we don't have any non-static
7538 2003-05-18 Martin Baulig <martin@ximian.com>
7540 Reworked the way how local variables and parameters are handled by
7541 the flow analysis code.
7543 * statement.cs (TypeInfo, VariableMap): New public classes.
7544 (VariableInfo): New public class. This is now responsible for
7545 checking whether a variable has been assigned. It is used for
7546 parameters and local variables.
7547 (Block.EmitMeta): Take the InternalParameters as argument; compute
7548 the layout of the flow vectors here.
7549 (Block.LocalMap, Block.ParameterMap): New public properties.
7550 (FlowBranching): The .ctor doesn't get the InternalParameters
7551 anymore since Block.EmitMeta() now computes the layout of the flow
7553 (MyStructInfo): This class is now known as `StructInfo' and nested
7554 in `TypeInfo'; we don't access this directly anymore.
7556 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
7557 property and removed IsAssigned(), IsFieldAssigned(),
7558 SetAssigned() and SetFieldAssigned(); we now call them on the
7559 VariableInfo so we don't need to duplicate this code everywhere.
7561 * expression.cs (ParameterReference): Added `Block block' argument
7563 (LocalVariableReference, ParameterReference, This): The new
7564 VariableInfo class is now responsible for all the definite
7567 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
7568 IsParameterAssigned, SetParameterAssigned): Removed.
7570 2003-05-18 Martin Baulig <martin@ximian.com>
7572 * typemanager.cs (InitCoreTypes): Try calling
7573 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
7574 the 3-args-version. Corlib now also needs our `void_type'.
7575 (GetMethod): Added overloaded version which takes an optional
7576 `bool report_errors' to allow lookups of optional methods.
7578 2003-05-12 Martin Baulig <martin@ximian.com>
7580 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
7581 only used for locals and not for parameters.
7583 2003-05-12 Miguel de Icaza <miguel@ximian.com>
7585 * support.cs (InternalParameters.ParameterType): Return the
7586 ExternalType of the parameter.
7588 * parameter.cs (Parameter.ExternalType): drop the two arguments,
7591 2003-05-11 Miguel de Icaza <miguel@ximian.com>
7593 * class.cs (MethodData.Define): Do not set the `newslot' on
7594 interface members, if they are also flagged as "override".
7596 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
7597 better code for ++i and i++. This only works for static fields
7598 and local variables.
7600 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
7601 want to pull the DeclSpace out of the builder_to_declspace instead
7602 of the TypeBuilder (like in TypeContainer.FindMembers).
7604 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
7605 instead of LookupTypeContainer. Fixes the crash on .NET for
7606 looking up interface members.
7608 * const.cs: Create our own emit context during the Definition
7609 stage, so that constants are evaluated in the proper context, when
7610 a recursive definition happens.
7612 2003-05-11 Martin Baulig <martin@ximian.com>
7614 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
7615 new block for a switch section.
7616 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
7617 the adding/lookup in the switch block. Fixes #39828.
7619 2003-05-09 Miguel de Icaza <miguel@ximian.com>
7621 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
7622 functionality: I needed to convert the data after I had performed
7623 the add/sub operation into the operands type size.
7625 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
7626 pass the type for the box operation, otherwise the resulting
7627 object would have been of type object.
7629 (BoxedCast): Add constructor to specify the type to box as.
7631 2003-05-07 Miguel de Icaza <miguel@ximian.com>
7633 * iterators.cs: I was reusing the `count' variable inadvertently,
7634 take steps to not allow this to happen.
7636 2003-05-06 Miguel de Icaza <miguel@ximian.com>
7638 * attribute.cs (Attribute.Resolve): Params attributes are encoded
7639 by creating an array at the point where the params starts and
7640 putting all those arguments there, then adjusting the size of the
7643 2003-05-05 Miguel de Icaza <miguel@ximian.com>
7645 * expression.cs (New.AddressOf): Implement interface
7646 IMemoryLocation. This is used when the `new' operator is used in
7647 the context of an invocation to a method on a value type.
7649 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
7652 * namespace.cs: Also check the using aliases here.
7654 * driver.cs: Move the test for using validity after the types have
7655 been entered, so we do a single pass that also includes the using
7658 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
7659 in the regular case. CreateSiblingForFinally is doing extra
7662 * attribute.cs (GetAttributeArgumentExpression): Store the result
7663 on an out value, and use the return value to indicate failure
7664 instead of using null (which is a valid return for Constant.GetValue).
7666 * statement.cs: Perform the analysis flow for the increment
7667 portion after the statement, because this will be the real flow of
7668 execution. Fixes #42385
7670 * codegen.cs (EmitContext.EmitArgument,
7671 EmitContext.EmitStoreArgument): New helper functions when the
7672 RemapToProxy flag is set.
7674 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
7677 Add support for remapping parameters.
7679 * iterators.cs: Propagate parameter values; Store parameter
7680 values in the proxy classes.
7682 2003-05-04 Miguel de Icaza <miguel@ximian.com>
7684 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
7685 need a proxy reference; I do not know what I was thinking
7687 * cs-parser.jay (constructor_initializer): catch another error,
7688 and display nice message.
7690 (field_declaration): catch void field declaration
7691 to flag a better error.
7693 * class.cs (MemberBase.CheckBase): Report an error instead of a
7694 warning if a new protected member is declared in a struct.
7695 (Field.Define): catch the error of readonly/volatile.
7697 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
7699 (FieldExpr.AddressOf): ditto. Catch error where the address of a
7700 volatile variable is taken
7702 2003-05-02 Miguel de Icaza <miguel@ximian.com>
7704 * statement.cs (Fixed.Resolve): Report an error if we are not in
7707 2003-05-01 Miguel de Icaza <miguel@ximian.com>
7709 * typemanager.cs: reuse the code that handles type clashes for
7710 delegates and enumerations.
7712 * class.cs (Report28): Always report.
7714 * expression.cs (EncodeAsAttribute): Allow nulls here.
7716 2003-04-28 Miguel de Icaza <miguel@ximian.com>
7718 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
7719 the functionality for testing whether an expression is valid for
7720 an attribute here. Also handle the case of arrays of elements
7723 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
7724 encoding a linear array into an array of objects that are suitable
7725 to be passed to an CustomAttributeBuilder.
7727 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
7729 * ecore.cs: (FieldExpr): Handle field remapping here.
7731 * iteratators.cs: Pass the instance variable (if the method is an
7732 instance method) to the constructors, so we can access the field
7733 variables on the class.
7735 TODO: Test this with structs. I think the THIS variable on
7736 structs might have to be a pointer, and not a refenrece
7738 2003-04-27 Miguel de Icaza <miguel@ximian.com>
7740 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
7741 local variables to fields in a proxy class.
7743 * iterators.cs (PopulateProxy): Rename our internal fields to
7745 Create a <THIS> field if we are an instance method, so we can
7746 reference our parent container variables.
7747 (MapVariable): Called back from the EmitContext code to enter a
7748 new variable to field mapping into the proxy class (we just create
7752 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
7753 for using the remapped locals to fields.
7755 I placed the code here, because that gives the same semantics to
7756 local variables, and only changes the Emit code.
7758 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
7759 statements inside iterators.
7760 (VariableInfo): Add a FieldBuilder for the cases when we are
7761 remapping local variables to fields in a proxy class
7763 * ecore.cs (SimpleNameResolve): Avoid testing two times for
7764 current_block != null.
7766 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
7767 not cope with strings, as it has been moved to the
7768 TableSwitchEmit. Fixed bug in switch generation.
7770 * expression.cs (New.DoResolve): Provide more context for the user
7771 when reporting an error.
7773 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
7776 * expression.cs (MemberAccess.DoResolve): When we get a type back,
7777 check the permissions for it. Note than in a type-resolution
7778 context the check was already present in DeclSpace.ResolveType,
7779 but was missing from the MemberAccess.
7781 (ArrayCreation.CheckIndices): warn if the user has
7782 more nested levels of expressions, but there are no more
7783 dimensions specified. Avoids crash on bug 41906.
7785 2003-04-26 Miguel de Icaza <miguel@ximian.com>
7787 * statement.cs (Block): replace Implicit bool, for a generic
7789 New flag: `Unchecked'. This is used during the EmitMeta phase
7790 (which is out-of-line with the regular Resolve/Emit process for a
7791 statement, as this is done ahead of time, but still gets a chance
7792 to call constant resolve).
7794 (Block.Flags): new enum for adding a new flag.
7796 (Block.EmitMeta): track the state of unchecked.
7798 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
7799 to enable constant resolution to work there as well.
7801 2003-04-22 Miguel de Icaza <miguel@ximian.com>
7803 * typemanager.cs (ienumerable_type): Also look up
7804 System.Collections.IEnumerable.
7806 2003-04-21 Miguel de Icaza <miguel@ximian.com>
7808 TODO: Test more than one conditional per method.
7810 * class.cs (Indexer.Define): Report the location where the user is
7811 referencing the unsupported feature.
7813 (MethodData): Overload the use of `conditionals' to
7814 minimize the creation of needless ArrayLists. This saves roughly
7815 212kb on my machine.
7817 (Method): Implement the new IIteratorContainer interface.
7818 (Method.SetYields): Implement the method by setting the ModFlags
7819 to contain METHOD_YIELDS.
7821 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
7822 which just got set to null.
7824 * iterators.cs: New file.
7826 (Yield, YieldBreak): New statements.
7828 * statement.cs (Return.Resolve): Flag an error if we are used in
7831 * codegen.cs (InIterator): New flag set if the code is being
7832 compiled in an iterator method.
7834 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
7835 internal modifier, and we just use it to avoid adding extra
7836 fields, as this is seldom used.
7838 * cs-parser.jay: Add yield_statement (yield and yield break).
7840 * driver.cs: New flag -v2 to turn on version 2 features.
7842 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
7843 hashtable when v2 is enabled.
7845 2003-04-20 Miguel de Icaza <miguel@ximian.com>
7847 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
7848 there is already a namespace defined with this name.
7850 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
7851 people upgraded their corlibs.
7853 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
7854 always use fully qualified types, no need to use the compiler
7857 (TypeManager.IsNamespace): Use binarysearch.
7859 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
7860 AddDelegate): I did not quite use the new IsValid API properly: I
7861 have to pass the short-name and the fullname. I was passing only
7862 the basename instead of the fullname sometimes.
7864 (TypeContainer.DefineType): call NamespaceClash.
7866 * interface.cs (Interface.DefineType): use NamespaceClash before
7869 * delegate.cs (Delegate.DefineType): use NamespaceClash before
7872 * enum.cs: (Enum.DefineType): use NamespaceClash before
7875 * typemanager.cs (: 3-line patch that gives us some tasty 11%
7876 speed increase. First, use the negative_hits cache when we get a
7877 negative. Second, add the type with its full original name
7878 instead of the new . and + encoded name (reflection uses + to
7879 separate type from a nested type). Use LookupTypeReflection
7880 directly which bypasses the type->name hashtable (that we already
7881 know does not contain the type.
7883 * decl.cs (DeclSpace.ResolveTypeExpr): track the
7884 location/container type.
7886 * driver.cs: When passing utf8, use directly the UTF8Encoding.
7888 2003-04-19 Miguel de Icaza <miguel@ximian.com>
7890 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
7892 * delegate.cs (NewDelegate.Resolve): Test whether an instance
7893 method is being referenced in the method group from a static
7894 context, and report error 120 if so.
7896 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
7899 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
7900 is created, we create the A namespace).
7902 * cs-parser.jay: A namespace also introduces a DeclarationFound.
7905 2003-04-18 Miguel de Icaza <miguel@ximian.com>
7907 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
7908 invocation to ModuleBuilder.GetType with the same values will
7909 return a new type instance, so we need to cache its return
7912 * expression.cs (Binary.ResolveOperator): Only allow the compare
7913 operators on enums if they are of the same type.
7915 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
7916 types of ValueType on their own case. Before we were giving them
7917 the same treatment as objects.
7919 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
7920 fullname. Short name is used to compare against container name.
7921 Fullname is used to check against defined namespace names.
7923 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
7924 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
7926 (Method.CheckBase): Call parent.
7927 (MemberBase.CheckBase): Check for protected members on sealed
7929 (PropertyBase.CheckBase): Call parent.
7930 (Field.Define): Call parent.
7932 * report.cs: Negative error codes are now mapped to 8000 - code,
7933 so that the display is render more nicely.
7935 * typemanager.cs: Do not use try/catch, instead report a regular
7938 (GetPointerType, GetReferenceType): These methods provide
7939 mechanisms to obtain the T* and T& from a T. We had the code
7940 previously scattered around the code base, and it also used
7941 TypeManager.LookupType that would go through plenty of caches.
7942 This one goes directly to the type source.
7944 In some places we did the Type.GetType followed by
7945 ModuleBuilder.GetType, but not in others, so this unifies the
7948 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
7949 statements now that we have namespace information.
7951 * typemanager.cs (IsNamespace): New method, returns whether the
7952 string presented is a namespace or not.
7954 (ComputeNamespaces): New public entry point, computes the list of
7955 available namespaces, using the GetNamespaces API call in Mono, or
7956 the slower version in MS.NET.
7958 Now before we start the semantic analysis phase, we have a
7959 complete list of namespaces including everything that the user has
7962 Deleted old code to cache namespaces in .nsc files.
7964 2003-04-17 Miguel de Icaza <miguel@ximian.com>
7966 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
7967 class/struct location definition Location for the implicit
7968 constructor location.
7970 (Operator.Define): Use the location of the operator for the
7971 implicit Method definition.
7973 (Constructor.Emit): use the constructor location for the implicit
7974 base initializer constructor.
7976 * ecore.cs: Remove ITypeExpression. This interface is now gone,
7977 and the Expression class now contains two new methods:
7979 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
7980 isolate type lookup from the rest of the resolution process.
7982 Since we use Expressions to hold type definitions due to the way
7983 we parse the input we have historically overloaded Resolve to
7984 perform the Type lookups if a special flag is passed. Now this is
7985 eliminated and two methods take their place.
7987 The differences in the two methods between xStep and xTerminal is
7988 that xStep is involved in our current lookup system that uses
7989 SimpleNames to compose a name, while xTerminal is used just to
7990 catch the case where the simplename lookup failed.
7992 2003-04-16 Miguel de Icaza <miguel@ximian.com>
7994 * expression.cs (ResolveMemberAccess): Remove redundant code.
7995 TypeExpr expressions are always born fully resolved.
7997 * interface.cs (PopulateMethod): Do not lookup the types twice.
7998 We were doing it once during SemanticAnalysis and once during
8001 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
8002 in local variable type definitions, were being returned as a
8003 SimpleName (we decomposed everything into a string), that is
8004 because primary_expression was being used instead of a type in the
8005 grammar (reduce/reduce conflicts).
8007 The part that was wrong is that we converted the expression into a
8008 string (an oversimplification in one hand, compounded with primary
8009 expressions doing string concatenation).
8015 Would return "A.B.C[]" as a SimpleName. This stopped things like
8016 using clauses from working on this particular context. And a type
8017 was being matched directly against "A.B.C[]".
8019 We now use the correct approach, and allow for ComposedCast to be
8020 part of the unary expression. So the "A.B.C []" become a composed
8021 cast of "A.B.C" (as a nested group of MemberAccess with a
8022 SimpleName at the end) plus the rank composition "[]".
8026 2003-04-10 Miguel de Icaza <miguel@ximian.com>
8028 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
8029 for the access level checking.
8031 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
8032 `TypeContainer container', because I kept getting confused when I
8033 was debugging this code.
8035 * expression.cs (Indexers): Instead of tracking getters/setters,
8036 we now track them in parallel. We create one arraylist less, but
8037 most importantly it is possible now for the LValue code to find a
8038 matching get for a set.
8040 (IndexerAccess.DoResolveLValue): Update the code.
8041 GetIndexersForType has been modified already to extract all the
8042 indexers from a type. The code assumed it did not.
8044 Also make the code set the correct return type for the indexer.
8045 This was fixed a long time ago for properties, but was missing for
8046 indexers. It used to be void_type.
8048 (Binary.Emit): Test first for doubles instead of
8049 floats, as they are more common.
8051 (Binary.EmitBranchable): Use the .un version of the branch opcodes
8052 when dealing with floats and the <=, >= operators. This fixes bug
8055 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
8056 to load the array value by emitting a load on the foreach variable
8057 type. This was incorrect.
8059 We now emit the code to load an element using the the array
8060 variable type, and then we emit the conversion operator.
8064 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
8066 * attribute.cs: Avoid allocation of ArrayLists in the common case.
8068 2003-04-09 Miguel de Icaza <miguel@ximian.com>
8070 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
8071 test for protection before we test for signatures.
8073 (MethodSignature.ToString): implement.
8075 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
8076 to the case where we reduced into a LongConstant.
8078 * decl.cs (CheckAccessLevel): If the type is an array, we can not
8079 depend on whether the information is acurrate, because the
8080 Microsoft runtime will always claim that the array type is public,
8081 regardless of the real state.
8083 If the type is a pointer, another problem happens: the type is
8084 reported as non-public in Microsoft.
8086 In both cases we have to call CheckAccessLevel recursively with
8087 the underlying type as the argument to be tested.
8089 2003-04-08 Miguel de Icaza <miguel@ximian.com>
8091 * assign.cs (Assign.Emit): If we are dealing with a compound
8092 assignment expression, we should use the code path that stores the
8093 intermediate result in a temporary value. This fixes #40903.
8095 *expression.cs (Indirection.ToString): Provide ToString method for
8098 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
8100 * class.cs: Null out fields holding references to Block objects so
8101 they can be garbage collected.
8103 * expression.cs (OverloadResolve): Remove unused local.
8105 2003-04-07 Martin Baulig <martin@ximian.com>
8107 * codegen.cs (EmitContext.CurrentFile): New public field.
8108 (EmitContext.Mark): Use the CurrentFile to check whether the
8109 location is in the correct file.
8110 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
8112 2003-04-07 Martin Baulig <martin@ximian.com>
8114 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
8116 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
8117 location. [FIXME: The location argument which gets passed to this
8118 method is sometimes wrong!]
8120 2003-04-07 Nick Drochak <ndrochak@gol.com>
8122 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
8124 2003-04-07 Miguel de Icaza <miguel@ximian.com>
8126 * expression.cs (Indirection.EmitAssign): We were using the
8127 temporary, but returning immediately instead of continuing the
8130 2003-04-06 Martin Baulig <martin@ximian.com>
8132 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
8133 if it's a nested child, but also deriving from the outer class.
8136 * typemanager.cs (IsNestedChildOf): Make this work if it's a
8137 nested child, but also deriving from the outer class. See
8139 (FilterWithClosure): We may access private members of the outer
8140 class if we're a nested child and deriving from the outer class.
8141 (RealMemberLookup): Only set `closure_private_ok' if the
8142 `original_bf' contained BindingFlags.NonPublic.
8144 2003-04-05 Martin Baulig <martin@ximian.com>
8146 * expression.cs (SizeOf.DoResolve): Use ResolveTypeExpr, so we can
8147 probe if its a type parameter, and if so, flag an error.
8149 * decl.cs: Move here the SetParameterInfo code from class.cs.
8150 Handle IsGeneric here.
8152 Handle a variety of errors in the parameter info definition.
8154 * ecore.cs (SimpleName.DoResolveType): Handle look ups for generic
8155 type parameters here.
8157 * cs-parser.jay (class_declaration): report errors for parameters
8160 2003-01-21 Miguel de Icaza <miguel@ximian.com>
8162 * generic.cs: New file, contains support code for generics.
8164 * cs-parser.jay: Remove OP_SHIFT_LEFT, OP_SHIFT_RIGHT,
8165 OP_SHIFT_LEFT_ASSIGN, OP_SHIFT_RIGHT_ASSIGN.
8167 Update parser for the above removals.
8169 * cs-tokenizer.cs: Do not handle <<= or >>= specially. This is
8170 now taken care of in the parser.
8172 2003-04-02 Miguel de Icaza <miguel@ximian.com>
8174 * class.cs (Event.Define): Do not allow abstract events to have
8177 2003-04-01 Miguel de Icaza <miguel@ximian.com>
8179 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
8180 block in event declarations.
8182 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
8183 value type, get its address.
8185 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
8186 leaving a class on the stack instead of a boolean value (int
8187 0/1). Change the code so we compare against null, and then the
8188 result against zero.
8190 * class.cs (TypeContainer.GetClassBases): We were checking for the
8191 parent class being sealed too late.
8193 * expression.cs (Binary.Emit): For <= and >= when dealing with
8194 floating point values, use cgt.un and clt.un instead of cgt and
8197 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
8199 * statement.cs: Apply the same optimization as MS: skip the
8200 GetEnumerator returning an IEnumerator, and use the one returning a
8201 CharEnumerator instead. This allows us to avoid the try-finally block
8204 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
8206 * cs-parser.jay: Attributes cannot be applied to
8207 namespaces. Fixes #40473
8209 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8212 (Add*): check if the name is valid using the full name for constants,
8213 fields, properties and events.
8215 2003-03-28 Miguel de Icaza <miguel@ximian.com>
8217 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
8218 char constants to be part of the enumeration.
8220 * expression.cs (Conditional.DoResolve): Add support for operator
8221 true. Implements the missing functionality from 14.12
8223 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
8224 operator true/false as required by the spec.
8226 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
8227 implicit conversion to boolean.
8229 * statement.cs (Statement.ResolveBoolean): A boolean expression is
8230 also one where the type implements `operator true'.
8232 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
8233 get an expression that will invoke operator true based on an
8236 (GetConversionOperators): Removed the hack that called op_True
8239 (Expression.ResolveBoolean): Move this from Statement.
8241 2003-03-17 Miguel de Icaza <miguel@ximian.com>
8243 * ecore.cs (FieldExpr): do not allow initialization of initonly
8244 fields on derived classes
8246 2003-03-13 Martin Baulig <martin@ximian.com>
8248 * statement.cs (Block.Emit): Call ig.BeginScope() and
8249 ig.EndScope() when compiling with debugging info; call
8250 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
8252 2003-03-08 Miguel de Icaza <miguel@ximian.com>
8254 * expression.cs (Indexers): Do not construct immediately, allow
8255 for new members to be appended as we go. Fixes 38143
8257 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8259 * expression.cs: save/restore context when resolving an unchecked
8262 2003-03-05 Miguel de Icaza <miguel@ximian.com>
8264 * cfold.cs: Catch division by zero in modulus operator during
8267 2003-03-03 Miguel de Icaza <miguel@ximian.com>
8269 * interface.cs (Interface.DefineMembers): Avoid defining members
8272 2003-02-27 Miguel de Icaza <miguel@ximian.com>
8274 * driver.cs: handle the +/- options for -noconfig
8276 * statement.cs (Unckeched.Resolve): Also track the state of
8277 unchecked in the Resolve phase.
8279 2003-02-27 Martin Baulig <martin@ximian.com>
8281 * ecore.cs (Expression.MemberLookup): Don't create a
8282 MethodGroupExpr for something which is not a method. Fixes #38291.
8284 2003-02-25 Miguel de Icaza <miguel@ximian.com>
8286 * class.cs (MemberBase.CheckParameters): Also check that the type
8287 is unmanaged if it is a pointer.
8289 * expression.cs (SizeOf.Resolve): Add location information.
8291 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
8292 a managed type is declared.
8294 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
8295 parameter modifiers as well. Fixes bug 38606
8297 * class.cs: Very sad. Am backing out the speed up changes
8298 introduced by the ArrayList -> Array in the TypeContainer, as they
8299 were not actually that much faster, and introduced a bug (no error
8300 reports on duplicated methods).
8302 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
8303 source first, this will guarantee that we have a valid expression
8304 before calling in lower levels functions that will require a
8305 resolved object. Then use this original_source in the
8306 target.ResolveLValue instead of the original source that was
8309 Another change. Use target.Resolve instead of LValueResolve.
8310 Although we are resolving for LValues, we will let the Assign code
8311 take care of that (it will be called again from Resolve). This
8312 basically allows code like this:
8314 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
8315 class Y { void A (X x) { x [0] += o; }
8317 The problem was that the indexer was trying to resolve for
8318 set_Item (idx, object o) and never finding one. The real set_Item
8319 was set_Item (idx, X). By delaying the process we get the right
8324 2003-02-23 Martin Baulig <martin@ximian.com>
8326 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
8327 while calling DoEmit ().
8329 * codegen.cs (EmitContext.Mark): Don't mark locations in other
8330 source files; if you use the #line directive inside a method, the
8331 compiler stops emitting line numbers for the debugger until it
8332 reaches the end of the method or another #line directive which
8333 restores the original file.
8335 2003-02-23 Martin Baulig <martin@ximian.com>
8337 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
8339 2003-02-23 Martin Baulig <martin@ximian.com>
8341 * statement.cs (Block.AddChildVariableNames): We need to call this
8342 recursively, not just for our immediate children.
8344 2003-02-23 Martin Baulig <martin@ximian.com>
8346 * class.cs (Event.Define): Always make the field private, like csc does.
8348 * typemanager.cs (TypeManager.RealMemberLookup): Make events
8349 actually work, fixes bug #37521.
8351 2003-02-23 Miguel de Icaza <miguel@ximian.com>
8353 * delegate.cs: When creating the various temporary "Parameters"
8354 classes, make sure that we call the ComputeAndDefineParameterTypes
8355 on those new parameters (just like we do with the formal ones), to
8356 allow them to be resolved in the context of the DeclSpace.
8358 This fixes the bug that Dick observed in Bugzilla #38530.
8360 2003-02-22 Miguel de Icaza <miguel@ximian.com>
8362 * expression.cs (ResolveMemberAccess): When resolving a constant,
8363 do not attempt to pull a constant if the value was not able to
8364 generate a valid constant.
8366 * const.cs (LookupConstantValue): Do not report more errors than required.
8368 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8370 * expression.cs: fixes bug #38328.
8372 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8374 * class.cs: Changed all the various members that can be part of a
8375 class from being an ArrayList to be an Array of the right type.
8376 During the DefineType type_list, interface_list, delegate_list and
8377 enum_list are turned into types, interfaces, delegates and enums
8380 And during the member population, indexer_list, event_list,
8381 constant_list, field_list, instance_constructor_list, method_list,
8382 operator_list and property_list are turned into their real arrays.
8384 Although we could probably perform this operation earlier, for
8385 good error reporting we need to keep the lists and remove the
8386 lists for longer than required.
8388 This optimization was triggered by Paolo profiling the compiler
8389 speed on the output of `gen-sample-program.pl' perl script.
8391 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
8392 not crash in methods like MemberLookupFailed that use this field.
8394 This problem arises when the compiler fails to resolve a type
8395 during interface type definition for example.
8397 2003-02-18 Miguel de Icaza <miguel@ximian.com>
8399 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
8400 inherit from System.Object, so we have to stop at null, not only
8401 when reaching System.Object.
8403 2003-02-17 Miguel de Icaza <miguel@ximian.com>
8405 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
8406 DeclaredOnly because the parent indexer might have had a different
8407 name, but did not loop until the top of the hierarchy was reached.
8409 The problem this one fixes is 35492: when a class implemented an
8410 indexer from an interface, we were getting the interface method
8411 (which was abstract) and we were flagging an error (can not invoke
8414 This also keeps bug 33089 functioning, and test-148 functioning.
8416 * typemanager.cs (IsSpecialMethod): The correct way of figuring
8417 out if a method is special is to see if it is declared in a
8418 property or event, or whether it is one of the predefined operator
8419 names. This should fix correctly #36804.
8421 2003-02-15 Miguel de Icaza <miguel@ximian.com>
8423 The goal here is to remove the dependency on EmptyCast.Peel ().
8424 Killing it completely.
8426 The problem is that currently in a number of places where
8427 constants are expected, we have to "probe" for an EmptyCast, and
8428 Peel, which is not the correct thing to do, as this will be
8429 repetitive and will likely lead to errors.
8431 The idea is to remove any EmptyCasts that are used in casts that
8432 can be reduced to constants, so we only have to cope with
8435 This bug hunt was triggered by Bug 37363 and the desire to remove
8436 the duplicate pattern where we were "peeling" emptycasts to check
8437 whether they were constants. Now constants will always be
8440 * ecore.cs: Use an enumconstant here instead of wrapping with
8443 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
8444 throwing me off. By handling this we can get rid of a few hacks.
8446 * statement.cs (Switch): Removed Peel() code.
8448 2003-02-14 Miguel de Icaza <miguel@ximian.com>
8450 * class.cs: Location information for error 508
8452 * expression.cs (New.DoResolve): Add a guard against double
8453 resolution of an expression.
8455 The New DoResolve might be called twice when initializing field
8456 expressions (see EmitFieldInitializers, the call to
8457 GetInitializerExpression will perform a resolve on the expression,
8458 and later the assign will trigger another resolution
8460 This leads to bugs (#37014)
8462 * delegate.cs: The signature for EndInvoke should contain any ref
8463 or out parameters as well. We were not doing this in the past.
8465 * class.cs (Field.Define): Do not overwrite the type definition
8466 inside the `volatile' group. Turns out that volatile enumerations
8467 were changing the type here to perform a validity test, which
8470 2003-02-12 Miguel de Icaza <miguel@ximian.com>
8472 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
8473 and structs, we do not want to load the instance variable
8475 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
8476 enum_type has to be handled like an object reference (implicit
8477 conversions exists from this to object), but the regular IsClass
8478 and IsValueType tests will never return true for this one.
8480 Also we use TypeManager.IsValueType instead of type.IsValueType,
8481 just for consistency with the rest of the code (this is only
8482 needed if we ever use the construct exposed by test-180.cs inside
8483 corlib, which we dont today).
8485 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
8487 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
8490 2003-02-09 Martin Baulig <martin@ximian.com>
8492 * namespace.cs (Namespace..ctor): Added SourceFile argument.
8493 (Namespace.DefineNamespaces): New static public method; this is
8494 called when we're compiling with debugging to add all namespaces
8497 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
8498 pass it to the Namespace's .ctor.
8500 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
8501 and MethodBase arguments; pass the namespace ID to the symwriter;
8502 pass the MethodBase instead of the token to the symwriter.
8503 (SymbolWriter.DefineNamespace): New method to add a namespace to
8506 2003-02-09 Martin Baulig <martin@ximian.com>
8508 * symbolwriter.cs: New file. This is a wrapper around
8509 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
8510 methods here in near future.
8512 2003-02-09 Martin Baulig <martin@ximian.com>
8514 * codegen.cs (EmitContext.Mark): Just pass the arguments to
8515 ILGenerator.MarkSequencePoint() which are actually used by the
8518 2003-02-09 Martin Baulig <martin@ximian.com>
8520 * location.cs (SourceFile): New public sealed class. This
8521 contains the name and an index which is used in the location's token.
8522 (Location): Reserve an appropriate number of bits in the token for
8523 the source file instead of walking over that list, this gives us a
8524 really huge performance improvement when compiling with debugging.
8526 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
8527 `SourceFile' argument instead of a string.
8528 (Driver.ProcessFile): Add all the files via Location.AddFile(),
8529 but don't parse/tokenize here, we need to generate the list of all
8530 source files before we do that.
8531 (Driver.ProcessFiles): New static function. Parses/tokenizes all
8534 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
8535 instead of a string.
8537 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
8540 2003-02-09 Martin Baulig <martin@ximian.com>
8542 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
8543 filename on `#line default'.
8545 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
8547 * statement.cs: don't clear the pinned var when the fixed statement
8548 returns from the method (fixes bug#37752).
8550 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
8552 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
8555 2003-02-07 Martin Baulig <martin@ximian.com>
8557 * driver.cs: Removed the `--debug-args' command line argument.
8559 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
8560 automatically by the AsssemblyBuilder.
8561 (CodeGen.InitializeSymbolWriter): We don't need to call any
8562 initialization function on the symbol writer anymore. This method
8563 doesn't take any arguments.
8565 2003-02-03 Miguel de Icaza <miguel@ximian.com>
8567 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
8568 from referenced assemblies as well.
8570 2003-02-02 Martin Baulig <martin@ximian.com>
8572 * class.cs (MethodData.Emit): Generate debugging info for external methods.
8574 2003-02-02 Martin Baulig <martin@ximian.com>
8576 * class.cs (Constructor.Emit): Open the symbol writer before
8577 emitting the constructor initializer.
8578 (ConstructorInitializer.Emit): Call ec.Mark() to allow
8579 single-stepping through constructor initializers.
8581 2003-01-30 Miguel de Icaza <miguel@ximian.com>
8583 * class.cs: Handle error 549: do not allow virtual methods in
8586 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
8588 * decl.cs: Check access levels when resolving types
8590 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
8592 * statement.cs: Add parameters and locals set in catch blocks that might
8593 return to set vector
8595 2003-01-29 Miguel de Icaza <miguel@ximian.com>
8597 * class.cs (Operator): Set the SpecialName flags for operators.
8599 * expression.cs (Invocation.DoResolve): Only block calls to
8600 accessors and operators on SpecialName methods.
8602 (Cast.TryReduce): Handle conversions from char constants.
8605 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
8607 * statement.cs: small memory and time optimization in FlowBranching.
8609 2003-01-28 Pedro Mart <yoros@wanadoo.es>
8611 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
8612 problem that the last fix but in the other sid (Set).
8614 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
8615 access when there is no indexer in the hierarchy.
8617 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
8619 * class.cs: Combine some if statements.
8621 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8623 * driver.cs: fixed bug #37187.
8625 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
8627 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
8628 any indexer, it's needed to build a list with all the indexers in the
8629 hierarchy (AllGetters), else we have problems. Fixes #35653.
8631 2003-01-23 Miguel de Icaza <miguel@ximian.com>
8633 * class.cs (MethodData.Define): It is wrong for an interface
8634 implementation to be static in both cases: explicit and implicit.
8635 We were only handling this in one case.
8637 Improve the if situation there to not have negations.
8639 * class.cs (Field.Define): Turns out that we do not need to check
8640 the unsafe bit on field definition, only on usage. Remove the test.
8642 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8644 * driver.cs: use assembly.Location instead of Codebase (the latest
8645 patch made mcs fail when using MS assemblies).
8647 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
8649 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
8650 get the path to *corlib.dll.
8652 2003-01-21 Nick Drochak <ndrochak@gol.com>
8656 * typemanager.cs: Remove compiler warnings
8658 2003-01-20 Duncan Mak <duncan@ximian.com>
8660 * AssemblyInfo.cs: Bump the version number to 0.19.
8662 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8664 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
8666 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
8668 * class.cs (Constructor::Emit): Emit debugging info for constructors.
8670 2003-01-17 Miguel de Icaza <miguel@ximian.com>
8672 * cs-parser.jay: Small fix: we were not comparing the constructor
8673 name correctly. Thanks to Zoltan for the initial pointer.
8675 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
8677 * cs-tokenizer.cs: Set file name when specified with #line
8679 2003-01-15 Miguel de Icaza <miguel@ximian.com>
8681 * cs-parser.jay: Only perform the constructor checks here if we
8682 are named like the class; This will help provider a better
8683 error. The constructor path is taken when a type definition is
8684 not found, but most likely the user forgot to add the type, so
8685 report that rather than the constructor error.
8687 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
8689 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
8692 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8694 * cs-parser.jay: Add cleanup call.
8696 2003-01-13 Duncan Mak <duncan@ximian.com>
8698 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
8699 consistent with other methods.
8701 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
8703 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
8705 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
8707 * attribute.cs: only set GuidAttr to true when we have a
8710 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8714 * typemanager.cs: fixes to allow mcs compile corlib with the new
8715 Type.IsSubclassOf fix.
8717 2003-01-08 Miguel de Icaza <miguel@ximian.com>
8719 * expression.cs (LocalVariableReference.DoResolve): Classify a
8720 constant as a value, not as a variable. Also, set the type for
8723 * cs-parser.jay (fixed_statement): take a type instead of a
8724 pointer_type, so we can produce a better error message later.
8726 * statement.cs (Fixed.Resolve): Flag types that are not pointers
8729 (For.DoEmit): Make inifinite loops have a
8730 non-conditional branch back.
8732 (Fixed.DoEmit): First populate the pinned variables, then emit the
8733 statement, then clear the variables. Before I was emitting the
8734 code once for each fixed piece.
8737 2003-01-08 Martin Baulig <martin@ximian.com>
8739 * statement.cs (FlowBranching.MergeChild): A break in a
8740 SWITCH_SECTION does not leave a loop. Fixes #36155.
8742 2003-01-08 Martin Baulig <martin@ximian.com>
8744 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
8745 lives in the same number space than `param_map'. Fixes #36154.
8747 2003-01-07 Miguel de Icaza <miguel@ximian.com>
8749 * cs-parser.jay (constructor_declaration): Set the
8750 Constructor.ModFlags before probing for it. This makes the
8751 compiler report 514, 515 and 132 (the code was there, but got
8754 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
8755 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
8756 (GotoCase.Resolve): Set `Returns' to ALWAYS.
8758 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
8760 * enum.cs: create the enum static fields using the enum type.
8762 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
8764 * class.cs: don't try to create the ParamBuilder for the return
8765 type if it's not needed (and handle it breaking for the ms runtime
8768 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
8770 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
8772 2002-12-29 Miguel de Icaza <miguel@ximian.com>
8774 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
8775 the command. This showed up while compiling the JANET source
8776 code, which used \r as its only newline separator.
8778 2002-12-28 Miguel de Icaza <miguel@ximian.com>
8780 * class.cs (Method.Define): If we are an operator (because it
8781 reuses our code), then set the SpecialName and HideBySig. #36128
8783 2002-12-22 Miguel de Icaza <miguel@ximian.com>
8785 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
8786 exception, report error 120 `object reference required'.
8788 * driver.cs: Add --pause option, used during to measure the size
8789 of the process as it goes with --timestamp.
8791 * expression.cs (Invocation.DoResolve): Do not allow methods with
8792 SpecialName to be invoked.
8794 2002-12-21 Miguel de Icaza <miguel@ximian.com>
8796 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
8797 number before adding it.
8799 2002-12-21 Ravi Pratap <ravi@ximian.com>
8801 * ecore.cs (StandardImplicitConversion): When in an unsafe
8802 context, we allow conversion between void * to any other pointer
8803 type. This fixes bug #35973.
8805 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
8807 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
8808 is not thrown when extensionless outputs are used
8810 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8812 * rootcontext.cs: fixed compilation of corlib.
8814 2002-12-19 Miguel de Icaza <miguel@ximian.com>
8816 * attribute.cs (Attributes.Contains): Add new method.
8818 * class.cs (MethodCore.LabelParameters): if the parameter is an
8819 `out' parameter, check that no attribute `[In]' has been passed.
8821 * enum.cs: Handle the `value__' name in an enumeration.
8823 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
8825 * decl.cs: Added special case to allow overrides on "protected
8828 2002-12-18 Ravi Pratap <ravi@ximian.com>
8830 * attribute.cs (Attributes.AddAttributeSection): Rename to this
8831 since it makes much more sense.
8833 (Attributes.ctor): Don't require a Location parameter.
8835 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
8837 * attribute.cs (ApplyAttributes): Remove extra Location parameters
8838 since we already have that information per attribute.
8840 * everywhere : make appropriate changes.
8842 * class.cs (LabelParameters): Write the code which actually
8843 applies attributes to the return type. We can't do this on the MS
8844 .NET runtime so we flag a warning in the case an exception is
8847 2002-12-18 Miguel de Icaza <miguel@ximian.com>
8849 * const.cs: Handle implicit null conversions here too.
8851 2002-12-17 Ravi Pratap <ravi@ximian.com>
8853 * class.cs (MethodCore.LabelParameters): Remove the extra
8854 Type [] parameter since it is completely unnecessary. Instead
8855 pass in the method's attributes so that we can extract
8856 the "return" attribute.
8858 2002-12-17 Miguel de Icaza <miguel@ximian.com>
8860 * cs-parser.jay (parse): Use Report.Error to flag errors instead
8861 of ignoring it and letting the compile continue.
8863 * typemanager.cs (ChangeType): use an extra argument to return an
8864 error condition instead of throwing an exception.
8866 2002-12-15 Miguel de Icaza <miguel@ximian.com>
8868 * expression.cs (Unary.TryReduce): mimic the code for the regular
8869 code path. Perform an implicit cast in the cases where we can
8870 implicitly convert to one of the integral types, and then reduce
8871 based on that constant. This fixes bug #35483.
8873 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8875 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
8877 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8879 * namespace.cs: fixed bug #35489.
8881 2002-12-12 Miguel de Icaza <miguel@ximian.com>
8883 * class.cs: Remove some dead code.
8885 * cs-parser.jay: Estimate the number of methods needed
8886 (RootContext.MethodCount);
8888 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
8889 numbers instead of StringBuilders.
8891 * support.cs (PtrHashtable): Add constructor with initial size;
8892 We can now reduce reallocations of the method table.
8894 2002-12-10 Ravi Pratap <ravi@ximian.com>
8896 * attribute.cs (ApplyAttributes): Keep track of the emitted
8897 attributes on a per-target basis. This fixes bug #35413.
8899 2002-12-10 Miguel de Icaza <miguel@ximian.com>
8901 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
8902 default to the Windows 1252 encoding.
8904 (UnixParseOption): Support version, thanks to Alp for the missing
8907 * AssemblyInfo.cs: Add nice assembly information.
8909 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
8912 * cs-parser.jay: Allow a trailing comma before the close bracked
8913 in the attribute_section production.
8915 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
8916 address of the instance was being taken, I will take this out,
8917 because we take the address of the object immediately here.
8919 2002-12-09 Ravi Pratap <ravi@ximian.com>
8921 * typemanager.cs (AreMultipleAllowed): Take care of the most
8922 obvious case where attribute type is not in the current assembly -
8925 2002-12-08 Miguel de Icaza <miguel@ximian.com>
8927 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
8928 definitions, instead of doing that afterwards.
8930 Also we use a nice little hack, depending on the constructor, we
8931 know if we are a "composed" name or a simple name. Hence, we
8932 avoid the IndexOf test, and we avoid
8934 * codegen.cs: Add code to assist in a bug reporter to track down
8935 the source of a compiler crash.
8937 2002-12-07 Ravi Pratap <ravi@ximian.com>
8939 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
8940 types have been emitted for a given element and flag an error
8941 if something which does not have AllowMultiple set is used more
8944 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
8945 attribute types and their corresponding AllowMultiple properties
8947 (AreMultipleAllowed): Check the property for a given type.
8949 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
8950 property in the case we have a TypeContainer.
8952 (Attributes.AddAttribute): Detect duplicates and just skip on
8953 adding them. This trivial fix catches a pretty gross error in our
8954 attribute emission - global attributes were being emitted twice!
8956 Bugzilla bug #33187 is now fixed.
8958 2002-12-06 Miguel de Icaza <miguel@ximian.com>
8960 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
8963 * expression.cs (Binary.ResolveOperator): I can only use the
8964 Concat (string, string, string) and Concat (string, string,
8965 string, string) if the child is actually a concatenation of
8968 2002-12-04 Miguel de Icaza <miguel@ximian.com>
8970 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
8971 context where we need a 2-character lookahead.
8973 * pending.cs (PendingImplementation): Rework so we can keep track
8974 of interface types all the time, and flag those which were
8975 implemented by parents as optional.
8977 2002-12-03 Miguel de Icaza <miguel@ximian.com>
8979 * expression.cs (Binary.ResolveOperator): Use
8980 String.Concat(string,string,string) or
8981 String.Concat(string,string,string,string) when possible.
8983 * typemanager: More helper methods.
8986 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
8988 * pending.cs: remove the bogus return from GetMissingInterfaces()
8989 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
8991 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8993 * namespace.cs: avoid duplicated 'using xxx' being added to
8994 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
8995 when we get more than one 'using' statement for the same namespace.
8996 Report a CS0105 warning for it.
8998 2002-11-30 Miguel de Icaza <miguel@ximian.com>
9000 * cs-tokenizer.cs (consume_identifier): use read directly, instead
9001 of calling getChar/putback, uses internal knowledge of it.
9003 (xtoken): Reorder tokenizer so most common patterns are checked
9004 first. This reduces the compilation time in another 5% (from 8.11s
9005 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
9007 The parsing time is 22% of the compilation in mcs, and from that
9008 64% is spent on the tokenization process.
9010 I tried using a binary search for keywords, but this is slower
9011 than the hashtable. Another option would be to do a couple of
9014 * Not use a StringBuilder, instead use an array of chars,
9015 with a set value. Notice that this way we could catch
9016 the 645 error without having to do it *afterwards*.
9018 * We could write a hand-parser to avoid the hashtable
9019 compares altogether.
9021 The identifier consumption process takes 37% of the tokenization
9022 time. Another 15% is spent on is_number. 56% of the time spent
9023 on is_number is spent on Int64.Parse:
9025 * We could probably choose based on the string length to
9026 use Int32.Parse or Int64.Parse and avoid all the 64-bit
9029 Another 3% is spend on wrapping `xtoken' in the `token' function.
9031 Handle 0xa0 as whitespace (#34752)
9033 2002-11-26 Miguel de Icaza <miguel@ximian.com>
9035 * typemanager.cs (IsCLRType): New routine to tell whether a type
9036 is one of the builtin types.
9038 Maybe it needs to use TypeCodes to be faster. Maybe we could use
9039 typecode in more places instead of doing pointer comparissions.
9040 We could leverage some knowledge about the way the typecodes are
9043 New code to cache namespaces in assemblies, it is currently not
9044 invoked, to be used soon.
9046 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
9048 * expression.cs (Binary.ResolveOperator): specially handle
9049 strings, and do not perform user-defined operator overloading for
9052 2002-11-24 Miguel de Icaza <miguel@ximian.com>
9054 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
9055 internalcall as it is a pretty simple operation; Avoid whenever
9056 possible to call Char.IsLetter.
9058 (consume_identifier): Cut by half the number of
9059 hashtable calls by merging the is_keyword and GetKeyword behavior.
9061 Do not short-circuit, because if we do, we
9062 report errors (ie, #if false && true would produce an invalid
9066 2002-11-24 Martin Baulig <martin@ximian.com>
9068 * expression.cs (Cast.TryReduce): If we're in checked syntax,
9069 check constant ranges and report a CS0221. Fixes #33186.
9071 2002-11-24 Martin Baulig <martin@ximian.com>
9073 * cs-parser.jay: Make this work for uninitialized variable
9074 declarations in the `for' initializer. Fixes #32416.
9076 2002-11-24 Martin Baulig <martin@ximian.com>
9078 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
9079 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
9081 2002-11-24 Martin Baulig <martin@ximian.com>
9083 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
9084 argument; if true, we also check for user-defined conversions.
9085 This is only needed if both arguments are of a user-defined type.
9086 Fixes #30443, added test-175.cs.
9087 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
9089 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
9091 2002-11-24 Martin Baulig <martin@ximian.com>
9093 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
9094 function to get the store opcode.
9095 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
9096 only emit the Ldelema if the store opcode is Stobj. You must run
9097 both test-34 and test-167 to test this. Fixes #34529.
9099 2002-11-23 Martin Baulig <martin@ximian.com>
9101 * ecore.cs (Expression.MemberLookup): Added additional
9102 `qualifier_type' argument which is used when we're being called
9103 from MemberAccess.DoResolve() and null if we're called from a
9105 (Expression.MemberLookupFailed): New method to report errors; this
9106 does the CS1540 check and reports the correct error message.
9108 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
9109 argument for the CS1540 check and redone the way how we're dealing
9110 with private members. See the comment in the source code for details.
9111 (FilterWithClosure): Reverted this back to revision 1.197; renamed
9112 `closure_start_type' to `closure_qualifier_type' and check whether
9113 it's not null. It was not this filter being broken, it was just
9114 being called with the wrong arguments.
9116 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
9117 and pass it the correct `qualifier_type'; this also does the error
9120 2002-11-22 Miguel de Icaza <miguel@ximian.com>
9122 * expression.cs (Invocation.EmitParams): If the we are dealing
9123 with a non-built-in value type, load its address as well.
9125 (ArrayCreation): Use a a pretty constant instead
9126 of the hardcoded value 2. Use 6 instead of 2 for the number of
9127 static initializers.
9129 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
9130 because they are not really value types, just glorified integers.
9132 * driver.cs: Do not append .exe, the CSC compiler does not do it.
9134 * ecore.cs: Remove redundant code for enumerations, make them use
9135 the same code path as everything else, fixes the casting issue
9136 with enumerations in Windows.Forms.
9138 * attribute.cs: Do only cast to string if it is a string, the
9139 validation happens later.
9141 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
9142 people upgrade their corlibs.
9144 * ecore.cs: Oops, enumerations were not following the entire code path
9146 2002-11-21 Miguel de Icaza <miguel@ximian.com>
9148 * typemanager.cs (FilterWithClosure): Commented out the test for
9149 1540 in typemanager.cs, as it has problems when accessing
9150 protected methods from a parent class (see test-174.cs).
9152 * attribute.cs (Attribute.ValidateGuid): new method.
9153 (Attribute.Resolve): Use above.
9155 2002-11-19 Miguel de Icaza <miguel@ximian.com>
9157 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
9159 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
9160 handling for enumerations, as we only needed the TypeContainer
9161 functionality to begin with (this is required for the fix below to
9162 work for enums that reference constants in a container class for
9165 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
9167 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
9168 a valid TypeBuilder to perform lookups on.o
9170 * class.cs (InheritableMemberSignatureCompare): Use true in the
9171 call to GetGetMethod and GetSetMethod, because we are comparing
9172 the signature, and we need to get the methods *even* if they are
9175 (PropertyBase.CheckBase): ditto.
9177 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
9178 GotoCase.Resolve): Use Peel on EmpytCasts.
9180 * ecore.cs (EmptyCast): drop child, add Peel method.
9182 2002-11-17 Martin Baulig <martin@ximian.com>
9184 * ecore.cs (EmptyCast.Child): New public property.
9186 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
9187 label resolved to an EmptyCast. Fixes #34162.
9188 (GotoCase.Resolve): Likewise.
9189 (Block.EmitMeta): Likewise.
9191 2002-11-17 Martin Baulig <martin@ximian.com>
9193 * expression.cs (Invocation.BetterConversion): Prefer int over
9194 uint; short over ushort; long over ulong for integer literals.
9195 Use ImplicitConversionExists instead of StandardConversionExists
9196 since we also need to check for user-defined implicit conversions.
9197 Fixes #34165. Added test-173.cs.
9199 2002-11-16 Martin Baulig <martin@ximian.com>
9201 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
9202 with the `true' and `false' literals. Fixes #33151.
9204 2002-11-16 Martin Baulig <martin@ximian.com>
9206 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
9207 October 22nd; don't do the cs1540 check for static members.
9209 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
9210 now using our own filter here and doing the cs1540 check again.
9212 2002-11-16 Martin Baulig <martin@ximian.com>
9214 * support.cs (InternalParameters): Don't crash if we don't have
9215 any fixed parameters. Fixes #33532.
9217 2002-11-16 Martin Baulig <martin@ximian.com>
9219 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
9220 when looking up static methods to make this work on Windows.
9223 2002-11-16 Martin Baulig <martin@ximian.com>
9225 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
9226 a setter rather than using PropertyInfo.CanWrite.
9228 2002-11-15 Nick Drochak <ndrochak@gol.com>
9230 * class.cs: Allow acces to block member by subclasses. Fixes build
9233 2002-11-14 Martin Baulig <martin@ximian.com>
9235 * class.cs (Constructor.Emit): Added the extern/block check.
9238 2002-11-14 Martin Baulig <martin@ximian.com>
9240 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
9241 iteration while looking for indexers, this is needed because the
9242 indexer may have a different name in our base classes. Fixed the
9243 error reporting (no indexers at all, not get accessor, no
9244 overloaded match). Fixes bug #33089.
9245 (IndexerAccess.DoResolveLValue): Likewise.
9247 2002-11-14 Martin Baulig <martin@ximian.com>
9249 * class.cs (PropertyBase.CheckBase): Make this work for multiple
9250 indexers. Fixes the first part of bug #33089.
9251 (MethodSignature.InheritableMemberSignatureCompare): Added support
9254 2002-11-13 Ravi Pratap <ravi@ximian.com>
9256 * attribute.cs (Attribute.Resolve): Catch the
9257 NullReferenceException and report it since it isn't supposed to
9260 2002-11-12 Miguel de Icaza <miguel@ximian.com>
9262 * expression.cs (Binary.EmitBranchable): Also handle the cases for
9263 LogicalOr and LogicalAnd that can benefit from recursively
9264 handling EmitBranchable. The code now should be nice for Paolo.
9266 2002-11-08 Miguel de Icaza <miguel@ximian.com>
9268 * typemanager.cs (LookupType): Added a negative-hit hashtable for
9269 the Type lookups, as we perform quite a number of lookups on
9270 non-Types. This can be removed once we can deterministically tell
9271 whether we have a type or a namespace in advance.
9273 But this might require special hacks from our corlib.
9277 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
9278 and double which avoids a conversion from an integer to a double.
9280 * expression.cs: tiny optimization, avoid calling IsConstant,
9281 because it effectively performs the lookup twice.
9283 2002-11-06 Miguel de Icaza <miguel@ximian.com>
9285 But a bogus return here to keep the semantics of the old code
9286 until the Mono runtime is fixed.
9288 * pending.cs (GetMissingInterfaces): New method used to remove all
9289 the interfaces that are already implemented by our parent
9290 classes from the list of pending methods.
9292 * interface.cs: Add checks for calls after ResolveTypeExpr.
9294 2002-11-05 Miguel de Icaza <miguel@ximian.com>
9296 * class.cs (Class.Emit): Report warning 67: event not used if the
9297 warning level is beyond 3.
9299 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
9300 being a NullLiteral.
9302 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
9305 * class.cs (TypeContainer.GetClassBases): Cover a missing code
9306 path that might fail if a type can not be resolved.
9308 * expression.cs (Binary.Emit): Emit unsigned versions of the
9311 * driver.cs: use error 5.
9313 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
9315 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
9317 2002-11-01 Miguel de Icaza <miguel@ximian.com>
9319 * cs-parser.jay (switch_section): A beautiful patch from Martin
9320 Baulig that fixed 33094.
9322 2002-10-31 Miguel de Icaza <miguel@ximian.com>
9324 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
9325 Check whether the base is abstract and report an error if so.
9327 * expression.cs (IndexerAccess.DoResolveLValue,
9328 IndexerAccess.DoResolve): ditto.
9330 (Invocation.DoResolve): ditto.
9332 (Invocation.FullMethodDesc): Improve the report string.
9334 * statement.cs (Block): Eliminate IsVariableDefined as it is
9335 basically just a wrapper for GetVariableInfo.
9337 * ecore.cs (SimpleName): Use new
9339 * support.cs (ReflectionParamter.ParameterType): We unwrap the
9340 type, as we return the actual parameter ref/unref state on a
9343 2002-10-30 Miguel de Icaza <miguel@ximian.com>
9345 * support.cs: Return proper flags REF/OUT fixing the previous
9348 * expression.cs: Reverted last patch, that was wrong. Is_ref is
9349 not used to mean `ref' but `ref or out' in ParameterReference
9351 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
9352 full type signature instead of calling TypeManger.CSharpName
9355 * support.cs (InternalParameters.ParameterDesc): Do not compare
9356 directly to the modflags, because REF/OUT will actually be bitsets
9359 * delegate.cs (VerifyMethod): Check also the modifiers.
9361 * cs-tokenizer.cs: Fix bug where floating point values with an
9362 exponent where a sign was missing was ignored.
9364 * driver.cs: Allow multiple assemblies to be specified in a single
9367 2002-10-28 Miguel de Icaza <miguel@ximian.com>
9369 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
9370 because identifiers after a parenthesis would end up in this kind
9371 of production, and we needed to desamiguate it for having casts
9374 (UserDefinedType *) xxx
9376 2002-10-24 Miguel de Icaza <miguel@ximian.com>
9378 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
9379 we should set on the Bindingflags.NonPublic, but not turn on
9380 private_ok. private_ok controls whether a Private member is
9381 returned (this is chekced on the filter routine), while the
9382 BindingFlags.NonPublic just controls whether private/protected
9383 will be allowed. This fixes the problem part of the problem of
9384 private properties being allowed to be used in derived classes.
9386 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
9387 so we can call the children DoResolveLValue method (this will
9388 properly signal errors on lvalue assignments to base properties)
9390 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
9391 getter are null, and we have a property info, we know that this
9392 happened because the lookup failed, so we report an error 122 for
9393 protection level violation.
9395 We also silently return if setter and getter are null in the
9396 resolve functions, this condition only happens if we have flagged
9397 the error before. This is the other half of the problem.
9399 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
9400 not have accessibility information, that is why we were returning
9401 true in the filter function in typemanager.cs.
9403 To properly report 122 (property is inaccessible because of its
9404 protection level) correctly, we report this error in ResolveAccess
9405 by failing if both the setter and the getter are lacking (ie, the
9408 DoResolve and DoLResolve have been modified to check for both
9409 setter/getter being null and returning silently, the reason being
9410 that I did not want to put the knowledge about this error in upper
9413 int old = Report.Errors;
9414 x = new PropertyExpr (...);
9415 if (old != Report.Errors)
9420 So the property expr is returned, but it is invalid, so the error
9421 will be flagged during the resolve process.
9423 * class.cs: Remove InheritablePropertySignatureCompare from the
9424 class, as we no longer depend on the property signature to compute
9425 whether it is possible to implement a method or not.
9427 The reason is that calling PropertyInfo.GetGetMethod will return
9428 null (in .NET, in Mono it works, and we should change this), in
9429 cases where the Get Method does not exist in that particular
9434 class X { public virtual int A { get { return 1; } } }
9436 class Z : Y { public override int A { get { return 2; } } }
9438 Would fail in Z because the parent (Y) would not have the property
9439 defined. So we avoid this completely now (because the alternative
9440 fix was ugly and slow), and we now depend exclusively on the
9443 (PropertyBase.CheckBase): Use a method-base mechanism to find our
9444 reference method, instead of using the property.
9446 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
9447 routines are gone now.
9449 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
9450 names, they were incorrectly named.
9452 * cs-tokenizer.cs: Return are more gentle token on failure.
9454 * pending.cs (PendingImplementation.InterfaceMethod): This routine
9455 had an out-of-sync index variable, which caused it to remove from
9456 the list of pending methods the wrong method sometimes.
9458 2002-10-22 Miguel de Icaza <miguel@ximian.com>
9460 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
9461 CanWrite, because those refer to this particular instance of the
9462 property, and do not take into account the fact that we can
9463 override single members of a property.
9465 Constructor requires an EmitContext. The resolution process does
9466 not happen here, but we need to compute the accessors before,
9467 because the resolution does not always happen for properties.
9469 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
9470 subclass, before we did not update this flag, but we did update
9473 (GetAccessors): Drop this routine, as it did not work in the
9474 presence of partially overwritten set/get methods.
9476 Notice that this broke the cs1540 detection, but that will require
9479 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9483 * driver.cs: issue a warning instead of an error if we don't support
9484 debugging for the platform. Also ignore a couple of errors that may
9485 arise when trying to write the symbols. Undo my previous patch.
9487 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9489 * driver.cs: ignore /debug switch except for Unix platforms.
9491 2002-10-23 Nick Drochak <ndrochak@gol.com>
9493 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
9495 2002-10-21 Miguel de Icaza <miguel@ximian.com>
9497 * driver.cs: Do not make mcs-debug conditional, so we do not break
9500 * statement.cs (UsageVector.MergeChildren): I would like Martin to
9501 review this patch. But basically after all the children variables
9502 have been merged, the value of "Breaks" was not being set to
9503 new_breaks for Switch blocks. I think that it should be set after
9504 it has executed. Currently I set this to the value of new_breaks,
9505 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
9506 conservative, but I do not understand this code very well.
9508 I did not break anything in the build, so that is good ;-)
9510 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
9512 2002-10-20 Mark Crichton <crichton@gimp.org>
9514 * cfold.cs: Fixed compile blocker. Really fixed it this time.
9516 2002-10-20 Nick Drochak <ndrochak@gol.com>
9518 * cfold.cs: Fixed compile blocker.
9520 2002-10-20 Miguel de Icaza <miguel@ximian.com>
9522 * driver.cs: I was chekcing the key, not the file.
9524 2002-10-19 Ravi Pratap <ravi@ximian.com>
9526 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
9527 message that we were generating - we just need to silently return
9530 2002-10-19 Miguel de Icaza <miguel@ximian.com>
9532 * class.cs (Event.Define): Change my previous commit, as this
9533 breaks the debugger. This is a temporary hack, as it seems like
9534 the compiler is generating events incorrectly to begin with.
9536 * expression.cs (Binary.ResolveOperator): Added support for
9537 "U operator - (E x, E y)"
9539 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
9542 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
9543 init-only variables, but this path did not take into account that
9544 there might be also instance readonly variables. Correct this
9547 This fixes bug 32253
9549 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
9552 * driver.cs: Change the extension for modules to `netmodule'
9554 * cs-parser.jay: Improved slightly the location tracking for
9555 the debugger symbols.
9557 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
9558 modifiers that were specified instead of the hardcoded value
9559 (FamAndAssem). This was basically ignoring the static modifier,
9560 and others. Fixes 32429.
9562 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
9563 fixed a bug in the process (32476)
9565 * expression.cs (ArrayAccess.EmitAssign): Patch from
9566 hwang_rob@yahoo.ca that fixes bug 31834.3
9568 2002-10-18 Miguel de Icaza <miguel@ximian.com>
9570 * driver.cs: Make the module extension .netmodule.
9572 2002-10-16 Miguel de Icaza <miguel@ximian.com>
9574 * driver.cs: Report an error if the resource file is not found
9575 instead of crashing.
9577 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
9578 false, like Emit does.
9580 2002-10-16 Nick Drochak <ndrochak@gol.com>
9582 * typemanager.cs: Remove unused private member. Also reported mcs
9583 bug to report this as a warning like csc.
9585 2002-10-15 Martin Baulig <martin@gnome.org>
9587 * statement.cs (Statement.Emit): Made this a virtual method; emits
9588 the line number info and calls DoEmit().
9589 (Statement.DoEmit): New protected abstract method, formerly knows
9590 as Statement.Emit().
9592 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
9594 2002-10-11 Miguel de Icaza <miguel@ximian.com>
9596 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
9597 have fixed a remaining problem: not every AddXXXX was adding a
9598 fully qualified name.
9600 Now everyone registers a fully qualified name in the DeclSpace as
9601 being defined instead of the partial name.
9603 Downsides: we are slower than we need to be due to the excess
9604 copies and the names being registered this way.
9606 The reason for this is that we currently depend (on the corlib
9607 bootstrap for instance) that types are fully qualified, because
9608 we dump all the types in the namespace, and we should really have
9609 types inserted into the proper namespace, so we can only store the
9610 basenames in the defined_names array.
9612 2002-10-10 Martin Baulig <martin@gnome.org>
9614 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
9615 from bug #31834, see the bug report for a testcase which is
9618 2002-10-10 Martin Baulig <martin@gnome.org>
9620 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
9621 flow analysis code for this.
9623 * statement.cs (Do, While, For): Tell the flow analysis code about
9625 (FlowBranching.UsageVector): Added support for infinite loops.
9626 (Block.Resolve): Moved the dead code elimination here and use flow
9629 2002-10-09 Miguel de Icaza <miguel@ximian.com>
9631 * class.cs (Field.Define): Catch cycles on struct type
9634 * typemanager.cs (IsUnmanagedtype): Do not recursively check
9635 fields if the fields are static. We only need to check instance
9638 * expression.cs (As.DoResolve): Test for reference type.
9640 * statement.cs (Using.ResolveExpression): Use
9641 ConvertImplicitRequired, not ConvertImplicit which reports an
9643 (Using.ResolveLocalVariableDecls): ditto.
9645 * expression.cs (Binary.ResolveOperator): Report errors in a few
9646 places where we had to.
9648 * typemanager.cs (IsUnmanagedtype): Finish implementation.
9650 2002-10-08 Miguel de Icaza <miguel@ximian.com>
9652 * expression.cs: Use StoreFromPtr instead of extracting the type
9653 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
9655 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
9656 an enumeration value to a System.Enum, but System.Enum is not a
9657 value type, but an class type, so we need to box.
9659 (Expression.ConvertExplicit): One codepath could return
9660 errors but not flag them. Fix this. Fixes #31853
9662 * parameter.cs (Resolve): Do not allow void as a parameter type.
9664 2002-10-06 Martin Baulig <martin@gnome.org>
9666 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
9667 if it's a class type and not a struct. Fixes #31815.
9669 2002-10-06 Martin Baulig <martin@gnome.org>
9671 * statement.cs: Reworked the flow analysis code a bit to make it
9672 usable for dead code elimination.
9674 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9676 * cs-parser.jay: allow empty source files. Fixes bug #31781.
9678 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9680 * expression.cs (ComposedCast.DoResolveType): A quick workaround
9681 to fix the test 165, will investigate deeper.
9683 2002-10-04 Martin Baulig <martin@gnome.org>
9685 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
9686 finally blocks actually work.
9687 (Try.Resolve): We don't need to create a sibling for `finally' if
9688 there is no finally block.
9690 2002-10-04 Martin Baulig <martin@gnome.org>
9692 * class.cs (Constructor.Define): The default accessibility for a
9693 non-default constructor is private, not public.
9695 2002-10-04 Miguel de Icaza <miguel@ximian.com>
9697 * class.cs (Constructor): Make AllowedModifiers public, add
9700 * cs-parser.jay: Perform the modifiers test here, as the
9701 constructor for the Constructor class usually receives a zero
9702 because of the way we create it (first we create, later we
9703 customize, and we were never checking the modifiers).
9705 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
9706 is a version of LookupTypeReflection that includes the type-name
9707 cache. This can be used as a fast path for functions that know
9708 the fully qualified name and are only calling into *.GetType() to
9709 obtain a composed type.
9711 This is also used by TypeManager.LookupType during its type
9714 (LookupType): We now also track the real type name, as sometimes
9715 we can get a quey for the real type name from things like
9716 ComposedCast. This fixes bug 31422.
9718 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
9719 complete type fullname, it does not have to go through the type
9720 resolution system to obtain the composed version of the type (for
9721 obtaining arrays or pointers).
9723 (Conditional.Emit): Use the EmitBoolExpression to
9724 generate nicer code, as requested by Paolo.
9726 (ArrayCreation.CheckIndices): Use the patch from
9727 hwang_rob@yahoo.ca to validate the array initializers.
9729 2002-10-03 Miguel de Icaza <miguel@ximian.com>
9731 * class.cs (ConstructorInitializer.Emit): simplify code by using
9732 Invocation.EmitCall, and at the same time, fix the bugs in calling
9733 parent constructors that took variable arguments.
9735 * ecore.cs (Expression.ConvertNumericExplicit,
9736 Expression.ImplicitNumericConversion): Remove the code that
9737 manually wrapped decimal (InternalTypeConstructor call is now gone
9740 * expression.cs (Cast.TryReduce): Also handle decimal types when
9741 trying to perform a constant fold on the type.
9743 * typemanager.cs (IsUnmanagedtype): Partially implemented.
9745 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
9746 that only turned off an error report, and did nothing else.
9748 2002-10-02 Miguel de Icaza <miguel@ximian.com>
9750 * driver.cs: Handle and ignore /fullpaths
9752 2002-10-01 Miguel de Icaza <miguel@ximian.com>
9754 * expression.cs (Binary.ResolveOperator): Catch the case where
9755 DoNumericPromotions returns true,
9757 (Binary.DoNumericPromotions): Simplify the code, and the tests.
9759 2002-09-27 Miguel de Icaza <miguel@ximian.com>
9761 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
9764 2002-09-26 Miguel de Icaza <miguel@ximian.com>
9766 * ecore.cs (ConvertNumericExplicit): It is not enough that the
9767 conversion exists, but it is also required that the conversion be
9768 performed. This manifested in "(Type64Enum) 2".
9770 * class.cs (TypeManager.AddMethod): The fix is not to change
9771 AddEnum, because that one was using a fully qualified name (every
9772 DeclSpace derivative does), but to change the AddMethod routine
9773 that was using an un-namespaced name. This now correctly reports
9774 the duplicated name.
9776 Revert patch until I can properly fix it. The issue
9777 is that we have a shared Type space across all namespaces
9778 currently, which is wrong.
9780 Options include making the Namespace a DeclSpace, and merge
9781 current_namespace/current_container in the parser.
9783 2002-09-25 Miguel de Icaza <miguel@ximian.com>
9785 * cs-parser.jay: Improve error reporting when we get a different
9786 kind of expression in local_variable_type and
9787 local_variable_pointer_type.
9789 Propagate this to avoid missleading errors being reported.
9791 * ecore.cs (ImplicitReferenceConversion): treat
9792 TypeManager.value_type as a target just like object_type. As
9797 Is valid, and needs to result in the int 1 being boxed before it
9798 is assigned to the value type v.
9800 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
9801 to validate the enumeration name.
9803 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
9804 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
9805 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
9807 * ecore.cs (TryImplicitIntConversion): When doing an
9808 implicit-enumeration-conversion, check if the type is 64-bits and
9809 perform a conversion before passing to EnumConstant.
9811 2002-09-23 Miguel de Icaza <miguel@ximian.com>
9813 * decl.cs (Error_AmbiguousTypeReference); New routine used to
9814 report ambiguous type references. Unlike the MS version, we
9815 report what the ambiguity is. Innovation at work ;-)
9817 (DeclSpace.FindType): Require a location argument to
9818 display when we display an ambiguous error.
9820 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
9822 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
9824 * expression.cs (EmitDynamicInitializers): Apply patch from
9825 hwang_rob@yahoo.ca that fixes the order in which we emit our
9828 2002-09-21 Martin Baulig <martin@gnome.org>
9830 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
9831 delegate takes no arguments.
9833 2002-09-20 Miguel de Icaza <miguel@ximian.com>
9835 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
9838 * expression.cs: Extract the underlying type.
9840 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
9842 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
9844 2002-09-19 Miguel de Icaza <miguel@ximian.com>
9846 * class.cs (TypeContainer.DefineType): We can not use the nice
9847 PackingSize with the size set to 1 DefineType method, because it
9848 will not allow us to define the interfaces that the struct
9851 This completes the fixing of bug 27287
9853 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
9854 means also structs. This fixes part of the problem.
9855 (Expresion.ImplicitReferenceConversionExists): ditto.
9857 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
9858 error if there were no errors reported during the type lookup
9859 process, to avoid duplicates or redundant errors. Without this
9860 you would get an ambiguous errors plus a type not found. We have
9861 beaten the user enough with the first error.
9863 (DeclSparce.FindType): Emit a warning if we have an ambiguous
9866 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
9867 during the resolution process, stop the lookup, this avoids
9868 repeated error reports (same error twice).
9870 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
9872 * typemanager.cs (LookupType): Redo the type lookup code to match
9873 the needs of System.Reflection.
9875 The issue is that System.Reflection requires references to nested
9876 types to begin with a "+" sign instead of a dot. So toplevel
9877 types look like: "NameSpace.TopLevelClass", and nested ones look
9878 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
9881 2002-09-19 Martin Baulig <martin@gnome.org>
9883 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
9884 says that a method always returns or always throws an exception,
9885 don't report the CS0161.
9887 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
9888 set `Returns = new_returns'.
9890 2002-09-19 Martin Baulig <martin@gnome.org>
9892 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
9893 to an enum constant, check for a CS0176.
9895 2002-09-18 Miguel de Icaza <miguel@ximian.com>
9897 * class.cs (TypeContainer.CheckPairedOperators): Now we check
9898 for operators that must be in pairs and report errors.
9900 * ecore.cs (SimpleName.DoResolveType): During the initial type
9901 resolution process, when we define types recursively, we must
9902 check first for types in our current scope before we perform
9903 lookups in the enclosing scopes.
9905 * expression.cs (MakeByteBlob): Handle Decimal blobs.
9907 (Invocation.VerifyArgumentsCompat): Call
9908 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
9909 I thought we were supposed to always call this, but there are a
9910 few places in the code where we dont do it.
9912 2002-09-17 Miguel de Icaza <miguel@ximian.com>
9914 * driver.cs: Add support in -linkres and -resource to specify the
9915 name of the identifier.
9917 2002-09-16 Miguel de Icaza <miguel@ximian.com>
9919 * ecore.cs (StandardConversionExists): Sync with the conversion
9920 code: allow anything-* to void* conversions.
9922 (FindMostSpecificSource): Use an Expression argument
9923 instead of a Type, because we might be handed over a Literal which
9924 gets a few more implicit conversions that plain types do not. So
9925 this information was being lost.
9927 Also, we drop the temporary type-holder expression when not
9930 2002-09-17 Martin Baulig <martin@gnome.org>
9932 * class.cs (PropertyBase.CheckBase): Don't check the base class if
9933 this is an explicit interface implementation.
9935 2002-09-17 Martin Baulig <martin@gnome.org>
9937 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
9938 different `IndexerName' attributes.
9940 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
9941 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
9942 virtual CommonResolve().
9944 2002-09-16 Miguel de Icaza <miguel@ximian.com>
9946 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
9947 and convert that to the UnderlyingType.
9949 * statement.cs (Foreach.Resolve): Indexers are just like variables
9950 or PropertyAccesses.
9952 * cs-tokenizer.cs (consume_string): Track line numbers and columns
9953 inside quoted strings, we were not doing this before.
9955 2002-09-16 Martin Baulig <martin@gnome.org>
9957 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
9958 resolve it. This is needed for the definite assignment check of the
9959 instance expression, fixes bug #29846.
9960 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
9962 2002-09-16 Nick Drochak <ndrochak@gol.com>
9964 * parameter.cs: Fix compile error. Cannot reference static member
9965 from an instance object. Is this an mcs bug?
9967 2002-09-14 Martin Baulig <martin@gnome.org>
9969 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
9970 multiple times. Fixes bug #30295, added test-166.cs.
9972 2002-09-14 Martin Baulig <martin@gnome.org>
9974 * statement.cs (Block.Emit): Don't emit unreachable code.
9975 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
9977 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
9979 2002-09-14 Martin Baulig <martin@gnome.org>
9981 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
9984 2002-09-14 Martin Baulig <martin@gnome.org>
9986 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
9987 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
9988 be false on the ms runtime.
9990 2002-09-13 Martin Baulig <martin@gnome.org>
9992 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
9993 the CS0038 error message.
9995 2002-09-12 Miguel de Icaza <miguel@ximian.com>
9997 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
9998 constant inside, return it.
10000 2002-09-12 Martin Baulig <martin@gnome.org>
10002 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
10003 implicit conversion can be done between enum types.
10005 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
10006 check whether an implicit conversion to the current enum's UnderlyingType
10007 exists and report an error if not.
10009 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
10010 without debugging support.
10012 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
10013 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
10015 2002-09-12 Martin Baulig <martin@gnome.org>
10017 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
10019 * ecore.cs (IMemberExpr.DeclaringType): New property.
10020 (SimpleName.SimpleNameResolve): Check whether we're accessing a
10021 nonstatic member of an outer type (CS0038).
10023 2002-09-11 Miguel de Icaza <miguel@ximian.com>
10025 * driver.cs: Activate the using-error detector at warning level
10026 4 (at least for MS-compatible APIs).
10028 * namespace.cs (VerifyUsing): Small buglett fix.
10030 * pending.cs (PendingImplementation): pass the container pointer.
10032 * interface.cs (GetMethods): Allow for recursive definition. Long
10033 term, I would like to move every type to support recursive
10034 definitions, not the current ordering mechanism that we have right
10037 The situation is this: Attributes are handled before interfaces,
10038 so we can apply attributes to interfaces. But some attributes
10039 implement interfaces, we will now handle the simple cases
10040 (recursive definitions will just get an error).
10042 * parameter.cs: Only invalidate types at the end if we fail to
10045 2002-09-09 Martin Baulig <martin@gnome.org>
10047 * ecore.cs (PropertyExpr.Emit): Also check for
10048 TypeManager.system_int_array_get_length so this'll also work when
10049 compiling corlib. Fixes #30003.
10051 2002-09-09 Martin Baulig <martin@gnome.org>
10053 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
10054 and throw an exception if we can't get the type's size. Fixed #30040,
10057 2002-09-09 Martin Baulig <martin@gnome.org>
10059 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
10061 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
10062 context. Fixes bug #30027.
10064 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
10065 virtual functions. Fixes bug #30043, added test-164.cs.
10067 2002-09-08 Ravi Pratap <ravi@ximian.com>
10069 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
10071 2002-09-08 Nick Drochak <ndrochak@gol.com>
10073 * driver.cs: Use an object to get the windows codepage since it's not a
10076 2002-09-08 Miguel de Icaza <miguel@ximian.com>
10078 * statement.cs (For.Emit): for infinite loops (test == null)
10079 return whether there is a break inside, not always "true".
10081 * namespace.cs (UsingEntry): New struct to hold the name of the
10082 using definition, the location where it is defined, and whether it
10083 has been used in a successful type lookup.
10085 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
10090 2002-09-06 Ravi Pratap <ravi@ximian.com>
10092 * attribute.cs : Fix incorrect code which relied on catching
10093 a NullReferenceException to detect a null being passed in
10094 where an object was expected.
10096 2002-09-06 Miguel de Icaza <miguel@ximian.com>
10098 * statement.cs (Try): flag the catch variable as assigned
10100 * expression.cs (Cast): Simplified by using ResolveType instead of
10101 manually resolving.
10103 * statement.cs (Catch): Fix bug by using ResolveType.
10105 2002-09-06 Ravi Pratap <ravi@ximian.com>
10107 * expression.cs (BetterConversion): Special case for when we have
10108 a NullLiteral as the argument and we have to choose between string
10109 and object types - we choose string the way csc does.
10111 * attribute.cs (Attribute.Resolve): Catch the
10112 NullReferenceException and report error #182 since the Mono
10113 runtime no more has the bug and having this exception raised means
10114 we tried to select a constructor which takes an object and is
10117 2002-09-05 Ravi Pratap <ravi@ximian.com>
10119 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
10120 message (1502, 1503) when we can't locate a method after overload
10121 resolution. This is much more informative and closes the bug
10124 * interface.cs (PopulateMethod): Return if there are no argument
10125 types. Fixes a NullReferenceException bug.
10127 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
10128 expressions too. Previously we were checking only in one place for
10129 positional arguments leaving out named arguments.
10131 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
10132 type to the enum type is not allowed. Remove code corresponding to
10135 (ConvertNumericExplicit): Allow explicit conversions from
10136 the underlying type to enum type. This precisely follows the spec
10137 and closes a bug filed by Gonzalo.
10139 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10142 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
10144 2002-09-03 Miguel de Icaza <miguel@ximian.com>
10146 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
10147 it was important that we stored the right value after the
10148 reduction in `converted'.
10150 2002-09-04 Martin Baulig <martin@gnome.org>
10152 * location.cs (Location.SymbolDocument): Use full pathnames for the
10155 2002-08-30 Miguel de Icaza <miguel@ximian.com>
10157 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
10158 of the expression resolve mechanism, because that will catch the
10159 SimpleName error failures.
10161 (Conditional): If we can not resolve the
10162 expression, return, do not crash.
10164 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10167 (location): display token name instead of its number.
10169 2002-08-28 Martin Baulig <martin@gnome.org>
10171 * expression.cs (Binary.ResolveOperator): Don't silently return
10172 but return an error if an operator cannot be applied between two
10175 2002-08-28 Martin Baulig <martin@gnome.org>
10177 * class.cs (Constructor.Define): Set the permission attributes
10178 correctly instead of making all constructors public.
10180 2002-08-28 Martin Baulig <martin@gnome.org>
10182 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
10183 for private members before reporting a CS0103; if we find anything,
10186 2002-08-28 Martin Baulig <martin@gnome.org>
10188 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
10189 to check whether `closure_start_type == closure_invocation_type',
10190 we also need to check whether `m.DeclaringType == closure_invocation_type'
10191 before bypassing the permission checks. We might be accessing
10192 protected/private members from the base class.
10193 (TypeManager.RealMemberLookup): Only set private_ok if private
10194 members were requested via BindingFlags.NonPublic.
10196 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
10198 * expression.cs (MemberAccess.ResolveMemberAccess): Set
10199 MethodGroupExpr.IsExplicitImpl if appropriate.
10200 (Invocation.DoResolve): Don't report the CS0120 for explicit
10201 interface implementations.
10203 2002-08-27 Martin Baulig <martin@gnome.org>
10205 * expression.cs (Invocation.DoResolve): If this is a static
10206 method and we don't have an InstanceExpression, we must report
10209 2002-08-25 Martin Baulig <martin@gnome.org>
10211 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
10212 `==' between a valuetype and an object.
10214 2002-08-25 Miguel de Icaza <miguel@ximian.com>
10216 * ecore.cs (TypeExpr): Provide a ToString method.
10218 2002-08-24 Martin Baulig <martin@gnome.org>
10220 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
10221 now called proggie.dbg and it's a binary file.
10223 2002-08-23 Martin Baulig <martin@gnome.org>
10225 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
10227 2002-08-23 Martin Baulig <martin@gnome.org>
10229 * struct.cs (MyStructInfo.ctor): Make this work with empty
10230 structs; it's not allowed to use foreach() on null.
10232 2002-08-23 Martin Baulig <martin@gnome.org>
10234 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
10235 writer the full pathname of the generated assembly.
10237 2002-08-23 Martin Baulig <martin@gnome.org>
10239 * statements.cs (FlowBranching.UsageVector.MergeChildren):
10240 A `finally' block never returns or breaks; improved handling of
10243 2002-08-23 Martin Baulig <martin@gnome.org>
10245 * statement.cs (Throw.Resolve): Allow `throw null'.
10247 2002-08-23 Martin Baulig <martin@gnome.org>
10249 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
10250 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
10251 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
10252 MemberLookup would return a wrong event if this is an explicit
10253 interface implementation and the class has an event with the same
10256 2002-08-23 Martin Baulig <martin@gnome.org>
10258 * statement.cs (Block.AddChildVariableNames): New public method.
10259 (Block.AddChildVariableName): Likewise.
10260 (Block.IsVariableNameUsedInChildBlock): Likewise.
10261 (Block.AddVariable): Check whether a variable name has already
10262 been used in a child block.
10264 * cs-parser.jay (declare_local_variables): Mark all variable names
10265 from the current block as being used in a child block in the
10268 2002-08-23 Martin Baulig <martin@gnome.org>
10270 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
10271 find the symbol writer.
10273 * driver.cs: csc also allows the arguments to /define being
10274 separated by commas, not only by semicolons.
10276 2002-08-23 Martin Baulig <martin@gnome.org>
10278 * interface.cs (Interface.GetMembers): Added static check for events.
10280 2002-08-15 Martin Baulig <martin@gnome.org>
10282 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
10283 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
10285 * ecore.cs (Expression.MemberLookup): Added documentation and explained
10286 why the MethodData.EmitDestructor() change was necessary.
10288 2002-08-20 Martin Baulig <martin@gnome.org>
10290 * class.cs (TypeContainer.FindMembers): Added static check for events.
10292 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
10294 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
10295 use Type.GetEvents(), not Type.FindMembers().
10297 2002-08-20 Martin Baulig <martin@gnome.org>
10299 * decl.cs (MemberCache): Added a special method cache which will
10300 be used for method-only searched. This ensures that a method
10301 search will return a MethodInfo with the correct ReflectedType for
10304 2002-08-20 Martin Baulig <martin@gnome.org>
10306 * decl.cs (DeclSpace.FindMembers): Made this public.
10308 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10310 * delegate.cs: fixed build on windows.
10311 [FIXME: Filed as bug #29150: MCS must report these errors.]
10313 2002-08-19 Ravi Pratap <ravi@ximian.com>
10315 * ecore.cs (StandardConversionExists): Return a false
10316 if we are trying to convert the void type to anything else
10317 since that is not allowed.
10319 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
10320 we flag error 70 in the event an event is trying to be accessed
10321 directly from outside the declaring type.
10323 2002-08-20 Martin Baulig <martin@gnome.org>
10325 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
10326 MemberCache from typemanager.cs to decl.cs.
10328 2002-08-19 Martin Baulig <martin@gnome.org>
10330 * class.cs (TypeContainer): Implement IMemberContainer.
10331 (TypeContainer.DefineMembers): Create the MemberCache.
10332 (TypeContainer.FindMembers): Do better BindingFlags checking; only
10333 return public members if BindingFlags.Public was given, check
10334 whether members are static.
10336 2002-08-16 Martin Baulig <martin@gnome.org>
10338 * decl.cs (DeclSpace.Define): Splitted this in Define and
10339 DefineMembers. DefineMembers is called first and initializes the
10342 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
10343 DefineMembers() on all our DeclSpaces.
10345 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
10346 but call DefineMembers() on all nested interfaces. We call their
10347 Define() in our new Define() function.
10349 * interface.cs (Interface): Implement IMemberContainer.
10350 (Interface.Define): Moved all code except the attribute stuf to
10352 (Interface.DefineMembers): Initialize the member cache.
10354 * typemanager.cs (IMemberFinder): Removed this interface, we don't
10355 need this anymore since we can use MemberCache.FindMembers directly.
10357 2002-08-19 Martin Baulig <martin@gnome.org>
10359 * typemanager.cs (MemberCache): When creating the cache for an
10360 interface type, add all inherited members.
10361 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
10362 to `out bool used_cache' and documented it.
10363 (TypeManager.MemberLookup): If we already used the cache in the first
10364 iteration, we don't need to do the interfaces check.
10366 2002-08-19 Martin Baulig <martin@gnome.org>
10368 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
10369 here from IMemberFinder and don't implement this interface anymore.
10370 (DeclSpace.MemberCache): Moved here from IMemberFinder.
10372 * typemanager.cs (IMemberFinder): This interface is now only used by
10373 classes which actually support the member cache.
10374 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
10375 since we only put DeclSpaces into this Hashtable.
10376 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
10377 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
10379 2002-08-16 Martin Baulig <martin@gnome.org>
10381 * typemanager.cs (ICachingMemberFinder): Removed.
10382 (IMemberFinder.MemberCache): New property.
10383 (TypeManager.FindMembers): Merged this with RealFindMembers().
10384 This function will never be called from TypeManager.MemberLookup()
10385 so we can't use the cache here, just the IMemberFinder.
10386 (TypeManager.MemberLookup_FindMembers): Check whether the
10387 IMemberFinder has a MemberCache and call the cache's FindMembers
10389 (MemberCache): Rewrote larger parts of this yet another time and
10390 cleaned it up a bit.
10392 2002-08-15 Miguel de Icaza <miguel@ximian.com>
10394 * driver.cs (LoadArgs): Support quoting.
10396 (Usage): Show the CSC-like command line arguments.
10398 Improved a few error messages.
10400 2002-08-15 Martin Baulig <martin@gnome.org>
10402 * typemanager.cs (IMemberContainer.Type): New property.
10403 (IMemberContainer.IsInterface): New property.
10405 The following changes are conditional to BROKEN_RUNTIME, which is
10406 defined at the top of the file.
10408 * typemanager.cs (MemberCache.MemberCache): Don't add the base
10409 class'es members, but add all members from TypeHandle.ObjectType
10410 if we're an interface.
10411 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
10412 is the current type.
10413 (MemberCache.CacheEntry.Container): Removed this field.
10414 (TypeHandle.GetMembers): Include inherited members.
10416 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10418 * typemanager.cs: fixed compilation and added a comment on a field that
10421 2002-08-15 Martin Baulig <martin@gnome.org>
10423 * class.cs (ConstructorInitializer.Resolve): In the
10424 Expression.MemberLookup call, use the queried_type as
10427 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
10428 declared' attribute, it's always true.
10429 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
10430 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
10431 temporary wrapper for FindMembers which tells MemberLookup whether
10432 members from the base classes are included in the return value.
10433 This will go away soon.
10434 (TypeManager.MemberLookup): Use this temporary hack here; once the
10435 new MemberCache is completed, we don't need to do the DeclaredOnly
10436 looping here anymore since the MemberCache will take care of this.
10437 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
10438 (MemberCache): When creating the MemberCache for a class, get
10439 members from the current class and all its base classes.
10440 (MemberCache.CacheEntry.Container): New field. This is a
10441 temporary hack until the Mono runtime is fixed to distinguish
10442 between ReflectedType and DeclaringType. It allows us to use MCS
10443 with both the MS runtime and the unfixed Mono runtime without
10444 problems and without accecting performance.
10445 (MemberCache.SearchMembers): The DeclaredOnly looping from
10446 TypeManager.MemberLookup is now done here.
10448 2002-08-14 Martin Baulig <martin@gnome.org>
10450 * statement.cs (MyStructInfo.MyStructInfo): Don't call
10451 Type.GetFields on dynamic types but get the fields from the
10452 corresponding TypeContainer.
10453 (MyStructInfo.GetStructInfo): Added check for enum types.
10455 * typemanager.cs (MemberList.IsSynchronized): Implemented.
10456 (MemberList.SyncRoot): Implemented.
10457 (TypeManager.FilterWithClosure): No need to check permissions if
10458 closure_start_type == closure_invocation_type, don't crash if
10459 closure_invocation_type is null.
10461 2002-08-13 Martin Baulig <martin@gnome.org>
10463 Rewrote TypeContainer.FindMembers to use a member cache. This
10464 gives us a speed increase of about 35% for the self-hosting MCS
10465 build and of about 15-20% for the class libs (both on GNU/Linux).
10467 * report.cs (Timer): New class to get enhanced profiling. This
10468 whole class is "TIMER" conditional since it remarkably slows down
10471 * class.cs (MemberList): New class. This is an IList wrapper
10472 which we're now using instead of passing MemberInfo[]'s around to
10473 avoid copying this array unnecessarily.
10474 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
10475 (ICachingMemberFinder, IMemberContainer): New interface.
10476 (TypeManager.FilterWithClosure): If `criteria' is null, the name
10477 has already been checked, otherwise use it for the name comparision.
10478 (TypeManager.FindMembers): Renamed to RealMemberFinder and
10479 provided wrapper which tries to use ICachingMemberFinder.FindMembers
10480 if possible. Returns a MemberList, not a MemberInfo [].
10481 (TypeHandle): New class, implements IMemberContainer. We create
10482 one instance of this class per type, it contains a MemberCache
10483 which is used to do the member lookups.
10484 (MemberCache): New class. Each instance of this class contains
10485 all members of a type and a name-based hash table.
10486 (MemberCache.FindMembers): This is our new member lookup
10487 function. First, it looks up all members of the requested name in
10488 the hash table. Then, it walks this list and sorts out all
10489 applicable members and returns them.
10491 2002-08-13 Martin Baulig <martin@gnome.org>
10493 In addition to a nice code cleanup, this gives us a performance
10494 increase of about 1.4% on GNU/Linux - not much, but it's already
10495 half a second for the self-hosting MCS compilation.
10497 * typemanager.cs (IMemberFinder): New interface. It is used by
10498 TypeManager.FindMembers to call FindMembers on a TypeContainer,
10499 Enum, Delegate or Interface.
10500 (TypeManager.finder_to_member_finder): New PtrHashtable.
10501 (TypeManager.finder_to_container): Removed.
10502 (TypeManager.finder_to_delegate): Removed.
10503 (TypeManager.finder_to_interface): Removed.
10504 (TypeManager.finder_to_enum): Removed.
10506 * interface.cs (Interface): Implement IMemberFinder.
10508 * delegate.cs (Delegate): Implement IMemberFinder.
10510 * enum.cs (Enum): Implement IMemberFinder.
10512 * class.cs (TypeContainer): Implement IMemberFinder.
10514 2002-08-12 Martin Baulig <martin@gnome.org>
10516 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
10518 2002-08-12 Martin Baulig <martin@gnome.org>
10520 * ecore.cs (ITypeExpression): New interface for expressions which
10522 (TypeExpression): Renamed to TypeLookupExpression.
10523 (Expression.DoResolve): If we're doing a types-only lookup, the
10524 expression must implement the ITypeExpression interface and we
10525 call DoResolveType() on it.
10526 (SimpleName): Implement the new ITypeExpression interface.
10527 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
10528 hack, the situation that we're only looking up types can't happen
10529 anymore when this method is called. Moved the type lookup code to
10530 DoResolveType() and call it.
10531 (SimpleName.DoResolveType): This ITypeExpression interface method
10532 is now doing the types-only lookup.
10533 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
10534 (ResolveFlags): Added MaskExprClass.
10536 * expression.cs (MemberAccess): Implement the ITypeExpression
10538 (MemberAccess.DoResolve): Added support for a types-only lookup
10539 when we're called via ITypeExpression.DoResolveType().
10540 (ComposedCast): Implement the ITypeExpression interface.
10542 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
10543 Expression.Resolve() with ResolveFlags.Type instead.
10545 2002-08-12 Martin Baulig <martin@gnome.org>
10547 * interface.cs (Interface.Define): Apply attributes.
10549 * attribute.cs (Attribute.ApplyAttributes): Added support for
10550 interface attributes.
10552 2002-08-11 Martin Baulig <martin@gnome.org>
10554 * statement.cs (Block.Emit): Only check the "this" variable if we
10555 do not always throw an exception.
10557 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
10558 whether the property has a set accessor.
10560 2002-08-11 Martin Baulig <martin@gnome.org>
10562 Added control flow analysis support for structs.
10564 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
10565 with control flow analysis turned off.
10566 (IVariable): New interface.
10567 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
10568 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
10569 (FieldExpr.DoResolve): Resolve the instance expression with flow
10570 analysis turned off and do the definite assignment check after the
10571 resolving when we know what the expression will resolve to.
10573 * expression.cs (LocalVariableReference, ParameterReference):
10574 Implement the new IVariable interface, only call the flow analysis
10575 code if ec.DoFlowAnalysis is true.
10576 (This): Added constructor which takes a Block argument. Implement
10577 the new IVariable interface.
10578 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
10579 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
10580 This does the definite assignment checks for struct members.
10582 * class.cs (Constructor.Emit): If this is a non-static `struct'
10583 constructor which doesn't have any initializer, call
10584 Block.AddThisVariable() to tell the flow analysis code that all
10585 struct elements must be initialized before control returns from
10588 * statement.cs (MyStructInfo): New public class.
10589 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
10590 argument to this indexer. If non-zero, check an individual struct
10591 member, not the whole struct.
10592 (FlowBranching.CheckOutParameters): Check struct members.
10593 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
10594 overloaded versions of these methods which take an additional
10595 `int field_idx' argument to check struct members.
10596 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
10597 overloaded versions of these methods which take an additional
10598 `string field_name' argument to check struct member.s
10599 (VariableInfo): Implement the IVariable interface.
10600 (VariableInfo.StructInfo): New public property. Returns the
10601 MyStructInfo instance of the variable if it's a struct or null.
10602 (Block.AddThisVariable): New public method. This is called from
10603 Constructor.Emit() for non-static `struct' constructor which do
10604 not have any initializer. It creates a special variable for the
10605 "this" instance variable which will be checked by the flow
10606 analysis code to ensure that all of the struct's fields are
10607 initialized before control returns from the constructor.
10608 (UsageVector): Added support for struct members. If a
10609 variable/parameter is a struct with N members, we reserve a slot
10610 in the usage vector for each member. A struct is considered fully
10611 initialized if either the struct itself (slot 0) or all its
10612 members are initialized.
10614 2002-08-08 Martin Baulig <martin@gnome.org>
10616 * driver.cs (Driver.MainDriver): Only report an error CS5001
10617 if there were no compilation errors.
10619 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
10620 `UnsafeContext' property to determine whether the parent is in
10621 unsafe context rather than checking the parent's ModFlags:
10622 classes nested in an unsafe class are unsafe as well.
10624 2002-08-08 Martin Baulig <martin@gnome.org>
10626 * statement.cs (UsageVector.MergeChildren): Distinguish between
10627 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
10628 we return. Added test17() and test18() to test-154.cs.
10630 2002-08-08 Martin Baulig <martin@gnome.org>
10632 * typemanager.cs (TypeManager.FilterWithClosure): If we have
10633 Family access, make sure the invoking type isn't a subclass of the
10634 queried type (that'd be a CS1540).
10636 * ecore.cs (Expression.MemberLookup): Added overloaded version of
10637 this method which takes an additional `Type invocation_type'.
10639 * expression.cs (BaseAccess.DoResolve): Use the base type as
10640 invocation and query type.
10641 (MemberAccess.DoResolve): If the lookup failed and we're about to
10642 report a CS0122, try a lookup with the ec.ContainerType - if this
10643 succeeds, we must report a CS1540.
10645 2002-08-08 Martin Baulig <martin@gnome.org>
10647 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
10648 (MethodGroupExpr): Implement the IMemberExpr interface.
10650 * expression (MemberAccess.ResolveMemberAccess): No need to have
10651 any special code for MethodGroupExprs anymore, they're now
10654 2002-08-08 Martin Baulig <martin@gnome.org>
10656 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
10657 Family, FamANDAssem and FamORAssem permissions.
10658 (TypeManager.IsSubclassOrNestedChildOf): New public method.
10660 2002-08-08 Martin Baulig <martin@gnome.org>
10662 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
10663 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
10666 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
10668 * driver.cs: implemented /resource option to embed managed resources.
10670 2002-08-07 Martin Baulig <martin@gnome.org>
10672 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
10673 (FieldBase.HasFieldInitializer): New public property.
10674 (FieldBase.GetInitializerExpression): New public method. Resolves and
10675 returns the field initializer and makes sure it is only resolved once.
10676 (TypeContainer.EmitFieldInitializers): Call
10677 FieldBase.GetInitializerExpression to get the initializer, this ensures
10678 that it isn't resolved multiple times.
10680 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
10681 the resolving process (SimpleName/MemberLookup) that we're currently
10682 emitting a field initializer (which must not access any instance members,
10683 this is an error CS0236).
10685 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
10686 argument, if the `IsFieldInitializer' flag is set, we must report and
10687 error CS0236 and not an error CS0120.
10689 2002-08-07 Martin Baulig <martin@gnome.org>
10691 * ecore.cs (IMemberExpr): New public interface.
10692 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
10693 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
10694 if the expression is an IMemberExpr.
10696 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
10697 to be null, implicitly default to `this' if we're non-static in
10698 this case. Simplified the code a lot by using the new IMemberExpr
10699 interface. Also fixed bug #28176 here.
10701 2002-08-06 Martin Baulig <martin@gnome.org>
10703 * cs-parser.jay (SimpleLookup): Removed. We need to create
10704 ParameterReferences during semantic analysis so that we can do a
10705 type-only search when resolving Cast, TypeOf and SizeOf.
10706 (block): Pass the `current_local_parameters' to the Block's
10709 * class.cs (ConstructorInitializer): Added `Parameters parameters'
10710 argument to the constructor.
10711 (ConstructorInitializer.Resolve): Create a temporary implicit
10712 block with the parameters.
10714 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
10715 references here if we aren't doing a type-only search.
10717 * statement.cs (Block): Added constructor which takes a
10718 `Parameters parameters' argument.
10719 (Block.Parameters): New public property.
10721 * support.cs (InternalParameters.Parameters): Renamed `parameters'
10722 to `Parameters' and made it public readonly.
10724 2002-08-06 Martin Baulig <martin@gnome.org>
10726 * ecore.cs (Expression.Warning): Made this public as well.
10728 * report.cs (Report.Debug): Print the contents of collections.
10730 2002-08-06 Martin Baulig <martin@gnome.org>
10732 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
10733 used to tell Resolve() which kinds of expressions it may return.
10734 (Expression.Resolve): Added overloaded version of this method which
10735 takes a `ResolveFlags flags' argument. This can be used to tell
10736 Resolve() which kinds of expressions it may return. Reports a
10738 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
10739 ResolveFlags.SimpleName.
10740 (Expression.Error118): Added overloaded version of this method which
10741 takes a `ResolveFlags flags' argument. It uses the flags to determine
10742 which kinds of expressions are allowed.
10744 * expression.cs (Argument.ResolveMethodGroup): New public method.
10745 Resolves an argument, but allows a MethodGroup to be returned.
10746 This is used when invoking a delegate.
10748 * TODO: Updated a bit.
10750 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10752 Fixed compilation with csc.
10754 * ecore.cs: Expression.Error made public. Is this correct? Should
10755 Warning be made public too?
10757 * expression.cs: use ea.Location instead of ea.loc.
10758 [FIXME: Filed as bug #28607: MCS must report these errors.]
10760 2002-08-06 Martin Baulig <martin@gnome.org>
10762 * ecore.cs (Expression.loc): Moved the location here instead of
10763 duplicating it in all derived classes.
10764 (Expression.Location): New public property.
10765 (Expression.Error, Expression.Warning): Made them non-static and
10766 removed the location argument.
10767 (Expression.Warning): Added overloaded version which takes an
10768 `int level' argument.
10769 (Expression.Error118): Make this non-static and removed the
10770 expression and location arguments.
10771 (TypeExpr): Added location argument to the constructor.
10773 * expression.cs (StaticCallExpr): Added location argument to
10775 (Indirection, PointerArithmetic): Likewise.
10776 (CheckedExpr, UnCheckedExpr): Likewise.
10777 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
10778 (StringPtr): Likewise.
10781 2002-08-05 Martin Baulig <martin@gnome.org>
10783 * expression.cs (BaseAccess.DoResolve): Actually report errors.
10785 * assign.cs (Assign.DoResolve): Check whether the source
10786 expression is a value or variable.
10788 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
10789 while resolving the corresponding blocks.
10791 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
10792 an error, don't silently return null.
10794 * statement.cs (Block.AddVariable): Do the error reporting here
10795 and distinguish between CS0128 and CS0136.
10796 (Block.DoResolve): Report all unused labels (warning CS0164).
10797 (LabeledStatement): Pass the location to the constructor.
10798 (LabeledStatement.HasBeenReferenced): New property.
10799 (LabeledStatement.Resolve): Set it to true here.
10801 * statement.cs (Return.Emit): Return success even after reporting
10802 a type mismatch error (CS0126 or CS0127), this is what csc does and
10803 it avoids confusing the users with any consecutive errors.
10805 2002-08-05 Martin Baulig <martin@gnome.org>
10807 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
10809 * const.cs (Const.LookupConstantValue): Catch circular definitions.
10811 * expression.cs (MemberAccess.DoResolve): Silently return if an
10812 error has already been reported.
10814 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
10815 error has already been reported.
10817 2002-08-05 Martin Baulig <martin@gnome.org>
10819 * statement.cs (UsageVector): Only initialize the `parameters'
10820 vector if we actually have any "out" parameters.
10822 2002-08-05 Martin Baulig <martin@gnome.org>
10824 * expression.cs (Binary.ResolveOperator): When combining delegates,
10825 they must have the same type.
10827 2002-08-05 Martin Baulig <martin@gnome.org>
10829 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
10830 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
10831 work with the ms runtime and we also don't need it: if we're a
10832 PropertyBuilder and not in the `indexer_arguments' hash, then we
10833 are a property and not an indexer.
10835 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
10836 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
10837 since the latter one doesn't work with the ms runtime.
10839 2002-08-03 Martin Baulig <martin@gnome.org>
10841 Fixed bugs #27998 and #22735.
10843 * class.cs (Method.IsOperator): New public field.
10844 (Method.CheckBase): Report CS0111 if there's already a method
10845 with the same parameters in the current class. Report CS0508 when
10846 attempting to change the return type of an inherited method.
10847 (MethodData.Emit): Report CS0179 if a method doesn't have a body
10848 and it's not marked abstract or extern.
10849 (PropertyBase): New abstract base class for Property and Indexer.
10850 (PropertyBase.CheckBase): Moved here from Property and made it work
10852 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
10853 the same so we can reuse it there.
10854 (Property, Indexer): Derive from PropertyBase.
10855 (MethodSignature.inheritable_property_signature_filter): New delegate
10856 to find properties and indexers.
10858 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
10859 argument and improved error reporting.
10861 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
10862 EmptyReadOnlyParameters and made it a property.
10864 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
10865 version of this method which takes a `PropertyInfo indexer'.
10866 (TypeManager.RegisterIndexer): New method.
10868 * class.cs: Added myself as author of this file :-)
10870 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10872 * class.cs: fixed compilation on windoze.
10874 2002-08-03 Martin Baulig <martin@gnome.org>
10876 * interface.cs (Interface.GetInterfaceBases): Check whether all
10877 base interfaces are at least as accessible than the current one.
10879 * class.cs (TypeContainer.GetClassBases): Check whether base types
10880 are at least as accessible than the current type.
10881 (TypeContainer.AsAccessible): Implemented and made non-static.
10882 (MemberBase.CheckParameters): Report errors if the accessibility
10885 * delegate.cs (Delegate.Delegate): The default visibility is
10886 internal for top-level types and private for nested types.
10887 (Delegate.Define): Report errors if the accessibility checks fail.
10889 * enum.cs (Enum.Enum): The default visibility is internal for
10890 top-level types and private for nested types.
10891 (Enum.DefineType): Compute the correct visibility.
10893 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
10894 function which takes a `bool is_toplevel' instead of a TypeContainer.
10896 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
10899 2002-08-02 Martin Baulig <martin@gnome.org>
10901 * expression.cs (LocalVariableReferenc): Added constructor which
10902 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
10903 (LocalVariableReference.IsReadOnly): New property.
10904 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
10905 variable is readonly, use our own readonly flag to do this; you can
10906 use the new constructor to get a writable reference to a read-only
10909 * cs-parser.jay (foreach_statement, using_statement): Get a writable
10910 reference to the local variable.
10912 2002-08-01 Miguel de Icaza <miguel@ximian.com>
10914 * rootcontext.cs (ResolveCore): Also include System.Exception
10916 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
10917 we reach an EmptyStatement.
10919 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
10922 * expression.cs (Binary.ResolveOperator): Check error result in
10925 use brtrue/brfalse directly and avoid compares to null.
10927 2002-08-02 Martin Baulig <martin@gnome.org>
10929 * class.cs (TypeContainer.Define): Define all nested interfaces here.
10930 Fixes bug #28407, added test-155.cs.
10932 2002-08-01 Martin Baulig <martin@gnome.org>
10934 * class.cs (Event.EmitDefaultMethod): Make this work with static
10935 events. Fixes #28311, added verify-3.cs.
10937 2002-08-01 Martin Baulig <martin@gnome.org>
10939 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
10940 `is_disposable' fields.
10941 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
10942 `hm.is_disposable' if we're using the collection pattern.
10943 (Foreach.EmitCollectionForeach): Use the correct type for the
10944 enumerator's local variable, only emit the try/finally block if
10945 necessary (fixes #27713).
10947 2002-08-01 Martin Baulig <martin@gnome.org>
10949 * ecore.cs (Expression.report118): Renamed to Error118 and made
10952 * statement.cs (Throw.Resolve): Check whether the expression is of
10953 the correct type (CS0118) and whether the type derives from
10954 System.Exception (CS0155).
10955 (Catch.Resolve): New method. Do the type lookup here and check
10956 whether it derives from System.Exception (CS0155).
10957 (Catch.CatchType, Catch.IsGeneral): New public properties.
10959 * typemanager.cs (TypeManager.exception_type): Added.
10961 2002-07-31 Miguel de Icaza <miguel@ximian.com>
10963 * driver.cs: Updated About function.
10965 2002-07-31 Martin Baulig <martin@gnome.org>
10967 Implemented Control Flow Analysis.
10969 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
10970 (EmitContext.CurrentBranching): Added.
10971 (EmitContext.StartFlowBranching): Added.
10972 (EmitContext.EndFlowBranching): Added.
10973 (EmitContext.KillFlowBranching): Added.
10974 (EmitContext.IsVariableAssigned): Added.
10975 (EmitContext.SetVariableAssigned): Added.
10976 (EmitContext.IsParameterAssigned): Added.
10977 (EmitContext.SetParameterAssigned): Added.
10978 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
10979 Added control flow analysis stuff here.
10981 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
10982 resolve the expression as lvalue.
10983 (LocalVariableReference.DoResolve): Check whether the variable has
10984 already been assigned.
10985 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
10986 the parameter as assigned here.
10987 (ParameterReference.DoResolve): Check whether the parameter has already
10989 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
10990 expression as lvalue.
10992 * statement.cs (FlowBranching): New class for the flow analysis code.
10993 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
10994 (LabeledStatement.IsDefined): New public property.
10995 (LabeledStatement.AddUsageVector): New public method to tell flow
10996 analyis that the label may be reached via a forward jump.
10997 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
10999 (VariableInfo.Number): New public field. This is used by flow analysis
11000 to number all locals of a block.
11001 (Block.CountVariables): New public property. This is the number of
11002 local variables in this block (including the locals from all parent
11004 (Block.EmitMeta): Number all the variables.
11006 * statement.cs: Added flow analysis support to all classes.
11008 2002-07-31 Martin Baulig <martin@gnome.org>
11010 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
11011 To get debugging messages, compile mcs with /define:MCS_DEBUG and
11012 then use this argument.
11014 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
11016 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
11017 use this to specify /define options.
11019 2002-07-29 Martin Baulig <martin@gnome.org>
11021 * statement.cs (Fixed): Moved all code that does variable lookups
11022 and resolvings from Emit to Resolve.
11024 * statement.cs (For): Moved all code that does variable lookups
11025 and resolvings from Emit to Resolve.
11027 * statement.cs (Using): Moved all code that does variable lookups
11028 and resolvings from Emit to Resolve.
11030 2002-07-29 Martin Baulig <martin@gnome.org>
11032 * attribute.cs (Attribute.Resolve): Explicitly catch a
11033 System.NullReferenceException when creating the
11034 CustromAttributeBuilder and report a different warning message.
11036 2002-07-29 Martin Baulig <martin@gnome.org>
11038 * support.cs (ParameterData.ParameterName): Added method to
11039 get the name of a parameter.
11041 * typemanager.cs (TypeManager.IsValueType): New public method.
11043 2002-07-29 Martin Baulig <martin@gnome.org>
11045 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
11046 is a flag which specifies that it's either ref or out.
11047 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
11048 the out parameter to `out Parameter.Modifier mod', also set the
11049 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
11051 * support.cs (InternalParameters.ParameterModifier): Distinguish
11052 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11053 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11055 * expression.cs (Argument.GetParameterModifier): Distinguish
11056 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
11057 Parameter.Modifier.ISBYREF flag if it's either ref or out.
11059 2002-07-29 Martin Baulig <martin@gnome.org>
11061 * expression.cs (ParameterReference.ParameterReference): Added
11062 `Location loc' argument to the constructor.
11064 * cs-parser.jay: Pass location to ParameterReference.
11066 2002-07-28 Miguel de Icaza <miguel@ximian.com>
11068 * statement.cs (Try): Initialize the location.
11070 * cs-parser.jay: pass location to Try.
11072 * expression.cs (Unary.Reduce): Change the prototype to return
11073 whether a constant fold could be performed or not. The result is
11074 returned in an out parameters. In the case of Indirection and
11075 AddressOf, we want to perform the full tests.
11077 2002-07-26 Miguel de Icaza <miguel@ximian.com>
11079 * statement.cs (Statement.Emit): Flag dead code.
11081 2002-07-27 Andrew Birkett <andy@nobugs.org>
11083 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
11085 2002-07-27 Martin Baulig <martin@gnome.org>
11087 * class.cs (MethodData.Define): Put back call to
11088 TypeManager.AddMethod(), accidentally commented this out.
11090 * report.cs (Debug): New public method to print debugging information,
11091 this is `[Conditional ("DEBUG")]'.
11093 2002-07-26 Martin Baulig <martin@gnome.org>
11095 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
11096 (switch_statement): Push the current_block to the switch_stack and
11097 pop it again when we're done with the switch.
11098 (switch_section): The new block is a child of the current_block.
11099 Fixes bug #24007, added test-152.cs.
11101 2002-07-27 Martin Baulig <martin@gnome.org>
11103 * expression.cs (Invocation.EmitArguments): When calling a varargs
11104 function with only its fixed arguments, we need to pass an empty
11107 2002-07-27 Martin Baulig <martin@gnome.org>
11109 Mono 0.13 has been released.
11111 2002-07-25 Miguel de Icaza <miguel@ximian.com>
11113 * driver.cs: Rename --resource to --linkres, because that is what
11114 we do currently, we dont support --resource yet.
11116 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
11118 2002-07-25 Martin Baulig <martin@gnome.org>
11120 * class.cs (MethodData): New public class. This is a `method builder'
11121 class for a method or one accessor of a Property/Indexer/Event.
11122 (MethodData.GetMethodFlags): Moved here from MemberBase.
11123 (MethodData.ApplyAttributes): Likewise.
11124 (MethodData.ApplyObsoleteAttribute): Likewise.
11125 (MethodData.ApplyConditionalAttribute): Likewise.
11126 (MethodData.ApplyDllImportAttribute): Likewise.
11127 (MethodData.CheckAbstractAndExternal): Likewise.
11128 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
11129 (MethodData.Emit): Formerly known as Method.Emit().
11130 (MemberBase): Moved everything which was specific to a single
11131 accessor/method to MethodData.
11132 (Method): Create a new MethodData and call Define() and Emit() on it.
11133 (Property, Indexer, Event): Create a new MethodData objects for each
11134 accessor and call Define() and Emit() on them.
11136 2002-07-25 Martin Baulig <martin@gnome.org>
11138 Made MethodCore derive from MemberBase to reuse the code from there.
11139 MemberBase now also checks for attributes.
11141 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
11142 (MemberBase.GetMethodFlags): Moved here from class Method and marked
11144 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
11145 `CallingConventions cc' and `Attributes opt_attrs' arguments.
11146 (MemberBase.ApplyAttributes): New virtual method; applies the
11147 attributes to a method or accessor.
11148 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
11149 (MemberBase.ApplyConditionalAttribute): Likewise.
11150 (MemberBase.ApplyDllImportAttribute): Likewise.
11151 (MemberBase.CheckAbstractAndExternal): Likewise.
11152 (MethodCore.ParameterTypes): This is now a property instead of a
11153 method, it's initialized from DoDefineParameters().
11154 (MethodCore.ParameterInfo): Removed the set accessor.
11155 (MethodCore.DoDefineParameters): New protected virtual method to
11156 initialize ParameterTypes and ParameterInfo.
11157 (Method.GetReturnType): We can now simply return the MemberType.
11158 (Method.GetMethodFlags): Override the MemberBase version and add
11159 the conditional flags.
11160 (Method.CheckBase): Moved some code from Define() here, call
11161 DoDefineParameters() here.
11162 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
11163 here to avoid some larger code duplication.
11164 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
11165 ensure that abstract and external accessors don't declare a body.
11167 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
11168 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
11169 lookup in the attribute's parent classes, so we need to abort as soon
11170 as we found the first match.
11171 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
11172 the attribute has no arguments.
11174 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
11177 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11179 * cs-parser.jay: reverted previous patch.
11181 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11183 * cs-parser.jay: fixed bug #22119.
11185 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11187 * attribute.cs: fixed compilation. The error was:
11188 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
11189 be assigned to before control leaves the current method."
11190 [FIXME: Filed as bug #28186: MCS must report this error.]
11192 2002-07-25 Martin Baulig <martin@gnome.org>
11194 * attribute.cs (Attribute.Conditional_GetConditionName): New static
11195 method to pull the condition name ouf of a Conditional attribute.
11196 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
11197 the obsolete message and error flag out of an Obsolete attribute.
11199 * class.cs (Method.GetMethodFlags): New public method to get the
11200 TypeManager.MethodFlags for this method.
11201 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
11203 (Method.Define): Get and apply the Obsolete and Conditional attributes;
11204 if we're overriding a virtual function, set the new private variable
11205 `parent_method'; call the new TypeManager.AddMethod().
11207 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
11208 the MethodBuilder and the Method in a PtrHashtable.
11209 (TypeManager.builder_to_method): Added for this purpose.
11210 (TypeManager.MethodFlags): Added IsObsoleteError.
11211 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
11212 Obsolete and Conditional arguments in MethodBuilders. If we discover
11213 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
11214 the message from the attribute.
11216 2002-07-24 Martin Baulig <martin@gnome.org>
11218 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
11219 preprocessor directives, ensure that the argument to #define/#undef is
11220 exactly one identifier and that it's actually an identifier.
11222 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
11225 2002-07-24 Martin Baulig <martin@gnome.org>
11227 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
11228 initialize it to TypeManager.object_type in the constructor.
11229 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
11230 of the `hm.get_current' method if we're using the collection pattern.
11231 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
11232 for the explicit conversion to make it work when we're using the collection
11233 pattern and the `Current' property has a different return type than `object'.
11236 2002-07-24 Martin Baulig <martin@gnome.org>
11238 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
11239 does not match, but don't report any errors. This method is called in
11240 order for all methods in a MethodGroupExpr until a matching method is
11241 found, so we don't want to bail out if the first method doesn't match.
11242 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
11243 matches, report the 123. Fixes #28070.
11245 2002-07-24 Martin Baulig <martin@gnome.org>
11247 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
11248 TypeManager.TypeToCoreType() to the top of the method so the
11249 following equality checks will work. Fixes #28107.
11251 2002-07-24 Martin Baulig <martin@gnome.org>
11253 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
11254 operand is of type uint, and the other operand is of type sbyte,
11255 short or int, the operands are converted to type long." -
11256 Actually do what this comment already told us. Fixes bug #28106,
11259 2002-07-24 Martin Baulig <martin@gnome.org>
11261 * class.cs (MethodBase): New abstract class. This is now a base
11262 class for Property, Indexer and Event to avoid some code duplication
11263 in their Define() and DefineMethods() methods.
11264 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
11265 generic methods for Define() and DefineMethods().
11266 (FieldBase): Derive from MemberBase, not MemberCore.
11267 (Property): Derive from MemberBase, not MemberCore.
11268 (Property.DefineMethod): Moved all the code from this method to the
11269 new MethodBase.DefineAccessor(), just call it with appropriate
11271 (Property.Define): Call the new Property.DoDefine(), this does some
11272 sanity checks and we don't need to duplicate the code everywhere.
11273 (Event): Derive from MemberBase, not MemberCore.
11274 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
11275 accessors, this will also make them work with interface events.
11276 (Indexer): Derive from MemberBase, not MemberCore.
11277 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
11278 (Indexer.Define): Use the new MethodBase functions.
11280 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
11281 argument to the constructor.
11282 (Interface.FindMembers): Added support for interface events.
11283 (Interface.PopluateEvent): Implemented.
11285 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
11287 2002-07-22 Miguel de Icaza <miguel@ximian.com>
11289 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
11290 but this is required to check for a method name being the same as
11291 the containing class.
11295 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11297 * interface.cs: initialize variable.
11299 2002-07-23 Martin Baulig <martin@gnome.org>
11301 Implemented the IndexerName attribute in interfaces.
11303 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
11304 name if this is an explicit interface implementation.
11305 (Indexer.InterfaceIndexerName): New public variable. If we're
11306 implementing an interface indexer, this is the IndexerName in that
11307 interface. Otherwise, it's the IndexerName.
11308 (Indexer.DefineMethod): If we're implementing interface indexer,
11309 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
11310 and Pending.ImplementIndexer methods.
11311 (Indexer.Define): Also define the PropertyBuilder if we're
11312 implementing an interface indexer and this is neither an explicit
11313 interface implementation nor do the IndexerName match the one in
11316 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
11317 If a method is defined here, then we always need to create a proxy
11318 for it. This is used when implementing interface indexers.
11319 (Pending.IsInterfaceIndexer): New public method.
11320 (Pending.ImplementIndexer): New public method.
11321 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
11322 This is used when implementing interface indexers to define a proxy
11324 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
11325 define a proxy if necessary.
11327 * interface.cs (Interface.IndexerName): New public variable.
11328 (Interface.PopulateIndexer): Set the IndexerName.
11329 (Interface.DefineIndexers): New private method. Populate all the
11330 indexers and make sure their IndexerNames match.
11332 * typemanager.cs (IndexerPropertyName): Added support for interface
11335 2002-07-22 Martin Baulig <martin@gnome.org>
11337 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
11338 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
11339 ret if HasReturnLabel.
11340 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
11343 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
11344 and set the ec.LoopBeginTryCatchLevel.
11345 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
11346 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
11347 the current ec.TryCatchLevel, the branch goes out of an exception
11348 block. In this case, we need to use Leave and not Br.
11350 2002-07-22 Martin Baulig <martin@gnome.org>
11352 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
11353 block unless the block does not always return or it is contained in
11354 another try { ... } catch { ... } block. Fixes bug #26506.
11355 Added verify-1.cs to the test suite.
11357 2002-07-22 Martin Baulig <martin@gnome.org>
11359 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
11360 then we do not always return. Fixes bug #24985.
11362 2002-07-22 Martin Baulig <martin@gnome.org>
11364 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
11365 lookup on a per-class level; ie. walk up the class hierarchy until we
11366 found at least one applicable method, then choose the best among them.
11367 Fixes bug #24463 and test-29.cs.
11369 2002-07-22 Martin Baulig <martin@gnome.org>
11371 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
11372 return types of the methods. The return type is not part of the
11373 signature and we must not check it to make the `new' modifier work.
11374 Fixes bug #27999, also added test-147.cs.
11375 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
11377 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
11378 on the method's return type.
11380 2002-07-21 Martin Baulig <martin@gnome.org>
11382 * assign.cs: Make this work if the rightmost source is a constant and
11383 we need to do an implicit type conversion. Also adding a few more tests
11384 to test-38.cs which should have caught this.
11386 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
11387 target in the makefile for this. The makefile.gnu is primarily intended
11388 for end-users who don't want to debug the compiler.
11390 2002-07-21 Martin Baulig <martin@gnome.org>
11392 * assign.cs: Improved the Assign class so it can now handle embedded
11393 assignments (X = Y = Z = something). As a side-effect this'll now also
11394 consume less local variables. test-38.cs now passes with MCS, added
11395 a few new test cases to that test.
11397 2002-07-20 Martin Baulig <martin@gnome.org>
11399 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
11400 instructions. Fixes bug #27977, also added test-146.cs.
11402 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11404 * cs-tokenizer.cs: fixed getHex ().
11406 2002-07-19 Martin Baulig <martin@gnome.org>
11408 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
11409 not Type.GetType() to lookup the array type. This is needed when
11410 we're constructing an array of a user-defined type.
11411 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
11412 single-dimensional arrays, but also for single-dimensial arrays of
11415 2002-07-19 Martin Baulig <martin@gnome.org>
11417 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
11418 this function is called, it's not allowed to share LocalBuilders
11419 among ILGenerators.
11421 2002-07-19 Martin Baulig <martin@gnome.org>
11423 * expression.cs (Argument.Resolve): Report an error 118 when trying
11424 to pass a type as argument.
11426 2002-07-18 Martin Baulig <martin@gnome.org>
11428 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
11429 Conv_R_Un for the signed `long' type.
11431 2002-07-15 Miguel de Icaza <miguel@ximian.com>
11433 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
11434 `expr' for the temporary result, as that will fail if we do
11435 multiple resolves on the same expression.
11437 2002-07-05 Miguel de Icaza <miguel@ximian.com>
11439 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
11440 ec.TypeContainer for looking up aliases.
11442 * class.cs (TypeContainer): Remove LookupAlias from here.
11444 * decl.cs (DeclSpace); Move here.
11446 2002-07-01 Miguel de Icaza <miguel@ximian.com>
11448 * class.cs (FindMembers): Only call filter if the constructor
11449 bulider is not null.
11451 Also handle delegates in `NestedTypes' now. Now we will perform
11452 type lookups using the standard resolution process. This also
11455 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
11456 This uses Expressions (the limited kind that can be parsed by the
11457 tree) instead of strings.
11459 * expression.cs (ComposedCast.ToString): Implement, used to flag
11460 errors since now we have to render expressions.
11462 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
11465 * ecore.cs (SimpleName.ToString): ditto.
11467 * cs-parser.jay: Instead of using strings to assemble types, use
11468 Expressions to assemble the type (using SimpleName, ComposedCast,
11469 MemberAccess). This should fix the type lookups in declarations,
11470 because we were using a different code path for this.
11472 * statement.cs (Block.Resolve): Continue processing statements
11473 even when there is an error.
11475 2002-07-17 Miguel de Icaza <miguel@ximian.com>
11477 * class.cs (Event.Define): Also remove the `remove' method from
11478 the list of pending items.
11480 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
11481 generate more compact code.
11483 2002-07-17 Martin Baulig <martin@gnome.org>
11485 * const.cs (Const.LookupConstantValue): Add support for constant
11486 `unchecked' and `checked' expressions.
11487 Also adding test case test-140.cs for this.
11489 2002-07-17 Martin Baulig <martin@gnome.org>
11491 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
11492 check whether mi.ReturnType implements the IEnumerator interface; the
11493 `==' and the IsAssignableFrom() will fail in this situation.
11495 2002-07-16 Ravi Pratap <ravi@ximian.com>
11497 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
11500 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11502 * expression.cs: fixed bug #27811.
11504 2002-07-14 Miguel de Icaza <miguel@ximian.com>
11506 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
11507 Molaro: when we are a ref, the value already contains a pointer
11508 value, do not take the address of it.
11510 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
11511 * removed mb-parser.jay and mb-tokenizer.cs
11513 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11515 * expression.cs: check against the building corlib void type.
11517 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
11519 * ecore.cs: fix for valuetype static readonly fields: when
11520 initializing them, we need their address, not the address of a copy.
11522 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
11524 * typemanager.cs: register also enum_type in corlib.
11526 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11528 * class.cs: allow calling this (but not base) initializers in structs.
11530 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
11532 * ecore.cs: make sure we compare against the building base types
11535 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
11537 * typemanager.cs: fix TypeToCoreType() to handle void and object
11538 (corlib gets no more typerefs after this change).
11540 2002-07-12 Miguel de Icaza <miguel@ximian.com>
11542 * expression.cs (ArrayCreation.EmitArrayArguments): use
11543 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
11545 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
11546 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
11547 array indexes, the runtime actually forbids them.
11549 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
11550 for array arguments here.
11552 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
11553 instead of the default for ValueTypes.
11555 (New.DoEmit): Use IsValueType instead of
11556 IsSubclassOf (value_type)
11557 (New.DoResolve): ditto.
11558 (Invocation.EmitCall): ditto.
11560 * assign.cs (Assign): ditto.
11562 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
11563 Statements *are* currently doing part of their resolution during
11566 Expressions do always resolve during resolve, but statements are
11567 only required to propagate resolution to their children.
11569 2002-07-11 Miguel de Icaza <miguel@ximian.com>
11571 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
11573 (LoadAssembly): Do not add the dll if it is already specified
11575 (MainDriver): Add the System directory to the link path at the end,
11576 after all the other -L arguments.
11578 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
11579 wrong opcode for loading bytes and bools (ldelem.i1 instead of
11580 ldelem.u1) and using the opposite for sbytes.
11582 This fixes Digger, and we can finally run it.
11584 * driver.cs (UnixParseOption): Move the option parsing here.
11585 (CSCParseOption): Implement CSC-like parsing of options.
11587 We now support both modes of operation, the old Unix way, and the
11588 new CSC-like way. This should help those who wanted to make cross
11589 platform makefiles.
11591 The only thing broken is that /r:, /reference: and /lib: are not
11592 implemented, because I want to make those have the same semantics
11593 as the CSC compiler has, and kill once and for all the confussion
11594 around this. Will be doing this tomorrow.
11596 * statement.cs (Unsafe.Resolve): The state is checked during
11597 resolve, not emit, so we have to set the flags for IsUnsfe here.
11599 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11601 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
11602 not catch the Error_ObjectRefRequired in SimpleName (as it is
11603 possible to have a class/instance variable name that later gets
11604 deambiguated), we have to check this here.
11606 2002-07-10 Ravi Pratap <ravi@ximian.com>
11608 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
11609 make static and put into Expression.
11611 (Event.Define): Register the private field of the event with the
11612 TypeManager so that GetFieldFromEvent can get at it.
11614 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
11615 keep track of the private field associated with an event which
11618 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
11621 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
11623 2002-07-10 Miguel de Icaza <miguel@ximian.com>
11625 * expression.cs (Binary.EmitBranchable): this routine emits the
11626 Binary expression in a branchable context. This basically means:
11627 we need to branch somewhere, not just get the value on the stack.
11629 This works together with Statement.EmitBoolExpression.
11631 * statement.cs (Statement.EmitBoolExpression): Use
11634 2002-07-09 Miguel de Icaza <miguel@ximian.com>
11636 * statement.cs (For): Reduce the number of jumps in loops.
11638 (For): Implement loop inversion for the For statement.
11640 (Break): We can be breaking out of a Try/Catch controlled section
11641 (foreach might have an implicit try/catch clause), so we need to
11642 use Leave instead of Br.
11644 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
11645 now). If the instace expression supports IMemoryLocation, we use
11646 the AddressOf method from the IMemoryLocation to extract the
11647 address instead of emitting the instance.
11649 This showed up with `This', as we were emitting the instance
11650 always (Emit) instead of the Address of This. Particularly
11651 interesting when This is a value type, as we dont want the Emit
11652 effect (which was to load the object).
11654 2002-07-08 Miguel de Icaza <miguel@ximian.com>
11656 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
11658 * statement.cs (Checked): Set the CheckedState during the resolve
11659 process too, as the ConvCast operations track the checked state on
11660 the resolve process, and not emit.
11662 * cs-parser.jay (namespace_member_declaration): Flag that we have
11663 found a declaration when we do. This is used to flag error 1529
11665 * driver.cs: Report ok when we display the help only.
11667 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
11669 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
11671 2002-07-04 Miguel de Icaza <miguel@ximian.com>
11673 * cs-tokenizer.cs (define): We also have to track locally the
11674 defines. AllDefines is just used for the Conditional Attribute,
11675 but we also need the local defines for the current source code.
11677 2002-07-03 Miguel de Icaza <miguel@ximian.com>
11679 * statement.cs (While, For, Do): These loops can exit through a
11680 Break statement, use this information to tell whether the
11681 statement is the last piece of code.
11683 (Break): Flag that we break.
11685 * codegen.cs (EmitContexts): New `Breaks' state variable.
11687 2002-07-03 Martin Baulig <martin@gnome.org>
11689 * class.cs (TypeContainer.MethodModifiersValid): Allow override
11690 modifiers in method declarations in structs. Otherwise, you won't
11691 be able to override things like Object.Equals().
11693 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11695 * class.cs (Method, Property, Indexer): Do not allow the public
11696 modifier to be used in explicit interface implementations.
11698 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
11699 override modifiers in method declarations in structs
11701 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
11703 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
11704 integer or real overflow, report an error
11706 2002-07-02 Martin Baulig <martin@gnome.org>
11708 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
11709 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
11710 to tell the runtime about our newly created System.Object and
11711 System.ValueType types.
11713 2002-07-02 Miguel de Icaza <miguel@ximian.com>
11715 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
11716 struct instead of Ldarg/Starg.
11718 2002-07-02 Martin Baulig <martin@gnome.org>
11720 * expression.cs (Indirection.Indirection): Call
11721 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
11723 2002-07-02 Martin Baulig <martin@gnome.org>
11725 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
11726 ValueType, call TypeManager.TypeToCoreType() on it.
11727 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
11728 the OpCodes.Newarr argument.
11730 2002-07-02 Martin Baulig <martin@gnome.org>
11732 * expression.cs (Invocation.EmitCall): When compiling corlib,
11733 replace all calls to the system's System.Array type to calls to
11734 the newly created one.
11736 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
11737 System.Array methods.
11738 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
11739 from the system's System.Array type which must be replaced.
11741 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
11743 * typemanager.cs: load unverifiable_code_ctor so we can build
11744 corlib using the correct type. Avoid using GetTypeCode() with
11746 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
11747 TypeManager.object_type to allow building corlib.
11749 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
11751 * ecore.cs: handle System.Enum separately in LoadFromPtr().
11753 2002-07-01 Martin Baulig <martin@gnome.org>
11755 * class.cs: Make the last change actually work, we need to check
11756 whether `ifaces != null' to avoid a crash.
11758 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
11760 * class.cs: when we build structs without fields that implement
11761 interfaces, we need to add the interfaces separately, since there is
11762 no API to both set the size and add the interfaces at type creation
11765 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
11767 * expression.cs: the dimension arguments to the array constructors
11768 need to be converted if they are a long.
11770 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
11772 * class.cs: don't emit ldarg.0 if there is no parent constructor
11773 (fixes showstopper for corlib).
11775 2002-06-29 Martin Baulig <martin@gnome.org>
11777 MCS now compiles corlib on GNU/Linux :-)
11779 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
11780 ie. check for MethodImplOptions.InternalCall.
11782 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
11783 and TypeManager.attribute_type are null, so we must explicitly check
11784 whether parent is not null to find out whether it's an attribute type.
11785 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
11786 and SetBuilder, not only if the property is neither abstract nor external.
11787 This is necessary to set the MethodImplOptions on the accessor methods.
11788 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
11789 SetBuilder, see Property.Emit().
11791 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
11792 populate "System.Object", "System.ValueType" and "System.Attribute" since
11793 they've already been populated from BootCorlib_PopulateCoreTypes().
11795 2002-06-29 Martin Baulig <martin@gnome.org>
11797 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
11798 is the NullLiteral, we also need to make sure that target_type is not
11801 2002-06-29 Martin Baulig <martin@gnome.org>
11803 * rootcontext.cs (RootContext.ResolveCore): We must initialize
11804 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
11805 before calling BootstrapCorlib_ResolveDelegate ().
11807 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11809 * statement.cs: fixed build-breaker. All tests passed ok.
11811 2002-06-27 Martin Baulig <martin@gnome.org>
11813 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
11814 for System.Decimal when compiling corlib.
11816 2002-06-27 Martin Baulig <martin@gnome.org>
11818 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
11819 switch blocks which contain nothing but a default clause.
11821 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
11823 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
11825 2002-06-27 Martin Baulig <martin@gnome.org>
11827 * ecore.cs (PropertyExpr.PropertyExpr): Call
11828 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
11830 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
11831 is already a TypeBuilder.
11833 2002-06-27 Martin Baulig <martin@gnome.org>
11835 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
11836 `target_type == TypeManager.array_type', not IsAssignableFrom() in
11837 the "from an array-type to System.Array" case. This makes it work
11838 when compiling corlib.
11840 2002-06-27 Martin Baulig <martin@gnome.org>
11842 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
11843 non-static PropertyExpr, set its InstanceExpression. This makes
11844 the `ICollection.Count' property work in System/Array.cs.
11846 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
11848 * driver.cs: Made error handling more consistent. Errors now
11849 tracked by Report class, so many methods which used to return int
11850 now return void. Main() now prints success/failure and
11851 errors/warnings message.
11853 Renamed '--probe' compiler argument to '--expect-error'. Removed
11854 the magic number return values (123 and 124). Now, if the
11855 expected error occurs, the compiler exits with success (exit value
11856 0). If the compilation completes without seeing that particular
11857 error, the compiler exits with failure (exit value 1). The
11858 makefile in mcs/errors has been changed to handle the new behaviour.
11860 * report.cs: Made 'expected error' number a property and renamed
11861 it from 'Probe' to 'ExpectedError'.
11863 * genericparser.cs: Removed error handling support, since it is
11864 now all done by Report class.
11866 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
11867 class, so parse() no longer returns an int.
11869 * namespace.cs: Use Report.Error instead of GenericParser.error
11871 2002-06-22 Miguel de Icaza <miguel@ximian.com>
11873 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
11874 TypeContainer.AddOperator): At the front of the list put the
11875 explicit implementations, so they get resolved/defined first.
11877 2002-06-21 Miguel de Icaza <miguel@ximian.com>
11879 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
11880 interface type is implemented by this TypeContainer. Used during
11881 explicit interface implementation.
11883 (Property.Define, Indexer.Define, Method.Define): Validate that
11884 the given interface in the explicit implementation is one of the
11885 base classes for the containing type.
11887 Also if we are explicitly implementing an interface, but there is
11888 no match in the pending implementation table, report an error.
11890 (Property.Define): Only define the property if we are
11891 not explicitly implementing a property from an interface. Use the
11892 correct name also for those properties (the same CSC uses,
11893 although that is really not needed).
11895 (Property.Emit): Do not emit attributes for explicitly implemented
11896 properties, as there is no TypeBuilder.
11898 (Indexer.Emit): ditto.
11900 Hiding then means that we do not really *implement* a pending
11901 implementation, which makes code fail.
11903 2002-06-22 Martin Baulig <martin@gnome.org>
11905 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
11906 the return value of Object.GetType(). [FIXME: we need to do this whenever
11907 we get a type back from the reflection library].
11909 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
11911 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
11913 2002-06-20 Miguel de Icaza <miguel@ximian.com>
11915 * attribute.cs: Return null if we can not look up the type.
11917 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
11918 the interface types found.
11920 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
11921 interface types found.
11923 * typemanager.cs (GetInterfaces): Make this routine returns alll
11924 the interfaces and work around the lame differences between
11925 System.Type and System.Reflection.Emit.TypeBuilder in the results
11926 result for GetInterfaces.
11928 (ExpandInterfaces): Given an array of interface types, expand and
11929 eliminate repeated ocurrences of an interface. This expands in
11930 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
11933 2002-06-21 Martin Baulig <martin@gnome.org>
11935 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
11938 2002-06-21 Martin Baulig <martin@gnome.org>
11940 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
11941 and called with one of the core types, return the corresponding typebuilder for
11944 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
11947 2002-06-21 Martin Baulig <martin@gnome.org>
11949 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
11950 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
11951 (Expression.ConvertReferenceExplicit): Likewise.
11953 * expression.cs (ElementAccess.DoResolve): Likewise.
11954 (ElementAccess.DoResolveLValue): Likewise.
11956 2002-06-10 Martin Baulig <martin@gnome.org>
11958 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
11959 add the "value" parameter to the parameter list.
11961 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
11964 2002-06-19 Miguel de Icaza <miguel@ximian.com>
11966 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
11967 the argument to an int, uint, long or ulong, per the spec. Also
11968 catch negative constants in array creation.
11970 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
11972 * class.cs: do not allow the same interface to appear twice in
11973 the definition list.
11975 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
11977 * ecore.cs: don't use ldlen with System.Array.
11979 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
11981 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
11983 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
11985 * modifiers.cs: produce correct field attributes for protected
11986 internal. Easy fix so miguel can work on ther harder stuff:-)
11988 2002-06-18 Miguel de Icaza <miguel@ximian.com>
11990 * pending.cs: New file. Move the code from class.cs here.
11991 Support clearning the pending flag for all methods (when not doing
11992 explicit interface implementation).
11994 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
11996 * rootcontext.cs: added a couple more types needed to bootstrap.
11998 2002-06-17 Miguel de Icaza <miguel@ximian.com>
12000 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
12001 constructor in the type, instead of any constructor in the type
12002 hierarchy. Thanks to Paolo for finding this bug (it showed up as
12003 a bug in the Mono runtime when applying the params attribute).
12005 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
12006 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
12008 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
12010 * expression.cs (Unary.ResolveOperator): Use TypeManager
12011 to resolve the type.
12013 2002-06-13 Ravi Pratap <ravi@ximian.com>
12015 * cs-parser.jay (enum_member_declaration): Pass in the attributes
12018 * enum.cs (AddEnumMember): Add support to store the attributes associated
12019 with each member too.
12021 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
12022 field builders too - this takes care of the enum member case.
12024 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
12026 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
12027 address-of operator on both value types and pointers.
12029 2002-06-10 Martin Baulig <martin@gnome.org>
12031 * interface.cs (Interface.PopulateIndexer): Add the indexer's
12032 PropertyBuilder to the `property_builders' list.
12034 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
12035 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
12036 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
12037 find any indexers which are inherited from an interface.
12039 2002-06-09 Martin Baulig <martin@gnome.org>
12041 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
12042 the same type as the constant if necessary. There's also a test-130.cs
12045 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
12047 * typemanager.cs (TypeManager.ChangeType): Previously known as
12048 Enum.ChangeEnumType().
12050 2002-06-09 Martin Baulig <martin@gnome.org>
12052 * expression.cs (Cast.TryReduce): Added support for consts.
12054 2002-06-08 Ravi Pratap <ravi@ximian.com>
12056 * class.cs (Accessor): Hold attributes information so we can pass
12059 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
12060 Modify to pass in attributes attached to the methods.
12062 (add_accessor_declaration, remove_accessor_declaration): Ditto.
12064 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
12065 to handle the Accessor kind :-)
12067 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
12069 2002-06-08 Martin Baulig <martin@gnome.org>
12071 * expression.cs (Unary.TryReduceNegative): Added support for
12074 2002-06-08 Martin Baulig <martin@gnome.org>
12076 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
12077 name can't be found in the `defined_names' - the caller will do a
12078 MemberLookup in this case and thus find methods in System.Enum
12079 such as Enum.IsDefined().
12081 2002-06-08 Martin Baulig <martin@gnome.org>
12083 * enum.cs (Enum.ChangeEnumType): This is a custom version of
12084 Convert.ChangeType() which works with TypeBuilder created types.
12085 (Enum.LookupEnumValue, Enum.Define): Use it here.
12087 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
12088 `TypeBuilder.BaseType != null' check.
12089 (TypeContainer.FindMembers): Only lookup parent members if we
12090 actually have a parent.
12091 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
12092 (ConstructorInitializer.Resolve): Likewise.
12094 * interface.cs (Interface.FindMembers): Added
12095 `TypeBuilder.BaseType != null' check.
12097 * rootcontext.cs (RootContext.ResolveCore): Added
12098 "System.Runtime.CompilerServices.IndexerNameAttribute" to
12099 classes_second_stage.
12101 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
12102 debug_type and trace_type when compiling with --nostdlib.
12104 2002-06-07 Martin Baulig <martin@gnome.org>
12106 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
12107 (AddField): Set it to true when adding a non-static field.
12108 (DefineType): Use `have_nonstatic_fields' to find out whether we
12109 have non-static fields, not `Fields != null'.
12111 2002-06-02 Miguel de Icaza <miguel@ximian.com>
12113 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
12114 dereferencing a null on the static-field code path)
12116 2002-05-30 Martin Baulig <martin@gnome.org>
12118 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
12119 to take command line arguments. Use reflection to call the new
12120 custom `Initialize' function on the symbol writer and pass it the
12121 command line arguments.
12123 * driver.cs (--debug-args): New command line argument to pass command
12124 line arguments to the symbol writer.
12126 2002-05-28 Miguel de Icaza <miguel@ximian.com>
12128 * assign.cs (DoResolve): Forgot to do the implicit conversion to
12129 the target type for indexers and properties. Thanks to Joe for
12132 2002-05-27 Miguel de Icaza <miguel@ximian.com>
12134 * typemanager.cs (MethodFlags): returns the method flags
12135 (Obsolete/ShouldIgnore) that control warning emission and whether
12136 the invocation should be made, or ignored.
12138 * expression.cs (Invocation.Emit): Remove previous hack, we should
12139 not do this on matching a base type, we should do this based on an attribute
12141 Only emit calls to System.Diagnostics.Debug and
12142 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
12143 on the command line.
12145 * rootcontext.cs: Global settings for tracing and debugging.
12147 * cs-tokenizer.cs (define): New utility function to track
12148 defines. Set the global settings for TRACE and DEBUG if found.
12150 2002-05-25 Ravi Pratap <ravi@ximian.com>
12152 * interface.cs (Populate*): Pass in the TypeContainer as well as
12153 the DeclSpace as parameters so that we can create EmitContexts and
12154 then use that to apply attributes etc.
12156 (PopulateMethod, PopulateEvent, PopulateProperty)
12157 (PopulateIndexer): Apply attributes everywhere.
12159 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
12162 (ApplyAttributes): Update accordingly.
12164 We now apply interface attributes for all members too.
12166 2002-05-26 Miguel de Icaza <miguel@ximian.com>
12168 * class.cs (Indexer.Define); Correctly check if we are explicit
12169 implementation (instead of checking the Name for a ".", we
12170 directly look up if the InterfaceType was specified).
12172 Delay the creation of the PropertyBuilder.
12174 Only create the PropertyBuilder if we are not an explicit
12175 interface implementation. This means that explicit interface
12176 implementation members do not participate in regular function
12177 lookups, and hence fixes another major ambiguity problem in
12178 overload resolution (that was the visible effect).
12180 (DefineMethod): Return whether we are doing an interface
12183 * typemanager.cs: Temporary hack until we get attributes in
12184 interfaces (Ravi is working on that) and we get IndexerName
12185 support in interfaces.
12187 * interface.cs: Register the indexers as properties.
12189 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
12190 warning, I have verified that this is a bug in the .NET runtime
12191 (JavaScript suffers of the same problem).
12193 * typemanager.cs (MemberLookup): When looking up members for
12194 interfaces, the parent of an interface is the implicit
12195 System.Object (so we succeed in searches of Object methods in an
12196 interface method invocation. Example: IEnumerable x; x.ToString
12199 2002-05-25 Miguel de Icaza <miguel@ximian.com>
12201 * class.cs (Event): Events should also register if they do
12202 implement the methods that an interface requires.
12204 * typemanager.cs (MemberLookup); use the new GetInterfaces
12207 (GetInterfaces): The code used to lookup interfaces for a type is
12208 used in more than one place, factor it here.
12210 * driver.cs: Track the errors at the bottom of the file, we kept
12213 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
12214 instance if the method we are calling is static!
12216 2002-05-24 Miguel de Icaza <miguel@ximian.com>
12218 * attribute.cs (ApplyAttributes): Make this function filter out
12219 the IndexerName attribute (as that attribute in reality is never
12220 applied) and return the string constant for the IndexerName
12223 * class.cs (TypeContainer.Emit): Validate that all the indexers
12224 have the same IndexerName attribute, and if so, set the
12225 DefaultName attribute on the class.
12227 * typemanager.cs: The return value might contain other stuff (not
12228 only methods). For instance, consider a method with an "Item"
12229 property and an Item method.
12231 * class.cs: If there is a problem with the parameter types,
12234 2002-05-24 Ravi Pratap <ravi@ximian.com>
12236 * ecore.cs (ImplicitConversionExists): Wrapper function which also
12237 looks at user defined conversion after making a call to
12238 StandardConversionExists - we need this for overload resolution.
12240 * expression.cs : Update accordingly the various method calls.
12242 This fixes 2 bugs filed against implicit user defined conversions
12244 2002-05-22 Miguel de Icaza <miguel@ximian.com>
12246 * statement.cs: Track the result of the assignment.
12248 2002-05-21 Miguel de Icaza <miguel@ximian.com>
12250 * expression.cs (MemberAccess): Improved error reporting for
12251 inaccessible members.
12253 2002-05-22 Martin Baulig <martin@gnome.org>
12255 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
12256 itself with debugging support.
12258 2002-05-22 Martin Baulig <martin@gnome.org>
12260 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
12261 Removed, this isn't needed anymore.
12263 2002-05-20 Martin Baulig <martin@gnome.org>
12265 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
12266 be underlying type for an enum.
12268 2002-05-20 Miguel de Icaza <miguel@ximian.com>
12270 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
12271 that splits out the loading of just the core types.
12273 * rootcontext.cs (ResolveCore): Split the struct resolution in
12274 two, so we can load the enumeration underlying types before any
12277 * expression.cs (Is): Bandaid until we fix properly Switch (see
12278 bug #24985 for details).
12280 * typemanager.cs (ImplementsInterface): The hashtable will contain
12281 a null if there are no interfaces implemented.
12283 2002-05-18 Miguel de Icaza <miguel@ximian.com>
12285 * cs-parser.jay (indexer_declarator): It is fine to have array
12288 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12290 * typemanager.cs: (RegisterBuilder): New function used to register
12291 TypeBuilders that implement interfaces. Since
12292 TypeBuilder.GetInterfaces (as usual) does not work with lame
12294 (AddUserType): register interfaces.
12296 (ImplementsInterface): Use the builder_to_ifaces hash if we are
12297 dealing with TypeBuilder. Also, arrays are showing up as
12298 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
12299 methods can not be invoked on them!
12301 * ecore.cs (ExplicitReferenceConversionExists): Made public.
12302 (ImplicitReferenceConversionExists): Split out from
12303 StandardConversionExists.
12305 * expression.cs (As): We were only implementing one of the three
12306 cases for the as operator. We now implement them all.
12307 (Is): Implement the various other cases for Is as well.
12309 * typemanager.cs (CACHE): New define used to control if we want or
12310 not the FindMembers cache. Seems to have a negative impact on
12311 performance currently
12313 (MemberLookup): Nested types have full acess to
12314 enclosing type members
12316 Remove code that coped with instance/static returns for events, we
12317 now catch this in RealFindMembers.
12319 (RealFindMembers): only perform static lookup if the instance
12320 lookup did not return a type or an event.
12322 2002-05-17 Miguel de Icaza <miguel@ximian.com>
12324 * assign.cs (CompoundAssign): We pass more semantic information
12325 now to Compound Assignments than we did before: now we have all
12326 the information at hand, and now we resolve the target *before* we
12327 do the expression expansion, which allows the "CacheValue" method
12328 to have the effect we intended (before, a [x] += 1 would generate
12329 two differen ArrayAccess expressions from the ElementAccess,
12330 during the resolution process).
12332 (CompoundAssign.DoResolve): Resolve target and original_source here.
12334 2002-05-16 Miguel de Icaza <miguel@ximian.com>
12336 * expression.cs (ArrayAccess): dropped debugging information.
12338 * typemanager.cs: Small bug fix: I was always returning i_members,
12339 instead of one of i_members or s_members (depending on which had
12342 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
12343 method is invoked before any code generation takes place, and it
12344 is a mechanism to inform that the expression will be invoked more
12345 than once, and that the method should use temporary values to
12346 avoid having side effects
12348 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
12350 * ecore.cs (Expression.CacheTemporaries): Provide empty default
12353 * expression.cs (Indirection, ArrayAccess): Add support for
12354 CacheTemporaries in these two bad boys.
12356 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
12357 ldobj or ldind_ref.
12358 (StoreFromPtr): Handle stobj as well.
12360 * expression.cs (UnaryMutator): Share more code.
12362 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
12363 down: I was not tracking the Filter function as well, which
12364 was affecting the results of the cache.
12366 2002-05-15 Miguel de Icaza <miguel@ximian.com>
12368 * attribute.cs: Remove the hack to handle the CharSet property on
12371 2002-05-14 Miguel de Icaza <miguel@ximian.com>
12373 * attribute.cs (DoResolve): More uglyness, we now only try to
12374 resolve the attribute partially, to extract the CharSet
12375 information (only if we are a StructLayout attribute). Otherwise
12377 (GetExtraTypeInfo): Add some code to conditionally kill in the
12378 future this. I am more and more convinced that the .NET
12379 framework has special code to handle the attribute setting on
12382 * expression.cs (IsParamsMethodApplicable): Revert my previous
12383 foreach change here, it was wrong.
12385 2002-05-13 Miguel de Icaza <miguel@ximian.com>
12387 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
12388 (pp_expr): do not abort on unknown input, just return.
12389 (eval): abort if there are pending chars.
12391 * attribute.cs (Attribute.Resolve): Positional parameters are
12392 optional. Deal with that case.
12394 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
12395 the Ansi/Unicode/Auto information for the type.
12397 (TypeContainer.DefineType): instantiate the EmitContext here, as
12398 we will be using it during the type definition (to resolve
12399 attributes) and during the emit phase.
12401 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
12402 to pull type information out of the attributes
12404 (Attribute.Resolve): track the constructor builder, and allow for
12405 multiple invocations (structs and classes will use this).
12407 * ecore.cs (MemberLookupFinal): new version with all the
12408 parameters customizable.
12410 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
12411 constructors. Return if the result value is null (as the error
12412 would have been flagged already by MemberLookupFinal)
12414 Do not allow instances of abstract classes or interfaces to be
12417 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
12418 We have to compare the assembly property here when dealing with
12419 FamANDAssem and Assembly access modifiers, because we might be
12420 creating an assembly from *modules* (that means that we are not
12421 getting TypeBuilders for types defined in other modules that are
12422 part of this assembly).
12424 (Method.Emit): If the method is marked abstract and has a body,
12427 (TypeContainer.DefineMembers): If both the defined member and the
12428 parent name match are methods, then do not emit any warnings: let
12429 the Method.Define routine take care of flagging warnings. But if
12430 there is a mismatch (method overrides something else, or method is
12431 overriwritten by something, then emit warning).
12433 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
12434 set to null, this means `do not check for the return type on the
12437 (Method.Define): set the return type for the method signature to
12438 null, so that we get methods with the same name and parameters and
12439 different return types. This is used to flag warning 114 (you are
12440 hiding a method, and you probably want to use the new/override
12443 * typemanager.cs (MemberLookup): Implemented proper access
12444 control, closing a long standing set of bug reports. The problem
12445 was that the Framework only has two bits: Public and NonPublic,
12446 and NonPublic includes private and protected methods, but we need
12447 to enforce the FamANDAssem, FamOrAssem and Family.
12449 2002-05-11 Miguel de Icaza <miguel@ximian.com>
12451 * statement.cs (GotoCase): Return true: Ammounts to giving up
12452 knowledge on whether we return or not, and letting the other case
12453 be responsible for it.
12455 2002-05-10 Miguel de Icaza <miguel@ximian.com>
12457 * driver.cs: Do not load directories for each file processed, only
12458 do it if there is a pattern.
12460 * ecore.cs: Report readonly assigns here as well, as we might have
12461 been resolved only by MemberAccess.
12463 (SimpleName.SimpleNameResolve): Also be useful for LValue
12464 resolution. We need this to propagate assign to local readonly variables
12466 * typemanager.cs: Use a ptrhashtable for the criteria, because we
12467 do not want to reuse potential criteria memory.
12469 * class.cs (MyEventBuilder): Set reflected_type;
12471 * ecore.cs (Constantify): Added support for constifying bools.
12473 (RootContext.LookupType): Added a cache for values looked up in
12474 the declaration space.
12476 * typemanager.cs (FindMembers): Now is a front-end to
12477 RealFindMembers, and provides a two-level hashtable-based cache to
12480 15% performance improvement: from 22.5 to 19.2 seconds.
12482 * expression.cs (IsParamsMethodApplicable): use foreach.
12483 (Invocation.DoResolve): ditto.
12484 (New.DoResolve): ditto.
12485 (ArrayCreation.DoResolve): ditto.
12487 * ecore.cs (FindMostEncompassingType): use foreach.
12489 * delegate.cs (NewDelegate.DoResolve): Use foreach
12491 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
12492 (RemoveMethods): use foreach.
12494 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
12495 nested foreach statements instead of for, and also break out of
12496 the inner loop once a match is found.
12498 (Invocation.OverloadResolve): Use foreach, simplify the code.
12500 2002-05-08 Miguel de Icaza <miguel@ximian.com>
12502 * cfold.cs (BinaryFold): During an enumeration evaluation context,
12503 we actually unwrap the expression to allow for extra information
12506 * expression.cs: Use Shr_Un on unsigned operations.
12508 2002-05-08 Ravi Pratap <ravi@ximian.com>
12510 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
12511 applicable operators was not being considered correctly. This closes
12512 the bug Miguel reported.
12514 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
12516 * attribute.cs: check that the type derives from System.Attribute
12517 and report the correct error in that case (moved the duplicate code to
12518 its own method, too).
12520 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
12522 * attribute.cs: lookup attribute type name as the spec says: first the
12523 bare attribute name and then name + "Attribute" (nant compiles with
12524 mcs after this fix).
12526 2002-05-07 Miguel de Icaza <miguel@ximian.com>
12528 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
12529 Because of the way we parse things, we should try to see if a
12530 UIntConstant can fit in an integer.
12532 2002-05-07 Ravi Pratap <ravi@ximian.com>
12534 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
12535 when we are in an explicit context.
12537 (ConvertReferenceExplicit): When converting from Iface type S to Class
12538 T make sure the rules are implemented as an OR.
12540 * parameter.cs (ParameterType): Make it a property for now although the
12541 purpose really isn't anything immediate.
12543 * expression.cs (Is*Applicable): Do better checking on the parameter type
12544 of a ref/out parameter. The ones from the system assemblies are already
12545 marked with the correct type so we don't need to do any correction.
12547 * ecore.cs (StandardConversionExists): Conversion from Interface types to
12548 the object type is standard too so include that.
12550 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12552 * ecore.cs (StandardConversionExists): Augment with missing code:
12553 deal with IntConstant, LongConstants and Enumerations.
12555 * assign.cs: Report the error, instead of failing silently
12557 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
12558 typecontainer that they are declared, because the
12559 typecontainer/namespace will have the list of using clauses that
12560 need to be applied.
12562 Assembly Attributes were escaping the normal registration
12565 (EmitCode): Apply attributes within an EmitContext that represents
12566 the container they were declared on.
12568 * cs-parser.jay: Track bases for structs. How did I get this wrong?
12570 2002-05-06 Ravi Pratap <ravi@ximian.com>
12572 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
12573 Revamp completely - make much cleaner as we now operate only
12576 (FindMostSpecificSource, FindMostSpecificTarget): New methods
12577 to implement the logic detailed in the spec more correctly.
12579 (UserDefinedConversion): Update accordingly.
12581 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12583 * statement.cs: Return flow analysis information up.
12585 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
12588 (token): Do not consume an extra character before calling
12591 2002-05-06 Piers Haken <piersh@friskit.com>
12593 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
12595 2002-05-06 Miguel de Icaza <miguel@ximian.com>
12597 * class.cs (Constructor.Emit): Set the IsStatic flag in the
12598 EmitContext during the instance constructor initializer
12599 resolution, to stop access to instance variables.
12601 This is mandated by the spec, last paragraph of the `constructor
12602 initializers' section.
12604 2002-05-05 Miguel de Icaza <miguel@ximian.com>
12606 * cs-parser.jay, class.cs (Accessor): new class used to represent
12607 an accessor (get or set). In the past we used `null' to represent
12608 a missing accessor. But this is ambiguous because there was no
12609 way to tell in abstract indexers/properties if one of them was
12612 Now there is a way of addressing that.
12614 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
12615 instead of FindMembers.
12617 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
12618 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
12620 * attribute.cs: Treat indexers and properties as the same in terms
12621 of applying attributes
12623 * ecore.cs (FindMostEncompassedType): Use statically initialized
12624 EmptyExpressions()s like we do elsewhere to avoid creating useless
12625 objects (and we take this out of the tight loop).
12627 (GetConversionOperators): Move the code to extract the actual
12628 operators to a separate routine to clean things up.
12630 2002-05-04 Miguel de Icaza <miguel@ximian.com>
12632 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
12633 events are always registered FieldBuilders.
12635 * class.cs (FieldBase): New class shared by Fields
12637 * delegate.cs: If we are a toplevel delegate, use our full name.
12638 If we are a nested delegate, then only use our tail name.
12640 2002-05-02 Ravi Pratap <ravi@ximian.com>
12642 * expression.cs (IsApplicable): Ensure that we add the "&" to
12643 ref/out types before comparing it with the type of the argument.
12645 (IsParamsMethodApplicable): Ditto.
12647 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
12650 * delegate.cs : Handle the case when we have more than one applicable
12651 method. Flag an error only when we finish checking all.
12653 2002-05-02 Miguel de Icaza <miguel@ximian.com>
12655 * expression.cs: Add support for boolean static initializers.
12657 2002-05-01 Miguel de Icaza <miguel@ximian.com>
12659 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
12661 * parameter.cs (ComputeParameterTypes,
12662 ComputeAndDefineParameterTypes): Better error handling: now we
12663 clear the `types' cache if we fail during any of the type lookups.
12664 We also return the status code correctly to our caller
12666 * delegate.cs: If we fail to define a delegate, abort the extra
12669 * expression.cs (Binary.ResolveOperator): for
12670 operator==(object,object) and operator !=(object, object) we also
12671 have to verify that there is an implicit conversion from one to
12674 (ArrayAccess.DoResolve): Array Access can operate on
12677 2002-04-30 Miguel de Icaza <miguel@ximian.com>
12679 * assign.cs (CompoundAssign): A new class used as a "flag" that
12680 the assignment actually is happening as part of a compound
12681 assignment operator.
12683 During compound assignment, a few new rules exist to enable things
12690 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
12691 to the type of x) if y is implicitly convertible to the type of x,
12692 and the operator is a builtin operator and the return type of the
12693 operator is explicitly convertible to the type of x.
12695 * rootcontext.cs: Reset warning level to 2. 4 catches various
12696 "interesting" features in mcs, we must clean this up at some
12697 point, but currently am trying to kill other bugs ;-)
12699 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
12700 in container classes as well.
12702 * expression.cs (Binary.ResolveOperator): Handle string case
12703 before anything else (as operator overloading does emit an error
12704 before doing anything else).
12706 This code could go away when we move to a table driven model, but
12707 i could not come up with a good plan last night.
12709 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
12711 * typemanager.cs (CSharpName): reimplementation using regex.
12712 * class.cs: added null check for fields in Emit
12713 * rootcontext.cs: set warninglevel to 4
12715 2002-04-29 Miguel de Icaza <miguel@ximian.com>
12717 * typemanager.cs (CSharpName): reimplemented with Lupus
12720 2002-04-28 Miguel de Icaza <miguel@ximian.com>
12722 * statement.cs (If): correclty implement Resolve, because we were
12723 not catching sem errors in there. The same process is needed
12725 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
12728 (Statement.Warning_DeadCodeFound): Factorize code.
12729 (While): Report dead code here too.
12731 (Statement): Added Resolve virtual method to allow
12732 for resolution split from the emit code.
12734 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12736 * statement.cs (EmitBoolExpression): No longer try to resolve the
12738 (MakeBoolean): New utility function that resolve, implicitly
12739 converts to boolean and tags the expression.
12742 (If, Do): Implement dead code elimination.
12743 (While): Implement loop inversion
12745 (Do, While, For, If): Resolve the expression prior to calling our
12748 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
12751 - added method Report28 (warning: program has more than one entry point)
12752 - added method IsEntryPoint, implements paragraph 10.1 of the spec
12753 - modified method Method.Define, the part at the end of the method
12755 * rootcontext.cs: added static public Location EntryPointLocation;
12757 * ../errors/cs0028.cs : Add test case for the above warning.
12760 - modified method CSharpName to allow arrays of primitive type to
12761 be printed nicely (e.g. instead of System.Int32[][] it now prints
12763 - added method CSharpSignature: returns the signature of a method
12764 in string format to be used in reporting errors, warnings, etc.
12766 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
12769 2002-04-26 Ravi Pratap <ravi@ximian.com>
12771 * delegate.cs (Define): Fix extremely silly bug where I was
12772 setting the type of the 'object' parameter of the BeginInvoke
12773 method to System.IAsyncResult instead of System.Object ;-)
12775 2002-04-26 Miguel de Icaza <miguel@ximian.com>
12777 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
12780 (Constructor.Emit): return if we fail to initialize the
12781 constructor. Another door closed!
12783 * expression.cs (New.DoResolve): Improve error message (from -6 to
12784 1501). Use DeclaredOnly lookup to find the exact constructor.
12786 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
12787 loop. This is useful.
12789 * cs-parser.jay: Adjust the default parameters so that destructors
12790 have the proper signature.
12792 2002-04-26 Martin Baulig <martin@gnome.org>
12794 * driver.cs (LoadAssembly): If `assembly' contains any characters
12795 which are only valid in path names and not in assembly names
12796 (currently slash, backslash and point), use Assembly.LoadFrom ()
12797 instead of Assembly.Load () on the `assembly' (before iteration
12798 over the link_paths).
12800 2002-04-26 Martin Baulig <martin@gnome.org>
12802 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
12804 2002-04-25 Miguel de Icaza <miguel@ximian.com>
12806 * class.cs (Property): use the new typemanager.MemberLookup
12808 (TypeContainer.MemberLookup): Implement using the
12809 TypeManager.MemberLookup now.
12811 * typemanager.cs: Make MemberLookup a function of the TypeManager,
12812 and return MemberInfos, so that these can be used without an
12813 EmitContext (what we had before).
12815 2002-04-24 Miguel de Icaza <miguel@ximian.com>
12817 * expression.cs: Fix the case where the argument to params if the
12818 type of the params. I omitted handling this before. Fixed
12820 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12822 * driver.cs: Call BootCorlib_PopulateCoreType
12824 * class.cs (Property.CheckBase): Check for properties only, not
12827 * interface.cs: Temporary hack: try/catch around the
12828 CustomAttributeBuilder, because I am getting an exception that I
12831 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
12832 types whose definitions are required to be there (attributes are
12833 defined before standard types).
12835 Compute definitions as we boot the various types, as they are used
12836 immediately (value_type class will need object_type, but if we do
12837 not initialize object_type, we will pass a null, which will let
12838 the runtime pick the System.Object from the existing corlib, which
12839 is not what we want).
12841 2002-04-22 Patrik Torstensson <totte@labs2.com>
12843 * cs-tokenizer.cs: fixed a number of trim() issues.
12845 2002-04-22 Ravi Pratap <ravi@ximian.com>
12847 * expression.cs (Argument.Type): Ensure that we return the correct
12848 type when we have out or ref parameters [in which case we
12851 2002-04-22 Miguel de Icaza <miguel@ximian.com>
12853 * class.cs (Property, Indexer): Allow extern modifier in there.
12855 * typemanager.cs (InitBaseTypes): Initializes object_type and
12856 value_type, since those will be used early on during the bootstrap
12857 process to compile corlib.
12859 (InitCoreTypes): Move code from here to InitBaseTypes.
12861 2002-04-21 Miguel de Icaza <miguel@ximian.com>
12863 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
12864 single-dimension arrays as using the ldlen opcode.
12866 Daniel Lewis discovered this optimization.
12868 * typemanager.cs: Add signature for System.Array::get_Length
12870 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12872 * statement.cs: report the error when the foreach does not apply to an
12873 array nor a collection.
12875 2002-04-19 Miguel de Icaza <miguel@ximian.com>
12877 * expression.cs: Add implicit conversions to the operator ~.
12879 * constant.cs (DecimalConstant.Emit): Emit decimal value.
12881 * typemanager.cs: Locate the decimal constructor.
12883 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12885 * attribute.cs: use the new property of TypeOf.
12886 * expression.cs: added 'get' property around typearg.
12888 These changes fix a build breaker reported by NickD. Is this the
12889 correct way to fix? If not, please, revert my changes and make it
12892 2002-04-17 Miguel de Icaza <miguel@ximian.com>
12894 * attribute.cs: Add support for typeof in attribute invocations.
12895 I am not sure that this is right though.
12897 2002-04-14 Duncan Mak <duncan@ximian.com>
12899 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
12900 Binary.Operator.Division case.
12902 2002-04-13 Ravi Pratap <ravi@ximian.com>
12904 * class.cs (DefineType): Ensure that we do a proper check on
12905 attribute types and also register it with the TypeManager.
12907 (TypeContainer.Targets): The default for attribute types is
12908 AttributeTargets.All.
12910 * attribute.cs (ApplyAttributes): Registering the attribute type
12911 is done elsewhere, not when we discover we have a Usage attribute.
12913 2002-04-12 Ravi Pratap <ravi@ximian.com>
12915 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
12916 and get rid of is_delegate parameter.
12918 * everywhere : update.
12920 2002-04-12 Ravi Pratap <ravi@ximian.com>
12922 * cs-parser.jay (compilation_unit): Revamp completely to use
12923 some new ideas that I got from Rhys' grammar to solve the problems
12924 with assembly level attributes.
12926 (outer_declaration): New grammar production.
12928 (attribute_sections): Add.
12930 (opt_attributes): Base on attribute_sections
12932 (namespace_declaration): Allow opt_attributes to tackle the case
12933 when we have assembly level attributes - we are clever in this
12936 * attribute.cs (ApplyAttributes): Do not worry about assembly
12937 attributes in the non-global context.
12939 * rootcontext.cs (AddGlobalAttributes): Go back to using this
12940 instead of SetGlobalAttributes.
12942 * class.cs, rootcontext.cs : Ensure we define and generate
12943 attribute types before anything else.
12945 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
12946 and flag the new error -20 for the case when the attribute type
12947 does not have valid targets specified. csc does not catch this.
12949 * ../errors/errors.txt : update for error # -20
12951 2002-04-11 Ravi Pratap <ravi@ximian.com>
12953 * support.cs (InternalParameters.ParameterModifier): Do some null
12954 checking and return sane values.
12956 * class.cs (Method.Define): If we are a PInvoke method, ensure
12957 that we are static and extern. Report error # 601
12959 * ../errors/cs0601.cs : Add test case for the above error.
12961 2002-04-07 Ravi Pratap <ravi@ximian.com>
12963 * rootcontext.cs (attribute_types): We need to keep type of
12964 all attribute types separately and emit code for them first.
12966 (RegisterAttribute) : Implement.
12968 * class.cs (DefineType): Check if the current Type is a custom
12969 attribute type and register it accordingly.
12971 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
12972 adding the first attribute twice and rename to
12974 (SetGlobalAttributes): this.
12976 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
12979 * attribute.cs (ApplyAttributes): Take an additional argument telling us
12980 if we are processing global arguments. Hmm, I am unsure of this.
12982 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
12984 * expression.cs: added static array of strings to avoid calling
12985 Enum.ToString () for Operator in Binary. Significant recover of
12988 2002-04-10 Miguel de Icaza <miguel@ximian.com>
12990 * class.cs (FindMembers): Allow the Builders of the various
12991 members to be null. If they are skip them. This only happens
12992 during the PInvoke declaration.
12994 2002-04-09 Miguel de Icaza <miguel@ximian.com>
12996 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
12997 failure, so we do not keep going afterwards.
12999 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
13000 wanted to pass `false' as the `is_delegate' argument. If this is
13001 the case, why not use delegate_type == null to mean `is_delegate =
13002 false' and anything else as is_delegate = true.
13004 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
13006 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
13007 code for the section, not the beginning of the tests.
13009 2002-04-08 Miguel de Icaza <miguel@ximian.com>
13011 * cfold.cs: Handle operator + (Enum x, Underlying x)
13013 * expression.cs (Binary): same. Warn about errors where we have
13014 Enum/Enum in operator + as well.
13016 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
13019 - added support for switch(bool)
13020 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
13021 - add TableSwitchEmit() to handle table-based switch statements
13023 2002-04-05 Ravi Pratap <ravi@ximian.com>
13025 * expression.cs (Invocation.OverloadResolve): Factor out code which
13026 does parameter compatibility checking with arguments so that we can
13027 re-use the code even from Delegate.VerifyApplicability
13029 (VerifyArgumentsCompat): Move above code here.
13031 * delegate.cs (VerifyApplicability): Get rid of duplicate code
13032 and instead make a call to the above method.
13034 2002-03-31 Ravi Pratap <ravi@ximian.com>
13036 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
13037 We use it to keep track of classes which are attribute types.
13039 2002-04-02 Miguel de Icaza <miguel@ximian.com>
13041 * delegate.cs (Delegate.Define): Correctly define the types in the
13042 presence of fixed and array parameters.
13044 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
13047 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
13048 include NonPublic after the first iteration.
13050 * class.cs (Indexer.CheckBase): Only check if both parents are
13053 * cs-parser.jay (accessor_body): If empty, set to null.
13055 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
13056 same code path here to resolve constants names that we did have in
13057 MemberAccess.DoResolve. There is too much code duplicated here.
13059 2002-04-01 Miguel de Icaza <miguel@ximian.com>
13061 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
13063 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
13066 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
13067 tokens, numbers and strings.
13069 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
13072 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
13073 asyncronous parameters and the regular parameters.
13075 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
13076 specify the target directory.
13078 * expression.cs: (This.DoResolve): Simplify
13079 (As.Emit): Optimize, do not generate IsInst if the expression is
13080 always of the given type.
13082 (Is.DoResolve): Bug fix, we were reporting both always/never for
13085 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
13086 creating too many unnecessary arrays.
13088 2002-03-31 Miguel de Icaza <miguel@ximian.com>
13090 * class.cs (EmitFieldInitializer): Use Assign expression to assign
13091 fields instead of rolling our own initializer. Takes care of all
13092 implicit conversions, and drops unnecessary static checks/argument.
13094 2002-03-31 Dick Porter <dick@ximian.com>
13096 * driver.cs: use the GetDirectories() return values properly, and
13097 use "/" as path separator.
13099 2002-03-30 Miguel de Icaza <miguel@ximian.com>
13101 * expression.cs (Unary): Optimize - - expr into expr.
13102 (Binary): Optimize a + (-b) into a -b.
13104 * codegen.cs (CodeGen): Made all methods static.
13106 2002-03-29 Miguel de Icaza <miguel@ximian.com>
13110 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
13111 TypeBuilder property.
13113 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
13116 * tree.cs: Removed the various RecordXXXX, and replaced with a
13117 single RecordDecl. Removed all the accessor methods, and just
13118 left a single access point Type
13120 * enum.cs: Rename DefineEnum to DefineType.
13122 * decl.cs: New abstract method `DefineType' used to unify the
13123 Defines for Enumerations, Interfaces, TypeContainers and
13126 (FindType): Moved LookupInterfaceOrClass here. Moved the
13127 LookupBaseClasses method that used to live in class.cs and
13128 interface.cs here, and renamed to FindType.
13130 * delegate.cs: Implement DefineType. Take advantage of the
13131 refactored pattern for locating the parent builder without taking
13132 the parent_builder argument (which we know does not work if we are
13133 nested, and triggering a toplevel definition).
13135 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13137 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
13138 accessibility of a member has changed during override and report
13141 * class.cs (Method.Define, Property.Define): Only complain on
13142 overrides if the method is private, any other accessibility is
13143 fine (and since we just checked the permission is the same, we are
13146 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
13147 and elif are processed always. The other pre-processing
13148 directives are only processed if we are "taking" the path
13150 2002-03-29 Martin Baulig <martin@gnome.org>
13152 * class.cs (Method.Emit): Only emit symbolic debugging info if the
13153 current location is not Null.
13155 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
13156 a separate method so we can profile it.
13158 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
13159 `span.Seconds' are just seconds, but no minutes or hours.
13160 (MainDriver): Profile the CodeGen.SaveSymbols calls.
13162 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13164 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
13165 Remove the gratuitous set of Final:
13167 // If an interface implementation, then we can set Final.
13168 if (((flags & MethodAttributes.Abstract) == 0) &&
13169 implementing.DeclaringType.IsInterface)
13170 flags |= MethodAttributes.Final;
13172 I do not know what I was smoking when I used that.
13175 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
13176 step into fixing the name resolution issues for delegates and
13177 unifying the toplevel name resolution.
13179 2002-03-28 Martin Baulig <martin@gnome.org>
13181 * class.cs (Method.Emit): If we have a symbol writer, call its
13182 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
13183 tell it about the current method.
13185 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
13186 writer that we're going to emit the first byte of IL code for a new
13187 statement (a new source line).
13188 (EmitContext.EmitTopBlock): If we have a symbol writer, call
13189 EmitContext.Mark() before emitting any code.
13191 * location.cs (SymbolDocument): Return null when we're Null.
13193 * statement.cs (Statement): Moved the `Location loc' variable here.
13194 (Statement.EmitBoolExpression): If we have a symbol writer, call
13195 ec.Mark() before emitting any code to tell it that we're at the
13196 beginning of a new statement.
13197 (StatementExpression): Added `Location' argument to the constructor.
13198 (Block): Added public readonly variable `StartLocation' and public
13199 variable `EndLocation'. The latter is to be set using SetEndLocation().
13200 (Block): Added constructor which takes a start and end location.
13201 (Block.SetEndLocation): New method. This sets the end location.
13202 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
13203 local variables we create.
13204 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
13205 each statement and do also mark the begin and end of the block.
13207 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
13208 tell it the current lexer.Location, use Location.Null for the end of the
13210 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
13211 current block, set its end location using SetEndLocation().
13212 (statement_expression): StatementExpression constructor now takes the
13213 lexer.Location as additional argument.
13214 (for_statement, declare_local_variables): Likewise.
13215 (declare_local_variables): When creating a new implicit block, use the
13216 new Block constructor and pass it the lexer.Location.
13218 2002-03-28 Miguel de Icaza <miguel@ximian.com>
13220 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
13221 members also on the parent interfaces recursively.
13223 2002-03-27 Miguel de Icaza <miguel@ximian.com>
13225 * report.cs: Use new formats, since Gonzalo finished the missing
13228 * expression.cs (Binary.ResolveOperator): added missing operator|
13229 operator& and operator^ for bool/bool.
13231 * cs-parser.jay: CheckDef now takes a Location argument that is
13232 used to report errors more precisly (instead of reporting the end
13233 of a definition, we try to track something which is a lot closer
13234 to the source of the problem).
13236 * cs-tokenizer.cs: Track global token use, so we can properly flag
13237 the use of #define/#undef after the first token has been seen.
13239 Also, rename the reportXXXX to Error_DescriptiveName
13241 * decl.cs (DeclSpace.IsTopLevel): Move property here from
13242 TypeContainer, so that Enum and Interface can use this too.
13244 * class.cs (TypeContainer.LookupInterfaceOrClass,
13245 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
13246 `builder' argument. Typically this was used to pass the parent
13247 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
13250 The problem is that a nested class could trigger the definition of
13251 a toplevel class, and the builder would be obviously wrong in that
13254 So we drop this argument, and we compute dynamically the
13255 TypeBuilder/ModuleBuilder (the correct information was available
13256 to us anyways from DeclSpace.Parent)
13258 * interface.cs (Interface.DefineInterface): Drop builder
13259 parameter cleanup like class.cs
13261 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
13264 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
13267 (Try.Emit): Propagate the returns value from the statement.
13269 (Return.Emit): Even if we are leavning
13271 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
13273 * modifiers.cs: Fix the computation of MethodAttributes flags.
13275 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
13277 * driver.cs: allow compilation of files that start with '/'.
13278 Add a default case when checking the argument of --target.
13280 2002-03-25 Miguel de Icaza <miguel@ximian.com>
13282 * interface.cs: Implement the same search algorithm for types in
13283 the interface code.
13285 * delegate.cs: Do not allow multiple definition.
13287 * Recovered ChangeLog that got accidentally amputated
13289 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
13291 * rootcontext.cs: Load manually enum to allow core classes to
13292 contain enumerations.
13294 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
13295 Update to new static methods in TypeManager.
13297 * typemanager.cs (GetMethod, GetConstructor): Use our
13298 implementation of FindMembers to find the members, since during
13299 corlib compilation, the types are TypeBuilders and GetMethod and
13300 GetConstructor do not work.
13302 Make all methods in TypeManager static.
13304 (InitCodeHelpers): Split the functionality from
13305 the InitCodeTypes function.
13307 * driver.cs: Call InitCodeHelpers after we have populated the
13310 * cs-parser.jay (delegate_declaration): we did not used to compute
13311 the delegate name correctly for void delegates.
13313 2002-03-24 Miguel de Icaza <miguel@ximian.com>
13315 * rootcontext.cs (RootContext): Init the interface_resolve_order
13316 and type_container_resolve_order always.
13318 (ResolveCore, BootstrapCorlib_ResolveClass,
13319 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
13320 compiler when compiling with --nostdlib
13322 * class.cs (TypeContainer.DefineType): Check that our parent is
13323 not null. This test is most important when we are bootstraping
13326 * codegen.cs: Split out the symbol writing code.
13328 2002-03-25 Martin Baulig <martin@gnome.org>
13330 * driver.cs (-g): Made -g an alias for --debug.
13332 2002-03-24 Martin Baulig <martin@gnome.org>
13334 * codegen.cs (SymbolWriter): New public variable. Returns the
13335 current symbol writer.
13336 (CodeGen): Added `bool want_debugging_support' argument to the
13337 constructor. If true, tell the ModuleBuild that we want debugging
13338 support and ask it for the ISymbolWriter.
13339 (Save): If we have a symbol writer, call it's Close() method after
13340 saving the assembly.
13342 * driver.c (--debug): New command line argument to create a
13343 debugger information file.
13345 * location.cs (SymbolDocument): New public property. Returns an
13346 ISymbolDocumentWriter object for the current source file or null
13347 if we don't have a symbol writer.
13349 2002-03-21 Miguel de Icaza <miguel@ximian.com>
13351 * driver.cs (LoadAssembly): Correctly return when all the paths
13352 have been tried and not before.
13354 * statement.cs (Switch.Emit): return the actual coverage for this
13355 statement (returns/not-returns)
13357 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
13358 switch of the statement if we are the last switch section. That
13359 kills two problems: try/catch problems (we used to emit an empty
13360 nop at the end) and switch statements where all branches would
13363 2002-03-19 Miguel de Icaza <miguel@ximian.com>
13365 * driver.cs: Add default assemblies (the equivalent to the
13366 Microsoft CSC.RSP file)
13368 * cs-tokenizer.cs: When updating `cols and setting it to zero,
13369 also update tokens_seen and set it to false.
13371 * driver.cs: Implement --recurse for Mike.
13373 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
13374 correctly splitting out the paths.
13376 2002-03-18 Miguel de Icaza <miguel@ximian.com>
13378 * interface.cs (Interface.PopulateProperty): Instead of using
13379 `parent' as the declaration space for the set parameters, use
13382 * support.cs (InternalParameters): InternalParameters constructor
13383 takes a DeclSpace instead of a TypeContainer.
13385 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
13386 types are being initialized, load the address of it before calling
13389 (New): Provide a mechanism to disable the generation of local
13390 value type temporaries when the caller will be providing us with
13391 an address to store it.
13393 (ArrayCreation.EmitDynamicInitializers): Use it.
13395 2002-03-17 Miguel de Icaza <miguel@ximian.com>
13397 * expression.cs (Invocation.EmitArguments): Only probe for array
13398 property if there is more than one argument. Sorry about that.
13400 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
13401 empty param arrays.
13403 * class.cs (Method.LabelParameters): Fix incorrect code path that
13404 prevented the `ParamArrayAttribute' from being applied to the
13407 2002-03-16 Miguel de Icaza <miguel@ximian.com>
13409 * support.cs (ReflectionParameters): Correctly compute whether the
13410 last argument is a params array. Fixes the problem with
13413 * typemanager.cs: Make the assemblies array always be non-null
13414 (empty, but non-null)
13416 * tree.cs (RecordDecl): New function that abstracts the recording
13417 of names. This reports error 101, and provides a pointer to the
13418 previous declaration. Fixes a crash in the compiler.
13420 * cs-parser.jay (constructor_declaration): Update to new grammar,
13421 and provide a constructor_body that can be empty.
13423 2002-03-15 Miguel de Icaza <miguel@ximian.com>
13425 * driver.cs: Add support for --resources.
13427 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
13428 Make all types for the various array helper methods be integer.
13430 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
13431 CheckState to ConvCast.
13433 (ConvCast): Now it takes a `checked' state argument, to avoid
13434 depending on the emit context for the conversion, and just using
13435 the resolve time setting.
13437 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
13438 instead of Invocation.EmitArguments. We do not emit the original
13439 arguments, instead we emit those which have been converted to
13440 unsigned int expressions.
13442 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
13444 * codegen.cs: ditto.
13446 * expression.cs (LocalVariableReference): Drop the use of the
13447 Store function that depended on the variable index.
13449 * statement.cs (VariableInfo): Drop the `Idx' property from this
13450 class, as this is not taking into account the indexes for
13451 temporaries tat we generate during the execution, getting the
13454 * class.cs: First emit class initializers, then call the parent
13457 * expression.cs (Binary): Fix opcode emision.
13458 (UnaryMutator.EmitCode): Support checked code generation
13460 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
13461 matches for events for both the Static and Instance scans,
13462 pointing to the same element. Fix that.
13464 2002-03-14 Miguel de Icaza <miguel@ximian.com>
13466 * rootcontext.cs (ResolveTree): Always set the
13467 interface_resolve_order, because nested interfaces will be calling
13470 * class.cs (GetInterfaceOrClass): Track the same resolution
13471 process used by TypeManager.LookupType. This fixes the nested
13472 type lookups in class declarations (separate path from
13475 (TypeContainer.DefineType): Also define nested interfaces.
13476 (TypeContainer.RegisterOrder): New public function used to
13477 register the order in which child interfaces need to be closed.
13479 Nested interfaces need to be closed after their parents have been
13482 * interface.cs (InterfaceAttr): Put all the logic for computing
13483 the interface attribute here.
13485 (DefineInterface): Register our interface order with the
13486 RootContext or with the TypeContainer depending on the case.
13488 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13490 * cs-parser.jay: rework foreach statement to work with the new
13491 changes to the policy on SimpleNames.
13493 * report.cs: support Stacktrace on warnings as well.
13495 * makefile: drop --unsafe and /unsafe from the compile.
13497 2002-03-13 Ravi Pratap <ravi@ximian.com>
13499 * ecore.cs (StandardConversionExists): Modify to take an Expression
13500 as the first parameter. Ensure we do null -> reference type conversion
13503 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
13504 temporary Expression objects.
13506 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
13508 * interface.cs: workaround bug in method overloading resolution
13509 (there is already a bugzilla bug for it).
13511 2002-03-12 Miguel de Icaza <miguel@ximian.com>
13513 We could also solve this problem by having a separate path for
13514 performing type lookups, instead of DoResolve, we could have a
13515 ResolveType entry point, and only participating pieces of the
13516 production (simplename, deref, array) would implement this.
13518 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
13519 signal SimpleName to only resolve type names and not attempt to
13520 resolve anything else.
13522 * expression.cs (Cast): Set the flag.
13524 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
13526 * class.cs: Only report 108 if there is no `new' modifier.
13528 * cs-parser.jay: rework foreach statement to work with the new
13529 changes to the policy on SimpleNames.
13531 * report.cs: support Stacktrace on warnings as well.
13533 * makefile: drop --unsafe and /unsafe from the compile.
13535 2002-03-11 Miguel de Icaza <miguel@ximian.com>
13537 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13538 lookups here, instead of doing that at parse time. This means
13539 that our grammar will not introduce `LocalVariableReferences' as
13540 expressions at this point. That solves the problem of code like
13544 static void Main ()
13548 This is only half the fix. The full fix requires parameters to
13549 also be handled in this way.
13551 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
13552 makes the use more obvious of the DeclSpace. The
13553 ec.TypeContainer.TypeBuilder is now only used to pull the
13554 TypeBuilder for it.
13556 My theory is that I can get rid of the TypeBuilder completely from
13557 the EmitContext, and have typecasts where it is used (from
13558 DeclSpace to where it matters).
13560 The only pending problem is that the code that implements Aliases
13561 is on TypeContainer, and probably should go in DeclSpace.
13563 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
13564 lookups here, instead of doing that at parse time. This means
13565 that our grammar will not introduce `LocalVariableReferences' as
13566 expressions at this point. That solves the problem of code like
13570 static void Main ()
13574 This is only half the fix. The full fix requires parameters to
13575 also be handled in this way.
13577 * class.cs (Property.DefineMethod): When implementing an interface
13578 method, set newslot, when implementing an abstract method, do not
13579 set the flag (before we tried never setting it, or always setting
13580 it, which is the difference).
13581 (Indexer.DefineMethod): same.
13582 (Method.DefineMethod): same.
13584 * ecore.cs: Only set the status used flag if we get back a Field.
13586 * attribute.cs: Temporary hack, so Paolo can keep working.
13588 2002-03-08 Ravi Pratap <ravi@ximian.com>
13590 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
13591 the unmanaged type in the case we have a MarshalAs attribute.
13593 (Resolve): Handle the case when we are parsing the special MarshalAs
13594 attribute [we need to store the unmanaged type to use later]
13596 * typemanager.cs (marshal_as_attr_type): Built in type for the
13597 MarshalAs Attribute.
13599 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
13600 on parameters and accordingly set the marshalling info.
13602 2002-03-09 Miguel de Icaza <miguel@ximian.com>
13604 * class.cs: Optimizing slightly by removing redundant code after
13605 we switched to the `NoTypes' return value.
13606 (Property.DefineMethod): use NoTypes here too.
13608 This fixes the bug I introduced in my last batch of changes.
13610 2002-03-05 Ravi Pratap <ravi@ximian.com>
13612 * tree.cs (RecordEnum): Add. We now keep track of enums too.
13614 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
13615 Enums since those are types too.
13617 * cs-parser.jay (enum_declaration): Record enums as we parse them.
13619 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
13620 thanks to a call during the lookup process.
13622 2002-03-07 Miguel de Icaza <miguel@ximian.com>
13624 * statement.cs (Foreach): Lots of work to accomodate a particular
13625 kind of foreach statement that I had not kept in mind. It is
13626 possible to have foreachs on classes that provide a GetEnumerator
13627 method that return objects that implement the "pattern" for using
13628 a foreach, there is no need to support GetEnumerator
13631 This is needed to compile nant.
13633 * decl.cs: Only report 114 if the member is not `Finalize' and if
13634 the warning level is at least 2.
13636 * class.cs: Moved the compare function from Method to
13639 (MethodSignature.InheritableMemberSignatureCompare): Add new
13640 filter function that is used to extract inheritable methods from a
13643 (Method.Define): Use the new `inheritable_method_signature_filter'
13646 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
13649 2002-03-06 Miguel de Icaza <miguel@ximian.com>
13651 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
13653 * cs-parser.jay: Add opt_semicolon to the interface declaration.
13655 * expression.cs: Pass location information to
13656 ConvertImplicitStandard.
13658 * class.cs: Added debugging code to track return values from
13661 2002-03-05 Miguel de Icaza <miguel@ximian.com>
13663 * expression.cs (Is.DoResolve): If either side of the `is' is an
13664 interface, do not flag the warning.
13666 * ecore.cs (ImplicitReferenceConversion): We need a separate test
13669 * report.cs: Allow for --fatal to be used with --probe.
13671 * typemanager.cs (NoTypes): Move the definition for the empty Type
13674 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
13676 (TypeContainer.DefineProxy): New function used to proxy to parent
13677 implementations when implementing interfaces.
13678 (TypeContainer.ParentImplements): used to lookup if our parent
13679 implements a public function that is required by an interface.
13680 (TypeContainer.VerifyPendingMethods): Hook this up.
13682 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
13683 `modules' and `assemblies' arraylists into arrays. We only grow
13684 these are the very early start up of the program, so this improves
13685 the speedof LookupType (nicely measured).
13687 * expression.cs (MakeByteBlob): Replaced unsafe code with
13688 BitConverter, as suggested by Paolo.
13690 * cfold.cs (ConstantFold.Binary): Special case: perform constant
13691 folding of string concatenation, but if either side is a string,
13692 and the other is not, then return null, and let the runtime use
13693 the concatenation on the string plus the object (using
13694 `Object.ToString').
13696 2002-03-04 Miguel de Icaza <miguel@ximian.com>
13698 Constant Folding has been implemented now.
13700 * expression.cs (Unary.Reduce): Do not throw an exception, catch
13701 the error instead on types that are not supported in one's
13704 * constant.cs (Constant and all children): New set of functions to
13705 perform implict and explicit conversions.
13707 * ecore.cs (EnumConstant): Implement the new functions to perform
13708 conversion by proxying to the child expression.
13710 * codegen.cs: (ConstantCheckState): Constant evaluation has its
13711 own separate setting that can not be turned off from the command
13712 line using --unchecked or --checked and is only controlled using
13713 the checked/unchecked statements and expressions. This setting is
13714 used by the constant folder to flag errors.
13716 * expression.cs (CheckedExpr, UncheckedExpr): Set the
13717 ConstantCheckState as well.
13719 During Resolve, they also have to flag the state, because the
13720 constant folder runs completely in the Resolve phase.
13722 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
13725 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13727 * cfold.cs: New file, this file contains the constant folder.
13729 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
13730 argument to track whether we are using the resulting address to
13731 load or store a value and provide better error messages.
13733 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
13734 new AddressOf arguments.
13736 * statement.cs (Foreach.EmitCollectionForeach): Update
13738 * expression.cs (Argument.Emit): Call AddressOf with proper
13739 arguments to track usage.
13741 (New.DoEmit): Call AddressOf with new arguments.
13743 (Unary.Emit): Adjust AddressOf call.
13745 2002-03-01 Ravi Pratap <ravi@ximian.com>
13747 * cs-parser.jay (member_access): Change the case for pre-defined types
13748 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
13751 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
13754 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
13755 essentially like methods and apply attributes like MethodImplOptions to them too.
13757 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
13760 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
13761 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
13764 * Update code everywhere accordingly.
13766 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
13768 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
13770 2002-02-28 Ravi Pratap <ravi@ximian.com>
13772 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
13773 try performing lookups against those instead of jumping straight into using
13774 the 'using' clauses.
13776 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
13778 (LookupType): Perform lookups in implicit parents too.
13780 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
13781 sequence as RootContext.LookupType.
13783 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
13784 the various cases of namespace lookups into this method.
13786 2002-03-01 Miguel de Icaza <miguel@ximian.com>
13788 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
13789 in positional arguments)
13791 * class.cs (Operator): Update the AllowedModifiers to contain
13794 * cs-parser.jay: Update operator declaration to allow for the
13795 operator body to be empty.
13797 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
13800 2002-02-27 Miguel de Icaza <miguel@ximian.com>
13802 * class.cs (Method.Emit): Label parameters.
13804 * driver.cs: Return 1 or 0 as the program exit code.
13806 2002-02-26 Miguel de Icaza <miguel@ximian.com>
13808 * expression.cs: Special case the `null' object when trying to
13809 auto-compute the type, as anything can be explicitly converted to
13812 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
13813 spotting this Paolo.
13815 (Expression.ImplicitNumericConversion): Perform comparissions of
13816 the type using the underlying type in the case of an enumeration
13817 rather than using the enumeration type for the compare.
13819 Cope with the underlying == type case, which is not possible to
13822 (Expression.ConvertNumericExplicit): Perform comparissions of
13823 the type using the underlying type in the case of an enumeration
13824 rather than using the enumeration type for the compare.
13826 * driver.cs: If the user does not supply an extension, assume .exe
13828 * cs-parser.jay (if_statement): Rewrote so that we can track the
13829 location for the if statement.
13831 * expression.cs (Binary.ConstantFold): Only concat strings when
13832 the operation is "+", not everything ;-)
13834 * statement.cs (Statement.EmitBoolExpression): Take a location
13836 (If, While, Do): Track location.
13838 * expression.cs (Binary.ResolveOperator): In the object + string
13839 case, I was missing a call to ConvertImplicit
13841 2002-02-25 Ravi Pratap <ravi@ximian.com>
13843 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
13844 Location arguments. Ensure we use RootContext.LookupType to do our work
13845 and not try to do a direct Type.GetType and ModuleBuilder.GetType
13847 * interface.cs (PopulateMethod): Handle the type of the parameter being
13850 * expression.cs (Invocation.BetterFunction): Handle the case when we
13851 have a params method with no fixed arguments and a call is made with no
13854 2002-02-25 Miguel de Icaza <miguel@ximian.com>
13856 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
13857 the verbatim-string-literal
13859 * support.cs (InternalParameters.ParameterModifier): handle null
13861 (InternalParameters.ParameterType): ditto.
13863 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
13864 duplicating the name of the variable parameter.
13865 (GetParameterByName): Fix bug where we were not looking up array
13866 paramters if they were the only present (thanks Paolo!).
13867 (GetParameterInfo): We only have an empty set of types if both
13868 fixed and array are set to null.
13869 (GetParameterInfo-idx): Handle FixedParameter == null
13871 * cs-parser.jay: Handle the case where there is no catch
13872 statements (missing null test).
13874 2002-02-22 Miguel de Icaza <miguel@ximian.com>
13876 * driver.cs (MainDriver): Be conservative on our command line
13879 Catch DirectoryNotFoundException when calling GetFiles.
13881 (SplitPathAndPattern): Used to split the input specification into
13882 a path and a pattern that we can feed to Directory.GetFiles.
13884 2002-02-21 Miguel de Icaza <miguel@ximian.com>
13886 * statement.cs (Fixed): Implement the last case of the Fixed
13887 statement (string handling).
13889 * expression.cs (StringPtr): New class used to return a char * to
13890 a string; Used by the Fixed statement.
13892 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
13894 * expression.cs (Binary.ResolveOperator): Remove redundant
13895 MemberLookup pn parent type.
13896 Optimize union call, we do not need a union if the types are the same.
13897 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
13900 Specialize the use of MemberLookup everywhere, instead of using
13901 the default settings.
13903 (StackAlloc): Implement stackalloc keyword.
13905 * cs-parser.jay: Add rule to parse stackalloc.
13907 * driver.cs: Handle /h, /help, /?
13909 * expression.cs (MakeByteBlob): Removed the hacks we had in place
13910 before we supported unsafe code.
13912 * makefile: add --unsafe to the self compilation of mcs.
13914 2002-02-20 Miguel de Icaza <miguel@ximian.com>
13916 * expression.cs (PointerArithmetic): New class that is used to
13917 perform pointer arithmetic.
13918 (Binary.Resolve): Handle pointer arithmetic
13919 Handle pointer comparission.
13920 (ArrayPtr): Utility expression class that is used to take the
13921 address of an array.
13923 (ElementAccess): Implement array access for pointers
13925 * statement.cs (Fixed): Implement fixed statement for arrays, we
13926 are missing one more case before we are done.
13928 * expression.cs (Indirection): Implement EmitAssign and set the
13929 ExprClass to Variable. This allows pointer dereferences to be
13930 treated as variables, and to have values assigned to them.
13932 * ecore.cs (Expression.StoreFromPtr): New utility function to
13933 store values dereferencing.
13935 2002-02-20 Ravi Pratap <ravi@ximian.com>
13937 * expression.cs (Binary.ResolveOperator): Ensure that we are
13938 not trying to operate on a void type - this fixes the reported
13941 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
13942 the parent implementation is sealed.
13944 * ../errors/cs0239.cs : Add.
13946 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
13948 * typemanager.cs (unverifiable_code_type): Corresponds to
13949 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
13950 which have unsafe code in them.
13952 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
13955 2002-02-19 Miguel de Icaza <miguel@ximian.com>
13957 * cs-tokenizer.cs: Add support for @"litreal strings"
13959 Make tokenizer accept pre-processor directives
13960 on any column (remove the old C-like limitation).
13962 * rootcontext.cs (EmitCode): Emit any global attributes.
13963 (AddGlobalAttributes): Used to keep track of assembly attributes.
13965 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
13967 * cs-parser.jay: Add support for global attributes.
13969 2002-02-17 Miguel de Icaza <miguel@ximian.com>
13971 * expression.cs (Indirection): New helper class. Unary will
13972 create Indirection classes to be able to implement the
13973 IMemoryLocation interface on it.
13975 2002-02-16 Miguel de Icaza <miguel@ximian.com>
13977 * cs-parser.jay (fixed_statement): reference the right statement.
13979 * statement.cs (Fixed.Emit): Finish implementing the fixed
13980 statement for the &x case.
13982 2002-02-14 Miguel de Icaza <miguel@ximian.com>
13984 * class.cs (Property.Define, Method.Define): Remove newslot when
13987 * modifiers.cs: My use of NewSlot when `Abstract' was set was
13988 wrong. NewSlot should only be used if the `new' keyword is present.
13990 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
13991 locating our system dir. Sorry about this.
13993 2002-02-13 Miguel de Icaza <miguel@ximian.com>
13995 * driver.cs (GetSystemDir): Compute correctly the location of our
13996 system assemblies. I was using the compiler directory instead of
13997 the library directory.
13999 2002-02-13 Ravi Pratap <ravi@ximian.com>
14001 * expression.cs (BetterFunction): Put back in what Miguel commented out
14002 since it is the correct fix. The problem is elsewhere ;-)
14004 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
14005 parameters of the parms method are themselves compatible or not !
14007 (StandardConversionExists): Fix very dangerous bug where we were forgetting
14008 to check that a class implements an interface before saying that an implicit
14009 conversion was allowed. Use ImplementsInterface to do the checking.
14011 2002-02-13 Miguel de Icaza <miguel@ximian.com>
14013 * class.cs (Method.Define): Track whether we are an explicit
14014 implementation or not. And only call DefineMethodOverride if we
14015 are an explicit implementation.
14017 (Property.DefineMethod): Ditto.
14019 2002-02-11 Ravi Pratap <ravi@ximian.com>
14021 * expression.cs (BetterFunction): Catch hideous bug which was
14022 preventing us from detecting ambiguous calls due to implicit casts i.e
14025 2002-01-29 Miguel de Icaza <miguel@ximian.com>
14027 * support.cs (Pair): Remove un-needed method. I figured why I was
14028 getting the error in cs-parser.jay, the variable in a foreach loop
14029 is readonly, and the compiler does not really treat this as a variable.
14031 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
14032 instead of EQUALS in grammar.
14034 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
14036 * expression.cs (Unary.DoResolve): Check whether the argument is
14039 2002-01-28 Miguel de Icaza <miguel@ximian.com>
14041 * support.cs: Api for Pair to set a value. Despite the fact that
14042 the variables are public the MS C# compiler refuses to compile
14043 code that accesses the field if the variable is part of a foreach
14046 * statement.cs (Fixed): Begin implementation of the fixed
14049 (Block.AddVariable): Return the VariableInfo on success and null
14050 on failure instead of true/false.
14052 * cs-parser.jay (foreach): Catch errors on variables already
14053 defined (we were ignoring this value before) and properly unwind
14054 the block hierarchy
14056 (fixed_statement): grammar for the fixed statement.
14058 2002-01-25 Miguel de Icaza <miguel@ximian.com>
14060 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
14061 pointer types to be incretemented.
14063 (SizeOf): Implement.
14065 * cs-parser.jay (pointer_member_access): Implement
14066 expr->IDENTIFIER production.
14068 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
14069 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
14072 (Unary): Implement indirection.
14074 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
14075 use in non-unsafe context).
14077 (SimpleName.DoResolve): Check for pointers in field access on safe
14080 (Expression.LoadFromPtr): Factor the load-indirect code in this
14081 function. This was duplicated in UnboxCast and ParameterReference
14083 2002-01-24 Miguel de Icaza <miguel@ximian.com>
14085 * expression.cs (ComposedCast): report an error if a pointer cast
14086 is used in a safe region.
14088 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
14089 pointer type casts in unsafe context.
14091 * codegen.cs (EmitContext): Set up IsUnsafe.
14093 * cs-parser.jay (non_expression_type): Add productions for pointer
14096 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
14097 code. We should not use force into static mode if the method is
14098 not virtual. Fixes bug in MIS
14100 * statement.cs (Do.Emit, While.Emit, For.Emit,
14101 Statement.EmitBoolExpression): Add support to Do and While to
14102 propagate infinite loop as `I do return' semantics.
14104 Improve the For case to also test for boolean constants.
14106 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
14107 to the list of attributes we can add.
14109 Remove `EmitContext' argument.
14111 * class.cs (Method.Define): Apply parameter attributes.
14112 (Constructor.Define): Apply parameter attributes.
14113 (MethodCore.LabelParameters): Move here the core of labeling
14116 * support.cs (ReflectionParameters.ParameterModifier,
14117 InternalParameters.ParameterModifier): Use IsByRef on the type and
14118 only return the OUT bit for these parameters instead of in/out/ref
14121 This is because I miss-understood things. The ParameterInfo.IsIn
14122 and IsOut represent whether the parameter has the [In] and [Out]
14125 2002-01-22 Miguel de Icaza <miguel@ximian.com>
14127 * ecore.cs (FieldExpr.Emit): Release temporaries.
14129 * assign.cs (LocalTemporary.Release): new function.
14131 * codegen.cs (EmitContext.GetTemporaryStorage,
14132 EmitContext.FreeTemporaryStorage): Rework the way we deal with
14133 temporary storage. Now we can "put back" localbuilders when we
14136 2002-01-21 Miguel de Icaza <miguel@ximian.com>
14138 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
14139 need to make a copy of the variable to generate verifiable code.
14141 2002-01-19 Miguel de Icaza <miguel@ximian.com>
14143 * driver.cs: Compute dynamically the system directory.
14145 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
14146 Slower, but more generally useful. Used by the abstract
14147 registering implementation.
14149 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
14150 the rules for the special rule on Type/instances. First check if
14151 we have the same name, and if so, try that special static path
14152 rather than the instance path.
14154 2002-01-18 Miguel de Icaza <miguel@ximian.com>
14156 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
14159 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
14160 Enum, ValueType, Delegate or Array for non-corlib compiles.
14162 * cs-tokenizer.cs: Catch long identifiers (645)
14164 * typemanager.cs (IndexerPropetyName): Ravi never tested this
14167 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
14168 fix, we were returning too early, so we were not registering
14169 pending methods from abstract classes.
14171 Do not register pending methods if the class is abstract.
14173 * expression.cs (Conditional.DoResolve): Report circular implicit
14174 conversions when we neecd to compute it for conditional
14177 (Is.DoResolve): If the expression is always of the provided type,
14178 flag warning 183. If the expression can not ever be of the
14179 provided type flag warning 184.
14181 * class.cs: Catch 169 as well.
14183 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
14186 2002-01-18 Nick Drochak <ndrochak@gol.com>
14188 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
14190 2002-01-17 Miguel de Icaza <miguel@ximian.com>
14192 * interface.cs: (PopulateMethod): Check for pointers being defined
14193 only if the unsafe context is active.
14194 (PopulateProperty): ditto.
14195 (PopulateIndexer): ditto.
14197 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
14198 specified. If pointers are present, make sure that they are
14199 present in an unsafe context.
14200 (Constructor, Constructor.Define): ditto.
14201 (Field, Field.Define): ditto.
14202 (Property, Property.Define): ditto.
14203 (Event, Event.Define): ditto.
14205 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
14206 hashtable if there are classes or structs defined.
14208 * expression.cs (LocalVariableReference.DoResolve): Simplify this
14209 code, as the constant resolution moved.
14211 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
14212 the metadata, so we can flag error 133.
14214 * decl.cs (MemberCore.UnsafeOK): New function to test that a
14215 pointer is being declared in an unsafe context.
14217 2002-01-16 Miguel de Icaza <miguel@ximian.com>
14219 * modifiers.cs (Modifiers.Check): Require a Location argument.
14220 Report error 227 for Unsafe use.
14222 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
14224 * statement.cs (For.Emit): If the test is null, then report that
14225 we do `return', as we wont reach anything afterwards.
14227 (Switch.SwitchGoverningType): Track the expression that matched
14230 * driver.cs: Allow negative numbers as an error code to flag.
14232 * cs-parser.jay: Handle 1551.
14234 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
14236 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14238 * cs-parser.jay: Report 1518 (type declaration can only contain
14239 class, struct, interface, enum or delegate)
14241 (switch_label): Report 1523 (keywords `case' or `default' must
14244 (opt_switch_sections): Report 1522 (empty switch)
14246 * driver.cs: Report 1515 (response file specified multiple times)
14247 Report 1516 (Source file specified multiple times).
14249 * expression.cs (Argument.Resolve): Signal 1510
14251 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
14252 access not allowed in static code)
14254 2002-01-11 Ravi Pratap <ravi@ximian.com>
14256 * typemanager.cs (IsPointerType): Utility method which we are going
14259 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
14260 the object type, so we take care of that.
14262 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
14264 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
14265 added to non-params parameters :-)
14267 * typemanager.cs (CSharpName): Include 'void' type too.
14269 (void_ptr_type): Include in the set of core types.
14271 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
14274 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
14277 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
14278 completely forgotten about it.
14280 2002-01-10 Ravi Pratap <ravi@ximian.com>
14282 * cs-parser.jay (pointer_type): Add. This begins our implementation
14283 of parsing rules for unsafe code.
14285 (unsafe_statement): Implement.
14287 (embedded_statement): Modify to include the above.
14289 * statement.cs (Unsafe): Implement new class for unsafe blocks.
14291 * codegen.cs (EmitContext.InUnsafe): Add. This determines
14292 if the current context is an unsafe one.
14294 * cs-parser.jay (local_variable_pointer_type): Since local variable types
14295 are handled differently, we need separate rules for them.
14297 (local_variable_declaration): Update to use local_variable_pointer_type
14298 to allow variable declarations of unmanaged pointer types.
14300 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
14301 in unsafe contexts.
14303 * ../errors/cs0214.cs : Add.
14305 2002-01-16 Nick Drochak <ndrochak@gol.com>
14307 * makefile: remove 'response' file when cleaning.
14309 2002-01-15 Miguel de Icaza <miguel@ximian.com>
14311 * cs-parser.jay: Report 1524.
14313 2002-01-14 Miguel de Icaza <miguel@ximian.com>
14315 * typemanager.cs (RegisterMethod): drop checking if we have
14316 registered this from here
14318 2002-01-12 Miguel de Icaza <miguel@ximian.com>
14320 * class.cs (Method.EmitDestructor): Implement calling our base
14323 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
14324 value of InFinally.
14326 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
14327 this routine and will wrap the call in a try/catch block. Deal
14330 2002-01-11 Miguel de Icaza <miguel@ximian.com>
14332 * ecore.cs (Expression.MemberLookup): instead of taking a
14333 parameter `same_type' that was used to tell whether we could
14334 access private members we compute our containing type from the
14337 (FieldExpr): Added partial support for volatile fields. This does
14338 not work for volatile fields exposed from assemblies, as I can not
14339 figure out how to extract the modreq from it.
14341 Updated all the source files to use this.
14343 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
14344 because it is referenced by MemberLookup very often.
14346 2002-01-09 Ravi Pratap <ravi@ximian.com>
14348 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
14349 TypeBuilder.GetCustomAttributes to retrieve what we need.
14351 Get rid of redundant default_member_attr_type as this is the same as
14352 default_member_type which already exists.
14354 * interface.cs, attribute.cs : Update accordingly.
14356 2002-01-08 Miguel de Icaza <miguel@ximian.com>
14358 * typemanager.cs: Enable IndexerPropertyName again. It does not
14359 work for TYpeBuilders though. Ravi, can you please fix this?
14361 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
14363 * expression.cs (Argument.Emit): Handle the case of ref objects
14364 being passed to ref functions;
14366 (ParameterReference.EmitLoad): Loads the content of the pointer
14367 without dereferencing.
14369 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14371 * cs-tokenizer.cs: Implemented the pre-processing expressions.
14373 2002-01-08 Ravi Pratap <ravi@ximian.com>
14375 * class.cs (Indexer.DefineMethod): Incorporate the interface
14376 type in the name of the method if we are doing explicit interface
14379 * expression.cs (ConversionExists): Remove as it is completely obsolete.
14381 (BetterConversion): Fix extremely trivial bug where we were referring to
14382 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
14385 * ../errors/bug16.cs : Add although we have fixed it.
14387 2002-01-07 Miguel de Icaza <miguel@ximian.com>
14389 * expression.cs (BaseIndexer): Begin implementation.
14391 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
14393 * cs-parser.jay (indexer_declarator): Use qualified_identifier
14394 production directly to remove a shift/reduce, and implement
14395 explicit interface implementation.
14397 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
14398 after a floating point suffix.
14400 * expression.cs (DoNumericPromotions): Improved the conversion for
14401 uint/uint. If we have a constant, we avoid doing a typecast to a
14404 * class.cs (Indexer): Implement explicit interface implementation
14407 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
14409 * class.cs: make the default instance constructor public and hidebysig.
14411 2001-01-03 Ravi Pratap <ravi@ximian.com>
14413 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
14414 so we can call it from elsewhere.
14416 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
14417 we emit it internally if the class has a defined indexer; otherwise the user
14418 emits it by decorating the class definition with the DefaultMemberAttribute.
14420 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
14421 attribute is not used on a type which defines an indexer.
14423 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
14424 character when we skip whitespace.
14426 * ../errors/cs0646.cs : Add.
14428 2002-01-03 Miguel de Icaza <miguel@ximian.com>
14430 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
14433 * makefile: Add practical target `mcs3.exe' which builds the third
14434 generation compiler.
14436 * expression.cs (New): Fix structures constructor calling.
14438 * class.cs (Property, Method, Indexer): Emit Final flag on the
14439 method if we are an interface implementation and we are not
14442 * ecore.cs (PropertyExpr): New public field `IsBase', tells
14443 whether this property is referencing a `base' method.
14445 * expression.cs (Invocation.EmitCall): take an extra argument:
14446 is_base, this is used to determine whether the `call' or
14447 `callvirt' opcode should be used.
14450 * delegate.cs: update EmitCall.
14452 * class.cs (Method.Define): Set NewSlot for the cases where we are
14453 not implementing an interface method.
14455 (Property.Define): ditto.
14457 2002-01-02 Miguel de Icaza <miguel@ximian.com>
14459 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
14460 'r'. Allows mcs to parse itself fully.
14462 2002-01-02 Ravi Pratap <ravi@ximian.com>
14464 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
14465 of the number of initializers that require the InitializeArray method.
14467 (CheckIndices): Store the Expression in all cases - not the plain value. Also
14468 update the above field where necessary.
14470 (MakeByteBlob): Update accordingly.
14472 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
14475 (EmitDynamicInitializers): Update in accordance with the new optimization.
14477 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
14478 same OpCode applies.
14480 * cs-parser.jay : Fix some glaring errors I introduced.
14482 2002-01-01 Ravi Pratap <ravi@ximian.com>
14484 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
14485 so that we can check for name clashes there too.
14487 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
14488 for interface indexers.
14490 * interfaces.cs (Define): Emit the default member attribute.
14492 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
14493 variable was being referred to while setting the value ;-)
14495 2002-01-01 Miguel de Icaza <miguel@ximian.com>
14497 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
14498 byte-by-byte information when we know the data is zero.
14500 Make the block always a multiple of 4, because
14501 DefineInitializedData has a bug.
14503 * assign.cs: Fix, we should assign from the temporary, not from
14506 * expression.cs (MakeByteBlob): Fix my incorrect code.
14508 2001-12-31 Miguel de Icaza <miguel@ximian.com>
14510 * typemanager.cs (EnumToUnderlying): This function is used to get
14511 the underlying type from an enumeration, because it does not
14514 * constant.cs: Use the I4_S form for values between -128 and 127.
14516 * statement.cs (Block.LookupLabel): Looks up a label.
14517 (Block): Drop support for labeled blocks.
14519 (LabeledStatement): New kind of statement that represents a label
14522 (Goto): Finally implement this bad boy.
14524 * cs-parser.jay: Update to reflect new mechanism to implement
14527 2001-12-30 Miguel de Icaza <miguel@ximian.com>
14529 * codegen.cs (EmitContext.This): a codegen property that keeps the
14530 a single instance of this instead of creating many different this
14533 * delegate.cs (Delegate.DoResolve): Update to use the property;
14535 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
14537 * expression.cs (BaseAccess.DoResolve): Ditto.
14539 2001-12-29 Ravi Pratap <ravi@ximian.com>
14541 * typemanager.cs (methodimpl_attr_type): Add to hold the type
14542 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
14544 (InitCoreTypes): Update accordingly.
14546 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
14547 so we can quickly store the state.
14549 (ApplyAttributes): Set the correct implementation flags
14550 for InternalCall methods.
14552 2001-12-29 Miguel de Icaza <miguel@ximian.com>
14554 * expression.cs (EmitCall): if a method is not virtual, then do
14555 not use callvirt on it.
14557 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
14558 user defined stuff) requires the use of stobj, which takes an
14559 address on the stack instead of an array and an index. So emit
14560 the Ldelema operation for it.
14562 (EmitStoreOpcode): Use stobj for valuetypes.
14564 (UnaryMutator.EmitCode): Use the right 1 value depending on
14565 whether we are dealing with int64/uint64, float or doubles.
14567 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
14568 constructors that I implemented last night.
14570 (Constructor.IsDefault): Fix to work properly for static
14573 * cs-parser.jay (CheckDef): report method signature errors.
14574 Update error number 103 to be 132.
14576 * decl.cs: New AdditionResult enumeration value: MethodExists.
14577 Although we do this check for methods later on in the semantic
14578 analysis, catching repeated default constructors is so easy that
14579 we catch these here.
14581 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
14584 (ParameterReference.EmitAssign, Emit): handle
14587 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
14588 (ArrayAccess.EmitStoreOpcode): ditto.
14590 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
14592 * expression.cs (MakeByteBlob): Complete all the missing types
14593 (uint, short, ushort, byte, sbyte)
14595 * class.cs: Only init instance field initializers on instance
14598 Rename `constructors' to instance_constructors.
14600 (TypeContainer.AddConstructor): Only add constructors to the list
14601 if it is not static.
14603 Make sure that we handle default_static_constructor independently
14604 everywhere where we handle instance_constructors
14606 2001-12-28 Miguel de Icaza <miguel@ximian.com>
14608 * class.cs: Do not lookup or create a base initializer for a
14609 static constructor.
14611 (ConstructorInitializer.Resolve): use the proper type to lookup
14614 * cs-parser.jay: Report error 1585 (modifiers between type and name).
14616 * enum.cs, interface.cs: Remove CloseType, this is taken care by
14619 * decl.cs: CloseType is now an virtual method, the default
14620 implementation just closes this type.
14622 2001-12-28 Ravi Pratap <ravi@ximian.com>
14624 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
14625 to PreserveSig by default. Also emit HideBySig on such methods.
14627 Basically, set the defaults to standard values.
14629 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
14630 argument, if candidate is better, it can't be worse than the best !
14632 (Invocation): Re-write bits to differentiate between methods being
14633 applicable in their expanded form and their normal form - for params
14636 Get rid of use_standard everywhere as only standard conversions are allowed
14637 in overload resolution.
14639 More spec conformance.
14641 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14643 * driver.cs: Add --timestamp, to see where the compiler spends
14646 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
14647 `this' in static code.
14649 (SimpleName.DoResolve): Implement in terms of a helper function
14650 that allows static-references to be passed upstream to
14653 (Expression.ResolveWithSimpleName): Resolve specially simple
14654 names when called by MemberAccess to implement the special
14657 (Expression.ImplicitReferenceConversion): Handle conversions from
14658 Null to reference types before others, as Null's type is
14661 * expression.cs (Invocation.EmitCall): Handle the special case of
14662 calling methods declared on a reference type from a ValueType
14663 (Base classes System.Object and System.Enum)
14665 (MemberAccess.Resolve): Only perform lookups on Enumerations if
14666 the left hand side is a TypeExpr, not on every enumeration.
14668 (Binary.Resolve): If types are reference types, then do a cast to
14669 object on operators != and == of both arguments.
14671 * typemanager.cs (FindMembers): Extract instance and static
14672 members if requested.
14674 * interface.cs (PopulateProperty): Use void_type instead of null
14675 as the return type for the setter method.
14677 (PopulateIndexer): ditto.
14679 2001-12-27 Ravi Pratap <ravi@ximian.com>
14681 * support.cs (ReflectionParameters): Fix minor bug where we
14682 were examining the wrong parameter for the ParamArray attribute.
14684 Cope with requests for the type of the parameter at position
14685 greater than the params parameter's. We now return the element
14686 type of the params array as that makes more sense.
14688 * expression.cs (Invocation.IsParamsMethodApplicable): Update
14689 accordingly as we no longer have to extract the element type
14692 (Invocation.OverloadResolve): Update.
14694 2001-12-27 Miguel de Icaza <miguel@ximian.com>
14696 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
14697 against IEnumerator, test whether the return value is a descendant
14698 of the IEnumerator interface.
14700 * class.cs (Indexer.Define): Use an auxiliary method to implement
14701 the other bits of the method definition. Begin support for
14702 explicit interface implementation.
14704 (Property.DefineMethod): Use TypeManager.void_type instead of null
14705 for an empty return value.
14707 2001-12-26 Miguel de Icaza <miguel@ximian.com>
14709 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
14710 dealing with a FieldExpr which is composed of a FieldBuilder, in
14711 the code path we did extract the constant, but we should have
14712 obtained the underlying value to be able to cast it (otherwise we
14713 end up in an infinite loop, this is what Ravi was running into).
14715 (ArrayCreation.UpdateIndices): Arrays might be empty.
14717 (MemberAccess.ResolveMemberAccess): Add support for section
14718 14.5.4.1 that deals with the special case of E.I when E is a type
14719 and something else, that I can be a reference to a static member.
14721 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
14722 handle a particular array type to create byte blobs, it is just
14723 something we dont generate byteblobs for.
14725 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
14728 * location.cs (Push): remove the key from the hashtable that we
14729 are about to add. This happens for empty files.
14731 * driver.cs: Dispose files after we have parsed them.
14733 (tokenize): new function that only runs the tokenizer on its
14734 input, for speed testing.
14736 2001-12-26 Ravi Pratap <ravi@ximian.com>
14738 * class.cs (Event.Define): Define the private field only if there
14739 are no accessors defined.
14741 * expression.cs (ResolveMemberAccess): If there is no associated
14742 field with the event, that means we have an event defined with its
14743 own accessors and we should flag error cs0070 since transforming
14744 ourselves into a field is not valid in that case.
14746 * ecore.cs (SimpleName.DoResolve): Same as above.
14748 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
14749 and charset to sane values.
14751 2001-12-25 Ravi Pratap <ravi@ximian.com>
14753 * assign.cs (DoResolve): Perform check on events only if they
14754 are being accessed outside the declaring type.
14756 * cs-parser.jay (event_declarations): Update rules to correctly
14757 set the type of the implicit parameter etc.
14759 (add_accessor, remove_accessor): Set current local parameters.
14761 * expression.cs (Binary): For delegate addition and subtraction,
14762 cast the return value from the method into the appropriate delegate
14765 2001-12-24 Ravi Pratap <ravi@ximian.com>
14767 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
14768 of these as the workaround is unnecessary.
14770 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
14771 delegate data - none of that is needed at all.
14773 Re-write bits to extract the instance expression and the delegate method
14776 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
14779 * attribute.cs (ApplyAttributes): New method to take care of common tasks
14780 of attaching attributes instead of duplicating code everywhere.
14782 * everywhere : Update code to do attribute emission using the above method.
14784 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14786 * expression.cs (IsParamsMethodApplicable): if there are not
14787 parameters, return immediately.
14789 * ecore.cs: The 0 literal can be implicity converted to an enum
14792 (SimpleName.DoResolve): First lookup the type, then lookup the
14795 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
14796 want to get its address. If the InstanceExpression is not
14797 addressable, store the result in a temporary variable, then get
14800 * codegen.cs: Only display 219 errors on warning level or above.
14802 * expression.cs (ArrayAccess): Make it implement the
14803 IMemoryLocation interface.
14805 (Binary.DoResolve): handle the operator == (object a, object b)
14806 and operator != (object a, object b) without incurring into a
14807 BoxedCast (because 5 != o should never be performed).
14809 Handle binary enumerator operators.
14811 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
14812 value type, otherwise use Ldelem_ref.
14814 Use precomputed names;
14816 (AddressOf): Implement address of
14818 * cs-parser.jay (labeled_statement): Fix recursive block
14819 addition by reworking the production.
14821 * expression.cs (New.DoEmit): New has a special case:
14823 If we are dealing with a ValueType, we have a few
14824 situations to deal with:
14826 * The target of New is a ValueType variable, that is
14827 easy, we just pass this as the variable reference
14829 * The target of New is being passed as an argument,
14830 to a boxing operation or a function that takes a
14833 In this case, we need to create a temporary variable
14834 that is the argument of New.
14837 2001-12-23 Ravi Pratap <ravi@ximian.com>
14839 * rootcontext.cs (LookupType): Check that current_type is not null before
14840 going about looking at nested types.
14842 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
14843 not implement the IAssignMethod interface any more.
14845 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
14846 where we tranform them into FieldExprs if they are being resolved from within
14847 the declaring type.
14849 * ecore.cs (SimpleName.DoResolve): Do the same here.
14851 * assign.cs (DoResolve, Emit): Clean up code considerably.
14853 * ../errors/bug10.cs : Add.
14855 * ../errors/cs0070.cs : Add.
14857 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
14859 * assign.cs : Get rid of EventIsLocal everywhere.
14861 2001-12-23 Miguel de Icaza <miguel@ximian.com>
14863 * ecore.cs (ConvertIntLiteral): finished the implementation.
14865 * statement.cs (SwitchLabel): Convert the value we are using as a
14866 key before looking up the table.
14868 2001-12-22 Miguel de Icaza <miguel@ximian.com>
14870 * codegen.cs (EmitTopBlock): Require a Location argument now.
14872 * cs-parser.jay (constructor_declarator): We need to setup
14873 current_local_parameters before we parse the
14874 opt_constructor_initializer, to allow the variables to be bound
14875 to the constructor arguments.
14877 * rootcontext.cs (LookupType): First lookup nested classes in our
14878 class and our parents before we go looking outside our class.
14880 * expression.cs (ConstantFold): Extract/debox the values at the
14883 * rootcontext.cs (EmitCode): Resolve the constants first before we
14884 resolve the types. This is not really needed, but it helps debugging.
14886 * statement.cs: report location.
14888 * cs-parser.jay: pass location to throw statement.
14890 * driver.cs: Small bug fix.
14892 * report.cs: Updated format to be 4-zero filled digits.
14894 2001-12-22 Ravi Pratap <ravi@ximian.com>
14896 * expression.cs (CheckIndices): Fix minor bug where the wrong
14897 variable was being referred to ;-)
14899 (DoEmit): Do not call EmitStaticInitializers when the
14900 underlying type is System.Object.
14902 2001-12-21 Ravi Pratap <ravi@ximian.com>
14904 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
14905 and do the usual workaround for SRE.
14907 * class.cs (MyEventBuilder.EventType): New member to get at the type
14908 of the event, quickly.
14910 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
14912 * assign.cs (Assign.DoResolve): Handle the case when the target
14913 is an EventExpr and perform the necessary checks.
14915 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
14918 (SimpleName.MemberStaticCheck): Include check for EventExpr.
14920 (EventExpr): Set the type in the constructor itself since we
14921 are meant to be born fully resolved.
14923 (EventExpr.Define): Revert code I wrote earlier.
14925 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
14926 instance expression is null. The instance expression is a This in that case
14927 or a null, depending on whether it is a static method or not.
14929 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
14930 refers to more than one method.
14932 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
14933 and accordingly flag errors.
14935 2001-12-21 Miguel de Icaza <miguel@ximian.com>
14937 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
14939 2001-12-22 Miguel de Icaza <miguel@ximian.com>
14941 * location.cs (ToString): Provide useful rutine.
14943 2001-12-21 Miguel de Icaza <miguel@ximian.com>
14945 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
14946 objects, return the actual integral boxed.
14948 * statement.cs (SwitchLabel): define an ILLabel for each
14951 (Switch.CheckSwitch): If the value is a Literal, extract
14952 the underlying literal.
14954 Also in the unused hashtable we had, add the SwitchLabel so we can
14955 quickly look this value up.
14957 * constant.cs: Implement a bunch of new constants. Rewrite
14958 Literal based on this. Made changes everywhere to adapt to this.
14960 * expression.cs (Expression.MakeByteBlob): Optimize routine by
14961 dereferencing array only once, and also copes with enumrations.
14963 bytes are two bytes wide, not one.
14965 (Cast): Perform constant conversions.
14967 * ecore.cs (TryImplicitIntConversion): Return literals instead of
14968 wrappers to the literals here.
14970 * expression.cs (DoNumericPromotions): long literals can converted
14971 to ulong implicity (this is taken care of elsewhere, but I was
14972 missing this spot).
14974 * ecore.cs (Expression.Literalize): Make the return type Literal,
14975 to improve type checking.
14977 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
14979 2001-12-20 Miguel de Icaza <miguel@ximian.com>
14981 * literal.cs: Revert code from ravi that checked the bounds. The
14982 bounds are sane by the definition of the type itself.
14984 * typemanager.cs: Fix implementation of ImplementsInterface. We
14985 need to actually look up in our parent hierarchy for interfaces
14988 * const.cs: Use the underlying type for enumerations
14990 * delegate.cs: Compute the basename for the delegate creation,
14991 that should fix the delegate test case, and restore the correct
14992 Type Lookup semantics in rootcontext
14994 * rootcontext.cs: Revert Ravi's last patch. The correct way of
14995 referencing a nested type with the Reflection API is using the "+"
14998 * cs-parser.jay: Do not require EOF token at the end.
15000 2001-12-20 Ravi Pratap <ravi@ximian.com>
15002 * rootcontext.cs (LookupType): Concatenate type names with
15003 a '.' instead of a '+' The test suite passes again.
15005 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
15006 field of the enumeration.
15008 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
15009 the case when the member is an EventExpr.
15011 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
15012 static has an associated instance expression.
15014 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
15016 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
15018 * class.cs (Event.Define): Register event and perform appropriate checks
15021 We define the Add and Remove methods even if the use provides none because
15022 in that case, we provide default implementations ourselves.
15024 Define a private field of the type of the event. This is done by the CSC compiler
15025 and we should be doing it too ;-)
15027 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
15028 More methods we use in code we generate.
15030 (multicast_delegate_type, delegate_type): Two separate types since the distinction
15033 (InitCoreTypes): Update accordingly for the above.
15035 * class.cs (Event.Emit): Generate code for default accessors that we provide
15037 (EmitDefaultMethod): Do the job in the above.
15039 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
15042 2001-12-20 Miguel de Icaza <miguel@ximian.com>
15044 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
15045 builders even if we were missing one.
15047 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
15048 pass the Basename as our class name instead of the Name. The
15049 basename will be correctly composed for us.
15051 * parameter.cs (Paramters): Now takes a Location argument.
15053 * decl.cs (DeclSpace.LookupType): Removed convenience function and
15054 make all the code call directly LookupType in RootContext and take
15055 this chance to pass the Location information everywhere.
15057 * Everywhere: pass Location information.
15059 2001-12-19 Miguel de Icaza <miguel@ximian.com>
15061 * class.cs (Constructor.Define): Updated way of detecting the
15062 length of the parameters.
15064 (TypeContainer.DefineType): Use basename as the type name for
15067 (TypeContainer.Define): Do not recursively define types here, as
15068 definition is taken care in order by the RootContext.
15070 * tree.cs: Keep track of namespaces in a per-file basis.
15072 * parameter.cs (Parameter.ComputeSignature): Update to use
15075 (Parameters.GetSignature): ditto.
15077 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
15078 instead of a TypeContainer.
15080 (Interface.SemanticAnalysis): Use `this' instead of our parent to
15081 resolve names. Because we need to be resolve in our context, not
15084 * driver.cs: Implement response files.
15086 * class.cs (TypeContainer.DefineType): If we are defined, do not
15087 redefine ourselves.
15089 (Event.Emit): Emit the code for add/remove handlers.
15090 (Event.Define): Save the MethodBuilders for add/remove.
15092 * typemanager.cs: Use pair here too.
15094 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
15095 DictionaryEntry requires the first argument to be non-null.
15097 (enum_declaration): Compute full name for registering the
15100 (delegate_declaration): Instead of using
15101 formal_parameter_list, use opt_formal_parameter_list as the list
15104 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
15105 (EventParsing): New property that controls whether `add' and
15106 `remove' are returned as tokens or identifiers (for events);
15108 2001-12-19 Ravi Pratap <ravi@ximian.com>
15110 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
15111 use MyEventBuilder only and let it wrap the real builder for us.
15113 (MyEventBuilder): Revamp constructor etc.
15115 Implement all operations that we perform on EventBuilder in precisely the same
15118 (FindMembers): Update to use the EventBuilder member.
15120 (Event.Emit): Update accordingly.
15122 2001-12-18 Ravi Pratap <ravi@ximian.com>
15124 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
15125 by calling the appropriate methods.
15127 (GetCustomAttributes): Make stubs as they cannot possibly do anything
15130 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
15132 2001-12-17 Ravi Pratap <ravi@ximian.com>
15134 * delegate.cs (Delegate.Populate): Check that the return type
15135 and various parameters types are indeed accessible.
15137 * class.cs (Constructor.Define): Same here.
15139 (Field.Define): Ditto.
15141 (Event.Define): Ditto.
15143 (Operator.Define): Check that the underlying Method defined itself
15144 correctly - so it's MethodBuilder should not be null.
15146 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
15147 expression happens to be null.
15149 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
15150 members but as of now we don't seem to be able to do anything really useful with it.
15152 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
15153 not the EventBuilder.
15155 2001-12-18 Miguel de Icaza <miguel@ximian.com>
15157 * cs-tokenizer.cs: Add support for defines.
15158 Add support for #if, #elif, #else, #endif
15160 (eval_var): evaluates a variable.
15161 (eval): stubbed for evaluating functions.
15163 * cs-parser.jay: Pass the defines information
15165 * driver.cs: Add --define command line option.
15167 * decl.cs: Move MemberCore here.
15169 Make it the base class for DeclSpace. This allows us to catch and
15170 report 108 and 109 for everything now.
15172 * class.cs (TypeContainer.Define): Extract all the members
15173 before populating and emit the warning 108 (new keyword required
15174 to override) instead of having each member implement this.
15176 (MemberCore.Define): New abstract method, we will be using this in
15177 the warning reporting engine in Populate.
15179 (Operator.Define): Adjust to new MemberCore protocol.
15181 * const.cs (Const): This does not derive from Expression, it is a
15182 temporary object we use to create fields, it is a MemberCore.
15184 * class.cs (Method.Define): Allow the entry point to be in a
15187 * driver.cs: Rewrite the argument handler to clean it up a bit.
15189 * rootcontext.cs: Made it just an auxiliary namespace feature by
15190 making everything static.
15192 * driver.cs: Adapt code to use RootContext type name instead of
15195 * delegate.cs: Remove RootContext argument.
15197 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
15200 * class.cs (Event.Define): The lookup can fail.
15202 * cs-tokenizer.cs: Begin implementation of pre-procesor.
15204 * expression.cs: Resolve the this instance before invoking the code.
15206 2001-12-17 Miguel de Icaza <miguel@ximian.com>
15208 * cs-parser.jay: Add a production in element_access that allows
15209 the thing to become a "type" reference. This way we can parse
15210 things like "(string [])" as a type.
15212 Note that this still does not handle the more complex rules of
15216 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
15218 * ecore.cs: (CopyNewMethods): new utility function used to
15219 assemble the list of methods from running FindMembers.
15221 (MemberLookup): Rework FindMembers so that
15223 2001-12-16 Miguel de Icaza <miguel@ximian.com>
15225 * class.cs (TypeContainer): Remove Delegates who fail to be
15228 * delegate.cs (Populate): Verify that we dont get null return
15229 values. TODO: Check for AsAccessible.
15231 * cs-parser.jay: Use basename to emit error 574 (destructor should
15232 have the same name as container class), not the full name.
15234 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
15235 possible representation.
15237 Also implements integer type suffixes U and L.
15239 2001-12-15 Miguel de Icaza <miguel@ximian.com>
15241 * expression.cs (ArrayCreation.DoResolve): We need to do the
15242 argument resolution *always*.
15244 * decl.cs: Make this hold the namespace. Hold the root context as
15246 (LookupType): Move here.
15248 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
15250 * location.cs (Row, Name): Fixed the code, it was always returning
15251 references to the first file.
15253 * interface.cs: Register properties defined through interfaces.
15255 * driver.cs: Add support for globbing on the command line
15257 * class.cs (Field): Make it derive from MemberCore as well.
15260 2001-12-15 Ravi Pratap <ravi@ximian.com>
15262 * class.cs (Event::Define): Check that the type of the event is a delegate
15263 type else flag error #66.
15265 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
15268 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
15269 values of EntryPoint, CharSet etc etc.
15271 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
15273 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
15274 be null and we should ignore this. I am not sure if this is really clean. Apparently,
15275 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
15276 which needs this to do its work.
15278 * ../errors/cs0066.cs : Add.
15280 2001-12-14 Miguel de Icaza <miguel@ximian.com>
15282 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
15285 * class.cs: (MethodSignature.MethodSignature): Removed hack that
15286 clears out the parameters field.
15287 (MemberSignatureCompare): Cleanup
15289 (MemberCore): New base class used to share code between MethodCore
15292 (RegisterRequiredImplementations) BindingFlags.Public requires
15293 either BindingFlags.Instace or Static. Use instance here.
15295 (Property): Refactored code to cope better with the full spec.
15297 * parameter.cs (GetParameterInfo): Return an empty array instead
15300 * class.cs (Property): Abstract or extern properties have no bodies.
15302 * parameter.cs (GetParameterInfo): return a zero-sized array.
15304 * class.cs (TypeContainer.MethodModifiersValid): Move all the
15305 method modifier validation to the typecontainer so we can reuse
15306 this on properties.
15308 (MethodCore.ParameterTypes): return an empty sized array of types.
15310 (Property.Define): Test property modifier validity.
15312 Add tests for sealed/override too.
15314 (Method.Emit): abstract or extern methods have no bodies.
15316 2001-12-14 Ravi Pratap <ravi@ximian.com>
15318 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
15321 (Method::Define, ::Emit): Modify accordingly.
15323 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
15325 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
15327 * makefile: Pass in /unsafe.
15329 2001-12-13 Miguel de Icaza <miguel@ximian.com>
15331 * class.cs (MakeKey): Kill routine.
15333 * class.cs (TypeContainer.Define): Correctly define explicit
15334 method implementations (they require the full interface name plus
15337 * typemanager.cs: Deply the PtrHashtable here and stop using the
15338 lame keys. Things work so much better.
15340 This of course broke everyone who depended on `RegisterMethod' to
15341 do the `test for existance' test. This has to be done elsewhere.
15343 * support.cs (PtrHashtable): A hashtable that avoid comparing with
15344 the object stupid Equals method (because, that like fails all over
15345 the place). We still do not use it.
15347 * class.cs (TypeContainer.SetRequiredInterface,
15348 TypeContainer.RequireMethods): Killed these two routines and moved
15349 all the functionality to RegisterRequiredImplementations.
15351 (TypeContainer.RegisterRequiredImplementations): This routine now
15352 registers all the implementations required in an array for the
15353 interfaces and abstract methods. We use an array of structures
15354 which can be computed ahead of time to reduce memory usage and we
15355 also assume that lookups are cheap as most classes will not
15356 implement too many interfaces.
15358 We also avoid creating too many MethodSignatures.
15360 (TypeContainer.IsInterfaceMethod): Update and optionally does not
15361 clear the "pending" bit if we find that there are problems with
15364 (TypeContainer.VerifyPendingMethods): Update to report errors of
15365 methods that look like implementations but are not.
15367 (TypeContainer.Define): Add support for explicit interface method
15370 2001-12-12 Miguel de Icaza <miguel@ximian.com>
15372 * typemanager.cs: Keep track of the parameters here instead of
15373 being a feature of the TypeContainer.
15375 * class.cs: Drop the registration of parameters here, as
15376 InterfaceMethods are also interface declarations.
15378 * delegate.cs: Register methods with the TypeManager not only with
15379 the TypeContainer. This code was buggy.
15381 * interface.cs: Full registation here.
15383 2001-12-11 Miguel de Icaza <miguel@ximian.com>
15385 * expression.cs: Remove reducer for binary expressions, it can not
15388 * const.cs: Put here the code that used to go into constant.cs
15390 * constant.cs: Put here the code for constants, this is a new base
15391 class for Literals.
15393 * literal.cs: Make Literal derive from Constant.
15395 2001-12-09 Miguel de Icaza <miguel@ximian.com>
15397 * statement.cs (Return.Emit): Report error 157 if the user
15398 attempts to return from a finally block.
15400 (Return.Emit): Instead of emitting a return, jump to the end of
15403 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
15404 LocalBuilder to store the result of the function. ReturnLabel is
15405 the target where we jump.
15408 2001-12-09 Radek Doulik <rodo@ximian.com>
15410 * cs-parser.jay: remember alias in current namespace
15412 * ecore.cs (SimpleName::DoResolve): use aliases for types or
15415 * class.cs (LookupAlias): lookup alias in my_namespace
15417 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
15419 (LookupAlias): lookup alias in this and if needed in parent
15422 2001-12-08 Miguel de Icaza <miguel@ximian.com>
15426 * rootcontext.cs: (ModuleBuilder) Made static, first step into
15427 making things static. I need this to avoid passing the
15428 TypeContainer when calling ParameterType.
15430 * support.cs (InternalParameters.ParameterType): Remove ugly hack
15431 that did string manipulation to compute the type and then call
15432 GetType. Use Parameter.ParameterType instead.
15434 * cs-tokenizer.cs: Consume the suffix for floating values.
15436 * expression.cs (ParameterReference): figure out whether this is a
15437 reference parameter or not. Kill an extra variable by computing
15438 the arg_idx during emission.
15440 * parameter.cs (Parameters.GetParameterInfo): New overloaded
15441 function that returns whether a parameter is an out/ref value or not.
15443 (Parameter.ParameterType): The type of the parameter (base,
15444 without ref/out applied).
15446 (Parameter.Resolve): Perform resolution here.
15447 (Parameter.ExternalType): The full type (with ref/out applied).
15449 * statement.cs (Using.Emit, Using.EmitExpression): Implement
15450 support for expressions on the using statement.
15452 2001-12-07 Miguel de Icaza <miguel@ximian.com>
15454 * statement.cs (Using.EmitLocalVariableDecls): Split the
15455 localvariable handling of the using statement.
15457 (Block.EmitMeta): Keep track of variable count across blocks. We
15458 were reusing slots on separate branches of blocks.
15460 (Try.Emit): Emit the general code block, we were not emitting it.
15462 Check the type of the declaration to be an IDisposable or
15463 something that can be implicity converted to it.
15465 Emit conversions if required.
15467 * ecore.cs (EmptyExpression): New utility class.
15468 (Expression.ImplicitConversionExists): New utility function.
15470 2001-12-06 Miguel de Icaza <miguel@ximian.com>
15472 * statement.cs (Using): Implement.
15474 * expression.cs (LocalVariableReference): Support read only variables.
15476 * statement.cs: Remove the explicit emit for the Leave opcode.
15477 (VariableInfo): Add a readonly field.
15479 2001-12-05 Miguel de Icaza <miguel@ximian.com>
15481 * ecore.cs (ConvCast): new class used to encapsulate the various
15482 explicit integer conversions that works in both checked and
15483 unchecked contexts.
15485 (Expression.ConvertNumericExplicit): Use new ConvCast class to
15486 properly generate the overflow opcodes.
15488 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15490 * statement.cs: The correct type for the EmptyExpression is the
15491 element_type, not the variable type. Ravi pointed this out.
15493 2001-12-04 Ravi Pratap <ravi@ximian.com>
15495 * class.cs (Method::Define): Handle PInvoke methods specially
15496 by using DefinePInvokeMethod instead of the usual one.
15498 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
15499 above to do the task of extracting information and defining the method.
15501 2001-12-04 Ravi Pratap <ravi@ximian.com>
15503 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
15504 of the condition for string type.
15506 (Emit): Move that here.
15508 (ArrayCreation::CheckIndices): Keep string literals in their expression
15511 (EmitDynamicInitializers): Handle strings appropriately.
15513 2001-12-04 Miguel de Icaza <miguel@ximian.com>
15515 * codegen.cs (EmitContext): Replace multiple variables with a
15516 single pointer to the current Switch statement.
15518 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
15521 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15525 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
15528 (Foreach.Emit): Foreach on arrays was not setting
15529 up the loop variables (for break/continue).
15531 (GotoCase): Semi-implented.
15533 2001-12-03 Ravi Pratap <ravi@ximian.com>
15535 * attribute.cs (CheckAttribute): Handle system attributes by using
15536 Attribute.GetAttributes to examine information we need.
15538 (GetValidPlaces): Same here.
15540 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
15542 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
15544 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
15546 (Method::Define): Set appropriate flags if we have a DllImport attribute.
15548 (Method::Emit): Handle the case when we are a PInvoke method.
15550 2001-12-03 Miguel de Icaza <miguel@ximian.com>
15552 * expression.cs: Use ResolveWithSimpleName on compound names.
15554 2001-12-02 Ravi Pratap <ravi@ximian.com>
15556 * constant.cs (EmitConstant): Make sure we resolve the associated expression
15557 before trying to reduce it.
15559 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
15561 * constant.cs (LookupConstantValue): Implement.
15563 (EmitConstant): Use the above in emitting the constant.
15565 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
15566 that are user-defined by doing a LookupConstantValue on them.
15568 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
15571 2001-11-29 Miguel de Icaza <miguel@ximian.com>
15573 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
15575 (BaseAccess.DoResolve): Implement.
15577 (MemberAccess.DoResolve): Split this routine into a
15578 ResolveMemberAccess routine that can be used independently
15580 2001-11-28 Miguel de Icaza <miguel@ximian.com>
15582 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
15583 As that share bits of the implementation. Is returns a boolean,
15584 while As returns the Type that is being probed.
15586 2001-12-01 Ravi Pratap <ravi@ximian.com>
15588 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
15589 instead of a Literal - much easier.
15591 (EnumInTransit): Remove - utterly useless :-)
15593 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
15595 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
15597 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
15598 chain when we have no associated expression.
15600 2001-11-30 Ravi Pratap <ravi@ximian.com>
15602 * constant.cs (Define): Use Location while reporting the errror.
15604 Also emit a warning when 'new' is used and there is no inherited
15607 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
15610 (LookupEnumValue): Implement to lookup an enum member's value and define it
15613 (Populate): Re-write accordingly to use the above routine.
15615 2001-11-27 Miguel de Icaza <miguel@ximian.com>
15617 * expression.cs (This): Fix prototype for DoResolveLValue to
15618 override the base class DoResolveLValue.
15620 * cs-parser.cs: Report errors cs574 and cs575 (destructor
15623 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
15624 (we need to load the address of the field here). This fixes
15627 (FieldExpr.DoResolveLValue): Call the DoResolve
15628 function to initialize the Instance expression.
15630 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
15631 correctly the GetEnumerator operation on a value type.
15633 * cs-parser.jay: Add more simple parsing error catches.
15635 * statement.cs (Switch): Add support for string switches.
15636 Handle null specially.
15638 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
15640 2001-11-28 Ravi Pratap <ravi@ximian.com>
15642 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
15644 (declare_local_constant): New helper function.
15646 * statement.cs (AddConstant): Keep a separate record of constants
15648 (IsConstant): Implement to determine if a variable is a constant.
15650 (GetConstantExpression): Implement.
15652 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
15654 * statement.cs (IsVariableDefined): Re-write.
15656 2001-11-27 Ravi Pratap <ravi@ximian.com>
15658 * class.cs (TypeContainer::FindMembers): Look for constants
15659 in the case when we are looking for MemberTypes.Field
15661 * expression.cs (MemberAccess::DoResolve): Check that in the
15662 case we are a FieldExpr and a Literal, we are not being accessed
15663 by an instance reference.
15665 * cs-parser.jay (local_constant_declaration): Implement.
15667 (declaration_statement): Implement for constant declarations.
15669 2001-11-26 Miguel de Icaza <miguel@ximian.com>
15671 * statement.cs (Switch): Catch double defaults.
15673 (Switch): More work on the switch() statement
15674 implementation. It works for integral values now, need to finish
15678 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15680 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
15681 integer literals into other integer literals. To be used by
15684 2001-11-24 Ravi Pratap <ravi@ximian.com>
15686 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
15689 (EmitDynamicInitializers): Cope with the above since we extract data
15690 directly from ArrayData now.
15692 (ExpectInitializers): Keep track of whether initializers are mandatory
15695 (Bounds): Make it a hashtable to prevent the same dimension being
15696 recorded for every element in that dimension.
15698 (EmitDynamicInitializers): Fix bug which prevented the Set array method
15701 Also fix bug which was causing the indices to be emitted in the reverse
15704 2001-11-24 Miguel de Icaza <miguel@ximian.com>
15706 * expression.cs (ArrayCreation): Implement the bits that Ravi left
15707 unfinished. They do not work, because the underlying code is
15710 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15712 * cs-parser.jay: Remove bogus fixme.
15714 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
15715 on Switch statement.
15717 2001-11-23 Ravi Pratap <ravi@ximian.com>
15719 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
15722 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
15723 parameter. Apparently, any expression is allowed.
15725 (ValidateInitializers): Update accordingly.
15727 (CheckIndices): Fix some tricky bugs thanks to recursion.
15729 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
15730 I was being completely brain-dead.
15732 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
15733 and re-write acordingly.
15735 (DelegateInvocation): Re-write accordingly.
15737 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
15739 (MakeByteBlob): Handle types more correctly.
15741 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
15742 initialization from expressions but it is incomplete because I am a complete
15745 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15747 * statement.cs (If.Emit): Fix a bug that generated incorrect code
15748 on If. Basically, we have to return `true' (ie, we do return to
15749 our caller) only if both branches of the if return.
15751 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
15752 short-circuit operators, handle them as short circuit operators.
15754 (Cast.DoResolve): Resolve type.
15755 (Cast.Cast): Take an expression as the target type.
15757 * cs-parser.jay (cast_expression): Remove old hack that only
15758 allowed a limited set of types to be handled. Now we take a
15759 unary_expression and we resolve to a type during semantic
15762 Use the grammar productions from Rhys to handle casts (this is
15763 not complete like Rhys syntax yet, we fail to handle that corner
15764 case that C# has regarding (-x), but we will get there.
15766 2001-11-22 Ravi Pratap <ravi@ximian.com>
15768 * class.cs (EmitFieldInitializer): Take care of the case when we have a
15769 field which is an array type.
15771 * cs-parser.jay (declare_local_variables): Support array initialization too.
15773 * typemanager.cs (MakeKey): Implement.
15775 (everywhere): Use the above appropriately.
15777 * cs-parser.jay (for_statement): Update for array initialization while
15778 declaring variables.
15780 * ecore.cs : The error message was correct, it's the variable's names that
15781 were misleading ;-) Make the code more readable.
15783 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
15784 the correct type etc.
15786 (ConvertExplicit): Handle Enum types by examining the underlying type.
15788 2001-11-21 Ravi Pratap <ravi@ximian.com>
15790 * parameter.cs (GetCallingConvention): Always return
15791 CallingConventions.Standard for now.
15793 2001-11-22 Miguel de Icaza <miguel@ximian.com>
15795 * expression.cs (Binary.ResolveOperator): Update the values of `l'
15796 and `r' after calling DoNumericPromotions.
15798 * ecore.cs: Fix error message (the types were in the wrong order).
15800 * statement.cs (Foreach.ProbeCollectionType): Need to pass
15801 BindingFlags.Instance as well
15803 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
15804 implicit int literal conversion in an empty cast so that we
15805 propagate the right type upstream.
15807 (UnboxCast): new class used to unbox value types.
15808 (Expression.ConvertExplicit): Add explicit type conversions done
15811 (Expression.ImplicitNumericConversion): Oops, forgot to test for
15812 the target type before applying the implicit LongLiterals to ULong
15815 2001-11-21 Miguel de Icaza <miguel@ximian.com>
15817 * cs-parser.jay (for_statement): Reworked the way For works: now
15818 we declare manually any variables that are introduced in
15819 for_initializer to solve the problem of having out-of-band code
15820 emition (that is what got for broken).
15822 (declaration_statement): Perform the actual variable declaration
15823 that used to be done in local_variable_declaration here.
15825 (local_variable_declaration): Do not declare anything, just pass
15826 the information on a DictionaryEntry
15828 2001-11-20 Ravi Pratap <ravi@ximian.com>
15830 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
15831 re-write of the logic to now make it recursive.
15833 (UpdateIndices): Re-write accordingly.
15835 Store element data in a separate ArrayData list in the above methods.
15837 (MakeByteBlob): Implement to dump the array data into a byte array.
15839 2001-11-19 Ravi Pratap <ravi@ximian.com>
15841 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
15844 * constant.cs (Define): Implement.
15846 (EmitConstant): Re-write fully.
15848 Pass in location info.
15850 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
15853 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
15854 DictionaryEntry since we need location info too.
15856 (constant_declaration): Update accordingly.
15858 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
15859 code into another method : UpdateIndices.
15861 2001-11-18 Ravi Pratap <ravi@ximian.com>
15863 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
15864 some type checking etc.
15866 2001-11-17 Ravi Pratap <ravi@ximian.com>
15868 * expression.cs (ArrayCreation::ValidateInitializers): Implement
15869 bits to provide dimension info if the user skips doing that.
15871 Update second constructor to store the rank correctly.
15873 2001-11-16 Ravi Pratap <ravi@ximian.com>
15875 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
15876 and try to implement.
15878 * ../errors/cs0150.cs : Add.
15880 * ../errors/cs0178.cs : Add.
15882 2001-11-16 Miguel de Icaza <miguel@ximian.com>
15884 * statement.cs: Implement foreach on multi-dimensional arrays.
15886 * parameter.cs (Parameters.GetParameterByName): Also lookup the
15887 name of the params argument.
15889 * expression.cs: Use EmitStoreOpcode to get the right opcode while
15890 initializing the array.
15892 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
15893 we can use this elsewhere.
15895 * statement.cs: Finish implementation of foreach for single
15898 * cs-parser.jay: Use an out-of-band stack to pass information
15899 around, I wonder why I need this.
15901 foreach_block: Make the new foreach_block the current_block.
15903 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
15904 function used to return a static Parameters structure. Used for
15905 empty parameters, as those are created very frequently.
15907 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
15909 2001-11-15 Ravi Pratap <ravi@ximian.com>
15911 * interface.cs : Default modifier is private, not public. The
15912 make verify test passes again.
15914 2001-11-15 Ravi Pratap <ravi@ximian.com>
15916 * support.cs (ReflectionParameters): Fix logic to determine
15917 whether the last parameter is a params one. Test 9 passes again.
15919 * delegate.cs (Populate): Register the builders we define with
15920 RegisterParameterForBuilder. Test 19 passes again.
15922 * cs-parser.jay (property_declaration): Reference $6 instead
15923 of $$ to get at the location.
15925 (indexer_declaration): Similar stuff.
15927 (attribute): Ditto.
15929 * class.cs (Property): Register parameters for the Get and Set methods
15930 if they exist. Test 23 passes again.
15932 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
15933 call to EmitArguments as we are sure there aren't any params arguments.
15934 Test 32 passes again.
15936 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
15937 IndexOutOfRangeException.
15939 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
15940 Test 33 now passes again.
15942 2001-11-15 Miguel de Icaza <miguel@ximian.com>
15944 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
15945 broke a bunch of things. Will have to come up with a better way
15946 of tracking locations.
15948 * statement.cs: Implemented foreach for single dimension arrays.
15950 2001-11-09 Miguel de Icaza <miguel@ximian.com>
15952 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
15953 an error. This removes the lookup from the critical path.
15955 * cs-parser.jay: Removed use of temporary_loc, which is completely
15958 2001-11-14 Miguel de Icaza <miguel@ximian.com>
15960 * support.cs (ReflectionParameters.ParameterModifier): Report
15961 whether the argument is a PARAMS argument or not.
15963 * class.cs: Set the attribute `ParamArrayAttribute' on the
15964 parameter argument.
15966 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
15967 and cons_param_array_attribute (ConstructorInfo for
15968 ParamArrayAttribute).,
15970 * codegen.cs: Emit the return using the `Return' statement, that
15971 way we can report the error correctly for missing return values.
15973 * class.cs (Method.Emit): Clean up.
15975 * expression.cs (Argument.Resolve): Take another argument: the
15976 location where this argument is used. Notice that this is not
15977 part of the "Argument" class as to reduce the size of the
15978 structure (we know the approximate location anyways).
15980 Test if the argument is a variable-reference, if not, then
15981 complain with a 206.
15983 (Argument.Emit): Emit addresses of variables.
15985 (Argument.FullDesc): Simplify.
15987 (Invocation.DoResolve): Update for Argument.Resolve.
15989 (ElementAccess.DoResolve): ditto.
15991 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
15992 method should be virtual, as this method is always virtual.
15994 (NewDelegate.DoResolve): Update for Argument.Resolve.
15996 * class.cs (ConstructorInitializer.DoResolve): ditto.
15998 * attribute.cs (Attribute.Resolve): ditto.
16000 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16002 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
16004 * expression.cs (ParameterReference): Drop IStackStorage and implement
16005 IAssignMethod instead.
16007 (LocalVariableReference): ditto.
16009 * ecore.cs (FieldExpr): Drop IStackStorage and implement
16010 IAssignMethod instead.
16012 2001-11-13 Miguel de Icaza <miguel@ximian.com>
16014 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
16015 enumerations that are used in heavily used structures derive from
16016 byte in a laughable and pathetic attempt to reduce memory usage.
16017 This is the kind of pre-optimzations that you should not do at
16018 home without adult supervision.
16020 * expression.cs (UnaryMutator): New class, used to handle ++ and
16021 -- separatedly from the other unary operators. Cleans up the
16022 code, and kills the ExpressionStatement dependency in Unary.
16024 (Unary): Removed `method' and `Arguments' from this class, making
16025 it smaller, and moving it all to SimpleCall, so I can reuse this
16026 code in other locations and avoid creating a lot of transient data
16027 strucutres when not required.
16029 * cs-parser.jay: Adjust for new changes.
16031 2001-11-11 Miguel de Icaza <miguel@ximian.com>
16033 * enum.cs (Enum.Populate): If there is a failure during
16036 * cs-parser.jay (opt_enum_base): we used to catch type errors
16037 here, but this is really incorrect. The type error should be
16038 catched during semantic analysis.
16040 2001-12-11 Ravi Pratap <ravi@ximian.com>
16042 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
16043 current_local_parameters as expected since I, in my stupidity, had forgotten
16046 * attribute.cs (GetValidPlaces): Fix stupid bug.
16048 * class.cs (Method::Emit): Perform check on applicability of attributes.
16050 (Constructor::Emit): Ditto.
16052 (Field::Emit): Ditto.
16054 (Field.Location): Store location information.
16056 (Property, Event, Indexer, Operator): Ditto.
16058 * cs-parser.jay (field_declaration): Pass in location for each field.
16060 * ../errors/cs0592.cs : Add.
16062 2001-11-12 Ravi Pratap <ravi@ximian.com>
16064 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
16066 (InitCoreTypes): Update accordingly.
16068 (RegisterAttrType, LookupAttr): Implement.
16070 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
16071 info about the same.
16073 (Resolve): Update to populate the above as necessary.
16075 (Error592): Helper.
16077 (GetValidPlaces): Helper to the above.
16079 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
16081 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
16083 2001-11-12 Ravi Pratap <ravi@ximian.com>
16085 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
16087 * ../errors/cs0617.cs : Add.
16089 2001-11-11 Ravi Pratap <ravi@ximian.com>
16091 * enum.cs (Emit): Rename to Populate to be more consistent with what
16092 we expect it to do and when exactly it is called.
16094 * class.cs, rootcontext.cs : Update accordingly.
16096 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
16097 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
16099 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
16101 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
16102 of a fieldinfo using the above, when dealing with a FieldBuilder.
16104 2001-11-10 Ravi Pratap <ravi@ximian.com>
16106 * ../errors/cs0031.cs : Add.
16108 * ../errors/cs1008.cs : Add.
16110 * ../errrors/cs0543.cs : Add.
16112 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
16115 (FindMembers): Implement.
16117 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
16118 enums and delegates too.
16120 (enum_types): Rename to builder_to_enum.
16122 (delegate_types): Rename to builder_to_delegate.
16124 * delegate.cs (FindMembers): Implement.
16126 2001-11-09 Ravi Pratap <ravi@ximian.com>
16128 * typemanager.cs (IsEnumType): Implement.
16130 * enum.cs (Emit): Re-write parts to account for the underlying type
16131 better and perform checking etc.
16133 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
16134 of the underlying type.
16136 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
16139 * enum.cs (error31): Helper to report error #31.
16141 * cs-parser.jay (enum_declaration): Store location of each member too.
16143 * enum.cs (member_to_location): New hashtable.
16145 (AddEnumMember): Update location hashtable.
16147 (Emit): Use the location of each member while reporting errors.
16149 2001-11-09 Miguel de Icaza <miguel@ximian.com>
16151 * cs-parser.jay: A for_initializer if is a
16152 local_variable_declaration really ammount to have an implicit
16153 block with the variable declaration and no initializer for for.
16155 * statement.cs (For.Emit): Cope with null initializers.
16157 This fixes the infinite loop on for initializers.
16159 2001-11-08 Miguel de Icaza <miguel@ximian.com>
16161 * enum.cs: More cleanup.
16163 * ecore.cs: Remove dead code.
16165 * class.cs (Property.Emit): More simplification.
16166 (Event.Emit): ditto.
16168 Reworked to have less levels of indentation.
16170 2001-11-08 Ravi Pratap <ravi@ximian.com>
16172 * class.cs (Property): Emit attributes.
16182 * enum.cs (Emit): Ditto.
16184 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
16187 * class.cs (Field, Event, etc.): Move attribute generation into the
16188 Emit method everywhere.
16190 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
16191 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
16192 as we had no way of defining nested enums !
16194 * rootcontext.cs : Adjust code accordingly.
16196 * typemanager.cs (AddEnumType): To keep track of enum types separately.
16198 2001-11-07 Ravi Pratap <ravi@ximian.com>
16200 * expression.cs (EvalConstantExpression): Move into ecore.cs
16202 * enum.cs (Enum): Rename some members and make them public and readonly
16203 according to our convention.
16205 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
16208 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
16210 (Enum::Emit): Write a simple version for now which doesn't try to compute
16211 expressions. I shall modify this to be more robust in just a while.
16213 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
16215 (TypeContainer::CloseType): Create the Enum types too.
16217 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
16219 * expression.cs (EvalConstantExpression): Get rid of completely.
16221 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
16222 user-defined values and other cases.
16224 (IsValidEnumLiteral): Helper function.
16226 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
16227 out there in the case we had a literal FieldExpr.
16229 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
16231 (Literalize): Revamp a bit to take two arguments.
16233 (EnumLiteral): New class which derives from Literal to wrap enum literals.
16235 2001-11-06 Ravi Pratap <ravi@ximian.com>
16237 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
16239 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
16241 (Resolve): Use the above to ensure we have proper initializers.
16243 2001-11-05 Ravi Pratap <ravi@ximian.com>
16245 * expression.cs (Expression::EvalConstantExpression): New method to
16246 evaluate constant expressions.
16248 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
16250 2001-11-07 Miguel de Icaza <miguel@ximian.com>
16252 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
16255 (Binary.ResolveOperator): Handle operator != (object a, object b)
16256 and operator == (object a, object b);
16258 (Binary.DoNumericPromotions): Indicate whether the numeric
16259 promotion was possible.
16261 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
16264 Made the ArrayAccess implement interface IAssignMethod instead of
16265 IStackStore as the order in which arguments are passed reflects
16268 * assign.cs: Instead of using expr.ExprClass to select the way of
16269 assinging, probe for the IStackStore/IAssignMethod interfaces.
16271 * typemanager.cs: Load InitializeArray definition.
16273 * rootcontext.cs (RootContext.MakeStaticData): Used to define
16274 static data that can be used to initialize arrays.
16276 2001-11-05 Miguel de Icaza <miguel@ximian.com>
16278 * expression.cs: Handle operator== and operator!= for booleans.
16280 (Conditioal.Reduce): Implement reducer for the ?: operator.
16282 (Conditional.Resolve): Implement dead code elimination.
16284 (Binary.Resolve): Catch string literals and return a new
16285 concatenated string.
16287 (Unary.Reduce): Implement reduction of unary expressions.
16289 * ecore.cs: Split out the expression core handling here.
16291 (Expression.Reduce): New method used to perform constant folding
16292 and CSE. This is needed to support constant-expressions.
16294 * statement.cs (Statement.EmitBoolExpression): Pass true and false
16295 targets, and optimize for !x.
16297 2001-11-04 Ravi Pratap <ravi@ximian.com>
16299 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
16300 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
16301 set custom atttributes.
16303 * literal.cs (Literal::GetValue): New abstract method to return the actual
16304 value of the literal, cast as an object.
16306 (*Literal): Implement GetValue method.
16308 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
16309 expressions to the arraylist but objects of type Argument.
16311 * class.cs (TypeContainer::Emit): Emit our attributes too.
16313 (Method::Emit, Constructor::Emit): Ditto.
16315 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
16316 to be ignoring earlier.
16318 2001-11-03 Ravi Pratap <ravi@ximian.com>
16320 * attribute.cs (AttributeSection::Define): Implement to do the business
16321 of constructing a CustomAttributeBuilder.
16323 (Attribute): New trivial class. Increases readability of code.
16325 * cs-parser.jay : Update accordingly.
16327 (positional_argument_list, named_argument_list, named_argument): New rules
16329 (attribute_arguments): Use the above so that we are more correct.
16331 2001-11-02 Ravi Pratap <ravi@ximian.com>
16333 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
16334 to perform all checks for a method with a params parameter.
16336 (Invocation::OverloadResolve): Update to use the above method and therefore
16337 cope correctly with params method invocations.
16339 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
16342 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
16343 constructors in our parent too because we can't afford to miss out on
16346 * attribute.cs (AttributeSection): New name for the class Attribute
16348 Other trivial changes to improve readability.
16350 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
16351 use the new class names.
16353 2001-11-01 Ravi Pratap <ravi@ximian.com>
16355 * class.cs (Method::Define): Complete definition for params types too
16357 (Indexer::Define): Ditto.
16359 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
16360 Cope everywhere with a request for info about the array parameter.
16362 2001-11-01 Ravi Pratap <ravi@ximian.com>
16364 * tree.cs (RecordNamespace): Fix up to check for the correct key.
16366 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
16367 local_variable_type to extract the string corresponding to the type.
16369 (local_variable_type): Fixup the action to use the new helper method.
16371 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
16374 * expression.cs : Clean out code which uses the above.
16376 2001-10-31 Ravi Pratap <ravi@ximian.com>
16378 * typemanager.cs (RegisterMethod): Check if we already have an existing key
16379 and bale out if necessary by returning a false.
16381 (RegisterProperty): Ditto.
16383 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
16384 and print out appropriate error messages.
16386 * interface.cs (everywhere): Ditto.
16388 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
16389 location to constructor.
16391 * class.cs (Property, Event, Indexer): Update accordingly.
16393 * ../errors/cs111.cs : Added.
16395 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
16396 of a method, as laid down by the spec.
16398 (Invocation::OverloadResolve): Use the above method.
16400 2001-10-31 Ravi Pratap <ravi@ximian.com>
16402 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
16403 now take a TypeContainer and a Parameters object.
16405 (ParameterData): Modify return type of ParameterModifier method to be
16406 Parameter.Modifier and not a string.
16408 (ReflectionParameters, InternalParameters): Update accordingly.
16410 * expression.cs (Argument::GetParameterModifier): Same here.
16412 * support.cs (InternalParameters::ParameterType): Find a better way of determining
16413 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
16414 symbol in it at all so maybe this is only for now.
16416 2001-10-30 Ravi Pratap <ravi@ximian.com>
16418 * support.cs (InternalParameters): Constructor now takes an extra argument
16419 which is the actual Parameters class.
16421 (ParameterDesc): Update to provide info on ref/out modifiers.
16423 * class.cs (everywhere): Update call to InternalParameters to pass in
16424 the second argument too.
16426 * support.cs (ParameterData): Add ParameterModifier, which is a method
16427 to return the modifier info [ref/out etc]
16429 (InternalParameters, ReflectionParameters): Implement the above.
16431 * expression.cs (Argument::ParameterModifier): Similar function to return
16432 info about the argument's modifiers.
16434 (Invocation::OverloadResolve): Update to take into account matching modifiers
16437 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
16438 a new SetFormalParameters object which we pass to InternalParameters.
16440 2001-10-30 Ravi Pratap <ravi@ximian.com>
16442 * expression.cs (NewArray): Merge into the ArrayCreation class.
16444 2001-10-29 Ravi Pratap <ravi@ximian.com>
16446 * expression.cs (NewArray): Merge classes NewBuiltinArray and
16447 NewUserdefinedArray into one as there wasn't much of a use in having
16450 * expression.cs (Argument): Change field's name to ArgType from Type.
16452 (Type): New readonly property which returns the proper type, taking into
16453 account ref/out modifiers.
16455 (everywhere): Adjust code accordingly for the above.
16457 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
16458 whether we are emitting for a ref or out parameter.
16460 * expression.cs (Argument::Emit): Use the above field to set the state.
16462 (LocalVariableReference::Emit): Update to honour the flag and emit the
16465 * parameter.cs (Attributes): Set the correct flags for ref parameters.
16467 * expression.cs (Argument::FullDesc): New function to provide a full desc.
16469 * support.cs (ParameterData): Add method ParameterDesc to the interface.
16471 (ReflectionParameters, InternalParameters): Implement the above method.
16473 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
16476 (Invocation::FullMethodDesc): Ditto.
16478 2001-10-29 Miguel de Icaza <miguel@ximian.com>
16480 * cs-parser.jay: Add extra production for the second form of array
16483 * expression.cs (ArrayCreation): Update to reflect the above
16486 * Small changes to prepare for Array initialization.
16488 2001-10-28 Miguel de Icaza <miguel@ximian.com>
16490 * typemanager.cs (ImplementsInterface): interface might be null;
16491 Deal with this problem;
16493 Also, we do store negative hits on the cache (null values), so use
16494 this instead of calling t.GetInterfaces on the type everytime.
16496 2001-10-28 Ravi Pratap <ravi@ximian.com>
16498 * typemanager.cs (IsBuiltinType): New method to help determine the same.
16500 * expression.cs (New::DoResolve): Get rid of array creation code and instead
16501 split functionality out into different classes.
16503 (New::FormArrayType): Move into NewBuiltinArray.
16505 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
16508 (NewBuiltinArray): New class to handle creation of built-in arrays.
16510 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
16511 account creation of one-dimensional arrays.
16513 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
16515 (NewUserdefinedArray::DoResolve): Implement.
16517 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
16519 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
16520 we maintain inside the TypeManager. This is necessary to perform lookups on the
16523 (LookupType): Update to perform GetType on the module builders too.
16525 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
16527 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
16529 2001-10-23 Ravi Pratap <ravi@ximian.com>
16531 * expression.cs (New::DoResolve): Implement guts of array creation.
16533 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
16535 2001-10-27 Miguel de Icaza <miguel@ximian.com>
16537 * expression.cs: Fix bug I introduced lsat night that broke
16540 (Expression.Resolve): Report a 246 error (can not resolve name)
16541 if we find a SimpleName in the stream.
16543 (Expression.ResolveLValue): Ditto.
16545 (Expression.ResolveWithSimpleName): This function is a variant of
16546 ResolveName, this one allows SimpleNames to be returned without a
16547 warning. The only consumer of SimpleNames is MemberAccess
16549 2001-10-26 Miguel de Icaza <miguel@ximian.com>
16551 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
16552 might arrive here. I have my doubts that this is correct.
16554 * statement.cs (Lock): Implement lock statement.
16556 * cs-parser.jay: Small fixes to support `lock' and `using'
16558 * cs-tokenizer.cs: Remove extra space
16560 * driver.cs: New flag --checked, allows to turn on integer math
16563 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
16564 Threading.Monitor.Exit
16566 2001-10-23 Miguel de Icaza <miguel@ximian.com>
16568 * expression.cs (IndexerAccess::DoResolveLValue): Set the
16569 Expression Class to be IndexerAccess.
16571 Notice that Indexer::DoResolve sets the eclass to Value.
16573 2001-10-22 Miguel de Icaza <miguel@ximian.com>
16575 * class.cs (TypeContainer::Emit): Emit code for indexers.
16577 * assign.cs (IAssignMethod): New interface implemented by Indexers
16578 and Properties for handling assignment.
16580 (Assign::Emit): Simplify and reuse code.
16582 * expression.cs (IndexerAccess, PropertyExpr): Implement
16583 IAssignMethod, clean up old code.
16585 2001-10-22 Ravi Pratap <ravi@ximian.com>
16587 * typemanager.cs (ImplementsInterface): New method to determine if a type
16588 implements a given interface. Provides a nice cache too.
16590 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
16593 (ConvertReferenceExplicit): Ditto.
16595 * delegate.cs (Delegate::Populate): Update to define the parameters on the
16596 various methods, with correct names etc.
16598 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
16599 Operator.UnaryNegation.
16601 * cs-parser.jay (operator_declarator): Be a little clever in the case where
16602 we have a unary plus or minus operator.
16604 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
16607 * everywhere : update accordingly.
16609 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
16612 * class.cs (Method::Define): For the case where we are implementing a method
16613 inherited from an interface, we need to set the MethodAttributes.Final flag too.
16614 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
16616 2001-10-21 Ravi Pratap <ravi@ximian.com>
16618 * interface.cs (FindMembers): Implement to work around S.R.E
16621 * typemanager.cs (IsInterfaceType): Implement.
16623 (FindMembers): Update to handle interface types too.
16625 * expression.cs (ImplicitReferenceConversion): Re-write bits which
16626 use IsAssignableFrom as that is not correct - it doesn't work.
16628 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
16629 and accordingly override EmitStatement.
16631 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
16632 using the correct logic :-)
16634 2001-10-19 Ravi Pratap <ravi@ximian.com>
16636 * ../errors/cs-11.cs : Add to demonstrate error -11
16638 2001-10-17 Miguel de Icaza <miguel@ximian.com>
16640 * assign.cs (Assign::Resolve): Resolve right hand side first, and
16641 then pass this as a hint to ResolveLValue.
16643 * expression.cs (FieldExpr): Add Location information
16645 (FieldExpr::LValueResolve): Report assignment to readonly
16648 (Expression::ExprClassFromMemberInfo): Pass location information.
16650 (Expression::ResolveLValue): Add new method that resolves an
16653 (Expression::DoResolveLValue): Default invocation calls
16656 (Indexers): New class used to keep track of indexers in a given
16659 (IStackStore): Renamed from LValue, as it did not really describe
16660 what this did. Also ResolveLValue is gone from this interface and
16661 now is part of Expression.
16663 (ElementAccess): Depending on the element access type
16665 * typemanager.cs: Add `indexer_name_type' as a Core type
16666 (System.Runtime.CompilerServices.IndexerNameAttribute)
16668 * statement.cs (Goto): Take a location.
16670 2001-10-18 Ravi Pratap <ravi@ximian.com>
16672 * delegate.cs (Delegate::VerifyDelegate): New method to verify
16673 if two delegates are compatible.
16675 (NewDelegate::DoResolve): Update to take care of the case when
16676 we instantiate a delegate from another delegate.
16678 * typemanager.cs (FindMembers): Don't even try to look up members
16679 of Delegate types for now.
16681 2001-10-18 Ravi Pratap <ravi@ximian.com>
16683 * delegate.cs (NewDelegate): New class to take care of delegate
16686 * expression.cs (New): Split the delegate related code out into
16687 the NewDelegate class.
16689 * delegate.cs (DelegateInvocation): New class to handle delegate
16692 * expression.cs (Invocation): Split out delegate related code into
16693 the DelegateInvocation class.
16695 2001-10-17 Ravi Pratap <ravi@ximian.com>
16697 * expression.cs (New::DoResolve): Implement delegate creation fully
16698 and according to the spec.
16700 (New::DoEmit): Update to handle delegates differently.
16702 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
16703 because of which we were printing out arguments in reverse order !
16705 * delegate.cs (VerifyMethod): Implement to check if the given method
16706 matches the delegate.
16708 (FullDelegateDesc): Implement.
16710 (VerifyApplicability): Implement.
16712 * expression.cs (Invocation::DoResolve): Update to accordingly handle
16713 delegate invocations too.
16715 (Invocation::Emit): Ditto.
16717 * ../errors/cs1593.cs : Added.
16719 * ../errors/cs1594.cs : Added.
16721 * delegate.cs (InstanceExpression, TargetMethod): New properties.
16723 2001-10-16 Ravi Pratap <ravi@ximian.com>
16725 * typemanager.cs (intptr_type): Core type for System.IntPtr
16727 (InitCoreTypes): Update for the same.
16729 (iasyncresult_type, asynccallback_type): Ditto.
16731 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
16734 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
16737 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
16738 the builders for the 4 members of a delegate type :-)
16740 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
16743 * expression.cs (New::DoResolve): Implement guts for delegate creation.
16745 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
16747 2001-10-15 Miguel de Icaza <miguel@ximian.com>
16749 * statement.cs (Break::Emit): Implement.
16750 (Continue::Emit): Implement.
16752 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
16753 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
16754 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
16755 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
16758 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
16759 properties that track the label for the current loop (begin of the
16760 loop and end of the loop).
16762 2001-10-15 Ravi Pratap <ravi@ximian.com>
16764 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
16765 use of emitting anything at all.
16767 * class.cs, rootcontext.cs : Get rid of calls to the same.
16769 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
16771 (Populate): Define the constructor correctly and set the implementation
16774 * typemanager.cs (delegate_types): New hashtable to hold delegates that
16777 (AddDelegateType): Implement.
16779 (IsDelegateType): Implement helper method.
16781 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
16783 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
16784 and accordingly handle it.
16786 * delegate.cs (Populate): Take TypeContainer argument.
16787 Implement bits to define the Invoke method. However, I still haven't figured out
16788 how to take care of the native int bit :-(
16790 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
16791 Qualify the name of the delegate, not its return type !
16793 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
16796 (StandardConversionExists): Checking for array types turns out to be recursive.
16798 (ConvertReferenceExplicit): Implement array conversion.
16800 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
16802 2001-10-12 Ravi Pratap <ravi@ximian.com>
16804 * cs-parser.jay (delegate_declaration): Store the fully qualified
16805 name as it is a type declaration.
16807 * delegate.cs (ReturnType, Name): Rename members to these. Make them
16810 (DefineDelegate): Renamed from Define. Does the same thing essentially,
16811 as TypeContainer::DefineType.
16813 (Populate): Method in which all the definition of the various methods (Invoke)
16816 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
16819 (CloseDelegate): Finally creates the delegate.
16821 * class.cs (TypeContainer::DefineType): Update to define delegates.
16822 (Populate, Emit and CloseType): Do the same thing here too.
16824 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
16825 delegates in all these operations.
16827 2001-10-14 Miguel de Icaza <miguel@ximian.com>
16829 * expression.cs: LocalTemporary: a new expression used to
16830 reference a temporary that has been created.
16832 * assign.cs: Handle PropertyAccess back here, so that we can
16833 provide the proper semantic access to properties.
16835 * expression.cs (Expression::ConvertReferenceExplicit): Implement
16836 a few more explicit conversions.
16838 * modifiers.cs: `NEW' modifier maps to HideBySig.
16840 * expression.cs (PropertyExpr): Make this into an
16841 ExpressionStatement, and support the EmitStatement code path.
16843 Perform get/set error checking, clean up the interface.
16845 * assign.cs: recognize PropertyExprs as targets, and if so, turn
16846 them into toplevel access objects.
16848 2001-10-12 Miguel de Icaza <miguel@ximian.com>
16850 * expression.cs: PropertyExpr::PropertyExpr: use work around the
16853 * typemanager.cs: Keep track here of our PropertyBuilders again to
16854 work around lameness in SRE.
16856 2001-10-11 Miguel de Icaza <miguel@ximian.com>
16858 * expression.cs (LValue::LValueResolve): New method in the
16859 interface, used to perform a second resolution pass for LValues.
16861 (This::DoResolve): Catch the use of this in static methods.
16863 (This::LValueResolve): Implement.
16865 (This::Store): Remove warning, assigning to `this' in structures
16868 (Invocation::Emit): Deal with invocation of
16869 methods on value types. We need to pass the address to structure
16870 methods rather than the object itself. (The equivalent code to
16871 emit "this" for structures leaves the entire structure on the
16872 stack instead of a pointer to it).
16874 (ParameterReference::DoResolve): Compute the real index for the
16875 argument based on whether the method takes or not a `this' pointer
16876 (ie, the method is static).
16878 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
16879 value types returned from functions when we need to invoke a
16880 method on the sturcture.
16883 2001-10-11 Ravi Pratap <ravi@ximian.com>
16885 * class.cs (TypeContainer::DefineType): Method to actually do the business of
16886 defining the type in the Modulebuilder or Typebuilder. This is to take
16887 care of nested types which need to be defined on the TypeBuilder using
16888 DefineNestedMethod.
16890 (TypeContainer::GetClassBases): Implement. Essentially the code from the
16891 methods in RootContext, only ported to be part of TypeContainer.
16893 (TypeContainer::GetInterfaceOrClass): Ditto.
16895 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
16897 * interface.cs (Interface::DefineInterface): New method. Does exactly
16898 what RootContext.CreateInterface did earlier, only it takes care of nested types
16901 (Interface::GetInterfaces): Move from RootContext here and port.
16903 (Interface::GetInterfaceByName): Same here.
16905 * rootcontext.cs (ResolveTree): Re-write.
16907 (PopulateTypes): Re-write.
16909 * class.cs (TypeContainer::Populate): Populate nested types too.
16910 (TypeContainer::Emit): Emit nested members too.
16912 * typemanager.cs (AddUserType): Do not make use of the FullName property,
16913 instead just use the name argument passed in as it is already fully
16916 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
16917 to TypeContainer mapping to see if a type is user-defined.
16919 * class.cs (TypeContainer::CloseType): Implement.
16921 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
16922 the default constructor.
16924 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
16927 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
16929 * interface.cs (CloseType): Create the type here.
16931 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
16934 Remove all the methods which are now in TypeContainer.
16936 2001-10-10 Ravi Pratap <ravi@ximian.com>
16938 * delegate.cs (Define): Re-write bits to define the delegate
16941 2001-10-10 Miguel de Icaza <miguel@ximian.com>
16943 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
16945 * expression.cs (ImplicitReferenceConversion): handle null as well
16946 as a source to convert to any reference type.
16948 * statement.cs (Return): Perform any implicit conversions to
16949 expected return type.
16951 Validate use of return statement.
16953 * codegen.cs (EmitContext): Pass the expected return type here.
16955 * class.cs (Method, Constructor, Property): Pass expected return
16956 type to EmitContext.
16958 2001-10-09 Miguel de Icaza <miguel@ximian.com>
16960 * expression.cs: Make DoResolve take an EmitContext instead of a
16963 Replaced `l' and `location' for `loc', for consistency.
16965 (Error, Warning): Remove unneeded Tc argument.
16967 * assign.cs, literal.cs, constant.cs: Update to new calling
16970 * codegen.cs: EmitContext now contains a flag indicating whether
16971 code is being generated in a static method or not.
16973 * cs-parser.jay: DecomposeQI, new function that replaces the old
16974 QualifiedIdentifier. Now we always decompose the assembled
16975 strings from qualified_identifier productions into a group of
16978 2001-10-08 Miguel de Icaza <miguel@ximian.com>
16980 * rootcontext.cs: Deal with field-less struct types correctly now
16981 by passing the size option to Define Type.
16983 * class.cs: Removed hack that created one static field.
16985 2001-10-07 Miguel de Icaza <miguel@ximian.com>
16987 * statement.cs: Moved most of the code generation here.
16989 2001-10-09 Ravi Pratap <ravi@ximian.com>
16991 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
16994 (ElementAccess): Remove useless bits for now - keep checks as the spec
16997 2001-10-08 Ravi Pratap <ravi@ximian.com>
16999 * expression.cs (ElementAccess::DoResolve): Remove my crap code
17000 and start performing checks according to the spec.
17002 2001-10-07 Ravi Pratap <ravi@ximian.com>
17004 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
17005 rank_specifiers instead.
17007 (rank_specifiers): Change the order in which the rank specifiers are stored
17009 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
17011 * expression.cs (ElementAccess): Implement the LValue interface too.
17013 2001-10-06 Ravi Pratap <ravi@ximian.com>
17015 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
17016 except that user defined conversions are not included.
17018 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
17019 perform the conversion of the return type, if necessary.
17021 (New::DoResolve): Check whether we are creating an array or an object
17022 and accordingly do the needful.
17024 (New::Emit): Same here.
17026 (New::DoResolve): Implement guts of array creation.
17028 (New::FormLookupType): Helper function.
17030 2001-10-07 Miguel de Icaza <miguel@ximian.com>
17032 * codegen.cs: Removed most of the code generation here, and move the
17033 corresponding code generation bits to the statement classes.
17035 Added support for try/catch/finalize and throw.
17037 * cs-parser.jay: Added support for try/catch/finalize.
17039 * class.cs: Catch static methods having the flags override,
17040 virtual or abstract.
17042 * expression.cs (UserCast): This user cast was not really doing
17043 what it was supposed to do. Which is to be born in fully resolved
17044 state. Parts of the resolution were being performed at Emit time!
17048 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17050 * expression.cs: Implicity convert the result from UserCast.
17052 2001-10-05 Ravi Pratap <ravi@ximian.com>
17054 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
17055 prevented it from working correctly.
17057 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
17058 merely ConvertImplicit.
17060 2001-10-05 Miguel de Icaza <miguel@ximian.com>
17062 * typemanager.cs: Make the LookupTypeContainer function static,
17063 and not per-instance.
17065 * class.cs: Make static FindMembers (the one that takes a Type
17068 * codegen.cs: Add EmitForeach here.
17070 * cs-parser.jay: Make foreach a toplevel object instead of the
17071 inline expansion, as we need to perform semantic analysis on it.
17073 2001-10-05 Ravi Pratap <ravi@ximian.com>
17075 * expression.cs (Expression::ImplicitUserConversion): Rename to
17076 UserDefinedConversion.
17078 (Expression::UserDefinedConversion): Take an extra argument specifying
17079 whether we look for explicit user conversions too.
17081 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
17083 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
17085 (ExplicitUserConversion): Make it a call to UserDefinedConversion
17086 with the appropriate arguments.
17088 * cs-parser.jay (cast_expression): Record location too.
17090 * expression.cs (Cast): Record location info.
17092 (Expression::ConvertExplicit): Take location argument.
17094 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
17095 to determine if we are doing explicit conversions.
17097 (UserCast::Emit): Update accordingly.
17099 (Expression::ConvertExplicit): Report an error if everything fails.
17101 * ../errors/cs0030.cs : Add.
17103 2001-10-04 Miguel de Icaza <miguel@ximian.com>
17105 * modifiers.cs: If the ABSTRACT keyword is present, also set the
17106 virtual and newslot bits.
17108 * class.cs (TypeContainer::RegisterRequiredImplementations):
17109 Record methods we need.
17111 (TypeContainer::MakeKey): Helper function to make keys for
17112 MethodBases, since the Methodbase key is useless.
17114 (TypeContainer::Populate): Call RegisterRequiredImplementations
17115 before defining the methods.
17117 Create a mapping for method_builders_to_methods ahead of time
17118 instead of inside a tight loop.
17120 (::RequireMethods): Accept an object as the data to set into the
17121 hashtable so we can report interface vs abstract method mismatch.
17123 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17125 * report.cs: Make all of it static.
17127 * rootcontext.cs: Drop object_type and value_type computations, as
17128 we have those in the TypeManager anyways.
17130 Drop report instance variable too, now it is a global.
17132 * driver.cs: Use try/catch on command line handling.
17134 Add --probe option to debug the error reporting system with a test
17137 * report.cs: Add support for exiting program when a probe
17138 condition is reached.
17140 2001-10-03 Ravi Pratap <ravi@ximian.com>
17142 * expression.cs (Binary::DoNumericPromotions): Fix the case when
17143 we do a forcible conversion regardless of type, to check if
17144 ForceConversion returns a null.
17146 (Binary::error19): Use location to report error.
17148 (Unary::error23): Use location here too.
17150 * ../errors/cs0019.cs : Check in.
17152 * ../errors/cs0023.cs : Check in.
17154 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
17155 case of a non-null MethodInfo object with a length of 0 !
17157 (Binary::ResolveOperator): Flag error if overload resolution fails to find
17158 an applicable member - according to the spec :-)
17159 Also fix logic to find members in base types.
17161 (Unary::ResolveOperator): Same here.
17163 (Unary::report23): Change name to error23 and make first argument a TypeContainer
17164 as I was getting thoroughly confused between this and error19 :-)
17166 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
17167 (::FindMostEncompassedType): Implement.
17168 (::FindMostEncompassingType): Implement.
17169 (::StandardConversionExists): Implement.
17171 (UserImplicitCast): Re-vamp. We now need info about most specific
17172 source and target types so that we can do the necessary conversions.
17174 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
17175 mathematical union with no duplicates.
17177 2001-10-03 Miguel de Icaza <miguel@ximian.com>
17179 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
17180 in order from base classes to child classes, so that we can in
17181 child classes look up in our parent for method names and
17182 attributes (required for handling abstract, virtual, new, override
17183 constructs: we need to instrospect our base class, and if we dont
17184 populate the classes in order, the introspection might be
17185 incorrect. For example, a method could query its parent before
17186 the parent has any methods and would determine that the parent has
17187 no abstract methods (while it could have had them)).
17189 (RootContext::CreateType): Record the order in which we define the
17192 2001-10-02 Miguel de Icaza <miguel@ximian.com>
17194 * class.cs (TypeContainer::Populate): Also method definitions can
17195 fail now, keep track of this.
17197 (TypeContainer::FindMembers): Implement support for
17198 DeclaredOnly/noDeclaredOnly flag.
17200 (Constructor::Emit) Return the ConstructorBuilder.
17202 (Method::Emit) Return the MethodBuilder.
17203 Check for abstract or virtual methods to be public.
17205 * rootcontext.cs (RootContext::CreateType): Register all the
17206 abstract methods required for the class to be complete and the
17207 interface methods that must be implemented.
17209 * cs-parser.jay: Report error 501 (method requires body if it is
17210 not marked abstract or extern).
17212 * expression.cs (TypeOf::Emit): Implement.
17214 * typemanager.cs: runtime_handle_type, new global type.
17216 * class.cs (Property::Emit): Generate code for properties.
17218 2001-10-02 Ravi Pratap <ravi@ximian.com>
17220 * expression.cs (Unary::ResolveOperator): Find operators on base type
17221 too - we now conform exactly to the spec.
17223 (Binary::ResolveOperator): Same here.
17225 * class.cs (Operator::Define): Fix minor quirk in the tests.
17227 * ../errors/cs0215.cs : Added.
17229 * ../errors/cs0556.cs : Added.
17231 * ../errors/cs0555.cs : Added.
17233 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17235 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
17236 single integer which is really efficient
17238 2001-10-01 Ravi Pratap <ravi@ximian.com>
17240 * expression.cs (Expression::ImplicitUserConversion): Use location
17241 even in the case when we are examining True operators.
17243 * class.cs (Operator::Define): Perform extensive checks to conform
17244 with the rules for operator overloading in the spec.
17246 * expression.cs (Expression::ImplicitReferenceConversion): Implement
17247 some of the other conversions mentioned in the spec.
17249 * typemanager.cs (array_type): New static member for the System.Array built-in
17252 (cloneable_interface): For System.ICloneable interface.
17254 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
17255 we start resolving the tree and populating types.
17257 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
17259 2001-10-01 Miguel de Icaza <miguel@ximian.com>
17261 * expression.cs (Expression::ExprClassFromMemberInfo,
17262 Expression::Literalize): Create literal expressions from
17263 FieldInfos which are literals.
17265 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
17266 type casts, because they were wrong. The test suite in tests
17269 (ImplicitNumericConversion): ushort to ulong requires a widening
17272 Int32 constant to long requires widening cast as well.
17274 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
17275 for integers because the type on the stack is not i4.
17277 2001-09-30 Miguel de Icaza <miguel@ximian.com>
17279 * expression.cs (report118): require location argument.
17281 * parameter.cs: Do not dereference potential null value.
17283 * class.cs: Catch methods that lack the `new' keyword when
17284 overriding a name. Report warnings when `new' is used without
17285 anything being there to override.
17287 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
17289 * class.cs: Only add constructor to hashtable if it is non-null
17290 (as now constructors can fail on define).
17292 (TypeManager, Class, Struct): Take location arguments.
17294 Catch field instance initialization in structs as errors.
17296 accepting_filter: a new filter for FindMembers that is static so
17297 that we dont create an instance per invocation.
17299 (Constructor::Define): Catch errors where a struct constructor is
17302 * cs-parser.jay: Pass location information for various new
17305 * delegate.cs (Delegate): take a location argument.
17307 * driver.cs: Do not call EmitCode if there were problesm in the
17308 Definition of the types, as many Builders wont be there.
17310 * decl.cs (Decl::Decl): Require a location argument.
17312 * cs-tokenizer.cs: Handle properly hex constants that can not fit
17313 into integers, and find the most appropiate integer for it.
17315 * literal.cs: Implement ULongLiteral.
17317 * rootcontext.cs: Provide better information about the location of
17318 failure when CreateType fails.
17320 2001-09-29 Miguel de Icaza <miguel@ximian.com>
17322 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
17325 * expression.cs (Binary::CheckShiftArguments): Add missing type
17327 (Binary::ResolveOperator): Add type to the logical and and logical
17328 or, Bitwise And/Or and Exclusive Or code paths, it was missing
17331 (Binary::DoNumericPromotions): In the case where either argument
17332 is ulong (and most signed types combined with ulong cause an
17333 error) perform implicit integer constant conversions as well.
17335 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17337 * expression.cs (UserImplicitCast): Method should always be
17339 (Invocation::BetterConversion): Simplified test for IntLiteral.
17341 (Expression::ImplicitNumericConversion): Split this routine out.
17342 Put the code that performs implicit constant integer conversions
17345 (Expression::Resolve): Become a wrapper around DoResolve so we can
17346 check eclass and type being set after resolve.
17348 (Invocation::Badness): Remove this dead function
17350 (Binary::ResolveOperator): Do not compute the expensive argumnets
17351 unless we have a union for it.
17353 (Probe::Emit): Is needs to do an isinst and then
17354 compare against null.
17356 (::CanConvert): Added Location argument. If the Location argument
17357 is null (Location.Null), then we do not report errors. This is
17358 used by the `probe' mechanism of the Explicit conversion. We do
17359 not want to generate an error for something that the user
17360 explicitly requested to be casted. But the pipeline for an
17361 explicit cast first tests for potential implicit casts.
17363 So for now, if the Location is null, it means `Probe only' to
17364 avoid adding another argument. Might have to revise this
17367 (ClassCast): New class used to type cast objects into arbitrary
17368 classes (used in Explicit Reference Conversions).
17370 Implement `as' as well.
17372 Reverted all the patches from Ravi below: they were broken:
17374 * The use of `level' as a mechanism to stop recursive
17375 invocations is wrong. That was there just to catch the
17376 bug with a strack trace but not as a way of addressing
17379 To fix the problem we have to *understand* what is going
17380 on and the interactions and come up with a plan, not
17381 just get things going.
17383 * The use of the type conversion cache that I proposed
17384 last night had an open topic: How does this work across
17385 protection domains. A user defined conversion might not
17386 be public in the location where we are applying the
17387 conversion, a different conversion might be selected
17388 (ie, private A->B (better) but public B->A (worse),
17389 inside A, A->B applies, but outside it, B->A will
17392 * On top of that (ie, even if the above is solved),
17393 conversions in a cache need to be abstract. Ie, `To
17394 convert from an Int to a Short use an OpcodeCast', not
17395 `To convert from an Int to a Short use the OpcodeCast on
17396 the variable 5' (which is what this patch was doing).
17398 2001-09-28 Ravi Pratap <ravi@ximian.com>
17400 * expression.cs (Invocation::ConversionExists): Re-write to use
17401 the conversion cache
17403 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
17404 cache all conversions done, not just user-defined ones.
17406 (Invocation::BetterConversion): The real culprit. Use ConversionExists
17407 to determine if a conversion exists instead of acutually trying to
17408 perform the conversion. It's faster too.
17410 (Expression::ConvertExplicit): Modify to use ConversionExists to check
17411 and only then attempt the implicit conversion.
17413 2001-09-28 Ravi Pratap <ravi@ximian.com>
17415 * expression.cs (ConvertImplicit): Use a cache for conversions
17416 already found. Check level of recursion and bail out if necessary.
17418 2001-09-28 Miguel de Icaza <miguel@ximian.com>
17420 * typemanager.cs (string_concat_string_string, string_concat_object_object):
17421 Export standard methods that we expect for string operations.
17423 * statement.cs (Block::UsageWarning): Track usage of variables and
17424 report the errors for not used variables.
17426 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
17429 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17431 * codegen.cs: remove unnneded code
17433 * expression.cs: Removed BuiltinTypeAccess class
17435 Fix the order in which implicit conversions are
17438 The previous fixed dropped support for boxed conversions (adding a
17439 test to the test suite now)
17441 (UserImplicitCast::CanConvert): Remove test for source being null,
17442 that code is broken. We should not feed a null to begin with, if
17443 we do, then we should track the bug where the problem originates
17444 and not try to cover it up here.
17446 Return a resolved expression of type UserImplicitCast on success
17447 rather than true/false. Ravi: this is what I was talking about,
17448 the pattern is to use a static method as a "constructor" for
17451 Also, do not create arguments until the very last minute,
17452 otherwise we always create the arguments even for lookups that
17453 will never be performed.
17455 (UserImplicitCast::Resolve): Eliminate, objects of type
17456 UserImplicitCast are born in a fully resolved state.
17458 * typemanager.cs (InitCoreTypes): Init also value_type
17459 (System.ValueType).
17461 * expression.cs (Cast::Resolve): First resolve the child expression.
17463 (LValue): Add new method AddressOf to be used by
17466 Change the argument of Store to take an EmitContext instead of an
17467 ILGenerator, because things like FieldExpr need to be able to call
17468 their children expression to generate the instance code.
17470 (Expression::Error, Expression::Warning): Sugar functions for
17473 (Expression::MemberLookup): Accept a TypeContainer instead of a
17474 Report as the first argument.
17476 (Expression::ResolvePrimary): Killed. I still want to improve
17477 this as currently the code is just not right.
17479 (Expression::ResolveMemberAccess): Simplify, but it is still
17482 (Unary::Resolve): Catch errors in AddressOf operators.
17484 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
17485 index to a byte for the short-version, or the compiler will choose
17486 the wrong Emit call, which generates the wrong data.
17488 (ParameterReference::Emit, ::Store): same.
17490 (FieldExpr::AddressOf): Implement.
17492 * typemanager.cs: TypeManager: made public variable instead of
17495 * driver.cs: document --fatal.
17497 * report.cs (ErrorMessage, WarningMessage): new names for the old
17498 Error and Warning classes.
17500 * cs-parser.jay (member_access): Turn built-in access to types
17501 into a normal simplename
17503 2001-09-27 Ravi Pratap <ravi@ximian.com>
17505 * expression.cs (Invocation::BetterConversion): Fix to cope
17506 with q being null, since this was introducing a bug.
17508 * expression.cs (ConvertImplicit): Do built-in conversions first.
17510 2001-09-27 Ravi Pratap <ravi@ximian.com>
17512 * expression.cs (UserImplicitCast::Resolve): Fix bug.
17514 2001-09-27 Ravi Pratap <ravi@ximian.com>
17516 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
17517 I had introduced long ago (what's new ?).
17519 * expression.cs (UserImplicitCast::CanConvert): Static method to do
17520 the work of all the checking.
17521 (ConvertImplicit): Call CanConvert and only then create object if necessary.
17522 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
17524 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
17525 that is the right way.
17527 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
17528 overloading resolution. Use everywhere instead of cutting and pasting code.
17530 (Binary::ResolveOperator): Use MakeUnionSet.
17532 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
17533 we have to convert to bool types. Not complete yet.
17535 2001-09-27 Miguel de Icaza <miguel@ximian.com>
17537 * typemanager.cs (TypeManager::CSharpName): support ushort.
17539 * expression.cs (Expression::TryImplicitIntConversion): Attempts
17540 to provide an expression that performsn an implicit constant int
17541 conversion (section 6.1.6).
17542 (Expression::ConvertImplicitRequired): Reworked to include
17543 implicit constant expression conversions.
17545 (Expression::ConvertNumericExplicit): Finished.
17547 (Invocation::Emit): If InstanceExpression is null, then it means
17548 that we perform a call on this.
17550 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17552 * expression.cs (Unary::Emit): Remove some dead code.
17553 (Probe): Implement Resolve and Emit for `is'.
17554 (Expression::ConvertImplicitRequired): Attempt to do constant
17555 expression conversions here. Maybe should be moved to
17556 ConvertImplicit, but I am not sure.
17557 (Expression::ImplicitLongConstantConversionPossible,
17558 Expression::ImplicitIntConstantConversionPossible): New functions
17559 that tell whether is it possible to apply an implicit constant
17560 expression conversion.
17562 (ConvertNumericExplicit): Started work on explicit numeric
17565 * cs-parser.jay: Update operator constants.
17567 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
17568 (Parameters::GetSignature): Hook up VerifyArgs here.
17569 (Parameters::VerifyArgs): Verifies that no two arguments have the
17572 * class.cs (Operator): Update the operator names to reflect the
17573 ones that the spec expects (as we are just stringizing the
17576 * expression.cs (Unary::ResolveOperator): Fix bug: Use
17577 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
17578 previous usage did only work for our methods.
17579 (Expression::ConvertImplicit): Handle decimal implicit numeric
17580 conversions as well.
17581 (Expression::InternalTypeConstructor): Used to invoke constructors
17582 on internal types for default promotions.
17584 (Unary::Emit): Implement special handling for the pre/post
17585 increment/decrement for overloaded operators, as they need to have
17586 the same semantics as the other operators.
17588 (Binary::ResolveOperator): ditto.
17589 (Invocation::ConversionExists): ditto.
17590 (UserImplicitCast::Resolve): ditto.
17592 2001-09-26 Ravi Pratap <ravi@ximian.com>
17594 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
17595 operator, return after emitting body. Regression tests pass again !
17597 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
17598 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
17599 (Invocation::OverloadResolve): Ditto.
17600 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
17602 * everywhere : update calls to the above methods accordingly.
17604 2001-09-26 Miguel de Icaza <miguel@ximian.com>
17606 * assign.cs (Assign): Make it inherit from ExpressionStatement.
17608 * expression.cs (ExpressionStatement): New base class used for
17609 expressions that can appear in statements, so that we can provide
17610 an alternate path to generate expression that do not leave a value
17613 (Expression::Emit, and all the derivatives): We no longer return
17614 whether a value is left on the stack or not. Every expression
17615 after being emitted leaves a single value on the stack.
17617 * codegen.cs (EmitContext::EmitStatementExpression): Use the
17618 facilties of ExpressionStatement if possible.
17620 * cs-parser.jay: Update statement_expression.
17622 2001-09-25 Miguel de Icaza <miguel@ximian.com>
17624 * driver.cs: Change the wording of message
17626 2001-09-25 Ravi Pratap <ravi@ximian.com>
17628 * expression.cs (Binary::ResolveOperator): Had forgottten to set
17629 the type of the expression to the return type of the method if
17630 we have an overloaded operator match ! The regression tests pass again !
17631 (Unary::ResolveOperator): Ditto.
17633 * expression.cs (Invocation::ConversionExists): Correct the member lookup
17634 to find "op_Implicit", not "implicit" ;-)
17635 (UserImplicitCast): New class to take care of user-defined implicit conversions.
17636 (ConvertImplicit, ForceConversion): Take TypeContainer argument
17638 * everywhere : Correct calls to the above accordingly.
17640 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
17641 (ConvertImplicit): Do user-defined conversion if it exists.
17643 2001-09-24 Miguel de Icaza <miguel@ximian.com>
17645 * assign.cs: track location.
17646 (Resolve): Use implicit conversions on assignment.
17648 * literal.cs: Oops. Not good, Emit of short access values should
17649 pass (Bytes) or the wrong argument will be selected.
17651 * expression.cs (Unary::Emit): Emit code for -expr.
17653 (Unary::ResolveOperator): Handle `Substract' for non-constants
17654 (substract from zero from the non-constants).
17655 Deal with Doubles as well.
17657 (Expression::ConvertImplicitRequired): New routine that reports an
17658 error if no implicit conversion exists.
17660 (Invocation::OverloadResolve): Store the converted implicit
17661 expressions if we make them
17663 2001-09-24 Ravi Pratap <ravi@ximian.com>
17665 * class.cs (ConstructorInitializer): Take a Location argument.
17666 (ConstructorBaseInitializer): Same here.
17667 (ConstructorThisInitializer): Same here.
17669 * cs-parser.jay : Update all calls accordingly.
17671 * expression.cs (Unary, Binary, New): Take location argument.
17672 Update accordingly everywhere.
17674 * cs-parser.jay : Update all calls to the above to take a location
17677 * class.cs : Ditto.
17679 2001-09-24 Ravi Pratap <ravi@ximian.com>
17681 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
17682 (Invocation::BetterConversion): Same here
17683 (Invocation::ConversionExists): Ditto.
17685 (Invocation::ConversionExists): Implement.
17687 2001-09-22 Ravi Pratap <ravi@ximian.com>
17689 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
17690 Also take an additional TypeContainer argument.
17692 * All over : Pass in TypeContainer as argument to OverloadResolve.
17694 * typemanager.cs (CSharpName): Update to check for the string type and return
17697 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
17700 2001-09-21 Ravi Pratap <ravi@ximian.com>
17702 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
17703 (Invocation::BetterFunction): Implement.
17704 (Invocation::BetterConversion): Implement.
17705 (Invocation::ConversionExists): Skeleton, no implementation yet.
17707 Okay, things work fine !
17709 2001-09-21 Miguel de Icaza <miguel@ximian.com>
17711 * typemanager.cs: declare and load enum_type, delegate_type and
17714 * expression.cs (Expression::Emit): Now emit returns a value that
17715 tells whether a value is left on the stack or not. This strategy
17716 might be reveted tomorrow with a mechanism that would address
17717 multiple assignments.
17718 (Expression::report118): Utility routine to report mismatches on
17721 (Unary::Report23): Report impossible type/operator combination
17724 (Unary::IsIncrementableNumber): Whether the type can be
17725 incremented or decremented with add.
17726 (Unary::ResolveOperator): Also allow enumerations to be bitwise
17728 (Unary::ResolveOperator): Implement ++, !, ~,
17730 (Invocation::Emit): Deal with new Emit convetion.
17732 * All Expression derivatives: Updated their Emit method to return
17733 whether they leave values on the stack or not.
17735 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
17736 stack for expressions that are statements.
17738 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17740 * expression.cs (LValue): New interface. Must be implemented by
17742 (LocalVariableReference, ParameterReference, FieldExpr): Implement
17745 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
17746 interface for generating code, simplifies the code.
17748 2001-09-20 Ravi Pratap <ravi@ximian.com>
17750 * expression.cs (everywhere): Comment out return statements in ::Resolve
17751 methods to avoid the warnings.
17753 2001-09-20 Miguel de Icaza <miguel@ximian.com>
17755 * driver.cs (parse): Report error 2001 if we can not open the
17758 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
17761 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
17764 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
17765 otherwise nested blocks end up with the same index.
17767 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
17769 * expression.cs: Instead of having FIXMEs in the Resolve
17770 functions, throw exceptions so it is obvious that we are facing a
17773 * cs-parser.jay (invocation_expression): Pass Location information.
17775 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
17776 Use a basename for those routines because .NET does not like paths
17779 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
17782 2001-09-19 Miguel de Icaza <miguel@ximian.com>
17784 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
17785 are loading the correct data types (throws an exception if not).
17786 (TypeManager::InitCoreTypes): Use CoreLookupType
17788 * expression.cs (Unary::ResolveOperator): return the child
17789 expression for expressions which are just +expr.
17790 (Unary::ResolveOperator): Return negative literals for -LITERAL
17791 expressions (otherwise they are Unary {Literal}).
17792 (Invocation::Badness): Take into account `Implicit constant
17793 expression conversions'.
17795 * literal.cs (LongLiteral): Implement long literal class.
17796 (IntLiteral): export the `Value' of the intliteral.
17798 2001-09-19 Ravi Pratap <ravi@ximian.com>
17800 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
17802 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
17803 instead of 'Operator'
17805 * expression.cs (Binary::ResolveOperator): Update accordingly.
17806 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
17809 * cs-parser.jay (unary_expression): Update to use the new names.
17811 * gen-treedump.cs (GetUnary): Same here.
17813 * expression.cs (Unary::Resolve): Implement.
17814 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
17815 operators are found instead of making noise ;-)
17816 (Unary::ResolveOperator): New method to do precisely the same thing which
17817 Binary::ResolveOperator does for Binary expressions.
17818 (Unary.method, .Arguments): Add.
17819 (Unary::OperName): Implement.
17820 (Unary::ForceConversion): Copy and Paste !
17822 * class.cs (Operator::Define): Fix a small bug for the case when we have
17825 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
17826 for the inbuilt operators. Only overloading works for now ;-)
17828 2001-09-18 Miguel de Icaza <miguel@ximian.com>
17830 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
17831 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
17833 * expression.cs (This::Emit): Implement.
17834 (This::Resolve): Implement.
17835 (TypeOf:Resolve): Implement.
17836 (Expression::ResolveSimpleName): Add an implicit this to instance
17838 (MemberAccess::Resolve): Deal with Parameters and Fields.
17839 Bind instance variable to Field expressions.
17840 (FieldExpr::Instance): New field used to track the expression that
17841 represents the object instance.
17842 (FieldExpr::Resolve): Track potential errors from MemberLookup not
17844 (FieldExpr::Emit): Implement.
17846 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
17847 the last instruction contains a return opcode to avoid generating
17848 the last `ret' instruction (this generates correct code, and it is
17849 nice to pass the peverify output).
17851 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
17852 initializer for static and instance variables.
17853 (Constructor::Emit): Allow initializer to be null in the case of
17854 static constructors. Only emit initializer for instance
17857 (TypeContainer::FindMembers): Return a null array if there are no
17860 Also fix the code for the MemberTypes.Method branch, as it was not
17861 scanning that for operators (or tried to access null variables before).
17863 * assign.cs (Assign::Emit): Handle instance and static fields.
17867 * driver.cs: Stop compilation if there are parse errors.
17869 * cs-parser.jay (constructor_declaration): Provide default base
17870 initializer for non-static constructors.
17871 (constructor_declarator): Do not provide a default base
17872 initializers if none was specified.
17873 Catch the fact that constructors should not have parameters.
17875 * class.cs: Do not emit parent class initializers for static
17876 constructors, that should be flagged as an error.
17878 2001-09-18 Ravi Pratap <ravi@ximian.com>
17880 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
17881 Move back code into TypeContainer::Populate.
17883 2001-09-18 Ravi Pratap <ravi@ximian.com>
17885 * class.cs (TypeContainer::AddConstructor): Fix the check to
17886 compare against Name, not Basename.
17887 (Operator::OpType): Change Plus and Minus to Add and Subtract.
17889 * cs-parser.jay : Update accordingly.
17891 * class.cs (TypeContainer::FindMembers): For the case where we are searching
17892 for methods, don't forget to look into the operators too.
17893 (RegisterMethodBuilder): Helper method to take care of this for
17894 methods, constructors and operators.
17895 (Operator::Define): Completely revamp.
17896 (Operator.OperatorMethod, MethodName): New fields.
17897 (TypeContainer::Populate): Move the registering of builders into
17898 RegisterMethodBuilder.
17899 (Operator::Emit): Re-write.
17901 * expression.cs (Binary::Emit): Comment out code path to emit method
17902 invocation stuff for the case when we have a user defined operator. I am
17903 just not able to get it right !
17905 2001-09-17 Miguel de Icaza <miguel@ximian.com>
17907 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
17910 (Expression::MemberLookup): Provide a version that allows to
17911 specify the MemberTypes and BindingFlags.
17913 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
17914 so it was not fetching variable information from outer blocks.
17916 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
17917 Beforefieldinit as it was buggy.
17919 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
17920 that Ravi put here.
17922 * class.cs (Constructor::Emit): Only emit if block is not null.
17923 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
17924 deal with this by semantically definining it as if the user had
17927 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
17928 constructors as we now "emit" them at a higher level.
17930 (TypeContainer::DefineDefaultConstructor): Used to define the
17931 default constructors if none was provided.
17933 (ConstructorInitializer): Add methods Resolve and Emit.
17935 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
17937 2001-09-17 Ravi Pratap <ravi@ximian.com>
17939 * class.cs (TypeContainer::EmitDefaultConstructor): Register
17940 the default constructor builder with our hashtable for methodbuilders
17943 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
17944 and argument_count is 0 in which case we have a match.
17945 (Binary::ResolveOperator): More null checking and miscellaneous coding
17948 2001-09-17 Ravi Pratap <ravi@ximian.com>
17950 * rootcontext.cs (IsNameSpace): Compare against null.
17952 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
17954 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
17955 and Unary::Operator.
17957 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
17960 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
17961 we have overloaded operators.
17962 (Binary::ResolveOperator): Implement the part which does the operator overload
17965 * class.cs (Operator::Emit): Implement.
17966 (TypeContainer::Emit): Emit the operators we have too.
17968 * expression.cs (Binary::Emit): Update to emit the appropriate code for
17969 the case when we have a user-defined operator.
17971 2001-09-17 Miguel de Icaza <miguel@ximian.com>
17973 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
17975 2001-09-16 Ravi Pratap <ravi@ximian.com>
17977 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
17978 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
17979 (Constructor::Emit): Implement.
17980 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
17981 if we have no work to do.
17982 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
17985 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
17986 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
17988 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
17991 2001-09-15 Ravi Pratap <ravi@ximian.com>
17993 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
17995 (Tree::RecordNamespace): Method to do what the name says ;-)
17996 (Tree::Namespaces): Property to get at the namespaces hashtable.
17998 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
18001 * rootcontext.cs (IsNamespace): Fixed it :-)
18003 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18005 * class.cs (TypeContainer::FindMembers): Add support for
18007 (MethodCore): New class that encapsulates both the shared aspects
18008 of a Constructor and a Method.
18009 (Method, Constructor): Factored pieces into MethodCore.
18011 * driver.cs: Added --fatal which makes errors throw exceptions.
18012 Load System assembly as well as part of the standard library.
18014 * report.cs: Allow throwing exceptions on errors for debugging.
18016 * modifiers.cs: Do not use `parent', instead use the real type
18017 container to evaluate permission settings.
18019 * class.cs: Put Ravi's patch back in. He is right, and we will
18020 have to cope with the
18022 2001-09-14 Ravi Pratap <ravi@ximian.com>
18024 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
18025 FamORAssem, not FamANDAssem.
18027 2001-09-14 Miguel de Icaza <miguel@ximian.com>
18029 * driver.cs: Added --parse option that only parses its input files
18032 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
18033 incorrect. IsTopLevel is not used to tell whether an object is
18034 root_types or not (that can be achieved by testing this ==
18035 root_types). But to see if this is a top-level *class* (not
18036 necessarly our "toplevel" container).
18038 2001-09-14 Ravi Pratap <ravi@ximian.com>
18040 * enum.cs (Enum::Define): Modify to call the Lookup method on the
18041 parent instead of a direct call to GetType.
18043 2001-09-14 Ravi Pratap <ravi@ximian.com>
18045 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
18046 Modifiers.TypeAttr. This should just be a call to that method.
18048 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
18049 object so that we can determine if we are top-level or not.
18051 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
18054 * enum.cs (Enum::Define): Ditto.
18056 * modifiers.cs (FieldAttr): Re-write.
18058 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
18059 (TypeContainer::HaveStaticConstructor): New property to provide access
18060 to precisely that info.
18062 * modifiers.cs (MethodAttr): Re-write.
18063 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
18065 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
18066 of top-level types as claimed.
18068 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18070 * expression.cs (MemberLookup): Fruitless attempt to lookup
18071 constructors. Maybe I need to emit default constructors? That
18072 might be it (currently .NET emits this for me automatically).
18073 (Invocation::OverloadResolve): Cope with Arguments == null.
18074 (Invocation::EmitArguments): new function, shared by the new
18075 constructor and us.
18076 (Invocation::Emit): Handle static and instance methods. Emit
18077 proper call instruction for virtual or non-virtual invocations.
18078 (New::Emit): Implement.
18079 (New::Resolve): Implement.
18080 (MemberAccess:Resolve): Implement.
18081 (MethodGroupExpr::InstanceExpression): used conforming to the spec
18082 to track instances.
18083 (FieldExpr::Resolve): Set type.
18085 * support.cs: Handle empty arguments.
18087 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
18088 SimpleLookup): Auxiliary routines to help parse a qualifier
18091 Update qualifier_identifier rule.
18093 * codegen.cs: Removed debugging messages.
18095 * class.cs: Make this a global thing, this acts just as a "key" to
18096 objects that we might have around.
18098 (Populate): Only initialize method_builders_to_methods once.
18100 * expression.cs (PropertyExpr): Initialize type from the
18103 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
18104 Resolve pattern. Attempt to implicitly convert value to boolean.
18107 * expression.cs: Set the type for the int32/int32 argument case.
18108 (Binary::ResolveOperator): Set the return type to boolean for
18109 comparission operators
18111 * typemanager.cs: Remove debugging print code.
18113 (Invocation::Resolve): resolve type.
18115 * class.cs: Allocate a MemberInfo of the correct size, as the code
18116 elsewhere depends on the test to reflect the correct contents.
18118 (Method::) Keep track of parameters, due to System.Reflection holes
18120 (TypeContainer::Populate): Keep track of MethodBuilders to Method
18123 (TypeContainer::FindMembers): Use ArrayList and then copy an array
18124 of the exact size and return that.
18126 (Class::LookupMethodByBuilder): New function that maps
18127 MethodBuilders to its methods. Required to locate the information
18128 on methods because System.Reflection bit us again.
18130 * support.cs: New file, contains an interface ParameterData and
18131 two implementations: ReflectionParameters and InternalParameters
18132 used to access Parameter information. We will need to grow this
18135 * expression.cs (Invocation::GetParameterData): implement a cache
18136 and a wrapper around the ParameterData creation for methods.
18137 (Invocation::OverloadResolve): Use new code.
18139 2001-09-13 Ravi Pratap <ravi@ximian.com>
18141 * class.cs (TypeContainer::EmitField): Remove and move into
18142 (Field::Define): here and modify accordingly.
18143 (Field.FieldBuilder): New member.
18144 (TypeContainer::Populate): Update accordingly.
18145 (TypeContainer::FindMembers): Implement.
18147 2001-09-13 Miguel de Icaza <miguel@ximian.com>
18149 * statement.cs: (VariableInfo::VariableType): New field to be
18150 initialized with the full type once it is resolved.
18152 2001-09-12 Miguel de Icaza <miguel@ximian.com>
18154 * parameter.cs (GetParameterInfo): Use a type cache to compute
18155 things only once, and to reuse this information
18157 * expression.cs (LocalVariableReference::Emit): Implement.
18158 (OpcodeCast::Emit): fix.
18160 (ParameterReference::Resolve): Implement.
18161 (ParameterReference::Emit): Implement.
18163 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
18164 that are expressions need to stay as Expressions.
18166 * typemanager.cs (CSharpName): Returns the C# name of a type if
18169 * expression.cs (Expression::ConvertImplicit): New function that
18170 implements implicit type conversions.
18172 (Expression::ImplicitReferenceConversion): Implements implicit
18173 reference conversions.
18175 (EmptyCast): New type for transparent casts.
18177 (OpcodeCast): New type for casts of types that are performed with
18178 a sequence of bytecodes.
18180 (BoxedCast): New type used for casting value types into reference
18181 types. Emits a box opcode.
18183 (Binary::DoNumericPromotions): Implements numeric promotions of
18184 and computation of the Binary::Type.
18186 (Binary::EmitBranchable): Optimization.
18188 (Binary::Emit): Implement code emission for expressions.
18190 * typemanager.cs (TypeManager): Added two new core types: sbyte
18193 2001-09-12 Ravi Pratap <ravi@ximian.com>
18195 * class.cs (TypeContainer::FindMembers): Method which does exactly
18196 what Type.FindMembers does, only we don't have to use reflection. No
18197 implementation yet.
18199 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
18200 typecontainer objects as we need to get at them.
18201 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
18203 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
18204 typecontainer object.
18206 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
18207 of just a Report object.
18209 2001-09-11 Ravi Pratap <ravi@ximian.com>
18211 * class.cs (Event::Define): Go back to using the prefixes "add_" and
18213 (TypeContainer::Populate): Now define the delegates of the type too.
18214 (TypeContainer.Delegates): Property to access the list of delegates defined
18217 * delegates.cs (Delegate::Define): Implement partially.
18219 * modifiers.cs (TypeAttr): Handle more flags.
18221 2001-09-11 Ravi Pratap <ravi@ximian.com>
18223 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
18225 (Operator::Define): Re-write logic to get types by using the LookupType method
18226 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
18227 (Indexer::Define): Ditto.
18228 (Event::Define): Ditto.
18229 (Property::Define): Ditto.
18231 2001-09-10 Ravi Pratap <ravi@ximian.com>
18233 * class.cs (TypeContainer::Populate): Now define operators too.
18234 (TypeContainer.Operators): New property to access the list of operators
18236 (Operator.OperatorMethodBuilder): New member to hold the method builder
18237 for the operator we are defining.
18238 (Operator::Define): Implement.
18240 2001-09-10 Ravi Pratap <ravi@ximian.com>
18242 * class.cs (Event::Define): Make the prefixes of the accessor methods
18243 addOn_ and removeOn_
18245 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
18246 of the location being passed in too. Ideally, this should go later since all
18247 error reporting should be done through the Report object.
18249 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
18250 (Populate): Iterate thru the indexers we have and define them too.
18251 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
18252 for the get and set accessors.
18253 (Indexer::Define): Implement.
18255 2001-09-09 Miguel de Icaza <miguel@ximian.com>
18257 * expression.cs (Binary::Resolve): Beginning of it. I scratched
18258 my previous implementation, did not work.
18260 * typemanager.cs: Add a couple of missing types (the longs).
18262 * literal.cs: Use TypeManager.bool_type instead of getting it.
18264 * expression.cs (EventExpr): New kind of expressions.
18265 (Expressio::ExprClassFromMemberInfo): finish
18267 2001-09-08 Miguel de Icaza <miguel@ximian.com>
18269 * assign.cs: Emit stores to static fields differently.
18271 2001-09-08 Ravi Pratap <ravi@ximian.com>
18273 * Merge in changes and adjust code to tackle conflicts. Backed out my
18274 code in Assign::Resolve ;-)
18276 2001-09-08 Ravi Pratap <ravi@ximian.com>
18278 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
18279 instead Report.Error and also pass in the location.
18280 (CSharpParser::Lexer): New readonly property to return the reference
18281 to the Tokenizer object.
18282 (declare_local_variables): Use Report.Error with location instead of plain
18286 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
18287 (Operator.CheckBinaryOperator): Ditto.
18289 * cs-parser.jay (operator_declarator): Update accordingly.
18291 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
18292 (CheckBinaryOperator): Same here.
18294 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
18295 on the name without any prefixes of namespace names etc. This is because we
18296 already might have something already fully qualified like
18297 'System.Console.WriteLine'
18299 * assign.cs (Resolve): Begin implementation. Stuck ;-)
18301 2001-09-07 Ravi Pratap <ravi@ximian.com>
18303 * cs-tokenizer.cs (location): Return a string which also contains
18306 * expression.cs (ElementAccess): New class for expressions of the
18307 type 'element access.'
18308 (BaseAccess): New class for expressions of the type 'base access.'
18309 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
18312 * cs-parser.jay (element_access): Implement action.
18313 (base_access): Implement actions.
18314 (checked_expression, unchecked_expression): Implement.
18316 * cs-parser.jay (local_variable_type): Correct and implement.
18317 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
18319 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
18321 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
18322 name and the specifiers.
18324 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
18326 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
18327 making them all public ;-)
18329 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
18332 2001-09-07 Miguel de Icaza <miguel@ximian.com>
18334 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
18336 (FieldExpr, PropertyExprs): New resolved expressions.
18337 (SimpleName::MemberStaticCheck): Perform static checks for access
18338 to non-static fields on static methods. Maybe this should be
18339 generalized for MemberAccesses.
18340 (SimpleName::ResolveSimpleName): More work on simple name
18343 * cs-parser.jay (primary_expression/qualified_identifier): track
18344 the parameter index.
18346 * codegen.cs (CodeGen::Save): Catch save exception, report error.
18347 (EmitContext::EmitBoolExpression): Chain to expression generation
18348 instead of temporary hack.
18349 (::EmitStatementExpression): Put generic expression code generation.
18351 * assign.cs (Assign::Emit): Implement variable assignments to
18352 local variables, parameters and fields.
18354 2001-09-06 Miguel de Icaza <miguel@ximian.com>
18356 * statement.cs (Block::GetVariableInfo): New method, returns the
18357 VariableInfo for a variable name in a block.
18358 (Block::GetVariableType): Implement in terms of GetVariableInfo
18360 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
18361 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
18363 2001-09-06 Ravi Pratap <ravi@ximian.com>
18365 * cs-parser.jay (operator_declaration): Continue on my quest : update
18366 to take attributes argument.
18367 (event_declaration): Ditto.
18368 (enum_declaration): Ditto.
18369 (indexer_declaration): Ditto.
18371 * class.cs (Operator::Operator): Update constructor accordingly.
18372 (Event::Event): Ditto.
18374 * delegate.cs (Delegate::Delegate): Same here.
18376 * enum.cs (Enum::Enum): Same here.
18378 2001-09-05 Ravi Pratap <ravi@ximian.com>
18380 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
18382 * ../tests/cs0658.cs : New file to demonstrate error 0658.
18384 * attribute.cs (Attributes): New class to encapsulate all attributes which were
18385 being passed around as an arraylist.
18386 (Attributes::AddAttribute): Method to add attribute sections.
18388 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
18389 (struct_declaration): Update accordingly.
18390 (constant_declaration): Update.
18391 (field_declaration): Update.
18392 (method_header): Update.
18393 (fixed_parameter): Update.
18394 (parameter_array): Ditto.
18395 (property_declaration): Ditto.
18396 (destructor_declaration): Ditto.
18398 * class.cs (Struct::Struct): Update constructors accordingly.
18399 (Class::Class): Ditto.
18400 (Field::Field): Ditto.
18401 (Method::Method): Ditto.
18402 (Property::Property): Ditto.
18403 (TypeContainer::OptAttribute): update property's return type.
18405 * interface.cs (Interface.opt_attributes): New member.
18406 (Interface::Interface): Update to take the extra Attributes argument.
18408 * parameter.cs (Parameter::Parameter): Ditto.
18410 * constant.cs (Constant::Constant): Ditto.
18412 * interface.cs (InterfaceMemberBase): New OptAttributes field.
18413 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
18414 the attributes as a parameter.
18415 (InterfaceProperty): Update constructor call.
18416 (InterfaceEvent): Ditto.
18417 (InterfaceMethod): Ditto.
18418 (InterfaceIndexer): Ditto.
18420 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
18421 pass the attributes too.
18422 (interface_event_declaration): Ditto.
18423 (interface_property_declaration): Ditto.
18424 (interface_method_declaration): Ditto.
18425 (interface_declaration): Ditto.
18427 2001-09-05 Miguel de Icaza <miguel@ximian.com>
18429 * class.cs (Method::Define): Track the "static Main" definition to
18430 create an entry point.
18432 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
18433 EntryPoint if we find it.
18435 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
18436 (EmitContext::ig): Make this variable public.
18438 * driver.cs: Make the default output file be the first file name
18439 with the .exe extension.
18441 Detect empty compilations
18443 Handle various kinds of output targets. Handle --target and
18444 rename -t to --dumper.
18446 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
18447 methods inherited from Expression return now an Expression. This
18448 will is used during the tree rewriting as we resolve them during
18451 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
18452 the spec. Missing entirely is the information about
18453 accessability of elements of it.
18455 (Expression::ExprClassFromMemberInfo): New constructor for
18456 Expressions that creates a fully initialized Expression based on
18457 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
18460 (Invocation::Resolve): Begin implementing resolution of invocations.
18462 * literal.cs (StringLiteral): Implement Emit.
18464 2001-09-05 Ravi Pratap <ravi@ximian.com>
18466 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
18469 2001-09-04 Ravi Pratap <ravi@ximian.com>
18471 * cs-parser.jay (attribute_arguments): Implement actions.
18472 (attribute): Fix bug in production. Implement action.
18473 (attribute_list): Implement.
18474 (attribute_target): Implement.
18475 (attribute_target_specifier, opt_target_specifier): Implement
18476 (CheckAttributeTarget): New method to check if the attribute target
18478 (attribute_section): Implement.
18479 (opt_attributes): Implement.
18481 * attribute.cs : New file to handle attributes.
18482 (Attribute): Class to hold attribute info.
18484 * cs-parser.jay (opt_attribute_target_specifier): Remove production
18485 (attribute_section): Modify production to use 2 different rules to
18486 achieve the same thing. 1 s/r conflict down !
18487 Clean out commented, useless, non-reducing dimension_separator rules.
18489 * class.cs (TypeContainer.attributes): New member to hold list
18490 of attributes for a type.
18491 (Struct::Struct): Modify to take one more argument, the attribute list.
18492 (Class::Class): Ditto.
18493 (Field::Field): Ditto.
18494 (Method::Method): Ditto.
18495 (Property::Property): Ditto.
18497 * cs-parser.jay (struct_declaration): Update constructor call to
18498 pass in the attributes too.
18499 (class_declaration): Ditto.
18500 (constant_declaration): Ditto.
18501 (field_declaration): Ditto.
18502 (method_header): Ditto.
18503 (fixed_parameter): Ditto.
18504 (parameter_array): Ditto.
18505 (property_declaration): Ditto.
18507 * constant.cs (Constant::Constant): Update constructor similarly.
18508 Use System.Collections.
18510 * parameter.cs (Parameter::Parameter): Update as above.
18512 2001-09-02 Ravi Pratap <ravi@ximian.com>
18514 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
18515 (TypeContainer.delegates): New member to hold list of delegates.
18517 * cs-parser.jay (delegate_declaration): Implement the action correctly
18518 this time as I seem to be on crack ;-)
18520 2001-09-02 Miguel de Icaza <miguel@ximian.com>
18522 * rootcontext.cs (RootContext::IsNamespace): new function, used to
18523 tell whether an identifier represents a namespace.
18525 * expression.cs (NamespaceExpr): A namespace expression, used only
18526 temporarly during expression resolution.
18527 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
18528 utility functions to resolve names on expressions.
18530 2001-09-01 Miguel de Icaza <miguel@ximian.com>
18532 * codegen.cs: Add hook for StatementExpressions.
18534 * class.cs: Fix inverted test for static flag in methods.
18536 2001-09-02 Ravi Pratap <ravi@ximian.com>
18538 * class.cs (Operator::CheckUnaryOperator): Correct error number used
18539 to make it coincide with MS' number.
18540 (Operator::CheckBinaryOperator): Ditto.
18542 * ../errors/errors.txt : Remove error numbers added earlier.
18544 * ../errors/cs1019.cs : Test case for error # 1019
18546 * ../errros/cs1020.cs : Test case for error # 1020
18548 * cs-parser.jay : Clean out commented cruft.
18549 (dimension_separators, dimension_separator): Comment out. Ostensibly not
18550 used anywhere - non-reducing rule.
18551 (namespace_declarations): Non-reducing rule - comment out.
18553 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
18554 with TypeContainer::AddEnum.
18556 * delegate.cs : New file for delegate handling classes.
18557 (Delegate): Class for declaring delegates.
18559 * makefile : Update.
18561 * cs-parser.jay (delegate_declaration): Implement.
18563 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
18565 * class.cs (Event::Define): Implement.
18566 (Event.EventBuilder): New member.
18568 * class.cs (TypeContainer::Populate): Update to define all enums and events
18570 (Events): New property for the events arraylist we hold. Shouldn't we move to using
18571 readonly fields for all these cases ?
18573 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18575 * class.cs (Property): Revamp to use the convention of making fields readonly.
18576 Accordingly modify code elsewhere.
18578 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
18579 the Define method of the Property class.
18581 * class.cs : Clean up applied patch and update references to variables etc. Fix
18583 (TypeContainer::Populate): Update to define all the properties we have. Also
18584 define all enumerations.
18586 * enum.cs (Define): Implement.
18588 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
18590 * cs-parser.jay (overloadable_operator): The semantic value is an
18591 enum of the Operator class.
18592 (operator_declarator): Implement actions.
18593 (operator_declaration): Implement.
18595 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
18596 validity of definitions.
18597 (Operator::CheckBinaryOperator): Static method to check for binary operators
18598 (TypeContainer::AddOperator): New method to add an operator to a type.
18600 * cs-parser.jay (indexer_declaration): Added line to actually call the
18601 AddIndexer method so it gets added ;-)
18603 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
18604 already taken care of by the MS compiler ?
18606 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18608 * class.cs (Operator): New class for operator declarations.
18609 (Operator::OpType): Enum for the various operators.
18611 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
18613 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
18614 ostensibly handle this in semantic analysis.
18616 * cs-parser.jay (general_catch_clause): Comment out
18617 (specific_catch_clauses, specific_catch_clause): Ditto.
18618 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
18619 (catch_args, opt_catch_args): New productions.
18620 (catch_clause): Rewrite to use the new productions above
18621 (catch_clauses): Modify accordingly.
18622 (opt_catch_clauses): New production to use in try_statement
18623 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
18624 and re-write the code in the actions to extract the specific and
18625 general catch clauses by being a little smart ;-)
18627 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
18628 Hooray, try and catch statements parse fine !
18630 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18632 * statement.cs (Block::GetVariableType): Fix logic to extract the type
18633 string from the hashtable of variables.
18635 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
18636 I end up making that mistake ;-)
18637 (catch_clauses): Fixed gross error which made Key and Value of the
18638 DictionaryEntry the same : $1 !!
18640 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18642 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
18644 * cs-parser.jay (event_declaration): Correct to remove the semicolon
18645 when the add and remove accessors are specified.
18647 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
18649 * cs-parser.jay (IndexerDeclaration): New helper class to hold
18650 information about indexer_declarator.
18651 (indexer_declarator): Implement actions.
18652 (parsing_indexer): New local boolean used to keep track of whether
18653 we are parsing indexers or properties. This is necessary because
18654 implicit_parameters come into picture even for the get accessor in the
18655 case of an indexer.
18656 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
18658 * class.cs (Indexer): New class for indexer declarations.
18659 (TypeContainer::AddIndexer): New method to add an indexer to a type.
18660 (TypeContainer::indexers): New member to hold list of indexers for the
18663 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18665 * cs-parser.jay (add_accessor_declaration): Implement action.
18666 (remove_accessor_declaration): Implement action.
18667 (event_accessors_declaration): Implement
18668 (variable_declarators): swap statements for first rule - trivial.
18670 * class.cs (Event): New class to hold information about event
18672 (TypeContainer::AddEvent): New method to add an event to a type
18673 (TypeContainer::events): New member to hold list of events.
18675 * cs-parser.jay (event_declaration): Implement actions.
18677 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
18679 * cs-parser.jay (dim_separators): Implement. Make it a string
18680 concatenating all the commas together, just as they appear.
18681 (opt_dim_separators): Modify accordingly
18682 (rank_specifiers): Update accordingly. Basically do the same
18683 thing - instead, collect the brackets here.
18684 (opt_rank_sepcifiers): Modify accordingly.
18685 (array_type): Modify to actually return the complete type string
18686 instead of ignoring the rank_specifiers.
18687 (expression_list): Implement to collect the expressions
18688 (variable_initializer): Implement. We make it a list of expressions
18689 essentially so that we can handle the array_initializer case neatly too.
18690 (variable_initializer_list): Implement.
18691 (array_initializer): Make it a list of variable_initializers
18692 (opt_array_initializer): Modify accordingly.
18694 * expression.cs (New::NType): Add enumeration to help us
18695 keep track of whether we have an object/delegate creation
18696 or an array creation.
18697 (New:NewType, New::Rank, New::Indices, New::Initializers): New
18698 members to hold data about array creation.
18699 (New:New): Modify to update NewType
18700 (New:New): New Overloaded contructor for the array creation
18703 * cs-parser.jay (array_creation_expression): Implement to call
18704 the overloaded New constructor.
18706 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
18708 * class.cs (TypeContainer::Constructors): Return member
18709 constructors instead of returning null.
18711 2001-08-26 Miguel de Icaza <miguel@ximian.com>
18713 * typemanager.cs (InitCoreTypes): Initialize the various core
18714 types after we have populated the type manager with the user
18715 defined types (this distinction will be important later while
18716 compiling corlib.dll)
18718 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
18719 on Expression Classification. Now all expressions have a method
18720 `Resolve' and a method `Emit'.
18722 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
18723 generation from working. Also add some temporary debugging
18726 2001-08-24 Miguel de Icaza <miguel@ximian.com>
18728 * codegen.cs: Lots of code generation pieces. This is only the
18729 beginning, will continue tomorrow with more touches of polish. We
18730 handle the fundamentals of if, while, do, for, return. Others are
18731 trickier and I need to start working on invocations soon.
18733 * gen-treedump.cs: Bug fix, use s.Increment here instead of
18736 * codegen.cs (EmitContext): New struct, used during code
18737 emission to keep a context. Most of the code generation will be
18740 * cs-parser.jay: Add embedded blocks to the list of statements of
18741 this block. So code generation proceeds in a top down fashion.
18743 2001-08-23 Miguel de Icaza <miguel@ximian.com>
18745 * statement.cs: Add support for multiple child blocks.
18747 2001-08-22 Miguel de Icaza <miguel@ximian.com>
18749 * codegen.cs (EmitCode): New function, will emit the code for a
18750 Block of code given a TypeContainer and its ILGenerator.
18752 * statement.cs (Block): Standard public readonly optimization.
18753 (Block::Block constructors): Link children.
18754 (Block::Child): Child Linker.
18755 (Block::EmitVariables): Emits IL variable declarations.
18757 * class.cs: Drop support for MethodGroups here, delay until
18759 (Method::): Applied the same simplification that I did before, and
18760 move from Properties to public readonly fields.
18761 (Method::ParameterTypes): Returns the parameter types for the
18762 function, and implements a cache that will be useful later when I
18763 do error checking and the semantic analysis on the methods is
18765 (Constructor::GetCallingConvention): Renamed from CallingConvetion
18766 and made a method, optional argument tells whether this is a class
18767 or a structure to apply the `has-this' bit.
18768 (Method::GetCallingConvention): Implement, returns the calling
18770 (Method::Define): Defines the type, a second pass is performed
18771 later to populate the methods.
18773 (Constructor::ParameterTypes): implement a cache similar to the
18774 one on Method::ParameterTypes, useful later when we do semantic
18777 (TypeContainer::EmitMethod): New method. Emits methods.
18779 * expression.cs: Removed MethodGroup class from here.
18781 * parameter.cs (Parameters::GetCallingConvention): new method.
18783 2001-08-21 Miguel de Icaza <miguel@ximian.com>
18785 * class.cs (TypeContainer::Populate): Drop RootContext from the
18788 (Constructor::CallingConvention): Returns the calling convention.
18789 (Constructor::ParameterTypes): Returns the constructor parameter
18792 (TypeContainer::AddConstructor): Keep track of default constructor
18793 and the default static constructor.
18795 (Constructor::) Another class that starts using `public readonly'
18796 instead of properties.
18798 (Constructor::IsDefault): Whether this is a default constructor.
18800 (Field::) use readonly public fields instead of properties also.
18802 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
18803 track of static constructors; If none is used, turn on
18804 BeforeFieldInit in the TypeAttributes.
18806 * cs-parser.jay (opt_argument_list): now the return can be null
18807 for the cases where there are no arguments.
18809 (constructor_declarator): If there is no implicit `base' or
18810 `this', then invoke the default parent constructor.
18812 * modifiers.cs (MethodAttr): New static function maps a set of
18813 modifiers flags into a MethodAttributes enum
18814 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
18815 MethodAttr, TypeAttr to represent the various mappings where the
18816 modifiers are used.
18817 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
18819 2001-08-19 Miguel de Icaza <miguel@ximian.com>
18821 * parameter.cs (GetParameterInfo): Fix bug where there would be no
18824 * interface.cs (PopulateIndexer): Implemented the code generator
18825 for interface indexers.
18827 2001-08-17 Miguel de Icaza <miguel@ximian.com>
18829 * interface.cs (InterfaceMemberBase): Now we track the new status
18832 (PopulateProperty): Implement property population. Woohoo! Got
18833 Methods and Properties going today.
18835 Removed all the properties for interfaces, and replaced them with
18836 `public readonly' fields.
18838 2001-08-16 Miguel de Icaza <miguel@ximian.com>
18840 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
18841 initialize their hashtables/arraylists only when they are needed
18842 instead of doing this always.
18844 * parameter.cs: Handle refs and out parameters.
18846 * cs-parser.jay: Use an ArrayList to construct the arguments
18847 instead of the ParameterCollection, and then cast that to a
18850 * parameter.cs: Drop the use of ParameterCollection and use
18851 instead arrays of Parameters.
18853 (GetParameterInfo): Use the Type, not the Name when resolving
18856 2001-08-13 Miguel de Icaza <miguel@ximian.com>
18858 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
18859 and instead use public readonly fields.
18861 * class.cs: Put back walking code for type containers.
18863 2001-08-11 Miguel de Icaza <miguel@ximian.com>
18865 * class.cs (MakeConstant): Code to define constants.
18867 * rootcontext.cs (LookupType): New function. Used to locate types
18870 2001-08-08 Miguel de Icaza <miguel@ximian.com>
18872 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
18873 this System.Reflection code is. Kudos to Microsoft
18875 * typemanager.cs: Implement a type cache and avoid loading all
18876 types at boot time. Wrap in LookupType the internals. This made
18877 the compiler so much faster. Wow. I rule!
18879 * driver.cs: Make sure we always load mscorlib first (for
18880 debugging purposes, nothing really important).
18882 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
18883 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
18885 * rootcontext.cs: Lookup types on their namespace; Lookup types
18886 on namespaces that have been imported using the `using' keyword.
18888 * class.cs (TypeContainer::TypeAttr): Virtualize.
18889 (Class::TypeAttr): Return attributes suitable for this bad boy.
18890 (Struct::TypeAttr): ditto.
18891 Handle nested classes.
18892 (TypeContainer::) Remove all the type visiting code, it is now
18893 replaced with the rootcontext.cs code
18895 * rootcontext.cs (GetClassBases): Added support for structs.
18897 2001-08-06 Miguel de Icaza <miguel@ximian.com>
18899 * interface.cs, statement.cs, class.cs, parameter.cs,
18900 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
18901 Drop use of TypeRefs, and use strings instead.
18903 2001-08-04 Miguel de Icaza <miguel@ximian.com>
18907 * class.cs (Struct::Struct): set the SEALED flags after
18908 checking the modifiers.
18909 (TypeContainer::TypeAttr): new property, returns the
18910 TypeAttributes for a class.
18912 * cs-parser.jay (type_list): Oops, list production was creating a
18913 new list of base types.
18915 * rootcontext.cs (StdLib): New property.
18916 (GetInterfaceTypeByName): returns an interface by type name, and
18917 encapsulates error handling here.
18918 (GetInterfaces): simplified.
18919 (ResolveTree): Encapsulated all the tree resolution here.
18920 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
18923 * driver.cs: Add support for --nostdlib, to avoid loading the
18924 default assemblies.
18925 (Main): Do not put tree resolution here.
18927 * rootcontext.cs: Beginning of the class resolution.
18929 2001-08-03 Miguel de Icaza <miguel@ximian.com>
18931 * rootcontext.cs: Provide better error reporting.
18933 * cs-parser.jay (interface_base): set our $$ to be interfaces.
18935 * rootcontext.cs (CreateInterface): Handle the case where there
18936 are no parent interfaces.
18938 (CloseTypes): Routine to flush types at the end.
18939 (CreateInterface): Track types.
18940 (GetInterfaces): Returns an array of Types from the list of
18941 defined interfaces.
18943 * typemanager.c (AddUserType): Mechanism to track user types (puts
18944 the type on the global type hash, and allows us to close it at the
18947 2001-08-02 Miguel de Icaza <miguel@ximian.com>
18949 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
18950 RecordInterface instead.
18952 * cs-parser.jay: Updated to reflect changes above.
18954 * decl.cs (Definition): Keep track of the TypeBuilder type that
18955 represents this type here. Not sure we will use it in the long
18956 run, but wont hurt for now.
18958 * driver.cs: Smaller changes to accomodate the new code.
18960 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
18963 * rootcontext.cs (CreateInterface): New method, used to create
18964 the System.TypeBuilder type for interfaces.
18965 (ResolveInterfaces): new entry point to resolve the interface
18967 (CodeGen): Property, used to keep track of the code generator.
18969 2001-07-26 Miguel de Icaza <miguel@ximian.com>
18971 * cs-parser.jay: Add a second production for delegate_declaration
18974 (enum_body): Put an opt_comma here instead of putting it on
18975 enum_body or enum_member_declarations so we can handle trailing
18976 commas on enumeration members. Gets rid of a shift/reduce.
18978 (type_list): Need a COMMA in the middle.
18980 (indexer_declaration): Tell tokenizer to recognize get/set
18982 * Remove old targets.
18984 * Re-add the parser target.
18986 2001-07-13 Simon Cozens <simon@simon-cozens.org>
18988 * cs-parser.jay: Add precendence rules for a number of operators
18989 ot reduce the number of shift/reduce conflicts in the grammar.
18991 2001-07-17 Miguel de Icaza <miguel@ximian.com>
18993 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
18996 Get rid of old crufty code.
18998 * rootcontext.cs: Use this to keep track of the parsed
18999 representation and the defined types available to the program.
19001 * gen-treedump.cs: adjust for new convention.
19003 * type.cs: Split out the type manager, and the assembly builder
19006 * typemanager.cs: the type manager will live here now.
19008 * cil-codegen.cs: And the code generator here.
19010 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
19012 * makefile: Fixed up for easy making.
19014 2001-07-13 Simon Cozens <simon@simon-cozens.org>
19016 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
19019 (unary_expression): Expand pre_increment_expression and
19020 post_decrement_expression to reduce a shift/reduce.
19022 2001-07-11 Simon Cozens
19024 * cs-tokenizer.cs: Hex numbers should begin with a 0.
19026 Improve allow_keyword_as_indent name.
19028 2001-06-19 Miguel de Icaza <miguel@ximian.com>
19030 * Adjustments for Beta2.
19032 2001-06-13 Miguel de Icaza <miguel@ximian.com>
19034 * decl.cs: Added `Define' abstract method.
19035 (InTransit): new property, used to catch recursive definitions.
19037 * interface.cs: Implement `Define'.
19039 * modifiers.cs: Map Modifiers.constants to
19040 System.Reflection.TypeAttribute flags.
19042 * class.cs: Keep track of types and user-defined types.
19043 (BuilderInit): New method for creating an assembly
19044 (ResolveType): New function to launch the resolution process, only
19045 used by interfaces for now.
19047 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
19048 that are inserted into the name space.
19050 2001-06-08 Miguel de Icaza <miguel@ximian.com>
19052 * ARGH. I have screwed up my tree so many times due to the use of
19053 rsync rather than using CVS. Going to fix this at once.
19055 * driver.cs: Objetify driver. Load assemblies, use assemblies to
19058 2001-06-07 Miguel de Icaza <miguel@ximian.com>
19060 * Experiment successful: Use System.Type rather that our own
19063 2001-05-25 Miguel de Icaza <miguel@ximian.com>
19065 * cs-parser.jay: Removed nsAliases from here.
19067 Use new namespaces, handle `using XXX;'
19069 * namespace.cs: Reimplemented namespace handling, use a recursive
19070 definition of the class. Now we can keep track of using clauses
19071 and catch invalid using clauses.
19073 2001-05-24 Miguel de Icaza <miguel@ximian.com>
19075 * gen-treedump.cs: Adapted for all the renaming.
19077 * expression.cs (Expression): this class now has a Type property
19078 which returns an expression Type.
19080 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
19081 `Type', as this has a different meaning now in the base
19083 2001-05-22 Miguel de Icaza <miguel@ximian.com>
19085 * interface.cs, class.cs: Removed from all the sources the
19086 references to signature computation, as we can not do method
19087 signature computation during the parsing time, as we are not
19088 trying to solve at that point distinguishing:
19092 void a (NS.Blah x) {}
19095 Which depending on the context might be valid or not, as we do not
19096 know if Blah is the same thing as NS.Blah at that point.
19098 * Redid everything so the code uses TypeRefs now instead of
19099 Types. TypeRefs are just temporary type placeholders, that need
19100 to be resolved. They initially have a pointer to a string and the
19101 current scope in which they are used. This is used later by the
19102 compiler to resolve the reference to an actual Type.
19104 * DeclSpace is no longer a CIR.Type, and neither are
19105 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
19106 are all DeclSpaces, but no Types.
19108 * type.cs (TypeRefManager): This implements the TypeRef manager,
19109 which keeps track of all the types that need to be resolved after
19110 the parsing has finished.
19112 2001-05-13 Miguel de Icaza <miguel@ximian.com>
19114 * ARGH. We are going to have to store `foreach' as a class rather
19115 than resolving it, as we need to verify error 1579 after name
19116 resolution. *OR* we could keep a flag that says `This request to
19117 IEnumerator comes from a foreach statement' which we can then use
19118 to generate the error.
19120 2001-05-10 Miguel de Icaza <miguel@ximian.com>
19122 * class.cs (TypeContainer.AddMethod): we now add methods to the
19123 MethodGroup instead of the method hashtable.
19125 * expression.cs: Add MethodGroup abstraction, which gets us one
19126 step closer to the specification in the way we handle method
19129 * cs-parser.jay (primary_expression): qualified_identifier now
19130 tried to match up an identifier to a local variable reference or
19131 to a parameter reference.
19133 current_local_parameters is now a parser global variable that
19134 points to the current parameters for the block, used during name
19137 (property_declaration): Now creates an implicit `value' argument to
19140 2001-05-09 Miguel de Icaza <miguel@ximian.com>
19142 * parameter.cs: Do not use `param' arguments as part of the
19143 signature, per the spec.
19145 2001-05-08 Miguel de Icaza <miguel@ximian.com>
19147 * decl.cs: Base class for classes, structs and interfaces. This
19148 is the "Declaration Space"
19150 * cs-parser.jay: Use CheckDef for checking declaration errors
19151 instead of having one on each function.
19153 * class.cs: Factor out some code for handling error handling in
19154 accordance to the "Declarations" section in the "Basic Concepts"
19155 chapter in the ECMA C# spec.
19157 * interface.cs: Make all interface member classes derive from
19158 InterfaceMemberBase.
19160 2001-05-07 Miguel de Icaza <miguel@ximian.com>
19162 * Many things: all interfaces are parsed and generated in
19163 gen-treedump. Support for member variables, constructors,
19164 destructors, properties, constants is there.
19166 Beginning of the IL backend, but very little done, just there for
19169 2001-04-29 Miguel de Icaza <miguel@ximian.com>
19171 * cs-parser.jay: Fix labeled statement.
19173 * cs-tokenizer.cs (escape): Escape " and ' always.
19174 ref_line, ref_name: keep track of the line/filename as instructed
19175 by #line by the compiler.
19178 2001-04-27 Miguel de Icaza <miguel@ximian.com>
19180 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
19181 to match the values in System.CodeDOM.
19183 Divid renamed to Divide.
19185 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
19187 (Statements.set): remove.
19189 * System.CodeDOM/CodeCatchClause.cs: always have a valid
19192 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
19193 falseStatements always have valid values.
19195 * cs-parser.jay: Use System.CodeDOM now.