1 2004-11-07 Miguel de Icaza <miguel@ximian.com>
3 * expression.cs (Invocation.OverloadResolve): Flag error if we are
4 calling an unsafe method from a safe location.
6 2004-11-06 Marek Safar <marek.safar@seznam.cz>
9 * codegen.cs (ApplyAttributeBuilder): Do not return; it is only warning.
11 2004-11-06 Miguel de Icaza <miguel@ximian.com>
13 * namespace.cs (VerifyUsing): use GetPartialName instead of
16 2004-11-05 Miguel de Icaza <miguel@ximian.com>
18 * statement.cs (Return.Resolve): Fix regression in typo: if
19 `in_exc', we have to request a NeedReturnLabel, this was a typo
20 introduced in the anonymous method check-in. Fixes #69131.
22 * Indexers were using the ShortName when defining themselves,
23 causing a regression in the compiler bootstrap when applying the
24 patch from 2004-11-02 (first part), now they use their full name
27 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
29 * driver.cs: Strip the path from the names of embedded resources. Fixes
32 2004-11-04 Raja R Harinath <rharinath@novell.com>
34 Fix error message regression: cs0104-2.cs.
35 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
36 (AliasEntry.Resolve): Update.
37 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
39 (RootContext.LookupType): Update.
41 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
43 * cs-parser.jay: Add support for handling accessor modifiers
44 * class: Add support port accessor modifiers and error checking,
45 define PropertyMethod.Define as virtual (not abstract anymore)
46 * ecore.cs: Add checking for proeprties access with access modifiers
47 * iterators.cs: Modify Accessor constructor call based in the modified
49 2004-11-02 Ben Maurer <bmaurer@ximian.com>
51 * expression.cs (StringConcat): Handle being called twice,
52 as when we have a concat in a field init with more than two
55 2004-11-02 Miguel de Icaza <miguel@ximian.com>
57 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
58 special case explicit implementations, we should always produce
59 the .property or .event declaration.
61 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
62 since it will not return correct data if people use this
63 unresolved in the presence of using statements (see test-313).
65 * class.cs (MethodData.Define): If we are an explicit interface
66 implementation, set the method name to the full name of the
67 interface plus the name of the method.
69 Notice that using the method.MethodName.GetFullName() does not
70 work, as it will only contain the name as declared on the source
71 file (it can be a shorthand in the presence of using statements)
72 and not the fully qualifed type name, for example:
76 class D : ICloneable {
77 object ICloneable.Clone () {
81 Would produce a method called `ICloneable.Clone' instead of
82 `System.ICloneable.Clone'.
84 * namespace.cs (Alias.Resolve): Use GetPartialName.
86 2004-11-01 Marek Safar <marek.safar@seznam.cz>
88 * cs-parser.jay: Add error 1055 report.
90 2004-11-01 Miguel de Icaza <miguel@ximian.com>
92 * assign.cs (Assign.DoResolve): Only do the transform of
93 assignment into a New if the types are compatible, if not, fall
94 through and let the implicit code deal with the errors and with
95 the necessary conversions.
97 2004-11-01 Marek Safar <marek.safar@seznam.cz>
99 * cs-parser.jay: Add error 1031 report.
101 * cs-tokenizer.cs: Add location for error 1038.
103 2004-10-31 Marek Safar <marek.safar@seznam.cz>
105 * cs-parser.jay: Add error 1016 report.
107 2004-10-31 Marek Safar <marek.safar@seznam.cz>
109 * cs-parser.jay: Add errors 1575,1611 report.
111 2004-10-31 Marek Safar <marek.safar@seznam.cz>
113 * cs-parser.jay: Add error 1001 report.
115 2004-10-31 Marek Safar <marek.safar@seznam.cz>
118 * attribute.cs (GetMarshal): Add method argument for
119 caller identification.
121 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
122 agument for GetMarshal and RuntimeMissingSupport.
124 2004-10-31 Marek Safar <marek.safar@seznam.cz>
126 * attribute.cs (ExtractSecurityPermissionSet): Removed
127 TypeManager.code_access_permission_type.
129 * typemanager.cs: Removed TypeManager.code_access_permission_type.
131 2004-10-27 Miguel de Icaza <miguel@ximian.com>
133 * expression.cs (LocalVariableReference.DoResolveLValue): Check
134 for obsolete use of a variable here. Fixes regression on errors
135 cs0619-25 and cs0619-26.
137 2004-10-27 Marek Safar <marek.safar@seznam.cz>
139 Fix #62358, implemented security attribute encoding.
141 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
142 Tests permitted SecurityAction for assembly or other types.
143 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
144 data from SecurityPermissionAttribute to PermisionSet class.
146 * class.cs (ApplyAttributeBuilder): Added special handling
147 for System.Security.Permissions.SecurityAttribute based types.
149 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
150 special handling for System.Security.Permissions.SecurityAttribute
153 * enum.cs (ApplyAttributeBuilder): Added special handling
154 for System.Security.Permissions.SecurityAttribute based types.
156 * parameter.cs (ApplyAttributeBuilder): Added special handling
157 for System.Security.Permissions.SecurityAttribute based types.
159 * rootcontext.cs: Next 2 core types.
161 * typemanager.cs (TypeManager.security_permission_attr_type):
162 Built in type for the SecurityPermission Attribute.
163 (code_access_permission_type): Build in type.
165 2004-10-17 Miguel de Icaza <miguel@ximian.com>
167 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
168 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
169 all of this information into
170 EmitContext.EmitCapturedVariableInstance.
172 * codegen.cs (EmitCapturedVariableInstance): move here the
173 funcionality of emitting an ldarg.0 in the presence of a
174 remapping. This centralizes the instance emit code.
176 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
177 then emit a load of this: it means that we have reached the
178 topmost ScopeInfo: the one that contains the pointer to the
179 instance of the class hosting the anonymous method.
181 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
182 captures to the topmost CaptureContext.
184 2004-10-12 Miguel de Icaza <miguel@ximian.com>
186 * expression.cs (LocalVariableReference): Move the knowledge about
187 the iterators into codegen's EmitCapturedVariableInstance.
189 2004-10-11 Miguel de Icaza <miguel@ximian.com>
191 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
192 all code paths return a value from an anonymous method (it is the
193 same as the 161 error, but for anonymous methods).
195 2004-10-08 Miguel de Icaza <miguel@ximian.com>
197 The introduction of anonymous methods in the compiler changed
198 various ways of doing things in the compiler. The most
199 significant one is the hard split between the resolution phase
200 and the emission phases of the compiler.
202 For instance, routines that referenced local variables no
203 longer can safely create temporary variables during the
204 resolution phase: they must do so from the emission phase,
205 since the variable might have been "captured", hence access to
206 it can not be done with the local-variable operations from the runtime.
210 (Block.Flags): New flag `IsTopLevel' to indicate that this block
213 (ToplevelBlock): A new kind of Block, these are the blocks that
214 are created by the parser for all toplevel method bodies. These
215 include methods, accessors and anonymous methods.
217 These contain some extra information not found in regular blocks:
218 A pointer to an optional CaptureContext (for tracking captured
219 local variables and parameters). A pointer to the parent
222 (Return.Resolve): Catch missmatches when returning a value from an
223 anonymous method (error 1662).
224 Invoke NeedReturnLabel from the Resolve phase instead of the emit
227 (Break.Resolve): ditto.
229 (SwitchLabel): instead of defining the labels during the
230 resolution phase, we now turned the public ILLabel and ILLabelCode
231 labels into methods called GetILLabelCode() and GetILLabel() that
232 only define the label during the Emit phase.
234 (GotoCase): Track the SwitchLabel instead of the computed label
235 (its contained therein). Emit the code by using
236 SwitchLabel.GetILLabelCode ().
238 (LocalInfo.Flags.Captured): A new flag has been introduce to track
239 whether the Local has been captured or not.
241 (LocalInfo.IsCaptured): New property, used to tell whether the
242 local has been captured.
244 * anonymous.cs: Vastly updated to contain the anonymous method
247 The main classes here are: CaptureContext which tracks any
248 captured information for a toplevel block and ScopeInfo used to
249 track the activation frames for various local variables.
251 Each toplevel block has an optional capture context associated
252 with it. When a method contains an anonymous method both the
253 toplevel method and the anonymous method will create a capture
254 context. When variables or parameters are captured, they are
255 recorded on the CaptureContext that owns them, for example:
259 MyDelegate d = delegate {
264 Here `a' will be recorded as captured on the toplevel
265 CapturedContext, the inner captured context will not have anything
266 (it will only have data if local variables or parameters from it
267 are captured in a nested anonymous method.
269 The ScopeInfo is used to track the activation frames for local
270 variables, for example:
272 for (int i = 0; i < 10; i++)
273 for (int j = 0; j < 10; j++){
274 MyDelegate d = delegate {
279 At runtime this captures a single captured variable `i', but it
280 captures 10 different versions of the variable `j'. The variable
281 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
284 The toplevel ScopeInfo will also track information like the `this'
285 pointer if instance variables were referenced (this is necessary
286 as the anonymous method lives inside a nested class in the host
289 (AnonymousMethod): Expanded to track the Toplevel, implement
290 `AnonymousMethod.Compatible' to tell whether an anonymous method
291 can be converted to a target delegate type.
293 The routine now also produces the anonymous method content
295 (AnonymousDelegate): A helper class that derives from
296 DelegateCreation, this is used to generate the code necessary to
297 produce the delegate for the anonymous method that was created.
299 * assign.cs: API adjustments for new changes in
300 Convert.ImplicitStandardConversionExists.
302 * class.cs: Adjustments to cope with the fact that now toplevel
303 blocks are of type `ToplevelBlock'.
305 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
306 insteda of standard blocks.
308 Flag errors if params arguments are passed to anonymous methods.
310 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
311 `CurrentAnonymousMethod' which points to the current Anonymous
312 Method. The variable points to the AnonymousMethod class that
313 holds the code being compiled. It is set in the new EmitContext
314 created for the anonymous method.
316 (EmitContext.Phase): Introduce a variable and an enumeration to
317 assist in enforcing some rules about when and where we are allowed
318 to invoke certain methods (EmitContext.NeedsReturnLabel is the
319 only one that enfonces this right now).
321 (EmitContext.HaveCaptureInfo): new helper method that returns
322 whether we have a CapturedContext initialized.
324 (EmitContext.CaptureVariable): New method used to register that a
325 LocalInfo must be flagged for capturing.
327 (EmitContext.CapturedParameter): New method used to register that a
328 parameters must be flagged for capturing.
330 (EmitContext.CapturedField): New method used to register that a
331 field must be flagged for capturing.
333 (EmitContext.HaveCapturedVariables,
334 EmitContext.HaveCapturedFields): Return whether there are captured
337 (EmitContext.EmitMethodHostInstance): This is used to emit the
338 instance for the anonymous method. The instance might be null
339 (static methods), this (for anonymous methods that capture nothing
340 and happen to live side-by-side with the current method body) or a
341 more complicated expression if the method has a CaptureContext.
343 (EmitContext.EmitTopBlock): Routine that drives the emission of
344 code: it will first resolve the top block, then emit any metadata
345 and then emit the code. The split is done so that we can extract
346 any anonymous methods and flag any captured variables/parameters.
348 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
349 during this phase, the ILGenerator should not be used as labels
350 and local variables declared here might not be accessible to any
351 code that is part of an anonymous method.
353 Exceptions to this include the temporary variables that are
354 created by some statements internally for holding temporary
357 (EmitContext.EmitMeta): New routine, in charge of emitting all the
360 (EmitContext.TemporaryReturn): This method is typically called
361 from the Emit phase, and its the only place where we allow the
362 ReturnLabel to be defined other than the EmitMeta. The reason is
363 that otherwise we would have to duplicate a lot of logic in the
364 Resolve phases of various methods that today is on the Emit
367 (EmitContext.NeedReturnLabel): This no longer creates the label,
368 as the ILGenerator is not valid during the resolve phase.
370 (EmitContext.EmitThis): Extended the knowledge in this class to
371 work in anonymous methods in addition to iterators.
373 (EmitContext.EmitCapturedVariableInstance): This emits whatever
374 code is necessary on the stack to access the instance to a local
375 variable (the variable will be accessed as a field).
377 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
378 EmitContext.EmitAddressOfParameter): Routines to support
379 parameters (not completed at this point).
381 Removals: Removed RemapLocal and RemapLocalLValue. We probably
382 will also remove the parameters.
384 * convert.cs (Convert): Define a `ConstantEC' which points to a
385 null. This is just to prefity some code that uses
386 ImplicitStandardConversion code and do not have an EmitContext
389 The idea is to flag explicitly that at that point in time, it is
390 known that the conversion will not trigger the delegate checking
391 code in implicit conversions (which requires a valid
394 Everywhere: pass new EmitContext parameter since
395 ImplicitStandardConversionExists now requires it to check for
396 anonymous method conversions.
398 (Convert.ImplicitStandardConversionExists): If the type of an
399 expression is the anonymous_method_type, and the type is a
400 delegate, we invoke the AnonymousMethod.Compatible method to check
401 whether an implicit conversion is possible.
403 (Convert.ImplicitConversionStandard): Only do implicit method
404 group conversions if the language level is not ISO_1.
406 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
407 MethodInfo for the Invoke method. used by Delegate and
410 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
411 method conversions if the target type is a delegate.
413 Removed extra debugging nops.
415 (LocalVariableReference): Turn the `local_info' into a public
418 Add `prepared' field, the same hack used for FieldExprs to cope
419 with composed assignments, as Local variables do not necessarily
420 operate purely on the stack as they used to: they can be captured
423 Add `temp' for a temporary result, like fields.
425 Refactor DoResolve and DoResolveLValue into DoResolveBase.
427 It now copes with Local variables that are captured and emits the
428 proper instance variable to load it from a field in the captured
431 (ParameterReference.DoResolveBase): During the resolve phase,
432 capture parameters if we are in an anonymous method.
434 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
435 anonymous method, use the EmitContext helper routines to emit the
438 * iterators.cs: Set RemapToProxy to true/false during the
441 * parameters.cs (GetParameterByName): New helper method.
443 * typemanager.cs (anonymous_method_type) a new type that
444 represents an anonyous method. This is always an internal type,
445 used as a fencepost to test against the anonymous-methodness of an
448 2004-10-24 Marek Safar <marek.safar@seznam.cz>
450 Fixed bugs #63705, #67130
451 * decl.cs (MemberCache.MemberCache): Add parameter to distinguish
452 imported and defined interfaces.
453 (CacheEntry, EntryType): Changed to protected internal.
455 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
458 * typemanager.cs (LookupInterfaceContainer): New method.
459 Fills member container from base interfaces.
461 2004-10-20 Marek Safar <marek.safar@seznam.cz>
463 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
465 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
467 2004-10-18 Martin Baulig <martin@ximian.com>
469 Merged latest changes into gmcs. Please keep this comment in
470 here, it makes it easier for me to see what changed in MCS since
471 the last time I merged.
473 2004-10-18 Martin Baulig <martin@ximian.com>
475 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
476 `Type' directly, but call ResolveType() on it.
477 (Catch.Resolve): Likewise.
478 (Foreach.Resolve): Likewise.
480 2004-10-18 Martin Baulig <martin@ximian.com>
482 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
483 `Type' directly, but call ResolveType() on it.
484 (Probe.DoResolve): Likewise.
485 (ArrayCreation.LookupType): Likewise.
486 (TypeOf.DoResolve): Likewise.
487 (SizeOf.DoResolve): Likewise.
489 2004-10-18 Martin Baulig <martin@ximian.com>
491 * expression.cs (Invocation.BetterFunction): Put back
492 TypeManager.TypeToCoreType().
494 2004-10-18 Raja R Harinath <rharinath@novell.com>
496 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
499 2004-10-18 Martin Baulig <martin@ximian.com>
501 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
502 `Type' directly, but call ResolveType() on it.
504 2004-10-18 Martin Baulig <martin@ximian.com>
506 * class.cs (FieldMember.Define): Don't access the TypeExpr's
507 `Type' directly, but call ResolveType() on it.
508 (MemberBase.DoDefine): Likewise.
510 * expression.cs (New.DoResolve): Don't access the TypeExpr's
511 `Type' directly, but call ResolveType() on it.
512 (ComposedCast.DoResolveAsTypeStep): Likewise.
514 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
515 `Type' directly, but call ResolveType() on it.
517 2004-10-17 John Luke <john.luke@gmail.com>
519 * class.cs (Operator.GetSignatureForError): use CSharpName
521 * parameter.cs (Parameter.GetSignatureForError): Returns
522 correct name even if was not defined.
524 2004-10-13 Raja R Harinath <rharinath@novell.com>
527 * class.cs (TypeContainer.EmitContext): New property.
528 (DefineNestedTypes): Create an emitcontext for each part.
529 (MethodCore.DoDefineParameters): Use container's emitcontext.
530 Pass type array to InternalParameters.
531 (MemberBase.DoDefine): Use container's emitcontext.
532 (FieldMember.Define): Likewise.
533 (Event.Define): Likewise.
534 (SetMethod.GetParameterInfo): Change argument to EmitContext.
535 Pass type array to InternalParameters.
536 (SetIndexerMethod.GetParameterInfo): Likewise.
537 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
538 * delegate.cs (Define): Pass emitcontext to
539 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
540 array to InternalParameters.
541 * expression.cs (ParameterReference.DoResolveBase): Pass
542 emitcontext to GetParameterInfo.
543 (ComposedCast.DoResolveAsTypeStep): Remove check on
544 ec.ResolvingTypeTree.
545 * parameter.cs (Parameter.Resolve): Change argument to
546 EmitContext. Use ResolveAsTypeTerminal.
547 (Parameter.GetSignature): Change argument to EmitContext.
548 (Parameters.ComputeSignature): Likewise.
549 (Parameters.ComputeParameterTypes): Likewise.
550 (Parameters.GetParameterInfo): Likewise.
551 (Parameters.ComputeAndDefineParameterTypes): Likewise.
552 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
553 * support.cs (InternalParameters..ctor): Remove variant that takes
555 * typemanager.cs (system_intptr_expr): New.
556 (InitExpressionTypes): Initialize it.
558 2004-10-12 Chris Toshok <toshok@ximian.com>
560 * cs-parser.jay: fix location for try_statement and catch_clause.
562 2004-10-11 Martin Baulig <martin@ximian.com>
564 * report.cs: Don't make --fatal abort on warnings, we have
565 -warnaserror for that.
567 2004-10-07 Raja R Harinath <rharinath@novell.com>
569 More DeclSpace.ResolveType avoidance.
570 * decl.cs (MemberCore.InUnsafe): New property.
571 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
572 with newly created EmitContext.
573 (FieldMember.Define): Likewise.
574 * delegate.cs (Delegate.Define): Likewise.
575 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
576 only if normal name-lookup fails.
577 (TypeExpr.DoResolve): Enable error-checking.
578 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
579 (SizeOf.DoResolve): Likewise.
580 (ComposedCast.DoResolveAsTypeStep): Likewise.
581 (StackAlloc.DoResolve): Likewise.
582 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
583 (Block.Unsafe): New property.
584 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
585 (Unsafe): Set 'unsafe' flag of contained block.
586 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
587 (Fixed.Resolve): Likewise.
588 (Catch.Resolve): Likewise.
589 (Using.ResolveLocalVariableDecls): Likewise.
590 (Foreach.Resolve): Likewise.
592 2004-10-05 John Luke <john.luke@gmail.com>
594 * cs-parser.jay: add location to error CS0175
596 2004-10-04 Miguel de Icaza <miguel@ximian.com>
598 * ecore.cs (Expression.Constantity): Add support for turning null
601 * const.cs (Const.Define): Allow constants to be reference types
602 as long as the value is Null.
604 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
606 * namespace.cs (NamespaceEntry.Using): No matter which warning
607 level is set, check if this namespace name has already been added.
609 2004-10-03 Ben Maurer <bmaurer@ximian.com>
611 * expression.cs: reftype [!=]= null should always use br[true,false].
614 2004-10-03 Marek Safar <marek.safar@seznam.cz>
617 * attribute.cs: Enum conversion moved to
618 GetAttributeArgumentExpression to be applied to the all
621 2004-10-01 Raja R Harinath <rharinath@novell.com>
623 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
624 * class.c (TypeContainer.DefineType): Flag error if
625 base types aren't accessible due to access permissions.
626 * decl.cs (DeclSpace.ResolveType): Move logic to
627 Expression.ResolveAsTypeTerminal.
628 (DeclSpace.ResolveTypeExpr): Thin layer over
629 Expression.ResolveAsTypeTerminal.
630 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
631 Refactor code into NestedAccess. Use it.
632 (DeclSpace.NestedAccess): New.
633 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
634 argument to silence errors. Check access permissions.
635 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
636 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
637 (Cast.DoResolve): Likewise.
638 (New.DoResolve): Likewise.
639 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
640 (TypeOf.DoResolve): Likewise.
642 * expression.cs (Invocation.BetterConversion): Return the Type of
643 the better conversion. Implement section 14.4.2.3 more faithfully.
644 (Invocation.BetterFunction): Make boolean. Make correspondence to
645 section 14.4.2.2 explicit.
646 (Invocation.OverloadResolve): Update.
647 (Invocation): Remove is_base field.
648 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
649 (Invocation.Emit): Likewise.
651 2004-09-27 Raja R Harinath <rharinath@novell.com>
653 * README: Update to changes.
655 2004-09-24 Marek Safar <marek.safar@seznam.cz>
657 * cs-parser.jay: Reverted 642 warning fix.
659 2004-09-23 Marek Safar <marek.safar@seznam.cz>
662 * decl.cs (FindMemberWithSameName): Indexer can have more than
665 2004-09-23 Marek Safar <marek.safar@seznam.cz>
667 * expression.cs (LocalVariableReference.DoResolveLValue):
668 Do not report warning 219 for out values.
669 (EmptyExpression.Null): New member to avoid extra allocations.
671 2004-09-23 Marek Safar <marek.safar@seznam.cz>
673 * cs-parser.jay: Fix wrong warning 642 report.
675 * cs-tokenizer.cs (CheckNextToken): New helper;
676 Inspect next character if is same as expected.
678 2004-09-23 Martin Baulig <martin@ximian.com>
680 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
681 (Convert.ImplicitReferenceConversionExists): Likewise.
683 2004-09-23 Marek Safar <marek.safar@seznam.cz>
685 * class.cs (Operator.Define): Add error 448 and 559 report.
687 2004-09-22 Marek Safar <marek.safar@seznam.cz>
689 * class.cs (MemberBase.IsTypePermitted): New protected
690 method for checking error CS0610.
692 2004-09-22 Marek Safar <marek.safar@seznam.cz>
694 * class.cs (TypeContainer.HasExplicitLayout): New property
695 Returns whether container has StructLayout attribute set Explicit.
696 (FieldMember): New abstract class for consts and fields.
697 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
698 (Field): Reuse FieldMember.
700 * const.cs (Const): Reuse FieldMember.
702 * rootcontext.cs: EmitConstants call moved to class.
704 2004-09-22 Martin Baulig <martin@ximian.com>
706 Thanks to Peter Sestoft for this bug report.
708 * expression.cs (Conditional): If both the `trueExpr' and the
709 `falseExpr' is a NullLiteral, return a NullLiteral.
711 2004-09-22 Martin Baulig <martin@ximian.com>
713 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
714 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
715 for the "get_Current" call.
717 2004-09-22 Martin Baulig <martin@ximian.com>
719 Marek and me just fixed one of our oldest bugs: #28562 :-)
721 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
723 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
724 we're an EnumConstant, just return that.
725 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
726 an EnumConstant. In this case, we need to use GetValueAsEnumType()
727 to get the value which'll actually be written into the attribute.
728 However, we have to use GetValue() to access the attribute's value
731 2004-09-22 Marek Safar <marek.safar@seznam.cz>
733 * constant.cs (Constant.IsNegative): New abstract property
736 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
737 (StackAlloc.DoResolve): Reused IsNegative.
739 2004-09-21 Martin Baulig <martin@ximian.com>
741 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
742 if we're used in an iterator, we may be called from different
745 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
746 we actually have an exception block.
748 2004-09-20 John Luke <jluke@cfl.rr.com>
750 * class.cs, cs-parser.jay: Improve the error report for 1520:
751 report the actual line where the error happens, not where the
754 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
755 Pass location information that was available elsewhere.
757 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
759 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
760 runtime to delay sign assemblies.
762 2004-09-19 Miguel de Icaza <miguel@ximian.com>
764 * cs-parser.jay: Do not report the stack trace, this is barely
767 2004-08-22 John Luke <john.luke@gmail.com>
769 * driver.cs : check that a resource id is not already used
770 before adding it, report CS1508 if it is, bug #63637
772 2004-09-19 Miguel de Icaza <miguel@ximian.com>
774 * ecore.cs: Removed dead code.
776 2004-09-18 Marek Safar <marek.safar@seznam.cz>
778 * class.cs: Do not report warning CS0067 on the interfaces.
780 2004-09-16 Marek Safar <marek.safar@seznam.cz>
782 * cs-parser.jay: Add error 504 report.
784 2004-09-16 Marek Safar <marek.safar@seznam.cz>
786 * rootcontext.cs: WarningLevel is 4 by default now.
788 * statement.cs (Fixed.Resolve): Do not null
791 2004-09-16 Marek Safar <marek.safar@seznam.cz>
794 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
795 deep search when property is not virtual.
796 (PropertyExpr.ResolveAccessors): Make one call for both
799 2004-09-15 Marek Safar <marek.safar@seznam.cz>
802 * statement.cs: Error 152 report constains also location.
804 2004-09-15 Marek Safar <marek.safar@seznam.cz>
807 * const.cs: Explicitly set constant as static.
809 2004-09-15 Marek Safar <marek.safar@seznam.cz>
812 * cs-parser.jay: Add error 1017 report.
814 2004-09-15 Marek Safar <marek.safar@seznam.cz>
816 Fixed bug #59980, #64224
817 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
819 * typemanager.cs (IsSpecialMethod): Simplified
821 2004-09-14 Marek Safar <marek.safar@seznam.cz>
823 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
824 condition with better params.
826 2004-09-14 Marek Safar <marek.safar@seznam.cz>
829 * attribute.cs (Resolve): Property has to have both
832 2004-09-14 Martin Baulig <martin@ximian.com>
834 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
836 2004-09-14 Marek Safar <marek.safar@seznam.cz>
839 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
840 called and is obsolete then this member suppress message
841 when call is inside next [Obsolete] method or type.
843 * expression.cs: Use TestObsoleteMethodUsage member.
845 2004-09-14 Martin Baulig <martin@ximian.com>
847 * cs-parser.jay: Sync a bit with the GMCS version.
849 2004-09-14 Martin Baulig <martin@ximian.com>
851 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
852 (CSharpParser.yacc_verbose_flag): New public field.
854 * genericparser.cs: Removed.
856 2004-09-14 Raja R Harinath <rharinath@novell.com>
858 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
860 2004-09-13 Marek Safar <marek.safar@seznam.cz>
862 * class.cs (MethodCore.CheckBase): Fix bug #65757.
864 2004-09-10 Martin Baulig <martin@ximian.com>
866 Backported my MemberName changes from GMCS into MCS.
868 - we are now using a special `MemberName' class instead of using
869 strings; in GMCS, the `MemberName' also contains the type
872 - changed the grammar rules a bit:
873 * the old `member_name' is now a `namespace_or_type_name':
874 The rule is that we use `namespace_or_type_name' everywhere
875 where we expect either a "member name" (GetEnumerator) or a
876 "member name" with an explicit interface name
877 (IEnumerable.GetEnumerator).
878 In GMCS, the explicit interface name may include type arguments
879 (IEnumerable<T>.GetEnumerator).
880 * we use `member_name' instead of just `IDENTIFIER' for
882 The rule is that we use `member_name' wherever a member may
883 have type parameters in GMCS.
885 * decl.cs (MemberName): New public class.
886 (MemberCore.MemberName): New public readonly field.
887 (MemberCore.ctor): Take a `MemberName' argument, not a string.
888 (DeclSpace): Likewise.
890 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
891 * enum.cs (Enum.ctor): Likewise.
893 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
895 (AliasEntry.ctor): Take a MemberName, not an Expression.
896 (AliasEntry.UsingAlias): Likewise.
898 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
899 (IMethodData.MemberName): Changed type from string to MemberName.
900 (MemberBase.ExplicitInterfaceName): Likewise.
901 (AbstractPropertyEventMethod.SetupName): Make this private.
902 (AbstractPropertyEventMethod.ctor): Added `string prefix'
903 argument; compute the member name here.
904 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
905 on the `member.MemberName' and the `prefix'.
907 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
909 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
910 thus, we get a `MemberName' instead of a `string'. These
911 declarations may have type parameters in GMCS.
912 (interface_method_declaration, delegate_declaration): Likewise.
913 (class_declaration, interface_declaration): Likewise.
914 (method_header): Use `namespace_or_type_name' instead of
915 `member_name'. We may be an explicit interface implementation.
916 (property_declaration, event_declaration): Likewise.
917 (member_name): This is now just an `IDENTIFIER', not a
918 `namespace_or_type_name'.
919 (type_name, interface_type): Removed.
920 (namespace_or_type_name): Return a MemberName, not an Expression.
921 (primary_expression): Use `member_name' instead of `IDENTIFIER';
922 call GetTypeExpression() on the MemberName to get an expression.
923 (IndexerDeclaration.interface_type): Changed type from string to
925 (MakeName): Operate on MemberName's instead of string's.
927 2004-09-13 Raja R Harinath <rharinath@novell.com>
930 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
931 (NamespaceEntry.Lookup): Add new argument to flag if we want the
932 lookup to avoid symbols introduced by 'using'.
933 * rootcontext.cs (NamespaceLookup): Update.
935 2004-09-12 Marek Safar <marek.safar@seznam.cz>
937 * class.cs (TypeContainer.DoDefineMembers): Do not call
938 DefineDefaultConstructor for static classes.
940 2004-09-12 Marek Safar <marek.safar@seznam.cz>
942 * attribute.cs (Attribute.Resolve): Add error 653 report.
944 * class.cs (Class.ApplyAttributeBuilder): Add error 641
946 (Method.ApplyAttributeBuilder): Add error 685 report.
947 (Operator.Define): Add error 564 report.
949 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
951 * expression.cs (Invocation.DoResolve): Add error
954 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
957 2004-09-11 Marek Safar <marek.safar@seznam.cz>
959 * class.cs (ConstructorInitializer.Resolve):
960 Wrong error number (515->516).
962 2004-09-11 Marek Safar <marek.safar@seznam.cz>
964 * class.cs (Indexer.Define): Add error 631 report.
966 2004-09-11 Marek Safar <marek.safar@seznam.cz>
968 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
970 2004-09-11 Marek Safar <marek.safar@seznam.cz>
972 * expression.cs (Probe.DoResolve): Add error CS0241 report.
974 2004-09-10 Marek Safar <marek.safar@seznam.cz>
976 * cs-parser.jay: Added error CS0241 report.
978 2004-09-10 Raja R Harinath <rharinath@novell.com>
980 * cs-parser.jay (fixed_statement): Introduce a scope for the
981 declaration in the 'fixed' statement.
983 2004-09-09 Marek Safar <marek.safar@seznam.cz>
985 * cs-parser.jay: Added CS0230 error report.
987 2004-09-09 Marek Safar <marek.safar@seznam.cz>
989 * cs-parser.jay: Added errors CS0231 and CS0257 report.
991 2004-09-09 Marek Safar <marek.safar@seznam.cz>
993 * expression.cs (Argument.Resolve): Added error CS0192 and
996 2004-09-09 Marek Safar <marek.safar@seznam.cz>
998 C# 2.0 #pragma warning feature
1000 * cs-tokenizer.cs (PreProcessPragma): New method;
1001 Handles #pragma directive.
1003 * report.cs (WarningRegions): New class; Support
1004 class for #pragma warning directive. It tests whether
1005 warning is enabled for a given line.
1007 2004-09-08 Miguel de Icaza <miguel@ximian.com>
1009 * const.cs: Add more descriptive error report, tahnks to
1012 2004-09-08 Marek Safar <marek.safar@seznam.cz>
1014 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
1016 2004-09-07 Miguel de Icaza <miguel@ximian.com>
1018 * expression.cs: Apply patch from Ben: Remove dead code from
1019 ArrayCreation, and remove the TurnintoConstant call in const.cs,
1020 as that code just threw an exception anwyays.
1022 * const.cs: Remove the call to the turnintoconstant, for details
1025 * literal.cs: The type of the null-literal is the null type; So
1026 we use a placeholder type (literal.cs:System.Null, defined here)
1029 * expression.cs (Conditional.DoResolve): Remove some old code that
1030 is no longer needed, conversions have been fixed.
1032 (ArrayCreationExpression.DoResolve): Return false if we fail to
1033 resolve the inner expression.
1035 2004-09-07 Raja R Harinath <rharinath@novell.com>
1038 * cs-parser.jay (delegate_declaration): Record a delegate
1039 declaration as a type declaration.
1040 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
1042 2004-09-06 Miguel de Icaza <miguel@ximian.com>
1044 * parameter.cs: Do not crash if the type can not be resolved.
1046 * expression.cs: Report errors with unsafe pointers, fixes #64896
1048 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
1050 * expression.cs: Pointer arith always needs to do a conv.i
1051 if the operand is a long. fix 65320
1053 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1055 Fixed cs0619-37.cs, cs0619-38.cs
1057 * enum.cs (GetObsoleteAttribute): Removed.
1059 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
1060 on Enum member is double staged. The first is tested member
1063 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1065 Fixed #56986, #63631, #65231
1067 * class.cs: (TypeContainer.AddToMemberContainer): New method,
1068 adds member to name container.
1069 (TypeContainer.AddToTypeContainer): New method, adds type to
1071 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
1072 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
1073 AddOperator): Simplified by reusing AddToMemberContainer.
1074 (TypeContainer.UserDefinedStaticConstructor): Changed to property
1076 (Method.CheckForDuplications): Fixed implementation to test all
1078 (MemberBase): Detection whether member is explicit interface
1079 implementation is now in constructor.
1080 (MemberBase.UpdateMemberName): Handles IndexerName.
1081 (Accessor): Changed to keep also location information.
1082 (AbstractPropertyEventMethod): Is derived from MemberCore.
1083 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
1084 will be emited or not.
1085 (PropertyBase.AreAccessorsDuplicateImplementation):
1086 Tests whether accessors are not in collision with some method.
1087 (Operator): Is derived from MethodCore to simplify common
1090 * decl.cs (Flags.TestMethodDuplication): Test for duplication
1092 (DeclSpace.AddToContainer): Adds the member to defined_names
1093 table. It tests for duplications and enclosing name conflicts.
1095 * enum.cs (EnumMember): Clean up to reuse the base structures
1097 2004-09-03 Martin Baulig <martin@ximian.com>
1099 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
1100 into TypeContainer, to make partial classes work again.
1102 2004-09-03 Martin Baulig <martin@ximian.com>
1104 * rootcontext.cs (RootContext.V2): Removed.
1106 2004-03-23 Martin Baulig <martin@ximian.com>
1108 * expression.cs (Invocation.OverloadResolve): Added `bool
1109 may_fail' argument and use it instead of the Location.IsNull() hack.
1111 2004-09-03 Martin Baulig <martin@ximian.com>
1113 Merged latest changes into gmcs. Please keep this comment in
1114 here, it makes it easier for me to see what changed in MCS since
1115 the last time I merged.
1117 2004-09-03 Raja R Harinath <rharinath@novell.com>
1120 * expression.cs (BetterConversion): Don't allow either conversion
1121 to be null. Remove redundant implicit conversion test when 'q ==
1122 null' -- when this function is invoked, we already know that the
1123 implicit conversion exists.
1124 (BetterFunction): Assume that 'best' is non-null. Remove
1125 redundant reimplementation of IsApplicable when 'best' is null.
1126 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
1127 number of arguments.
1128 (IsAncestralType): Extract from OverloadResolve.
1129 (OverloadResolve): Make robust to the MethodGroupExpr being
1130 unsorted. Implement all the logic of Section 14.5.5.1, and
1131 support overloading of methods from multiple applicable types.
1132 Clean up logic somewhat. Don't pass null methods to BetterFunction.
1134 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
1135 (RealError, Warning): Append type of report to related symbol.
1137 2004-09-03 Marek Safar <marek.safar@seznam.cz>
1139 * enum.cs: Fixed CLS-Compliance checks for enum members.
1140 Error tests cs3008-8.cs, cs3014-8.cs
1142 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1144 Fixed bug #62342, #63102
1145 * class.cs: ImplementIndexer uses member.IsExplicitImpl
1146 like ImplementMethod.
1148 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1150 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1153 2004-09-02 Martin Baulig <martin@ximian.com>
1155 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
1156 TypeManager.GetArgumentTypes() rather than calling GetParameters()
1159 2004-09-01 Marek Safar <marek.safar@seznam.cz>
1161 C# 2.0 Static classes implemented
1163 * class.cs (TypeContainer): instance_constructors,
1164 initialized_fields, initialized_static_fields,
1165 default_constructor, base_inteface_types are protected to be
1166 accessible from StaticClass.
1167 (TypeContainer.DefineDefaultConstructor): New virtual method
1168 for custom default constructor generating
1169 (StaticClass): New class to handle "Static classes" feature.
1171 * cs-parser.jay: Handle static keyword on class like instance
1174 * driver.cs: Added "/langversion" command line switch with two
1175 options (iso-1, default).
1177 2004-08-31 Marek Safar <marek.safar@seznam.cz>
1179 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
1181 2004-08-31 Miguel de Icaza <miguel@ximian.com>
1183 * delegate.cs: Style.
1185 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
1187 * delegate.cs: Add seperate instance expr field for miguel.
1189 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1191 * PointerArithmetic (Resolve): make sure we are not doing
1192 pointer arith on void*. Also, make sure we are resolved
1193 by not setting eclass until resolve.
1195 All callers: Make sure that PointerArithmetic gets resolved.
1197 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1199 * ArrayCreation (LookupType): If the type does not resolve
1200 to an array, give an error.
1202 2004-08-27 Marek Safar <marek.safar@seznam.cz>
1204 * statement.cs (Try.Resolve): Fixed bug #64222
1206 2004-08-27 Martin Baulig <martin@ximian.com>
1209 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
1212 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1214 * ecore.cs (Constantify): Get underlying type via
1215 System.Enum.GetUnderlyingType to avoid StackOverflow on the
1216 Windows in special cases.
1218 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1220 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
1221 for obtaining also private methods.
1222 (GetRemoveMethod): Used GetRemoveMethod (true)
1223 for obtaining also private methods.
1225 2004-08-24 Martin Baulig <martin@ximian.com>
1227 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
1228 MethodAttributes.HideBySig for operators.
1230 2004-08-23 Martin Baulig <martin@ximian.com>
1232 Back to the old error reporting system :-)
1234 * report.cs (Message): Removed.
1235 (Report.MessageData, ErrorData, WarningData): Removed.
1236 (Report.Error, Warning): Back to the old system.
1238 2004-08-23 Martin Baulig <martin@ximian.com>
1240 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
1242 * class.cs (TypeContainer.ParentContainer): New public virtual
1243 method; replaces the explicit interface implementation.
1244 (ClassPart.ParentContainer): Override.
1246 2004-08-23 Martin Baulig <martin@ximian.com>
1248 * statement.cs (Switch): Added support for constant switches; see
1249 #59428 or test-285.cs.
1251 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1254 * statement.cs (GetEnumeratorFilter): Removed useless
1255 logic because C# specs is strict. GetEnumerator must be
1258 2004-08-22 Martin Baulig <martin@ximian.com>
1260 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1261 a switch and may break, reset the barrier. Fixes #59867.
1263 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1265 CLS-Compliance speed up (~5% for corlib)
1267 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
1268 New method. Tests container for CLS-Compliant names
1270 * class.cs (TypeContainer.VerifyClsName): New method.
1271 Checks whether container name is CLS Compliant.
1272 (Constructor): Implements IMethodData.
1274 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
1275 low-case table for CLS Compliance test.
1276 (MemberCache.VerifyClsParameterConflict): New method.
1277 Checks method parameters for CS3006 error.
1279 * enum.cs (EnumMember): Is derived from MemberCore.
1280 (Enum.VerifyClsName): Optimized for better performance.
1282 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1284 * report.cs: Renamed Error_T to Error and changed all
1287 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1289 * class.cs (TypeContainer.IndexerArrayList): New inner class
1290 container for indexers.
1291 (TypeContainer.DefaultIndexerName): New constant for default
1292 indexer name. Replaced all "Item" with this constant.
1293 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
1295 * typemanager.cs (TypeManager.default_member_ctor): Cache here
1296 DefaultMemberAttribute constructor.
1298 2004-08-05 Martin Baulig <martin@ximian.com>
1300 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1303 2004-08-05 Marek Safar <marek.safar@seznam.cz>
1305 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
1306 multi platforms problem.
1308 * compiler.csproj: Included shared files.
1310 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1312 Fix bug 60333, 55971 in the more general way
1313 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1314 Added arg_type argument for constant conversion.
1315 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
1317 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1320 * class.cs (TypeContainer ): New inner classes MethodArrayList,
1321 OperatorArrayList, MethodCoreArrayList for typecontainer
1322 containers. Changed class member types to these new types.
1323 (MethodArrayList.DefineMembers): Added test for CS0659.
1325 2004-08-04 Miguel de Icaza <miguel@ximian.com>
1327 * cfold.cs: Synchronize the folding with the code in expression.cs
1328 Binary.DoNumericPromotions for uint operands.
1330 * attribute.cs: Revert patch from Raja, it introduced a regression
1331 while building Blam-1.2.1 (hard to isolate a test case).
1333 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1337 (TypeContainer.Define): Renamed to DefineContainerMembers because of
1339 (MethodCore.parent_method): New member. The method we're overriding
1340 if this is an override method.
1341 (MethodCore.CheckBase): Moved from Method class and made common.
1342 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
1344 (MethodCore.CheckForDuplications): New abstract method. For custom
1345 member duplication search in a container
1346 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
1347 method and its return type.
1348 (Event.conflict_symbol): New member. Symbol with same name in the
1352 (MemberCache.FindMemberWithSameName): New method. The method
1353 is looking for conflict with inherited symbols.
1355 2004-08-04 Martin Baulig <martin@ximian.com>
1357 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
1359 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
1361 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1363 * report.cs (Message): New enum for better error, warning reference in
1365 (MessageData): New inner abstract class. It generally handles printing of
1366 error and warning messages.
1367 Removed unused Error, Warning, Message methods.
1369 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1371 Fix for cs0592-8.cs test
1373 (Attributable.ValidAttributeTargets): Made public.
1374 (Attribute.ExplicitTarget): New member for explicit target value.
1375 (Attribute.CheckTargets): Now we translate explicit attribute
1376 target to Target here.
1378 2004-08-03 Ben Maurer <bmaurer@ximian.com>
1380 * ecore.cs (MethodGroupExpr): new IsBase property.
1382 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
1384 * delegate.cs (DelegateCreation): store a MethodGroupExpr
1385 rather than an instance expr.
1387 (DelegateCreation.Emit): Use the method group rather than
1388 the instance expression. Also, if you have base.Foo as the
1389 method for a delegate, make sure to emit ldftn, not ldftnvirt.
1391 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
1393 (NewDelegate.DoResolve): Only check for the existance of Invoke
1394 if the method is going to be needed. Use MethodGroupExpr.
1396 (NewDelegate.Emit): Remove, DelegateCreation implements this.
1398 * expression.cs: For pointer arith., make sure to use
1399 the size of the type, not the size of the pointer to
1402 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1405 * class.cs (Class): Added error CS0502 test.
1407 2004-08-03 John Luke <jluke@cfl.rr.com>
1408 Raja R Harinath <rharinath@novell.com>
1411 * attribute.cs (Attribute.complained_before): New flag.
1412 (Attribute.ResolveType, Attribute.Resolve),
1413 (Attribute.DefinePInvokeMethod): Set it.
1414 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
1416 2004-08-03 Martin Baulig <martin@ximian.com>
1418 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
1419 use a user-defined operator; we still need to do numeric
1420 promotions in case one argument is a builtin type and the other
1421 one has an implicit conversion to that type. Fixes #62322.
1423 2004-08-02 Martin Baulig <martin@ximian.com>
1425 * statement.cs (LocalInfo.Flags): Added `IsThis'.
1426 (LocalInfo.IsThis): New public property.
1427 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
1429 2004-08-01 Martin Baulig <martin@ximian.com>
1431 * class.cs (TypeContainer.GetClassBases): Don't set the default
1432 here since we may get called from GetPartialBases().
1433 (TypeContainer.DefineType): If GetClassBases() didn't return a
1434 parent, use the default one.
1436 2004-07-30 Duncan Mak <duncan@ximian.com>
1438 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
1440 2004-07-30 Martin Baulig <martin@ximian.com>
1442 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
1444 * class.cs (SourceMethod): New public class, derive from the
1445 symbol writer's ISourceMethod.
1446 (Method): Use the new symbol writer API.
1448 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
1449 as argument and use the new symbol writer.
1452 (SourceFile): Implement the symbol writer's ISourceFile.
1453 (Location.SymbolDocument): Removed.
1454 (Location.SourceFile): New public property.
1456 * symbolwriter.cs: Use the new symbol writer API.
1458 2004-07-30 Raja R Harinath <rharinath@novell.com>
1460 * Makefile (install-local): Remove. Functionality moved to
1463 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
1465 * Makefile: Install mcs.exe.config file together with mcs.exe.
1466 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
1467 correct runtime version.
1469 2004-07-25 Martin Baulig <martin@ximian.com>
1472 (TypeContainer.RegisterOrder): Removed, this was unused.
1473 (TypeContainer, interface_order): Removed.
1474 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
1475 TypeContainer as argument since we can also be called with a
1476 `PartialContainer' for a partial class/struct/interface.
1477 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
1478 of checking whether we're an `Interface' - we could be a
1480 (PartialContainer.Register): Override; call
1481 AddClass()/AddStruct()/AddInterface() on our parent.
1483 * cs-parser.jay (interface_member_declaration): Add things to the
1484 `current_container', not the `current_class'.
1486 * rootcontext.cs (RegisterOrder): The overloaded version which
1487 takes an `Interface' was unused, removed.
1489 * typemanager.cs (TypeManager.LookupInterface): Return a
1490 `TypeContainer', not an `Interface'.
1491 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
1492 contain a `PartialContainer' for an interface, so check it's
1493 `Kind' to figure out what it is.
1495 2004-07-25 Martin Baulig <martin@ximian.com>
1497 * class.cs (Class.DefaultTypeAttributes): New public constant.
1498 (Struct.DefaultTypeAttributes): Likewise.
1499 (Interface.DefaultTypeAttributes): Likewise.
1500 (PartialContainer.TypeAttr): Override this and add the
1501 DefaultTypeAttributes.
1503 2004-07-25 Martin Baulig <martin@ximian.com>
1505 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
1506 we can just use the `Parent' field instead.
1508 2004-07-25 Martin Baulig <martin@ximian.com>
1510 * class.cs (TypeContainer.Emit): Renamed to EmitType().
1512 2004-07-25 Martin Baulig <martin@ximian.com>
1514 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
1515 our parts before defining any methods.
1516 (TypeContainer.VerifyImplements): Make this virtual.
1517 (ClassPart.VerifyImplements): Override and call VerifyImplements()
1518 on our PartialContainer.
1520 2004-07-25 Martin Baulig <martin@ximian.com>
1522 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
1524 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
1525 argument, we can just use the `Parent' field instead.
1528 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
1529 (MemberBase.DoDefine): Likewise.
1531 2004-07-24 Martin Baulig <martin@ximian.com>
1533 * decl.cs (MemberCore.Parent): New public field.
1534 (DeclSpace.Parent): Moved to MemberCore.
1536 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
1537 (MemberBase.ctor): Added TypeContainer argument, pass it to our
1539 (FieldBase, Field, Operator): Likewise.
1540 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
1541 (EventField, Event): Likewise.
1543 2004-07-23 Martin Baulig <martin@ximian.com>
1545 * class.cs (PartialContainer): New public class.
1546 (ClassPart): New public class.
1547 (TypeContainer): Added support for partial classes.
1548 (TypeContainer.GetClassBases): Splitted some of the functionality
1549 out into GetNormalBases() and GetPartialBases().
1551 * cs-tokenizer.cs (Token.PARTIAL): New token.
1552 (Tokenizer.consume_identifier): Added some hacks to recognize
1553 `partial', but only if it's immediately followed by `class',
1554 `struct' or `interface'.
1556 * cs-parser.jay: Added support for partial clases.
1558 2004-07-23 Martin Baulig <martin@ximian.com>
1560 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
1561 a `DeclSpace' and also made it readonly.
1562 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
1563 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
1564 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
1566 * cs-parser.jay: Pass the `current_class', not the
1567 `current_container' (at the moment, this is still the same thing)
1568 to a new Method, Property, Event, Indexer or Constructor.
1570 2004-07-23 Martin Baulig <martin@ximian.com>
1572 * cs-parser.jay (CSharpParser): Added a new `current_class' field
1573 and removed the `current_interface' one.
1574 (struct_declaration, class_declaration, interface_declaration):
1575 Set `current_class' to the newly created class/struct/interface;
1576 set their `Bases' and call Register() before parsing their body.
1578 2004-07-23 Martin Baulig <martin@ximian.com>
1580 * class.cs (Kind): New public enum.
1581 (TypeContainer): Made this class abstract.
1582 (TypeContainer.Kind): New public readonly field.
1583 (TypeContainer.CheckDef): New public method; moved here from
1585 (TypeContainer.Register): New public abstract method.
1586 (TypeContainer.GetPendingImplementations): New public abstract
1588 (TypeContainer.GetClassBases): Removed the `is_class' and
1589 `is_iface' parameters.
1590 (TypeContainer.DefineNestedTypes): Formerly known as
1592 (ClassOrStruct): Made this class abstract.
1594 * tree.cs (RootTypes): New public type.
1596 2004-07-20 Martin Baulig <martin@ximian.com>
1598 * tree.cs (Tree.RecordNamespace): Removed.
1599 (Tree.Namespaces): Removed.
1601 * rootcontext.cs (RootContext.IsNamespace): Removed.
1603 * cs-parser.jay (namespace_declaration): Just create a new
1604 NamespaceEntry here.
1606 2004-07-20 Martin Baulig <martin@ximian.com>
1608 * statement.cs (ExceptionStatement): New abstract class. This is
1609 now used as a base class for everyone who's using `finally'.
1610 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
1611 our local variables before using them.
1613 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
1614 virtual method. This is used by Yield.Resolve() to "steal" an
1615 outer block's `finally' clauses.
1616 (FlowBranchingException): The .ctor now takes an ExceptionStatement
1619 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
1620 version which takes an ExceptionStatement. This version must be
1621 used to create exception branchings.
1624 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
1625 (Iterator.EmitMoveNext): Added exception support; protect the
1626 block with a `fault' clause, properly handle 'finally' clauses.
1627 (Iterator.EmitDispose): Run all the `finally' clauses here.
1629 2004-07-20 Martin Baulig <martin@ximian.com>
1631 * iterator.cs: This is the first of a set of changes in the
1632 iterator code. Match the spec more closely: if we're an
1633 IEnumerable, then GetEnumerator() must be called. The first time
1634 GetEnumerator() is called, it returns the current instance; all
1635 subsequent invocations (if any) must create a copy.
1637 2004-07-19 Miguel de Icaza <miguel@ximian.com>
1639 * expression.cs: Resolve the constant expression before returning
1642 2004-07-19 Martin Baulig <martin@ximian.com>
1644 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
1645 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
1646 the return type of the new EmitContext.
1648 2004-07-18 Martin Baulig <martin@ximian.com>
1650 * class.cs (Property.Define): Fix iterators.
1652 * iterators.cs (Iterator.Define): Moved the
1653 `container.AddInterator (this)' call here from the .ctor; only do
1654 it if we resolved successfully.
1656 2004-07-17 Miguel de Icaza <miguel@ximian.com>
1658 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
1659 `true' for preprocessing directives that we parse. The return
1660 value indicates whether we should return to regular tokenizing or
1661 not, not whether it was parsed successfully.
1663 In the past if we were in: #if false ... #line #endif, we would
1664 resume parsing after `#line'. See bug 61604.
1666 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
1667 building: IsEnumType should return true only for enums, not for
1668 enums or System.Enum itself. This fixes #61593.
1670 Likely what happened is that corlib was wrong: mcs depended on
1671 this bug in some places. The bug got fixed, we had to add the
1672 hack, which caused bug 61593.
1674 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
1675 that was a workaround for the older conditions.
1677 2004-07-16 Ben Maurer <bmaurer@ximian.com>
1679 * assign.cs: IAssignMethod has a new interface, as documented
1680 inline. All assignment code now uses this new api.
1682 * ecore.cs, expression.cs: All classes which implement
1683 IAssignMethod now use the new interface.
1685 * expression.cs (Invocation): add a hack to EmitCall so that
1686 IndexerAccess can be the target of a compound assignment without
1687 evaluating its arguments twice.
1689 * statement.cs: Handle changes in Invocation api.
1691 2004-07-16 Martin Baulig <martin@ximian.com>
1693 * iterators.cs: Rewrote this. We're now using one single Proxy
1694 class for both the IEnumerable and the IEnumerator interface and
1695 `Iterator' derives from Class so we can use the high-level API.
1697 * class.cs (TypeContainer.AddIterator): New method.
1698 (TypeContainer.DoDefineType): New protected virtual method, which
1699 is called from DefineType().
1700 (TypeContainer.DoDefineMembers): Call DefineType() and
1701 DefineMembers() on all our iterators.
1702 (TypeContainer.Emit): Call Emit() on all our iterators.
1703 (TypeContainer.CloseType): Call CloseType() on all our iterators.
1705 * codegen.cs (EmitContext.CurrentIterator): New public field.
1707 2004-07-15 Martin Baulig <martin@ximian.com>
1710 (TypeManager.not_supported_exception_type): New type.
1712 2004-07-14 Martin Baulig <martin@ximian.com>
1714 * iterators.cs: Use real error numbers.
1716 2004-07-14 Martin Baulig <martin@ximian.com>
1718 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
1719 requires this to be a System.Collection.IEnumerable and not a
1720 class implementing that interface.
1721 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
1723 2004-07-13 Marek Safar <marek.safar@seznam.cz>
1725 * class.cs: Fixed previous fix, it broke some error tests.
1727 2004-07-12 Martin Baulig <martin@ximian.com>
1729 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
1732 2004-07-09 Miguel de Icaza <miguel@ximian.com>
1734 * assign.cs (LocalTemporary): Add new argument: is_address,If
1735 `is_address' is true, then the value that we store is the address
1736 to the real value, and not the value itself.
1738 * ecore.cs (PropertyExpr): use the new local temporary
1739 stuff to allow us to handle X.Y += z (where X is a struct)
1741 2004-07-08 Martin Baulig <martin@ximian.com>
1743 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
1744 not always return, just like we're doing in Using.Resolve().
1746 2004-07-07 Miguel de Icaza <miguel@ximian.com>
1748 * cs-parser.jay (fixed_statement): flag this as Pinned.
1750 2004-07-06 Miguel de Icaza <miguel@ximian.com>
1752 * typemanager.cs (TypeManager): Removed MakePinned method, this
1753 mechanism is replaced with the .NET 2.x compatible mechanism of
1754 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1756 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1757 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1758 `IsFixed' property which has a different meaning.
1760 2004-07-02 Raja R Harinath <rharinath@novell.com>
1762 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1763 visible from inside a nested class, not just the names of the
1764 immediately enclosing class.
1767 2004-06-24 Raja R Harinath <rharinath@novell.com>
1769 * expression.cs (BetterConversion): Remove buggy special-case
1770 handling of "implicit constant expression conversions". At this
1771 point, we already know that the conversion is possible -- we're
1772 only checking to see which is better.
1774 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1776 * cs-parser.jay: Added error CS0210 test.
1778 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1780 * cs-parser.jay: Added error CS0134 test.
1782 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1785 * cs-parser.jay: Added error CS0145 test.
1787 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1789 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1791 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1793 * expression.cs (StackAlloc.Resolve): The argument may not
1794 be a constant; deal with this case.
1796 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1798 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1799 GetIndexerAttributeValue.
1800 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1802 * class.cs (Indexer.Define): Added error tests for CS0415,
1805 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1807 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1810 2004-06-23 Martin Baulig <martin@ximian.com>
1812 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1813 neither return nor throw, reset the barrier as well. Fixes #60457.
1815 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1817 * class.cs : EventAttributes is now set to None by default.
1818 This fixes bug #60459.
1820 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1823 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1824 Don't throw exception but return null (it's sufficient now).
1826 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1828 * typemanager.cs (GetArgumentTypes): Faster implementation.
1830 2004-06-18 Martin Baulig <martin@ximian.com>
1832 * attribute.cs (Attribute.Resolve): Check whether we're an
1833 EmptyCast which a Constant child. Fixes #60333.
1835 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1837 * statement.cs (EmitCollectionForeach): Account for the fact that
1838 not all valuetypes are in areas which we can take the address of.
1839 For these variables, we store to a temporary variable. Also, make
1840 sure that we dont emit a `callvirt' on a valuetype method.
1842 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1844 * expression.cs (StackAlloc.DoReSolve): Added test for
1845 negative parameter (CS0247).
1847 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1850 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1852 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1855 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1858 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1860 Fix bug #58254 & cs1555.cs, cs1556.cs
1861 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1863 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1865 * cs-parser.jay: Added error CS1669 test for indexers.
1867 2004-06-11 Martin Baulig <martin@ximian.com>
1869 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1870 call this twice: for params and varargs methods.
1872 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1875 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1877 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1879 * attribute.cs (Attribute.GetValidTargets): Made public.
1882 (AbstractPropertyEventMethod): New class for better code sharing.
1883 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1885 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1887 2004-06-11 Raja R Harinath <rharinath@novell.com>
1890 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
1891 that the call to Resolve is part of a MemberAccess.
1892 (Expression.Resolve): Use it for SimpleName resolution.
1893 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
1894 Add 'intermediate' boolean argument.
1895 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
1896 error message when the SimpleName can be resolved ambiguously
1897 between an expression and a type.
1898 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
1900 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
1901 call on the left-side.
1903 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1906 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
1908 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1910 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
1912 2004-06-11 Martin Baulig <martin@ximian.com>
1914 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
1915 varargs methods if applicable.
1917 2004-06-11 Martin Baulig <martin@ximian.com>
1919 * expression.cs (Invocation.EmitCall): Don't use
1920 `method.CallingConvention == CallingConventions.VarArgs' since the
1921 method could also have `CallingConventions.HasThis'.
1923 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1925 * class.cs (Event.GetSignatureForError): Implemented.
1926 Fixed crash in error test cs3010.cs
1928 2004-06-10 Miguel de Icaza <miguel@ximian.com>
1930 * cs-tokenizer.cs: Change the way we track __arglist to be
1931 consistent with the other keywords.
1933 2004-06-09 Miguel de Icaza <miguel@ximian.com>
1935 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
1938 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
1940 * codegen.cs: Check that all referenced assemblies have a strongname
1941 before strongnaming the compiled assembly. If not report error CS1577.
1942 Fix bug #56563. Patch by Jackson Harper.
1943 * typemanager.cs: Added a method to return all referenced assemblies.
1944 Fix bug #56563. Patch by Jackson Harper.
1946 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1949 (Method.ApplyAttributeBuilder): Moved and added conditional
1950 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
1953 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
1955 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1958 * class.cs: (EventField.attribute_targets): Changed default target.
1960 2004-06-08 Martin Baulig <martin@ximian.com>
1962 * expression.cs (Invocation.EmitCall): Enable varargs methods.
1964 2004-06-08 Martin Baulig <martin@ximian.com>
1966 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
1968 2004-06-07 Martin Baulig <martin@ximian.com>
1970 Added support for varargs methods.
1972 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
1975 * cs-parser.jay: Added support for `__arglist'.
1977 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
1979 * expression.cs (Argument.AType): Added `ArgList'.
1980 (Invocation): Added support for varargs methods.
1981 (ArglistAccess): New public class.
1982 (Arglist): New public class.
1984 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
1986 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
1987 a method's top-level block if the method has varargs.
1989 * support.cs (ReflectionParameters, InternalParameters): Added
1990 support for varargs methods.
1992 2004-06-07 Miguel de Icaza <miguel@ximian.com>
1994 * class.cs: Provide location in indexer error report.
1996 * driver.cs: Use standard names.
1998 * namespace.cs: Catch the use of using after a namespace has been
1999 declared also on using aliases.
2001 2004-06-03 Raja R Harinath <rharinath@novell.com>
2004 * typemanager.cs (closure_private_ok, closure_invocation_type)
2005 (closure_qualifier_type, closure_invocation_assembly)
2006 (FilterWithClosure): Move to ...
2007 (Closure): New internal nested class.
2008 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
2009 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
2010 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
2011 (MemberLookup, MemberLookupFailed): Use it.
2012 * expression.cs (New.DoResolve): Treat the lookup for the
2013 constructor as being qualified by the 'new'ed type.
2014 (Indexers.GetIndexersForTypeOrInterface): Update.
2016 2004-06-03 Marek Safar <marek.safar@seznam.cz>
2019 (GetConditionalAttributeValue): New method. Returns
2020 condition of ConditionalAttribute.
2021 (SearchMulti): New method. Returns all attributes of type 't'.
2022 Use it when attribute is AllowMultiple = true.
2023 (IsConditionalMethodExcluded): New method.
2026 (Method.IsExcluded): Implemented. Returns true if method has conditional
2027 attribute and the conditions is not defined (method is excluded).
2028 (IMethodData): Extended interface for ConditionalAttribute support.
2029 (PropertyMethod.IsExcluded): Implemented.
2032 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
2035 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
2038 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
2040 * expression.cs (ArrayCreationExpression): Make this just an
2041 `expression'. It can't be a statement, so the code here was
2044 2004-06-02 Marek Safar <marek.safar@seznam.cz>
2047 * typemanager.cs (GetFullNameSignature): New method for
2050 2004-06-02 Marek Safar <marek.safar@seznam.cz>
2053 * class.cs (MemberBase.GetSignatureForError): New virtual method.
2054 Use this method when MethodBuilder is null.
2055 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
2056 Added test for error CS0626 (MONO reports error for this situation).
2057 (IMethodData.GetSignatureForError): Extended interface.
2059 2004-06-01 Marek Safar <marek.safar@seznam.cz>
2062 (AttributeTester.GetObsoleteAttribute): Returns instance of
2063 ObsoleteAttribute when type is obsolete.
2066 (TypeContainer.VerifyObsoleteAttribute): Override.
2067 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
2068 (MethodCode.VerifyObsoleteAttribute): Override.
2069 (MemberBase.VerifyObsoleteAttribute): Override.
2072 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
2073 and report proper error.
2076 Delegate.VerifyObsoleteAttribute): Override.
2079 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
2080 and report proper error.
2081 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
2084 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
2088 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
2089 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
2090 Added test for ObsoleteAttribute.
2093 (Catch): Derived from Statement.
2095 2004-06-01 Marek Safar <marek.safar@seznam.cz>
2097 Fixed bug #59071 & cs0160.cs
2099 * statement.cs (Try.Resolve): Check here whether order of catch
2100 clauses matches their dependencies.
2102 2004-05-31 Miguel de Icaza <miguel@ximian.com>
2104 * Reverted patch to namespace.cs (Use lookuptypedirect). This
2105 caused a regression: #59343. Referencing nested classes from an
2106 assembly stopped working.
2108 2004-05-31 Martin Baulig <martin@ximian.com>
2110 MCS is now frozen for beta 2.
2112 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2114 * convert.cs: add a trivial cache for overload operator resolution.
2116 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2118 * decl.cs: If possible, use lookuptypedirect here. We can only do
2119 this if there is no `.' after the namespace. Avoids using
2120 LookupType, which does lots of slow processing.
2121 (FindNestedType) New method, does what it says :-).
2122 * namespace.cs: use LookupTypeDirect.
2123 * rootcontext.cs: use membercache, if possible.
2124 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
2126 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2129 According to the spec,
2131 In a member access of the form E.I, if E is a single identifier,
2132 and if the meaning of E as a simple-name (§7.5.2) is a constant,
2133 field, property, localvariable, or parameter with the same type as
2134 the meaning of E as a type-name (§3.8), then both possible
2135 meanings of E are permitted.
2137 We did not check that E as a simple-name had the same type as E as
2140 This trivial check gives us 5-7% on bootstrap time.
2142 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2144 * expression.cs (Invocation.OverloadResolve): Avoid the
2145 use of hashtables and boxing here by allocating on demand.
2147 2004-05-30 Martin Baulig <martin@ximian.com>
2149 * rootcontext.cs (RootContext.LookupType): Don't cache things if
2150 we're doing a silent lookup. Don't try to lookup nested types in
2151 TypeManager.object_type (thanks to Ben Maurer).
2153 2004-05-30 Martin Baulig <martin@ximian.com>
2155 Committing a patch from Ben Maurer.
2157 * rootcontext.cs (RootContext.LookupType): Cache negative results.
2159 2004-05-29 Martin Baulig <martin@ximian.com>
2161 * class.cs (IMethodData.ShouldIgnore): New method.
2163 * typemanager.cs (TypeManager.MethodFlags): Don't take a
2164 `Location' argument, we don't need it anywhere. Use
2165 `IMethodData.ShouldIgnore ()' instead of
2166 `MethodData.GetMethodFlags ()'.
2167 (TypeManager.AddMethod): Removed.
2168 (TypeManager.AddMethod2): Renamed to AddMethod.
2170 2004-05-29 Martin Baulig <martin@ximian.com>
2172 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
2174 * convert.cs (Convert.ImplicitReferenceConversion): If we're
2175 converting from a class type S to an interface type and we already
2176 have an object on the stack, don't box it again. Fixes #52578.
2178 2004-05-29 Martin Baulig <martin@ximian.com>
2180 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
2181 Added support for `params' parameters. Fixes #59267.
2183 2004-05-29 Martin Baulig <martin@ximian.com>
2185 * literal.cs (NullPointer): Provide a private .ctor which sets
2186 `type' to TypeManager.object_type. Fixes #59048.
2188 2004-05-29 Martin Baulig <martin@ximian.com>
2190 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
2191 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
2193 * ecore.cs (EventExpr.instance_expr): Make the field private.
2195 2004-05-26 Marek Safar <marek.safar@seznam.cz>
2197 Fixed bug #50080 & cs0214-2.cs
2198 * expression.cs (Cast.DoResolve): Check unsafe context here.
2200 * statement.cs (Resolve.DoResolve): Likewise.
2202 2004-05-26 Martin Baulig <martin@ximian.com>
2204 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
2206 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
2207 (RootContext.LookupType): Pass down the `silent' flag.
2209 2004-05-25 Martin Baulig <martin@ximian.com>
2212 (MethodGroupExpr.IdenticalTypeName): New public property.
2213 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
2214 expression actually refers to a type.
2216 2004-05-25 Martin Baulig <martin@ximian.com>
2218 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
2219 for #56176 and made it actually work.
2221 2004-05-25 Martin Baulig <martin@ximian.com>
2223 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
2224 (FieldExpr, PropertyExpr): Override and implement
2225 CacheTemporaries. Fixes #52279.
2227 2004-05-25 Miguel de Icaza <miguel@ximian.com>
2229 * location.cs: In the new compiler listing a file twice is a
2230 warning, not an error.
2232 2004-05-24 Martin Baulig <martin@ximian.com>
2234 * enum.cs (Enum.DefineType): For the `BaseType' to be a
2235 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
2237 2004-05-24 Martin Baulig <martin@ximian.com>
2239 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
2240 walking the `using' list. Fixes #53921.
2242 2004-05-24 Martin Baulig <martin@ximian.com>
2244 * const.cs (Const.LookupConstantValue): Added support for
2245 EmptyCast's; fixes #55251.
2247 2004-05-24 Martin Baulig <martin@ximian.com>
2249 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
2250 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
2251 which does the CS0135 check. The reason is that we first need to
2252 check whether the variable actually exists.
2254 2004-05-24 Martin Baulig <martin@ximian.com>
2256 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
2257 than RootContext.LookupType() to find the explicit interface
2260 2004-05-24 Raja R Harinath <rharinath@novell.com>
2262 * Makefile: Simplify. Use executable.make.
2263 * mcs.exe.sources: New file. List of sources of mcs.exe.
2265 2004-05-24 Anders Carlsson <andersca@gnome.org>
2269 Use the invariant culture when doing String.Compare for CLS case
2272 2004-05-23 Martin Baulig <martin@ximian.com>
2274 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
2275 don't have any dots. Fixes #52622, added cs0246-8.cs.
2277 * namespace.cs (NamespaceEntry.Lookup): Likewise.
2279 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2281 * class.cs (MemberBase.Define): Reuse MemberType member for
2282 resolved type. Other methods can use it too.
2284 2004-05-23 Martin Baulig <martin@ximian.com>
2286 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
2287 the variable also exists in the current block (otherwise, we need
2288 to report a CS0103). Fixes #58670.
2290 2004-05-23 Martin Baulig <martin@ximian.com>
2292 * flowanalysis.cs (Reachability.Reachable): Compute this
2293 on-the-fly rather than storing it as a field.
2295 2004-05-23 Martin Baulig <martin@ximian.com>
2297 * flowanalysis.cs (Reachability.And): Manually compute the
2298 resulting `barrier' from the reachability.
2300 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2303 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
2304 instance of ObsoleteAttribute when symbol is obsolete.
2307 (IMethodData): Extended interface for ObsoleteAttribute support.
2309 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2311 * attribute.cs: Fix bug #55970
2313 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2317 (GetObsoleteAttribute): New method. Creates the instance of
2319 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
2320 ObsoleteAttribute when member is obsolete.
2321 (AttributeTester.Report_ObsoleteMessage): Common method for
2322 Obsolete error/warning reporting.
2325 (TypeContainer.base_classs_type): New member for storing parent type.
2328 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
2329 for this MemberCore.
2331 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2333 * attribute.cs, const.cs: Fix bug #58590
2335 2004-05-21 Martin Baulig <martin@ximian.com>
2337 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
2338 out parameters if the end of the method is unreachable. Fixes
2341 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2343 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
2344 Hari was right, why extra method.
2346 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2348 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
2350 2004-05-20 Martin Baulig <martin@ximian.com>
2352 Merged this back from gmcs to keep the differences to a minumum.
2354 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
2355 instead of a Declspace.
2356 (Attribute.ResolveType): Likewise.
2357 (Attributes.Search): Likewise.
2358 (Attributes.Contains): Likewise.
2359 (Attributes.GetClsCompliantAttribute): Likewise.
2361 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
2363 (MethodData.ApplyAttributes): Take an EmitContext instead of a
2366 2004-05-19 Marek Safar <marek.safar@seznam.cz>
2368 Fix bug #58688 (MCS does not report error when the same attribute
2371 * attribute.cs (Attribute.Emit): Distinction between null and default.
2373 2004-05-19 Raja R Harinath <rharinath@novell.com>
2375 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
2376 of a top-level attribute without an attribute target.
2377 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
2379 (Attribute.Conditional_GetConditionName),
2380 (Attribute.Obsolete_GetObsoleteMessage): Update.
2381 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
2382 part of ScanForIndexerName.
2383 (Attribute.CanIgnoreInvalidAttribute): New function.
2384 (Attribute.ScanForIndexerName): Move to ...
2385 (Attributes.ScanForIndexerName): ... here.
2386 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
2387 (Attributes.Search): New internal variant that can choose not to
2388 complain if types aren't resolved. The original signature now
2390 (Attributes.GetClsCompliantAttribute): Use internal variant, with
2391 complaints suppressed.
2392 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
2393 only if it not useful.
2394 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
2395 top-level for attributes that are shared between the assembly
2396 and a top-level class.
2397 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
2398 * class.cs: Update to reflect changes.
2399 (DefineIndexers): Fuse loops.
2400 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
2401 a couple more variants of attribute names.
2403 2004-05-18 Marek Safar <marek.safar@seznam.cz>
2405 Fix bug #52585 (Implemented explicit attribute declaration)
2408 (Attributable.ValidAttributeTargets): New abstract method. It gets
2409 list of valid attribute targets for explicit target declaration.
2410 (Attribute.Target): It holds target itself.
2411 (AttributeSection): Removed.
2412 (Attribute.CheckTargets): New method. It checks whether attribute
2413 target is valid for the current element.
2416 (EventProperty): New class. For events that are declared like
2417 property (with add and remove accessors).
2418 (EventField): New class. For events that are declared like field.
2421 * cs-parser.jay: Implemented explicit attribute target declaration.
2423 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
2424 Override ValidAttributeTargets.
2427 (ReturnParameter): Class for applying custom attributes on
2429 (ParameterAtribute): New class. Class for applying custom
2430 attributes on the parameter type.
2432 2004-05-17 Miguel de Icaza <miguel@ximian.com>
2434 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
2437 (Method): Allow UNSAFE here.
2439 * modifiers.cs: Support unsafe reporting.
2441 2004-05-17 Marek Safar <marek.safar@seznam.cz>
2443 * decl.cs: Fix bug #58478.
2445 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2447 * statement.cs: When checking for unreachable code on an EmptyStatement,
2448 set the location. Fixes bug #58488.
2450 2004-05-13 Miguel de Icaza <miguel@ximian.com>
2452 * driver.cs: Add -pkg handling.
2454 From Gonzalo: UseShelLExecute=false
2456 2004-05-12 Marek Safar <marek.safar@seznam.cz>
2459 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
2461 (Attribute.IsClsCompliaceRequired): Moved to base for better
2463 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
2464 when attribute is AttributeUsageAttribute.
2465 (Attribute.GetValidTargets): Simplified.
2466 (Attribute.GetAttributeUsage): New method returns AttributeUsage
2467 attribute for this type.
2468 (Attribute.ApplyAttributes): Method renamed to Emit and make
2470 (GlobalAttributeSection): New class for special handling of global
2471 attributes (assembly, module).
2472 (AttributeSection.Emit): New method.
2474 * class.cs: Implemented Attributable abstract methods.
2475 (MethodCore.LabelParameters): Moved to Parameter class.
2476 (Accessor): Is back simple class.
2477 (PropertyMethod): Implemented Attributable abstract class.
2478 (DelegateMethod): Implemented Attributable abstract class.
2479 (Event): New constructor for disctintion between normal Event
2480 and Event with accessors.
2482 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
2484 * codegen.cs, const.cs, decl.cs, delegate.cs:
2485 (CommonAssemblyModulClass): Implemented Attributable abstract class
2488 * enum.cs: Implement IAttributeSupport interface.
2489 (EnumMember): New class for emum members. Implemented Attributable
2493 (ParameterBase): Is abstract.
2494 (ReturnParameter): New class for easier [return:] attribute handling.
2496 * typemanager.cs: Removed builder_to_attr.
2498 2004-05-11 Raja R Harinath <rharinath@novell.com>
2501 * attribute.cs (Attribute.GetPositionalValue): New function.
2502 * class.cs (TypeContainer.VerifyMembers): New function.
2503 (TypeContainer.Emit): Use it.
2504 (ClassOrStruct): New base class for Class and Struct.
2505 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
2506 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
2508 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
2509 then each non-static field should have a FieldOffset attribute.
2510 Otherwise, none of the fields should have a FieldOffset attribute.
2511 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
2512 and FieldOffset attributes.
2513 * typemanager.cs (TypeManager.struct_layout_attribute_type)
2514 (TypeManager.field_offset_attribute_type): New core types.
2515 (TypeManager.InitCoreTypes): Initialize them.
2517 2004-05-11 Michal Moskal <malekith@pld-linux.org>
2519 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
2520 Return correct type.
2523 2004-05-09 Miguel de Icaza <miguel@ximian.com>
2525 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
2526 be implicitly converted to ulong.
2528 * expression.cs: The logic for allowing operator &, | and ^ worked
2529 was wrong, it worked before because we did not report an error in
2530 an else branch. Fixes 57895.
2532 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
2533 allow volatile fields to be reference types.
2535 2004-05-07 Miguel de Icaza <miguel@ximian.com>
2537 * driver.cs: Add support for /debug-
2539 2004-05-07 Raja R Harinath <rharinath@novell.com>
2541 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
2542 Add a 'complain' parameter to silence errors.
2543 (Attribute.Resolve): Update to changes. Put in sanity check to catch
2544 silently overlooked type-resolutions.
2545 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
2547 (Attributes.Search): New function.
2548 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
2549 (Attributes.GetAttributeFullName): Remove hack.
2550 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
2551 Update to reflect changes.
2552 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2553 Use Attributes.Search instead of nested loops.
2555 2004-05-07 Marek Safar <marek.safar@seznam.cz>
2558 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
2559 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
2560 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
2562 * report.cs: (Report.Warning): Renamed to Warning_T because of
2563 parameter collision.
2565 2004-05-05 Raja R Harinath <rharinath@novell.com>
2567 * expression.cs (MemberAccess.ResolveMemberAccess):
2568 Exit with non-zero status after Report.Error.
2569 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
2571 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
2573 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2575 * support.cs: Don't hang when the file is empty.
2577 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2579 * support.cs: In SeekableStreamReader, compute the preamble size of the
2580 underlying stream. Position changes should take into account that initial
2583 2004-05-03 Todd Berman <tberman@sevenl.net>
2585 * driver.cs: remove unused GetSysVersion function.
2587 2004-05-03 Todd Berman <tberman@sevenl.net>
2589 * driver.cs: Remove the hack from saturday, as well as the hack
2590 from jackson (LoadAssemblyFromGac), also adds the CWD to the
2591 link_paths to get that bit proper.
2593 2004-05-01 Todd Berman <tberman@sevenl.net>
2595 * driver.cs: Try a LoadFrom before a Load, this checks the current
2596 path. This is currently a bug in mono that is be fixed, however, this
2597 provides a workaround for now. This will be removed when the bug
2600 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
2602 * CryptoConvert.cs: Updated to latest version. Fix issue with
2603 incomplete key pairs (#57941).
2605 2004-05-01 Todd Berman <tberman@sevenl.net>
2607 * driver.cs: Remove '.' from path_chars, now System.* loads properly
2610 2004-04-30 Jackson Harper <jackson@ximian.com>
2612 * codegen.cs: Open keys readonly.
2614 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2616 * typemanager.cs: don't report cyclic struct layout when a struct
2617 contains 2 or more fields of the same type. Failed for Pango.AttrShape
2618 which has 2 Pango.Rectangle fields.
2620 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
2622 * expression.cs: Handle IntPtr comparisons with IL code
2623 rather than a method call.
2625 2004-04-29 Martin Baulig <martin@ximian.com>
2627 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
2628 the list of PropertyInfo's in class hierarchy and find the
2629 accessor. Fixes #56013.
2631 2004-04-29 Martin Baulig <martin@ximian.com>
2633 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
2635 2004-04-29 Martin Baulig <martin@ximian.com>
2637 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2639 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
2641 2004-04-29 Martin Baulig <martin@ximian.com>
2643 * class.cs (ConstructorInitializer.Resolve): Check whether the
2644 parent .ctor is accessible. Fixes #52146.
2646 2004-04-29 Martin Baulig <martin@ximian.com>
2648 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2650 * statement.cs (Using.EmitLocalVariableDecls): Use
2651 TypeManager.idisposable_type, not typeof (IDisposable).
2652 (Foreach.EmitCollectionForeach): Added support for valuetypes.
2654 2004-04-29 Martin Baulig <martin@ximian.com>
2656 * class.cs (Event.Define): Don't emit the field and don't set
2657 RTSpecialName and SpecialName for events on interfaces. Fixes
2660 2004-04-29 Raja R Harinath <rharinath@novell.com>
2662 Refactor Attribute.ApplyAttributes.
2663 * attribute.cs (Attributable): New base class for objects that can
2664 have Attributes applied on them.
2665 (Attribute): Make AttributeUsage fields public.
2666 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
2667 (Attribute.IsInternalCall): New property.
2668 (Attribute.UsageAttr): Convert to a public read-only property.
2669 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
2670 (Attribute.ResolveType, Attribute.Resolve)
2671 (Attribute.ScanForIndexerName): Update to reflect changes.
2672 (Attribute.CheckAttributeTarget): Re-format.
2673 (Attribute.ApplyAttributes): Refactor, to various
2674 Attributable.ApplyAttributeBuilder methods.
2675 * decl.cs (MemberCore): Make Attributable.
2676 * class.cs (Accessor): Make Attributable.
2677 (MethodData.ApplyAttributes): Use proper attribute types, not
2679 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
2680 (TypeContainer.ApplyAttributeBuilder)
2681 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
2682 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
2683 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
2684 (Operator.ApplyAttributeBuilder): New factored-out methods.
2685 * const.cs (Const.ApplyAttributeBuilder): Likewise.
2686 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
2687 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
2688 * parameter.cs (ParameterBase): New Attributable base class
2689 that can also represent Return types.
2690 (Parameter): Update to the changes.
2692 2004-04-29 Jackson Harper <jackson@ximian.com>
2694 * driver.cs: Prefer the corlib system version when looking for
2695 assemblies in the GAC. This is still a hack, but its a better hack
2698 2004-04-29 Marek Safar <marek.safar@seznam.cz>
2700 * decl.cs, enum.cs: Improved error 3005 reporting.
2702 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
2703 (related_symbols): New private member for list of symbols
2704 related to reported error/warning.
2706 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
2708 2004-04-29 Martin Baulig <martin@ximian.com>
2710 * ecore.cs (Expression.Constantify): If we're an enum and
2711 TypeManager.TypeToCoreType() doesn't give us another type, use
2712 t.UnderlyingSystemType. Fixes #56178.
2714 2004-04-29 Martin Baulig <martin@ximian.com>
2716 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
2717 interfaces and for each interface, only add members directly
2718 declared in that interface. Fixes #53255.
2720 2004-04-28 Martin Baulig <martin@ximian.com>
2722 * expression.cs (ConditionalLogicalOperator): Use a temporary
2723 variable for `left' to avoid that we evaluate it more than once;
2726 2004-04-28 Martin Baulig <martin@ximian.com>
2728 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
2731 2004-04-28 Martin Baulig <martin@ximian.com>
2733 * statement.cs (LocalInfo.Resolve): Check whether the type is not
2736 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
2737 whether the type is not void (CS1547).
2739 2004-04-28 Martin Baulig <martin@ximian.com>
2741 * expression.cs (Unary.DoResolveLValue): Override this and report
2742 CS0131 for anything but Operator.Indirection.
2744 2004-04-28 Martin Baulig <martin@ximian.com>
2746 Committing a patch from Ben Maurer; see bug #50820.
2748 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2751 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2754 2004-04-28 Martin Baulig <martin@ximian.com>
2756 Committing a patch from Ben Maurer; see bug #50820.
2758 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2761 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2764 2004-04-28 Martin Baulig <martin@ximian.com>
2766 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
2767 (Block.AddLabel): Call DoLookupLabel() to only search in the
2770 2004-04-28 Martin Baulig <martin@ximian.com>
2772 * cfold.cs (ConstantFold.BinaryFold): Added special support for
2773 comparing StringConstants and NullLiterals in Equality and Inequality.
2775 2004-04-28 Jackson Harper <jackson@ximian.com>
2777 * driver.cs: Attempt to load referenced assemblies from the
2778 GAC. This is the quick and dirty version of this method that
2779 doesnt take into account versions and just takes the first
2780 canidate found. Will be good enough for now as we will not have more
2781 then one version installed into the GAC until I update this method.
2783 2004-04-28 Martin Baulig <martin@ximian.com>
2785 * typemanager.cs (TypeManager.CheckStructCycles): New public
2786 static method to check for cycles in the struct layout.
2788 * rootcontext.cs (RootContext.PopulateTypes): Call
2789 TypeManager.CheckStructCycles() for each TypeContainer.
2790 [Note: We only need to visit each type once.]
2792 2004-04-28 Martin Baulig <martin@ximian.com>
2794 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
2796 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
2797 success and added `out object value'. Use a `bool resolved' field
2798 to check whether we've already been called rather than
2799 `ConstantValue != null' since this breaks for NullLiterals.
2801 2004-04-28 Raja R Harinath <rharinath@novell.com>
2803 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
2804 setting of this flag, since the 'set' method may be non-public.
2806 2004-04-28 Raja R Harinath <rharinath@novell.com>
2808 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
2809 check on current_vector.Block.
2811 2004-04-27 Martin Baulig <martin@ximian.com>
2813 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
2814 a field initializer. Fixes #56459.
2816 2004-04-27 Martin Baulig <martin@ximian.com>
2818 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
2819 we're not attempting to use an indexer. Fixes #52154.
2821 2004-04-27 Martin Baulig <martin@ximian.com>
2823 * statement.cs (Return): Don't create a return label if we don't
2824 need it; reverts my change from January 20th. Thanks to Ben
2827 2004-04-27 Martin Baulig <martin@ximian.com>
2829 According to the spec, `goto' can only leave a nested scope, but
2832 * statement.cs (Block.LookupLabel): Only lookup in the current
2833 block, don't recurse into parent or child blocks.
2834 (Block.AddLabel): Check in parent and child blocks, report
2835 CS0140/CS0158 if we find a duplicate.
2836 (Block): Removed this indexer for label lookups.
2837 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2838 this already does the error reporting for us.
2841 (FlowBranching.UsageVector.Block): New public variable; may be null.
2842 (FlowBranching.CreateSibling): Added `Block' argument.
2843 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2844 label for the target of a `goto' and check whether we're not
2845 leaving a `finally'.
2847 2004-04-27 Martin Baulig <martin@ximian.com>
2849 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2850 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2853 2004-04-27 Martin Baulig <martin@ximian.com>
2855 * statement.cs (Block.AddLabel): Also check for implicit blocks
2856 and added a CS0158 check.
2858 2004-04-27 Martin Baulig <martin@ximian.com>
2860 * flowanalysis.cs (FlowBranchingLoop): New class.
2861 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2862 UsageVector's instead of an ArrayList.
2863 (FlowBranching.Label): Likewise.
2864 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2865 (FlowBranching.AddBreakVector): New method.
2867 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2869 * attribute.cs: Small regression fix: only convert the type if we
2870 the type is different, fixes System.Drawing build.
2872 2004-04-27 Martin Baulig <martin@ximian.com>
2874 * attribute.cs (Attribute.Resolve): If we have a constant value
2875 for a named field or property, implicity convert it to the correct
2878 2004-04-27 Raja R Harinath <rharinath@novell.com>
2880 * statement.cs (Block.Block): Implicit blocks share
2881 'child_variable_names' fields with parent blocks.
2882 (Block.AddChildVariableNames): Remove.
2883 (Block.AddVariable): Mark variable as "used by a child block" in
2884 every surrounding block.
2885 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2886 been used in a child block, complain about violation of "Invariant
2887 meaning in blocks" rule.
2888 * cs-parser.jay (declare_local_variables): Don't use
2889 AddChildVariableNames.
2890 (foreach_statement): Don't create an implicit block: 'foreach'
2893 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2895 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2896 converting from 0L to ulong. Fixes 57522.
2898 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2900 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2901 derived class hides via 'new' keyword field from base class (test-242.cs).
2902 TODO: Handle this in the more general way.
2904 * class.cs (CheckBase): Ditto.
2906 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2908 * decl.cs (caching_flags): New member for storing cached values
2910 (MemberCore.Flags): New enum where bit flags for caching_flags
2912 (MemberCore.cls_compliance): Moved to caching_flags.
2913 (DeclSpace.Created): Moved to caching_flags.
2915 * class.cs: Use caching_flags instead of DeclSpace.Created
2917 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2919 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2920 if we are only a derived class, not a nested class.
2922 * typemanager.cs: Same as above, but do this at the MemberLookup
2923 level (used by field and methods, properties are handled in
2924 PropertyExpr). Allow for the qualified access if we are a nested
2927 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2929 * class.cs: Refactoring.
2930 (IMethodData): New inteface; Holds links to parent members
2931 to avoid member duplication (reduced memory allocation).
2932 (Method): Implemented IMethodData interface.
2933 (PropertyBase): New inner classes for get/set methods.
2934 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2935 (Event): New inner classes for add/remove methods.
2936 (Event.DelegateMethod): Implemented IMethodData interface.
2938 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2939 EmitContext (related to class.cs refactoring).
2941 2004-04-21 Raja R Harinath <rharinath@novell.com>
2943 * delegate.cs (Delegate.VerifyApplicability): If the number of
2944 arguments are the same as the number of parameters, first try to
2945 verify applicability ignoring any 'params' modifier on the last
2949 2004-04-16 Raja R Harinath <rharinath@novell.com>
2951 * class.cs (TypeContainer.AddIndexer): Use
2952 'ExplicitInterfaceName' to determine if interface name was
2953 explicitly specified. 'InterfaceType' is not initialized at this time.
2954 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2955 Indexers array is already in the required order. Initialize
2956 'IndexerName' only if there are normal indexers.
2957 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2958 (TypeContainer.Emit): Emit DefaultMember attribute only if
2959 IndexerName is initialized.
2962 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2964 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2967 2004-04-15 Raja R Harinath <rharinath@novell.com>
2969 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2973 * attribute.cs (Attribute.Resolve): Check for duplicate named
2977 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2979 * iterators.cs (MarkYield): track whether we are in an exception,
2980 and generate code accordingly. Use a temporary value to store the
2981 result for our state.
2983 I had ignored a bit the interaction of try/catch with iterators
2984 since their behavior was not entirely obvious, but now it is
2985 possible to verify that our behavior is the same as MS .NET 2.0
2989 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2991 * iterators.cs: Avoid creating temporaries if there is no work to
2994 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2995 Enumerations, use TypeManager.EnumToUnderlying and call
2998 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
3001 (This.Emit): Use EmitContext.EmitThis to emit our
3004 (This.EmitAssign): Ditto.
3006 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
3007 codepaths, we will move all the functionality into
3010 (FieldExpr.EmitAssign): Ditto.
3012 This fixes several hidden bugs that I uncovered while doing a code
3013 review of this today.
3015 * codegen.cs (EmitThis): reworked so the semantics are more clear
3016 and also support value types "this" instances.
3018 * iterators.cs: Changed so that for iterators in value types, we
3019 do not pass the value type as a parameter.
3021 Initialization of the enumerator helpers is now done in the caller
3022 instead of passing the parameters to the constructors and having
3023 the constructor set the fields.
3025 The fields have now `assembly' visibility instead of private.
3027 2004-04-11 Miguel de Icaza <miguel@ximian.com>
3029 * expression.cs (Argument.Resolve): Check if fields passed as ref
3030 or out are contained in a MarshalByRefObject.
3032 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
3033 another compiler type.
3035 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
3037 * class.cs (Indexer.Define): use the new name checking method.
3038 Also, return false on an error.
3039 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
3040 (is_identifier_[start/part]_character): make static.
3042 2004-04-10 Miguel de Icaza <miguel@ximian.com>
3044 * expression.cs (Binary.ResolveOperator): Do no append strings
3045 twice: since we can be invoked more than once (array evaluation)
3046 on the same concatenation, take care of this here. Based on a fix
3047 from Ben (bug #56454)
3049 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
3051 * codegen.cs: Fix another case where CS1548 must be reported (when
3052 delay-sign isn't specified and no private is available #56564). Fix
3053 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
3054 error when MCS is used on the MS runtime and we need to delay-sign
3055 (which seems unsupported by AssemblyBuilder - see #56621).
3057 2004-04-08 Marek Safar <marek.safar@seznam.cz>
3059 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
3060 (TypeManager.ComputeNamespaces): Faster implementation for
3063 * compiler.csproj: Updated AssemblyName to mcs.
3065 2004-04-07 Miguel de Icaza <miguel@ximian.com>
3067 * rootcontext.cs: Add new types to the boot resolution.
3069 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
3070 MulticastDelegate is not allowed.
3072 * typemanager.cs: Add new types to lookup: System.TypedReference
3075 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
3076 check for TypedReference or ArgIterator, they are not allowed.
3078 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
3079 makes us properly catch 1510 in some conditions (see bug 56016 for
3082 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
3084 * CryptoConvert.cs: update from corlib version
3087 2004-04-05 Miguel de Icaza <miguel@ximian.com>
3089 * class.cs (Indexer.Define): Check indexername declaration
3091 2004-04-05 Marek Safar <marek.safar@seznam.cz>
3093 * attribute.cs (IsClsCompliant): Fixed problem with handling
3094 all three states (compliant, not-compliant, undetected).
3096 2004-03-30 Marek Safar <marek.safar@seznam.cz>
3098 * attribute.cs (Attribute): Location is now public.
3099 (Resolve): Store resolved arguments (pos_values) in attribute class.
3100 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
3101 (GetClsCompliantAttributeValue): New method that gets
3102 CLSCompliantAttribute value.
3103 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
3104 if exists else null.
3105 (AttributeTester): New class for CLS-Compliant verification routines.
3107 * class.cs (Emit): Add CLS-Compliant verification.
3108 (Method.GetSignatureForError): Implemented.
3109 (Constructor.GetSignatureForError): Implemented
3110 (Constructor.HasCompliantArgs): Returns if constructor has
3111 CLS-Compliant arguments.
3112 (Constructor.Emit): Override.
3113 (Construcor.IsIdentifierClsCompliant): New method; For constructors
3114 is needed to test only parameters.
3115 (FieldBase.GetSignatureForError): Implemented.
3116 (TypeContainer): New member for storing base interfaces.
3117 (TypeContainer.FindMembers): Search in base interfaces too.
3119 * codegen.cs (GetClsComplianceAttribute): New method that gets
3120 assembly or module CLSCompliantAttribute value.
3121 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
3123 (ModuleClass.Emit): Add error 3012 test.
3125 * const.cs (Emit): Override and call base for CLS-Compliant tests.
3127 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
3128 state for all decl types.
3129 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
3130 if CLS-Compliant tests are required.
3131 (IsClsCompliaceRequired): New method. Analyze whether code
3132 must be CLS-Compliant.
3133 (IsExposedFromAssembly): New method. Returns true when MemberCore
3134 is exposed from assembly.
3135 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
3136 value or gets cached value.
3137 (HasClsCompliantAttribute): New method. Returns true if MemberCore
3138 is explicitly marked with CLSCompliantAttribute.
3139 (IsIdentifierClsCompliant): New abstract method. This method is
3140 used to testing error 3005.
3141 (IsIdentifierAndParamClsCompliant): New method. Common helper method
3142 for identifier and parameters CLS-Compliant testing.
3143 (VerifyClsCompliance): New method. The main virtual method for
3144 CLS-Compliant verifications.
3145 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
3146 null. I don't know why is null (too many public members !).
3147 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
3148 and get value of first CLSCompliantAttribute that found.
3150 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
3151 (VerifyClsCompliance): Override and add extra tests.
3153 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
3154 clscheck- disable CLS-Compliant verification event if assembly is has
3155 CLSCompliantAttribute(true).
3157 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
3158 ApllyAttribute is now called in emit section as in the other cases.
3159 Possible future Emit integration.
3160 (IsIdentifierClsCompliant): New override.
3161 (VerifyClsCompliance): New override.
3162 (GetEnumeratorName): Returns full enum name.
3164 * parameter.cs (GetSignatureForError): Implemented.
3166 * report.cs (WarningData): New struct for Warning message information.
3167 (LocationOfPreviousError): New method.
3168 (Warning): New method. Reports warning based on the warning table.
3169 (Error_T): New method. Reports error based on the error table.
3171 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
3172 verifications are done here.
3174 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
3176 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
3177 CLSCompliantAttribute.
3178 (all_imported_types): New member holds all imported types from other
3180 (LoadAllImportedTypes): New method fills static table with exported types
3181 from all referenced assemblies.
3182 (Modules): New property returns all assembly modules.
3184 2004-03-30 Miguel de Icaza <miguel@ximian.com>
3186 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
3187 throwing a parser error.
3189 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
3190 which removes the hardcoded get_/set_ prefixes for properties, as
3191 IL allows for the properties to be named something else.
3195 * expression.cs: Do not override operand before we know if it is
3198 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3200 * typemanager.cs: support for pinned variables.
3202 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3204 * decl.cs, typemanager.cs: Avoid using an arraylist
3205 as a buffer if there is only one result set.
3207 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3209 * expression.cs: Make sure you cant call a static method
3210 with an instance expression, bug #56174.
3212 2004-03-29 Miguel de Icaza <miguel@ximian.com>
3214 * class.cs (IsDuplicateImplementation): Improve error reporting to
3215 flag 663 (method only differs in parameter modifier).
3217 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
3218 in preprocessor directives.
3220 * location.cs (LookupFile): Allow for the empty path.
3222 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
3223 better approach for some of that patch, but its failing with the
3224 CharSet enumeration. For now try/catch will do.
3226 * typemanager.cs: Do not crash if a struct does not have fields.
3229 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3231 * expression.cs: cs0213, cant fix a fixed expression.
3234 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3236 * cs-parser.jay: detect invalid embeded statements gracefully.
3239 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3241 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
3244 the invocation type may not be a subclass of the tye of the item/
3245 The type of the item must be a subclass of the invocation item.
3250 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
3252 * attribute.cs: Added methods to get a string and a bool from an
3253 attribute. Required to information from AssemblyKeyFileAttribute,
3254 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
3255 * codegen.cs: Modified AssemblyName creation to include support for
3256 strongnames. Catch additional exceptions to report them as CS1548.
3257 * compiler.csproj: Updated include CryptoConvert.cs.
3258 * compiler.csproj.user: Removed file - user specific configuration.
3259 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
3260 Mono.Security assembly. The original class is maintained and tested in
3261 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
3262 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
3263 like CSC 8.0 (C# v2) supports.
3264 * Makefile: Added CryptoConvert.cs to mcs sources.
3265 * rootcontext.cs: Added new options for strongnames.
3267 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
3269 * driver.cs: For --expect-error, report error code `2'
3270 if the program compiled with no errors, error code `1' if
3271 it compiled with an error other than the one expected.
3273 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
3275 * compiler.csproj: Updated for Visual Studio .NET 2003.
3276 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
3277 * compiler.sln: Updated for Visual Studio .NET 2003.
3279 2004-03-24 Ravi Pratap M <ravi@ximian.com>
3281 * expression.cs: Fix bug #47234. We basically need to apply the
3282 rule that we prefer the conversion of null to a reference type
3283 when faced with a conversion to 'object' (csc behaviour).
3285 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3287 * statement.cs: Shorter form for foreach, eliminates
3288 a local variable. r=Martin.
3290 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3292 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
3293 checks if we can use brtrue/brfalse to test for 0.
3294 * expression.cs: use the above in the test for using brtrue/brfalse.
3297 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3299 * expression.cs: Rewrite string concat stuff. Benefits:
3301 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
3302 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
3303 rather than a concat chain.
3305 * typemanager.cs: Add lookups for more concat overloads.
3307 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3309 * expression.cs: Emit shorter il code for array init.
3326 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
3328 * statement.cs: Before, two switch blocks would be merged if the
3329 total size of the blocks (end_item - begin_item + 1) was less than
3330 two times the combined sizes of the blocks.
3332 Now, it will only merge if after the merge at least half of the
3337 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
3339 * class.cs : csc build fix for GetMethods(). See bug #52503.
3341 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
3343 * expression.cs: Make sure fp comparisons work with NaN.
3344 This fixes bug #54303. Mig approved this patch a long
3345 time ago, but we were not able to test b/c the runtime
3348 2004-03-19 Miguel de Icaza <miguel@ximian.com>
3350 * ecore.cs (TypExpr.GetHashCode): implement this overload.
3352 2004-03-19 Martin Baulig <martin@ximian.com>
3354 * class.cs (MemberCore.IsDuplicateImplementation): Report the
3355 error here and not in our caller.
3357 2004-03-19 Martin Baulig <martin@ximian.com>
3359 * interface.cs: Completely killed this file.
3360 (Interface): We're now a TypeContainer and live in class.cs.
3362 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
3363 argument; we're now also called for interfaces.
3364 (TypeContainer.DefineMembers): Allow this method being called
3366 (TypeContainer.GetMethods): New public method; formerly known as
3367 Interface.GetMethod(). This is used by PendingImplementation.
3368 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
3369 it's now private and non-static.
3370 (Interface): Moved this here; it's now implemented similar to
3372 (Method, Property, Event, Indexer): Added `bool is_interface'
3373 argument to their .ctor's.
3374 (MemberBase.IsInterface): New public field.
3376 * cs-parser.jay: Create normal Method, Property, Event, Indexer
3377 instances instead of InterfaceMethod, InterfaceProperty, etc.
3378 (opt_interface_base): Removed; we now use `opt_class_base' instead.
3379 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
3381 2004-03-19 Martin Baulig <martin@ximian.com>
3383 * class.cs (MethodCore.IsDuplicateImplementation): New private
3384 method which does the CS0111 checking.
3385 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
3386 Use IsDuplicateImplementation().
3388 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
3390 * decl.cs (FindMemberToOverride): New method to find the correct
3391 method or property to override in the base class.
3393 - Make Method/Property use the above method to find the
3394 version in the base class.
3395 - Remove the InheritableMemberSignatureCompare as it is now
3398 This patch makes large code bases much faster to compile, as it is
3399 O(n) rather than O(n^2) to do this validation.
3401 Also, it fixes bug 52458 which is that nested classes are not
3402 taken into account when finding the base class member.
3404 Reviewed/Approved by Martin.
3406 2004-03-17 Marek Safar <marek.safar@seznam.cz>
3408 * interface.cs: In all interface classes removed redundant
3409 member initialization.
3411 2004-03-16 Martin Baulig <martin@ximian.com>
3413 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
3415 2004-03-15 Miguel de Icaza <miguel@ximian.com>
3417 * decl.cs (DefineTypeAndParents): New helper method to define a
3418 type's containers before the type itself is defined; This is a
3419 bug exposed by the recent changes to Windows.Forms when an
3420 implemented interface was defined inside a class that had not been
3423 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
3425 (Check): Loop correctly to report errors modifiers
3426 (UNSAFE was not in the loop, since it was the same as TOP).
3428 * interface.cs: Every interface member now takes a ModFlags,
3429 instead of a "is_new" bool, which we set on the base MemberCore.
3431 Every place where we called "UnsafeOk" in the interface, now we
3432 call the proper member (InterfaceMethod.UnsafeOK) instead to get
3433 the unsafe settings from the member declaration instead of the
3434 container interface.
3436 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
3438 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
3439 `set_indexer_name' to the pending bits (one per type).
3441 We fixed a bug today that was picking the wrong method to
3442 override, since for properties the existing InterfaceMethod code
3443 basically ignored the method name. Now we make sure that the
3444 method name is one of the valid indexer names.
3446 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
3448 * support.cs (SeekableStreamReader): Keep track of stream byte
3449 positions and don't mix them with character offsets to the buffer.
3451 Patch from Gustavo Giráldez
3453 2004-03-15 Marek Safar <marek.safar@seznam.cz>
3455 * interface.cs (InterfaceSetGetBase): Removed double member
3456 initialization, base class does it as well.
3458 2004-03-13 Martin Baulig <martin@ximian.com>
3460 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
3461 when compiling corlib.
3463 2004-03-13 Miguel de Icaza <miguel@ximian.com>
3465 * convert.cs (ExplicitConversion): We were reporting an error on
3466 certain conversions (object_type source to a value type, when the
3467 expression was `null') before we had a chance to pass it through
3468 the user defined conversions.
3470 * driver.cs: Replace / and \ in resource specifications to dots.
3473 * class.cs: Add check for duplicate operators. Fixes 52477
3475 2004-03-11 Miguel de Icaza <miguel@ximian.com>
3477 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
3478 that are in the middle of the statements, not only at the end.
3481 * class.cs (TypeContainer.AddField): No longer set the
3482 `HaveStaticConstructor' flag, now we call it
3483 `UserDefineStaticConstructor' to diferentiate the slightly
3484 semantic difference.
3486 The situation is that we were not adding BeforeFieldInit (from
3487 Modifiers.TypeAttr) to classes that could have it.
3488 BeforeFieldInit should be set to classes that have no static
3493 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
3495 And most importantly Zoltan's comment:
3497 http://bugzilla.ximian.com/show_bug.cgi?id=44229
3499 "I think beforefieldinit means 'it's ok to initialize the type sometime
3500 before its static fields are used', i.e. initialization does not need
3501 to be triggered by the first access to the type. Setting this flag
3502 helps the JIT to compile better code, since it can run the static
3503 constructor at JIT time, and does not need to generate code to call it
3504 (possibly lots of times) at runtime. Unfortunately, mcs does not set
3505 this flag for lots of classes like String.
3507 csc sets this flag if the type does not have an explicit static
3508 constructor. The reasoning seems to be that if there are only static
3509 initalizers for a type, and no static constructor, then the programmer
3510 does not care when this initialization happens, so beforefieldinit
3513 This bug prevents the AOT compiler from being usable, since it
3514 generates so many calls to mono_runtime_class_init that the AOT code
3515 is much slower than the JITted code. The JITted code is faster,
3516 because it does not generate these calls if the vtable is type is
3517 already initialized, which is true in the majority of cases. But the
3518 AOT compiler can't do this."
3520 2004-03-10 Miguel de Icaza <miguel@ximian.com>
3522 * class.cs (MethodData.Emit): Refactor the code so symbolic
3523 information is generated for destructors; For some reasons we
3524 were taking a code path that did not generate symbolic information
3527 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
3529 * class.cs: Create a Constructor.CheckBase method that
3530 takes care of all validation type code. The method
3531 contains some code that was moved from Define.
3533 It also includes new code that checks for duplicate ctors.
3534 This fixes bug #55148.
3536 2004-03-09 Joshua Tauberer <tauberer@for.net>
3538 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
3539 a { ... }-style array creation invokes EmitStaticInitializers
3540 which is not good for reference-type arrays. String, decimal
3541 and now null constants (NullCast) are not counted toward
3542 static initializers.
3544 2004-03-05 Martin Baulig <martin@ximian.com>
3546 * location.cs (SourceFile.HasLineDirective): New public field;
3547 specifies whether the file contains or is referenced by a "#line"
3549 (Location.DefineSymbolDocuments): Ignore source files which
3550 either contain or are referenced by a "#line" directive.
3552 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
3554 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
3555 direct access to our parent, so check the method inline there.
3557 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
3559 * expression.cs (Invocation.EmitCall): Miguel's last commit
3560 caused a regression. If you had:
3565 In Foo the implict this would be null.
3567 2004-02-27 Miguel de Icaza <miguel@ximian.com>
3569 * expression.cs (Invocation.EmitCall): If the method is not
3570 virtual, do not emit a CallVirt to it, use Call.
3572 * typemanager.cs (GetFullNameSignature): Improve the method to
3573 cope with ".ctor" and replace it with the type name.
3575 * class.cs (ConstructorInitializer.Resolve): Now the method takes
3576 as an argument the ConstructorBuilder where it is being defined,
3577 to catch the recursive constructor invocations.
3579 2004-02-26 Miguel de Icaza <miguel@ximian.com>
3581 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
3582 routines to check if a type is an enumerable/enumerator allow
3583 classes that implement the IEnumerable or IEnumerator interfaces.
3585 * class.cs (Property, Operator): Implement IIteratorContainer, and
3586 implement SetYields.
3588 (Property.Define): Do the block swapping for get_methods in the
3589 context of iterators. We need to check if Properties also
3590 include indexers or not.
3592 (Operator): Assign the Block before invoking the
3593 OperatorMethod.Define, so we can trigger the Iterator code
3596 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3597 Property and Operator classes are not created when we parse the
3598 declarator but until we have the block completed, so we use a
3599 singleton SimpleIteratorContainer.Simple to flag whether the
3600 SetYields has been invoked.
3602 We propagate this setting then to the Property or the Operator to
3603 allow the `yield' to function.
3605 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3607 * codegen.cs: Implemented attribute support for modules.
3608 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3609 Assembly/Module functionality.
3611 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3612 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3613 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3615 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3617 * interface.cs (FindMembers): The operation is performed on all base
3618 interfaces and not only on the first. It is required for future CLS Compliance patch.
3620 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3622 * statement.cs, codegen.cs:
3623 This patch deals with patterns such as:
3625 public class List : IEnumerable {
3627 public MyEnumerator GetEnumerator () {
3628 return new MyEnumerator(this);
3631 IEnumerator IEnumerable.GetEnumerator () {
3635 public struct MyEnumerator : IEnumerator {
3640 Before, there were a few things we did wrong:
3641 1) we would emit callvirt on a struct, which is illegal
3642 2) we emited ldarg when we needed to emit ldarga
3643 3) we would mistakenly call the interface methods on an enumerator
3644 type that derived from IEnumerator and was in another assembly. For example:
3646 public class MyEnumerator : IEnumerator
3648 Would have the interface methods called, even if there were public impls of the
3649 method. In a struct, this lead to invalid IL code.
3651 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3653 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3656 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3658 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3660 * cs-parser.jay: Fix small regression: we were not testing V2
3661 compiler features correctly.
3663 * interface.cs: If the emit context is null, then create one
3665 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3667 * decl.cs (GetSignatureForError): New virtual method to get full name
3670 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3671 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3673 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3674 Duplicated members and code in these classes has been removed.
3675 Better encapsulation in these classes.
3677 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3679 * assign.cs (Assign.DoResolve): When dealing with compound
3680 assignments, there is a new rule in ECMA C# 2.4 (might have been
3681 there before, but it is documented here) that states that in:
3685 If b is of type int, and the `op' is a shift-operator, then the
3686 above is evaluated as:
3690 * expression.cs (Binary.ResolveOperator): Instead of testing for
3691 int/uint/long/ulong, try to implicitly convert to any of those
3692 types and use that in pointer arithmetic.
3694 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3695 method to print information for from the type, not from the
3696 null-method we were given.
3698 2004-02-01 Duncan Mak <duncan@ximian.com>
3700 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3701 parsing for cmd, fixes bug #53694.
3703 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3705 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3706 in the member name duplication tests. Property and operator name duplication
3707 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3709 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3711 * interface.cs (PopulateMethod): Fixed crash when interface method
3712 returns not existing type (error test cs0246-3.cs).
3714 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3716 * cs-parser.jay (interface_accessors): Re-write actions to also
3717 store attributes attached to get and set methods. Fix spelling
3720 (inteface_property_declaration): Modify accordingly.
3722 (InterfaceAccessorInfo): New helper class to store information to pass
3723 around between rules that use interface_accessors.
3725 * interface.cs (Emit): Apply attributes on the get and set
3726 accessors of properties and indexers too.
3728 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3729 right MethodBuilder when applying attributes to the get and set accessors.
3731 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3733 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3735 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3737 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3739 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3741 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3742 changes that treat `yield' specially when present before `break'
3745 * cs-tokenizer.cs: yield is no longer a keyword.
3747 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3749 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3750 setting for default constructors.
3751 For default constructors are almost every time set wrong Modifier. The
3752 generated IL code has been alright. But inside mcs this values was
3753 wrong and this was reason why several of my CLS Compliance tests
3756 2004-01-22 Martin Baulig <martin@ximian.com>
3758 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3759 not a QualifiedIdentifier. This is what `type_name_expression'
3760 was previously doing.
3761 (type_name_expression): Removed; the code is now in
3762 `namespace_or_type_name'.
3763 (qualified_identifier): Removed, use `namespace_or_type_name'
3765 (QualifiedIdentifier): Removed this class.
3767 2004-01-22 Martin Baulig <martin@ximian.com>
3769 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3770 not a string as alias name.
3772 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3774 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3775 #52730 bug, and instead compute correctly the need to use a
3776 temporary variable when requesting an address based on the
3777 static/instace modified of the field and the constructor.
3779 2004-01-21 Martin Baulig <martin@ximian.com>
3781 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3782 class and namespace before looking up aliases. Fixes #52517.
3784 2004-01-21 Martin Baulig <martin@ximian.com>
3786 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3787 assinged in a 'try'; fixes exception4.cs.
3789 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3790 * class.cs : Implemented parameter-less constructor for TypeContainer
3792 * decl.cs: Attributes are now stored here. New property OptAttributes
3794 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3796 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3798 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3800 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3801 (CSharpSignature): New method for indexer and property signature.
3803 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3805 * pending.cs (IsVirtualFilter): Faster implementation.
3807 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3809 * typemanager.cs: Avoid inclusion of same assembly more than once.
3811 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3813 * cs-parser.jay: Fixed problem where the last assembly attribute
3814 has been applied also to following declaration (class, struct, etc.)
3816 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3818 * class.cs: Added error CS0538, CS0539 reporting.
3819 Fixed crash on Microsoft runtime when field type is void.
3821 * cs-parser.jay: Added error CS0537 reporting.
3823 * pending.cs: Added error CS0535 reporting.
3824 Improved error report for errors CS0536, CS0534.
3826 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3828 Merge a few bits from the Anonymous Method MCS tree.
3830 * statement.cs (ToplevelBlock): New class for toplevel methods,
3831 will hold anonymous methods, lifted variables.
3833 * cs-parser.jay: Create toplevel blocks for delegates and for
3834 regular blocks of code.
3836 2004-01-20 Martin Baulig <martin@ximian.com>
3838 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3839 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3840 and `NeedExplicitReturn'; added `IsLastStatement'.
3841 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3842 have a `ReturnLabel' or we're not unreachable.
3844 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3845 child's reachability; don't just override ours with it. Fixes
3846 #58058 (lluis's example).
3847 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3848 InFinally(), InLoop(), InSwitch() and
3849 BreakCrossesTryCatchBoundary() methods.
3851 * statement.cs (Return): Do all error checking in Resolve().
3852 Unless we are the last statement in a top-level block, always
3853 create a return label and jump to it.
3854 (Break, Continue): Do all error checking in Resolve(); also make
3855 sure we aren't leaving a `finally'.
3856 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3857 statement in a top-level block.
3858 (Block.Flags): Added `IsDestructor'.
3859 (Block.IsDestructor): New public property.
3861 2004-01-20 Martin Baulig <martin@ximian.com>
3863 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3865 2004-01-20 Martin Baulig <martin@ximian.com>
3867 * statement.cs (Statement.ResolveUnreachable): New public method.
3868 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3869 (Block.Resolve): Resolve unreachable statements.
3871 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3873 * expression.cs: We need to fix the case where we do
3874 not have a temp variable here.
3876 * assign.cs: Only expression compound assignments need
3877 temporary variables.
3879 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3881 * flowanalysis.cs: Reduce memory allocation in a few ways:
3882 - A block with no variables should not allocate a bit
3884 - A method with no out parameters does not need any tracking
3885 for assignment of the parameters, so we need not allocate
3888 public readonly Type[] VariableTypes;
3889 public readonly string[] VariableNames;
3890 Are redundant. The data is already stored in the variable
3891 map, so we need not allocate another array for it.
3892 - We need to add alot of checks for if (params | locals) == null
3893 due to the first two changes.
3895 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3897 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3898 implement IMemoryLocation, we store a copy on a local variable and
3899 take the address of it. Patch from Benjamin Jemlich
3901 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3902 to use a special "type_name_expression" rule which reduces the
3903 number of "QualifiedIdentifier" classes created, and instead
3904 directly creates MemberAccess expressions.
3906 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3908 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3909 that fixes #52853. Null literal assignment to ValueType
3911 * class.cs (MethodData.Emit): Instead of checking the name of the
3912 method to determine if its a destructor, create a new derived
3913 class from Method called Destructor, and test for that.
3915 * cs-parser.jay: Create a Destructor object instead of a Method.
3917 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3921 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3923 * expression.cs (Binary.ResolveOperator): Perform an implicit
3924 conversion from MethodGroups to their delegate types on the
3927 * delegate.cs: Introduce a new class DelegateCreation that is the
3928 base class for `NewDelegate' and `ImplicitDelegateCreation',
3929 factor some code in here.
3931 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3932 conversion from MethodGroups to compatible delegate types.
3934 * ecore.cs (Expression.Resolve): Do not flag error 654
3935 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3936 we allow conversions from MethodGroups to delegate types now.
3938 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3939 assignments in v2 either.
3941 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3943 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3944 static read-only fields in ctors.
3946 Applied patch from Benjamin Jemlich
3948 * expression.cs (UnaryMutator): Avoid leaking local variables.
3950 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3952 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3953 here to return true, as they can be used like this:
3957 Fixed 49836 and all the other dups
3959 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3961 * driver.cs: Implement /win32res and /win32icon.
3963 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3965 * cs-parser.jay: Add a rule to improve error handling for the
3966 common mistake of placing modifiers after the type.
3968 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3970 * cs-parser.jay (interface_event_declaration): Catch
3971 initialization of events on interfaces, and report cs0068
3973 * cs-parser.jay (interface_event_declaration): Catch
3974 initialization of events.
3976 * ecore.cs: Better report missing constructors.
3978 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3979 the error reporting done in the wrong place. Fix.
3981 * expression.cs (Binary.ResolveOperator): Catch the
3982 operator + (E x, E y) error earlier, and later allow for implicit
3983 conversions in operator +/- (E e, U x) from U to the underlying
3986 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3987 52596, if the container class is abstract, the default constructor
3988 is protected otherwise its public (before, we were always public).
3990 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3993 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3994 Jemlich that fixes bug #52597, MCS was generating invalid code for
3995 idisposable structs. Thanks to Ben for following up with this
3998 2004-01-06 Miguel de Icaza <miguel@ximian.com>
4000 * driver.cs: Allow assemblies without code to be generated, fixes
4003 2004-01-07 Nick Drochak <ndrochak@gol.com>
4005 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
4007 2004-01-05 Miguel de Icaza <miguel@ximian.com>
4009 * cs-parser.jay: Add rules to improve error reporting if fields or
4010 methods are declared at the namespace level (error 116)
4012 * Add rules to catch event add/remove
4014 2004-01-04 David Sheldon <dave-mono@earth.li>
4016 * expression.cs: Added matching ")" to error message for
4019 2004-01-03 Todd Berman <tberman@gentoo.org>
4021 * ecore.cs, attribute.cs:
4022 Applying fix from #52429.
4024 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4026 * ecore.cs, expression.cs, statement.cs:
4027 Total rewrite of how we handle branching. We
4028 now handle complex boolean expressions with fewer
4029 jumps. As well if (x == 0) no longer emits a ceq.
4031 if (x is Foo) is much faster now, because we generate
4034 Overall, we get a pretty big improvement on our benchmark
4035 tests. The code we generate is smaller and more readable.
4037 I did a full two-stage bootstrap. The patch was reviewed
4038 by Martin and Miguel.
4040 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4042 * cs-parser.jay: Make primary_expression not take a QI.
4043 we dont need this because the member_access rule covers
4044 us here. So we replace the rule with just IDENTIFIER.
4046 This has two good effects. First, we remove a s/r conflict.
4047 Second, we allocate many fewer QualifiedIdentifier objects.
4049 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4051 * attribute.cs: Handle MarshalAs attributes as pseudo, and
4052 set the correct information via SRE. This prevents
4053 hanging on the MS runtime. Fixes #29374.
4055 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4057 * convert.cs: correctly handle conversions to value types
4058 from Enum and ValueType as unboxing conversions.
4060 Fixes bug #52569. Patch by Benjamin Jemlich.
4062 2004-01-02 Ravi Pratap <ravi@ximian.com>
4064 * expression.cs (BetterConversion): Prefer int -> uint
4065 over int -> ulong (csc's behaviour). This fixed bug #52046.
4067 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
4069 * decl.cs (MemberCache.FindMembers): now returns a
4072 * typemanager.cs: In general, go with with ^^.
4073 (CopyNewMethods): take an IList.
4074 (RealMemberLookup): Only allocate an arraylist
4075 if we copy from two sets of methods.
4077 This change basically does two things:
4078 1) Fewer array lists allocated due to CopyNewMethods.
4079 2) the explicit cast in MemberList costed ALOT.
4081 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
4083 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
4084 a hashtable to avoid needless string allocations when an identifier is
4085 used more than once (the common case).
4087 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
4089 * pending.cs: MS's TypeBuilder.GetInterfaces ()
4090 is broken, it will not return anything. So, we
4091 have to use the information we have in mcs to
4094 * typemanager.cs: Add a cache for GetInterfaces,
4095 since this will now be used more often (due to ^^)
4097 (GetExplicitInterfaces) New method that gets the
4098 declared, not effective, interfaces on a type
4099 builder (eg, if you have interface IFoo, interface
4100 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
4103 This patch makes MCS able to bootstrap itself on
4106 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
4108 * expression.cs: Remove the Nop's that Miguel put
4111 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4113 * report.cs, codegen.cs: Give the real stack trace to
4114 the error when an exception is thrown.
4116 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4118 * decl.cs: only allocate hashtables for ifaces if
4121 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4123 * expression.cs: fix the error from cs0121-2.cs
4124 (a parent interface has two child interfaces that
4125 have a function with the same name and 0 params
4126 and the function is called through the parent).
4128 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
4130 * class.cs, rootcontext.cs, typmanager.cs: do not
4133 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
4135 * codegen.cs: remove stack for the ec flow branching.
4136 It is already a linked list, so no need.
4138 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
4140 * Makefile: Allow custom profiler here.
4142 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4144 * typemanager.cs (LookupType):
4145 - Use a static char [], because split takes
4146 a param array for args, so it was allocating
4148 - Do not store true in a hashtable, it boxes.
4150 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4152 * flowanalysis.cs: bytify common enums.
4154 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4156 * modifiers.cs: Add a new set of flags for the
4157 flags allowed on explicit interface impls.
4158 * cs-parser.jay: catch the use of modifiers in
4159 interfaces correctly.
4160 * class.cs: catch private void IFoo.Blah ().
4162 All related to bug #50572.
4164 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4166 * decl.cs: Rewrite the consistant accessability checking.
4167 Accessability is not linear, it must be implemented in
4168 a tableish way. Fixes #49704.
4170 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4172 * expression.cs: Handle negation in a checked context.
4173 We must use subtraction from zero. Fixes #38674.
4175 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4177 * class.cs: Ignore static void main in DLLs.
4178 * rootcontext.cs: Handle the target type here,
4179 since we are have to access it from class.cs
4180 * driver.cs: account for the above.
4182 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4184 * report.cs: Give line numbers and files if available.
4186 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
4188 * driver.cs: Implement /addmodule.
4190 * typemanager.cs: Change 'modules' field so it now contains Modules not
4193 2003-12-20 Martin Baulig <martin@ximian.com>
4195 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
4196 (FieldBase.IsAssigned): Removed this field.
4197 (FieldBase.SetAssigned): New public method.
4198 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
4200 2003-12-20 Martin Baulig <martin@ximian.com>
4202 * expression.cs (LocalVariableReference.DoResolve): Don't set
4203 `vi.Used' if we're called from DoResolveLValue().
4205 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
4206 returns the usage vector it just merged into the current one -
4207 pass this one to UsageWarning().
4208 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
4209 of the `EmitContext', don't call this recursively on our children.
4211 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
4213 * driver.cs: Implement /target:module.
4215 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
4217 * support.cs (CharArrayHashtable): New helper class.
4219 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
4220 char arrays, not strings, so we can avoid creating a string in
4221 consume_identifier if the identifier is a keyword.
4223 2003-12-16 Martin Baulig <martin@ximian.com>
4225 * statement.cs (LocalInfo.Assigned): Removed this property.
4226 (LocalInfo.Flags): Removed `Assigned'.
4227 (LocalInfo.IsAssigned): New public method; takes the EmitContext
4228 and uses flow analysis.
4229 (Block.UsageWarning): Made this method private.
4230 (Block.Resolve): Call UsageWarning() if appropriate.
4232 * expression.cs (LocalVariableReference.DoResolve): Always set
4233 LocalInfo.Used here.
4235 2003-12-13 Martin Baulig <martin@ximian.com>
4237 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
4238 any value here; we're now using flow analysis to figure out
4239 whether a statement/block returns a value.
4241 2003-12-13 Martin Baulig <martin@ximian.com>
4243 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
4245 (FlowBranching.MergeFinally): Don't call
4246 `branching.CheckOutParameters()' here, this is called in
4248 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
4249 when adding the `finally' vector.
4251 2003-12-13 Martin Baulig <martin@ximian.com>
4254 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
4255 actually work and also fix #48962.
4257 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
4259 * decl.cs: Do not check System.Object for nested types,
4260 since we know it does not have any. Big bang for buck:
4265 corlib: 17.99 seconds
4269 corlib: 17.39 seconds
4271 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
4273 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
4274 time we are returning 0 members, so we save alot here.
4276 2003-12-11 Martin Baulig <martin@ximian.com>
4278 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
4279 `MergeChild()', also just take the `FlowBranching' as argument;
4280 call Merge() on it and return the result.
4281 (FlowBranching.Merge): We don't need to do anything if we just
4284 2003-12-11 Martin Baulig <martin@ximian.com>
4286 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
4287 them in an `ArrayList' to reduce memory usage. Thanks to Ben
4288 Maurer for this idea.
4290 2003-12-11 Martin Baulig <martin@ximian.com>
4292 * flowanalysis.cs (MergeResult): This class is now gone; we now
4293 use the `UsageVector' for this. The reason for this is that if a
4294 branching just has one sibling, we don't need to "merge" them at
4295 all - that's the next step to do.
4296 (FlowBranching.Merge): We now return a `UsageVector' instead of a
4299 2003-12-11 Martin Baulig <martin@ximian.com>
4301 Reworked flow analyis and made it more precise and bug-free. The
4302 most important change is that we're now using a special `Reachability'
4303 class instead of having "magic" meanings of `FlowReturns'. I'll
4304 do some more cleanups and optimizations and also add some more
4305 documentation this week.
4307 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
4308 largely reworked this class.
4309 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
4310 the new `Reachability' class instead of having "magic" values here.
4311 (FlowBranching): We're now using an instance of `Reachability'
4312 instead of having separate `Returns', `Breaks' etc. fields.
4314 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
4315 based on flow analysis; ignore the return value of block.Emit ().
4317 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
4319 * driver.cs typemanager.cs: Find the mono extensions to corlib even
4320 if they are private.
4322 2003-12-09 Martin Baulig <martin@ximian.com>
4324 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4325 call them directly on the UsageVector.
4327 2003-12-09 Martin Baulig <martin@ximian.com>
4329 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
4330 Changed return type from `FlowReturns' to `Reachability'.
4332 2003-12-09 Martin Baulig <martin@ximian.com>
4334 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
4335 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
4336 `Reachable' fields with a single `Reachability' one.
4338 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4340 * class.cs (FindMembers): Remove foreach's.
4353 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4358 This patch does a few things:
4359 1. EmptyStatement is now a singleton, so it is never reallocated.
4360 2. All blah is EmptyStatement constructs have been changed to
4361 blah == EmptyStatement.Value, which is much faster and valid
4362 now that EmptyStatement is a singleton.
4363 3. When resolving a block, rather than allocating a new array for
4364 the non-empty statements, empty statements are replaced with
4365 EmptyStatement.Value
4366 4. Some recursive functions have been made non-recursive.
4367 Mainly the performance impact is from (3), however (1) and (2) are needed for
4368 this to work. (4) does not make a big difference in normal situations, however
4369 it makes the profile look saner.
4374 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4375 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4376 Total memory allocated: 56397 KB
4379 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
4380 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
4381 Total memory allocated: 55666 KB
4383 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4385 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
4386 than the hashtable in a hashtable version
4388 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
4389 we always end up concating a string. This results in a huge perf
4390 loss, because many strings have to be tracked by the GC. In this
4391 patch, we first use a hashtable that works with two keys, so that
4392 the strings do not need to be concat'ed.
4403 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4405 * Makefile: Add a new target `do-time' that does a quick and simple
4406 profile, leaving easy to parse output.
4408 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
4410 * codegen.cs (Init): Create the dynamic assembly with
4411 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
4413 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
4415 * support.cs: Make the PtrHashtable use only one
4416 instance of its comparer.
4418 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
4420 * typemanager.cs: Fix lookup of GetNamespaces.
4422 2003-11-29 Miguel de Icaza <miguel@ximian.com>
4424 * expression.cs: Removed redundant line.
4426 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
4427 ArrayLists, use for loops with bounds.
4429 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
4432 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
4433 arraylists, use for loop with bounds.
4435 The above three changes give us a 0.071 second performance
4436 improvement out of 3.294 seconds down to 3.223. On my machine
4437 the above changes reduced the memory usage by 1,387 KB during
4440 * cs-parser.jay (QualifiedIdentifier): New class used to represent
4441 QualifiedIdentifiers. Before we created a new string through
4442 concatenation, and mostly later on, the result would be
4443 manipulated by DecomposeQI through string manipulation.
4445 This reduced the compiler memory usage for bootstrapping from
4446 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
4447 compile times in 0.05 seconds.
4449 2003-11-28 Dick Porter <dick@ximian.com>
4451 * support.cs: Do string compares with the Invariant culture.
4459 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
4460 the comparison is done with the Invariant culture.
4462 2003-11-27 Miguel de Icaza <miguel@ximian.com>
4464 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
4465 GetEnumerator method.
4467 (ProbeCollectionType): Iterate starting at the most specific type
4468 upwards looking for a GetEnumerator
4470 * expression.cs: Shift count can be up to 31 for int/uint and 63
4473 2003-11-26 Miguel de Icaza <miguel@ximian.com>
4475 * statement.cs (Block.LookupLabel): Also look for the label on the
4476 children blocks. Use a hash table to keep track of visited
4479 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
4480 we actually did transform the other operand, otherwise fall back
4481 to the common codepath that casts to long.
4483 * cs-tokenizer.cs: Use the same code pattern as the int case.
4484 Maybe I should do the parsing myself, and avoid depending on the
4485 Parse routines to get this done.
4487 2003-11-25 Miguel de Icaza <miguel@ximian.com>
4489 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4490 which fixes bug 51347. This time test it.
4492 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
4493 attributes for example can not tell the difference between these.
4494 The difference was only a syntax feature of the language.
4496 * attribute.cs: Apply attributes to delegates.
4498 * delegate.cs: Call the apply attributes method.
4500 2003-11-24 Miguel de Icaza <miguel@ximian.com>
4502 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
4503 comparing 0 vs Byte.MinValue, not the value
4505 (ImplicitConversionRequired): When reporting a conversion error,
4506 use error 31 to print out the constant error instead of the
4509 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4510 which fixes bug 51347.
4512 2003-11-22 Miguel de Icaza <miguel@ximian.com>
4514 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
4515 which fixes the -warnaserror command line option.
4517 2003-11-21 Miguel de Icaza <miguel@ximian.com>
4519 * cfold.cs (DoNumericPromotions): During constant folding of
4520 additions on UIntConstant, special case intconstants with
4521 IntConstants like we do on the expression binary operator.
4523 2003-11-12 Miguel de Icaza <miguel@ximian.com>
4525 * convert.cs (ImplicitReferenceConversion): We were missing a case
4526 (System.Enum are not value types or class types, so we need to
4527 classify them separatedly).
4529 * driver.cs: We do not support error 2007.
4531 2003-11-12 Jackson Harper <jackson@ximian.com>
4533 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
4534 system directory. Also use the full file name so users can
4535 libraries names mscorlib-o-tron.dll in a non system dir.
4537 2003-11-10 Martin Baulig <martin@ximian.com>
4539 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
4540 (TypeManager.InitCoreTypes): Initialize them here, but instead of
4541 calling `ResolveType()' on them, directly assign their `Type'.
4543 2003-11-08 Martin Baulig <martin@ximian.com>
4545 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
4546 return value and the `out parent' parameter.
4547 (TypeContainer.DefineType): Moved the CS0644 check into
4548 GetClassBases(). Don't pass the interface types to the
4549 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
4550 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
4552 * ecore.cs (TypeExpr.IsAttribute): New property.
4553 (TypeExpr.GetInterfaces): New method.
4555 * interface.cs (Interface.GetInterfaceTypeByName): Return a
4556 TypeExpr instead of a Type.
4557 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
4558 (Interface.DefineType): Don't pass the interface types to the
4559 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
4560 them later and then call `TypeBulider.AddInterfaceImplementation()'.
4562 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
4563 instead of a `Type[]'.
4564 (TypeManager.RegisterBuilder): Likewise.
4565 (TypeManager.AddUserInterface): Likewise.
4566 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
4567 `Type[]' and also return a `TypeExpr[]'.
4568 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
4570 2003-11-08 Martin Baulig <martin@ximian.com>
4572 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
4575 2003-11-08 Martin Baulig <martin@ximian.com>
4577 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
4578 TypeManager.ResolveExpressionTypes().
4580 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
4581 instead of an Expression.
4582 (TypeExpr): This is now an abstract base class for `TypeExpression'.
4583 (TypeExpression): New public class; formerly known as `TypeExpr'.
4585 * expression.cs (ComposedCast): Derive from TypeExpr.
4587 * typemanager.cs (TypeManager.system_*_expr): These are now
4588 TypExpr's instead of Expression's.
4589 (TypeManager.ResolveExpressionTypes): New public static function;
4590 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
4593 2003-11-06 Miguel de Icaza <miguel@ximian.com>
4595 * expression.cs (New.DoResolve): Do not dereference value that
4596 might be a null return.
4598 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4599 sure that the constant value has the right type. Fixes an
4600 unreported bug, similar to 50425.
4602 * const.cs (Const.LookupConstantValue): Call
4603 ImplicitStandardConversionExists before doing a conversion to
4604 avoid havng the TypeManager.ChangeType do conversions.
4606 Reduced the number of casts used
4608 (Const.ChangeType): New routine to enable reuse of the constant
4609 type changing code from statement.
4611 * typemanager.cs (ChangeType): Move common initialization to
4612 static global variables.
4616 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4617 every value type to go through, even if it was void. Fix that.
4619 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4620 character of the define, and the is_identifier_part_character for
4621 the rest of the string.
4623 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4625 * expression.cs (UnaryMutator.EmitCode): When I updated
4626 LocalVariableReference.DoResolve, I overdid it, and dropped an
4627 optimization done on local variable references.
4629 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4631 * ecore.cs: Convert the return from Ldlen into an int.
4633 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4635 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4636 the accessibility, this is a special case for toplevel non-public
4637 classes (internal for instance).
4639 2003-10-20 Nick Drochak <ndrochak@gol.com>
4641 * ecore.cs: Fix typo and build. Needed another right paren.
4643 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4645 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4646 `internal' case regular and protected, but not allowing protected
4647 to be evaluated later. Bug 49840
4649 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4651 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4652 to kb.Nlast, and not the kb.nFirst to isolate the switch
4655 Extract the underlying type, so enumerations of long/ulong are
4656 treated like long/ulong.
4658 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4660 * expression.cs (New): Overload the meaning of RequestedType to
4661 track the possible creation of the NewDelegate type, since
4662 DoResolve is invoked more than once for new constructors on field
4665 See bugs: #48800 and #37014
4667 * cs-parser.jay (declare_local_constants): Take an arraylist
4668 instead of a single constant.
4670 (local_constant_declaration): It should take a
4671 constant_declarators, not a constant_declarator. Fixes 49487
4673 * convert.cs: Fix error report.
4675 2003-10-13 Jackson Harper <jackson@ximian.com>
4677 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4680 2003-10-09 Martin Baulig <martin@ximian.com>
4682 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4684 (MethodCore.DoDefineParameters): Removed the TypeContainer
4685 argument; use the DeclSpace which was passed to the .ctor instead.
4686 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4687 TypeContainer; we only need a DeclSpace here.
4689 2003-10-09 Martin Baulig <martin@ximian.com>
4691 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4693 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4694 EmitContext's .ctor.
4696 2003-10-09 Martin Baulig <martin@ximian.com>
4698 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4699 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4700 AsAccessible(), moved them as well.
4702 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4704 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4706 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4708 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4710 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4711 generation for >=, as spotted by Paolo, bug 48679.
4712 Patch from David Waite.
4714 * cs-tokenizer.cs: Add handling for #pragma.
4716 * cs-parser.jay: Allow for both yield and yield return in the
4717 syntax. The anti-cobolization of C# fight will go on!
4719 * class.cs (TypeBuilder.DefineType): Catch error condition here
4720 (Parent.DefineType erroring out and returning null).
4722 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4723 coping with enumerations variables, we were mistakenly processing
4724 them as a regular value type instead of built-in types. Fixes the
4727 * typemanager.cs (IsBuiltinOrEnum): New method.
4729 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4731 * cs-parser.jay: Upgrade: yield now needs the return clause.
4733 2003-09-19 Martin Baulig <martin@ximian.com>
4735 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4736 `MemberCache parent' argument. Normally, an interface doesn't
4737 have a parent type except System.Object, but we use this in gmcs
4738 for generic type parameters.
4740 2003-09-18 Martin Baulig <martin@ximian.com>
4742 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4743 on `type.IsInterface'; don't check whether the type has a parent
4744 to determine whether it's an interface.
4746 2003-09-15 Martin Baulig <martin@ximian.com>
4748 * class.cs (TypeContainer.DefineType): Added an error flag to
4749 avoid reporting duplicate CS0146's ("class definition is
4752 * driver.cs (Driver.MainDriver): Abort if
4753 RootContext.ResolveTree() reported any errors.
4755 2003-09-07 Martin Baulig <martin@ximian.com>
4757 * report.cs (Error, Warning): Added overloaded versions which take
4758 a `params object[] args' and call String.Format().
4760 2003-09-07 Martin Baulig <martin@ximian.com>
4762 * decl.cs (DeclSpace..ctor): Don't call
4763 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4764 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4765 (DeclSpace.RecordDecl): New method.
4767 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4769 2003-09-02 Ravi Pratap <ravi@ximian.com>
4771 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4772 value attributes to be applied to ParameterBuilders.
4774 * class.cs (MethodCore.LabelParameters): Make static and more
4775 generic so that it can be used from other places - like interface
4776 methods, for instance.
4778 * interface.cs (Interface.Emit): Call LabelParameters before
4779 emitting attributes on the InterfaceMethod.
4781 2003-08-26 Martin Baulig <martin@ximian.com>
4783 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4784 resolving aliases; fixes #47927.
4786 2003-08-26 Martin Baulig <martin@ximian.com>
4788 * statement.cs (Using.DoResolve): This is internally emitting a
4789 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4790 do not always return. Fixes #47681.
4792 2003-08-26 Martin Baulig <martin@ximian.com>
4794 * decl.cs (MemberCore): Moved WarningNotHiding(),
4795 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4797 (AdditionResult): Make this nested in DeclSpace.
4798 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4799 argument; call NamespaceEntry.Define() unless we're nested in a
4802 * namespace.cs (Namespace.DefineName): New public function. This
4803 is called from DeclSpace's .ctor to add
4804 (Namespace.Lookup): Include DeclSpaces in the lookup.
4806 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4808 * const.cs (Const): Derive from MemberBase, not MemberCore.
4810 2003-08-25 Martin Baulig <martin@ximian.com>
4812 * convert.cs (Convert.ExplicitReferenceConversion): When
4813 converting from an interface type to a class, unbox if the target
4814 type is a struct type. Fixes #47822.
4816 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4818 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
4821 2003-08-22 Martin Baulig <martin@ximian.com>
4823 * class.cs (TypeManager.DefineType): When defining a nested type,
4824 call DefineType() on our parent; fixes #47801.
4826 2003-08-22 Martin Baulig <martin@ximian.com>
4828 * class.cs (MethodData.Define): While checking if a method is an
4829 interface implementation, improve the test a bit more to fix #47654.
4831 2003-08-22 Martin Baulig <martin@ximian.com>
4833 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4834 correctly; fixes #47722.
4836 2003-08-22 Martin Baulig <martin@ximian.com>
4838 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
4839 LocalVariableReference, ensure it's not read-only. Fixes #47536.
4841 * statement.cs (Fixed.DoResolve): Make all variables read-only.
4843 2003-08-22 Martin Baulig <martin@ximian.com>
4845 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
4846 can only be assigned in static constructors. Fixes #47161.
4848 2003-08-22 Martin Baulig <martin@ximian.com>
4850 Rewrote and improved the flow analysis code.
4852 * flowbranching.cs (FlowBranching): Make this class abstract.
4853 (FlowBranching.CreateBranching): New static function to create a
4855 (FlowBranchingBlock, FlowBranchingException): New classes.
4856 (FlowBranching.UsageVector.Type): New public readonly field.
4857 (FlowBranching.UsageVector.Breaks): Removed the setter.
4858 (FlowBranching.UsageVector.Returns): Removed the setter.
4859 (FlowBranching.UsageVector): Added Break(), Return(),
4860 NeverReachable() and Throw() methods to modify the reachability.
4861 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
4862 done by FlowBranching.Merge().
4863 (FlowBranching.UsageVector.MergeChild): New method; merges the
4864 merge result into the current vector.
4865 (FlowBranching.Merge): New abstract method to merge a branching.
4867 2003-08-12 Martin Baulig <martin@ximian.com>
4869 * expression.cs (Indirection.CacheTemporaries): Create the
4870 LocalTemporary with the pointer type, not its element type.
4872 2003-08-10 Miguel de Icaza <miguel@ximian.com>
4874 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
4875 token was a keyword or not.
4877 Add `error' options where an IDENTIFIER was expected; Provide
4878 CheckToken and CheckIdentifierToken convenience error reporting
4881 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
4883 * decl.cs: Rename `NamespaceEntry Namespace' public field into
4884 NameSpaceEntry NameSpaceEntry.
4886 (LookupInterfaceOrClass): Avoid creating a full qualified name
4887 from namespace and name: avoid doing lookups when we know the
4888 namespace is non-existant. Use new Tree.LookupByNamespace which
4889 looks up DeclSpaces based on their namespace, name pair.
4891 * driver.cs: Provide a new `parser verbose' to display the
4892 exception thrown during parsing. This is turned off by default
4893 now, so the output of a failure from mcs is more graceful.
4895 * namespace.cs: Track all the namespaces defined in a hashtable
4898 (IsNamespace): New method
4900 2003-08-09 Miguel de Icaza <miguel@ximian.com>
4902 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
4903 we know that we need to concatenate (full typename can never be
4908 * statement.cs: Use a bitfield; Do not initialize to null things
4909 which are done by the constructor by default.
4911 * cs-parser.jay: bug fix, parameter was 4, not 3.
4913 * expression.cs: Just use the property;
4915 * statement.cs: No need for GetVariableInfo method.
4917 2003-08-08 Martin Baulig <martin@ximian.com>
4919 * flowanalysis.cs (FlowReturns): This is now nested in the
4920 `FlowBranching' class.
4921 (MyBitVector): Moved this here from statement.cs.
4922 (FlowBranching.SiblingType): New enum type.
4923 (FlowBranching.CreateSibling): Added `SiblingType' argument.
4925 2003-08-07 Martin Baulig <martin@ximian.com>
4927 * flowanalysis.cs (FlowBranchingType): This is now nested in the
4928 `FlowBranching' class and called `BranchingType'.
4930 2003-08-07 Martin Baulig <martin@ximian.com>
4932 * flowanalysis.cs: Moved all the control flow analysis code into
4935 2003-08-07 Martin Baulig <martin@ximian.com>
4937 * assign.cs (Assign.DoResolve): `target' must either be an
4938 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
4941 2003-08-07 Miguel de Icaza <miguel@ximian.com>
4943 * expression.cs (BinaryMethod): This kind of expression is created by the
4944 Binary class if it determines that the operator has to be handled
4947 (BinaryDelegate): This kind of expression is created if we are
4948 dealing with a + or - operator on delegates.
4950 (Binary): remove method, argumetns, and DelegateOperator: when
4951 dealing with methods,
4953 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
4955 * statement.cs (Block): use bitfields for the three extra booleans
4956 we had in use. Remove unused topblock parameter.
4958 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
4960 * assign.cs: Drop extra unneeded tests.
4962 2003-08-06 Miguel de Icaza <miguel@ximian.com>
4964 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
4966 * statement.cs (Foreach): Use VariableStorage instead of
4969 * codegen.cs (VariableStorage): New class used by clients that
4970 require a variable stored: locals or fields for variables that
4971 need to live across yield.
4973 Maybe provide a convenience api for EmitThis+EmitLoad?
4975 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
4978 2003-08-05 Miguel de Icaza <miguel@ximian.com>
4980 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4981 RemapParameterLValue): New methods that are used to turn a
4982 precomputed FieldInfo into an expression like this:
4986 The idea is to use this instead of making LocalVariableReference
4987 have more than one meaning.
4989 * cs-parser.jay: Add error production to BASE.
4991 * ecore.cs: Deal with TypeManager.GetField returning null, which
4992 is now a valid return value.
4994 (FieldExprNoAddress): New expression for Fields whose address can
4997 * expression.cs (LocalVariableReference): During the resolve
4998 phases, create new expressions if we are in a remapping context.
4999 Remove code that dealt with remapping here.
5001 (ParameterReference): same.
5003 (ProxyInstance): New expression, like the `This' expression, but
5004 it is born fully resolved. We know what we are doing, so remove
5005 the errors that are targeted to user-provided uses of `this'.
5007 * statement.cs (Foreach): our variable is now stored as an
5008 Expression; During resolution, follow the protocol, dont just
5009 assume it will return this.
5011 2003-08-06 Martin Baulig <martin@ximian.com>
5013 * support.cs (SeekableStreamReader.cs): New public class.
5015 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
5016 SeekableStreamReader instead of the normal StreamReader.
5018 2003-08-04 Martin Baulig <martin@ximian.com>
5020 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
5021 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
5022 deambiguate casts and delegate invocations.
5023 (parenthesized_expression): Use the new tokens to ensure this is
5024 not a cast of method invocation.
5026 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
5027 when reading a `)' and Deambiguate_CloseParens () was previously
5030 * expression.cs (ParenthesizedExpression): New class. This is
5031 just used for the CS0075 test.
5032 (Binary.DoResolve): Check for CS0075.
5034 2003-07-29 Ravi Pratap <ravi@ximian.com>
5036 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
5037 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
5038 reference comparison.
5040 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
5041 examine the ReturnType for equality - this is necessary in the
5042 cases of implicit and explicit operators whose signature also
5043 includes the return type.
5045 2003-07-26 Miguel de Icaza <miguel@ximian.com>
5047 * namespace.cs: Cache the result of the namespace computation,
5048 instead of computing it every time.
5050 2003-07-24 Miguel de Icaza <miguel@ximian.com>
5052 * decl.cs: Use a global arraylist that we reuse over invocations
5053 to avoid excesive memory consumption. Reduces memory usage on an
5054 mcs compile by one meg (45 average).
5056 * typemanager.cs (LookupTypeReflection): In .NET pointers are
5057 private, work around that.
5059 2003-07-23 Miguel de Icaza <miguel@ximian.com>
5061 * literal.cs (IntLiteral): Define Zero and One static literals.
5063 * cs-parser.jay (integer_literal): use static literals to reduce
5064 memory usage for the most used literals (0, 1 and -1). 211kb
5065 reduced in memory usage.
5067 Replace all calls to `new ArrayList' with `new
5068 ArrayList(4)' which is a good average number for most allocations,
5069 and also requires only 16 bytes of memory for its buffer by
5072 This reduced MCS memory usage in seven megabytes for the RSS after
5075 2003-07-28 Ravi Pratap <ravi@ximian.com>
5077 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
5078 handle params methods the correct way by forming only one
5079 applicable set with params and normal methods in them. Earlier we
5080 were looking at params methods only if we found no normal methods
5081 which was not the correct thing to do.
5083 (Invocation.BetterFunction): Take separate arguments indicating
5084 when candidate and the best method are params methods in their
5087 This fixes bugs #43367 and #46199.
5089 * attribute.cs: Documentation updates.
5091 (CheckAttribute): Rename to CheckAttributeTarget.
5092 (GetValidPlaces): Rename to GetValidTargets.
5094 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
5095 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
5099 2003-07-28 Martin Baulig <martin@ximian.com>
5101 * class.cs (TypeContainer.DefineMembers): Use the base type's full
5102 name when looking up the base class of a nested class. Fixes #46977.
5104 2003-07-26 Martin Baulig <martin@ximian.com>
5106 * expression.cs (Indexers.Indexer): New nested struct; contains
5107 getter, setter and the indexer's type.
5108 (Indexers.Properties): This is now an ArrayList of
5110 (IndexerAccess.DoResolveLValue): Correctly set the type if the
5111 indexer doesn't have any getters.
5113 * assign.cs (Assign.DoResolve): Also do the implicit conversions
5114 for embedded property and indexer assignments.
5116 2003-07-26 Martin Baulig <martin@ximian.com>
5118 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
5119 preprocessor directive is not the first non-whitespace character
5122 2003-07-26 Martin Baulig <martin@ximian.com>
5124 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
5125 namespace parsing, follow the spec more closely.
5127 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
5128 NamespaceEntry.Lookup().
5130 2003-07-25 Martin Baulig <martin@ximian.com>
5132 * MethodCore.cs (OverridesSomething): New public field; it's set
5133 from TypeContainer.DefineMembers if this method overrides
5134 something (which doesn't need to be a method). Fix #39462.
5136 2003-07-25 Ravi Pratap <ravi@ximian.com>
5138 * typemanager.cs (GetMembers): Ensure that the list of members is
5139 reversed. This keeps things in sync.
5141 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
5142 find an AttributeUsage attribute.
5144 * expression.cs (Invocation.OverloadResolve): Perform the check
5145 which disallows Invoke to be directly called on a Delegate.
5147 (Error_InvokeOnDelegate): Report error cs1533.
5149 2003-07-25 Martin Baulig <martin@ximian.com>
5151 * expression.cs (Indexers.GetIndexersForType): Only look in the
5152 interface hierarchy if the requested type is already an
5153 interface. Fixes #46788 while keeping #46502 fixed.
5155 2003-07-25 Martin Baulig <martin@ximian.com>
5157 * class.cs (TypeContainer.DefineMembers): Check whether all
5158 readonly fields have been assigned and report warning CS0649 if
5161 * statement.cs (LocalInfo.IsFixed): Always return true if this is
5164 2003-07-24 Ravi Pratap <ravi@ximian.com>
5166 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
5167 returned from GetMethods to make things consistent with the
5168 assumptions MCS makes about ordering of methods.
5170 This should comprehensively fix bug #45127 and it does :-)
5172 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
5173 ordering is actually reverse.
5175 * Clean up some debug messages I left lying around.
5177 * interface.cs (Populate*): Get rid of code which emits attributes
5178 since the stage in which we emit attributes is the 'Emit' stage,
5179 not the define stage.
5181 (Emit): Move attribute emission for interface members here.
5183 2003-07-22 Ravi Pratap <ravi@ximian.com>
5185 * expression.cs (Invocation.OverloadResolve): Follow the spec more
5186 closely: we eliminate methods in base types when we have an
5187 applicable method in a top-level type.
5189 Please see section 14.5.5.1 for an exact description of what goes
5192 This fixes bug #45127 and a host of other related to corlib compilation.
5194 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
5195 array is the method corresponding to the top-level type (this is
5196 because of the changes made to icall.c) so we change this
5199 (MethodGroupExpr.Name): This too.
5201 * typemanager.cs (GetElementType): New method which does the right
5202 thing when compiling corlib.
5204 * everywhere: Make use of the above in the relevant places.
5206 2003-07-22 Martin Baulig <martin@ximian.com>
5208 * cs-parser.jay (invocation_expression): Moved
5209 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
5210 `cast_expression', but create a InvocationOrCast which later
5211 resolves to either an Invocation or a Cast.
5213 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
5214 method; call this before EmitStatement() to make sure that this
5215 expression can be used as a statement.
5217 * expression.cs (InvocationOrCast): New class; resolves to either
5218 an Invocation or a Cast.
5220 * statement.cs (StatementExpression): Call ResolveStatement() on
5221 the ExpressionStatement before emitting it.
5223 2003-07-21 Martin Baulig <martin@ximian.com>
5225 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
5226 `ref' and `out' attributes match; fixes #46220.
5227 (MemberAccess.ResolveMemberAccess): You can't reference a type
5228 through an expression; fixes #33180.
5229 (Indexers.GetIndexersForType): Don't return the indexers from
5230 interfaces the class implements; fixes #46502.
5232 2003-07-21 Martin Baulig <martin@ximian.com>
5234 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
5235 CS0661 checks; fixes bug #30442.
5237 2003-07-21 Martin Baulig <martin@ximian.com>
5239 * decl.cs (AdditionResult): Added `Error'.
5241 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
5243 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
5244 makes cs0031.cs actually work.
5246 2003-07-20 Martin Baulig <martin@ximian.com>
5248 * namespace.cs: Fixed that bug which caused a crash when compiling
5251 2003-07-20 Miguel de Icaza <miguel@ximian.com>
5253 * typemanager.cs (LookupTypeReflection): Never expose types which
5254 are NotPublic, NestedPrivate, NestedAssembly, or
5255 NestedFamANDAssem. We used to return these, and later do a check
5256 that would report a meaningful error, but the problem is that we
5257 would not get the real match, if there was a name override.
5259 2003-07-18 Miguel de Icaza <miguel@ximian.com>
5261 * namespace.cs (Namespace, Name): Do not compute the namespace
5262 name dynamically, compute it in the constructor. This reduced
5263 memory usage by 1697 KB.
5265 * driver.cs: Use --pause to pause at the end.
5267 2003-07-17 Peter Williams <peter@newton.cx>
5269 * Makefile: Change the name of the test target so that it doesn't
5270 conflict with the recursive test target.
5272 2003-07-17 Miguel de Icaza <miguel@ximian.com>
5274 * expression.cs (LocalVariableReference.Emit, EmitAssign,
5275 AddressOf): Do not use EmitThis, that was wrong, use the actual
5278 2003-07-15 Miguel de Icaza <miguel@ximian.com>
5280 * class.cs (MethodData.Define): While checking if a method is an
5281 interface implementation, improve the test: If we are not public
5282 (use new test here: use the computed MethodAttributes directly,
5283 instead of the parsed modifier flags) check if the `implementing'
5284 method comes from an interface or not.
5286 * pending.cs (VerifyPendingMethods): Slightly better error
5289 * makefile: add test target that does the mcs bootstrap.
5291 2003-07-16 Ravi Pratap <ravi@ximian.com>
5293 * interface.cs (Define): Do nothing here since there are no
5294 members to populate etc. Move the attribute emission out of here
5295 since this was just totally the wrong place to put it. Attribute
5296 application happens during the 'Emit' phase, not in the 'Define'
5299 (Emit): Add this method and move the attribute emission here
5301 * rootcontext.cs (EmitCode): Call the Emit method on interface
5304 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5306 * expression.cs (OverloadResolve): Report error only if Location
5307 is not 'Null' which means that there was a probe going on.
5309 2003-07-14 Martin Baulig <martin@ximian.com>
5311 * expression.cs (ConditionalLogicalOperator): New public class to
5312 implement user defined conditional logical operators.
5313 This is section 14.11.2 in the spec and bug #40505.
5315 2003-07-14 Martin Baulig <martin@ximian.com>
5317 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
5319 2003-07-14 Martin Baulig <martin@ximian.com>
5321 * codegen.cs (EmitContext.InFixedInitializer): New public field.
5323 * ecore.cs (IVariable.VerifyFixed): New interface method.
5325 * expression.cs (Unary.ResolveOperator): When resolving the `&'
5326 operator, check whether the variable is actually fixed. Fixes bug
5327 #36055. Set a variable definitely assigned when taking its
5328 address as required by the spec.
5330 * statement.cs (LocalInfo.IsFixed): New field.
5331 (LocalInfo.MakePinned): Set `IsFixed' to true.
5333 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5335 * attribute.cs (Attribute.Resolve): While doing a Member lookup
5336 for .ctors, ensure that we only ask for members declared in the
5337 attribute type (BindingFlags.DeclaredOnly).
5341 * expression.cs (Error_WrongNumArguments): Report error 1501
5342 correctly the way CSC does.
5344 2003-07-13 Martin Baulig <martin@ximian.com>
5346 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
5347 lookup on the fully qualified name, to make things like "X.X" work
5348 where "X.X" is a fully qualified type name, but we also have a
5349 namespace "X" in the using list. Fixes #41975.
5351 2003-07-13 Martin Baulig <martin@ximian.com>
5353 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
5354 function. If we're a CompoundAssign, we need to create an embedded
5355 CompoundAssign, not an embedded Assign.
5356 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
5359 2003-07-13 Martin Baulig <martin@ximian.com>
5361 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
5362 work to fix bug #46088.
5364 2003-07-13 Ravi Pratap <ravi@ximian.com>
5366 * class.cs (Operator.Emit): Do not emit attributes here - it is
5367 taken care of by the Method class that we delegate too. This takes
5370 2003-07-10 Martin Baulig <martin@ximian.com>
5372 * expression.cs (TypeOfVoid): New class.
5373 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
5375 2003-07-10 Martin Baulig <martin@ximian.com>
5377 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
5380 2003-07-10 Martin Baulig <martin@ximian.com>
5382 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
5383 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
5385 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
5387 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
5389 2003-07-10 Martin Baulig <martin@ximian.com>
5391 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
5392 of decimal. Fixes #42850.
5394 NOTE: I also fixed the created byte blob, but this doesn't work on
5395 the MS runtime and csc never produces any byte blobs for decimal
5398 2003-07-10 Martin Baulig <martin@ximian.com>
5400 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
5401 structs; fixes #32068.
5402 (Block.AddChildVariableNames): Fixed #44302.
5404 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5406 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
5408 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5410 * attribute.cs: And this test is onger needed.
5412 2003-07-08 Martin Baulig <martin@ximian.com>
5414 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
5415 inaccessible types. Fixes #36313.
5417 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
5419 * namespace.cs (NamespaceEntry): Create implicit entries for all
5420 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
5421 implicit entries for N1.N2 and N1.
5423 2003-07-08 Martin Baulig <martin@ximian.com>
5425 Rewrote the handling of namespaces to fix a lot of the issues
5426 wrt. `using' aliases etc.
5428 * namespace.cs (Namespace): Splitted this class into a
5429 per-assembly `Namespace' and a per-file `NamespaceEntry'.
5431 * typemanager.cs (TypeManager.IsNamespace): Removed.
5432 (TypeManager.ComputeNamespaces): Only compute namespaces from
5433 loaded assemblies here, not the namespaces from the assembly we're
5434 currently compiling.
5436 2003-07-08 Martin Baulig <martin@ximian.com>
5438 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
5440 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5442 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
5445 I thought about the memory savings here, but LookupTypeReflection
5446 is used under already very constrained scenarios. Compiling
5447 corlib or mcs only exposes one hit, so it would not really reduce
5448 any memory consumption.
5450 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5452 * typemanager.cs: fixes bug #45889 by only adding public types from
5453 other assemblies to the list of known types.
5455 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5457 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
5458 on the type we resolved.
5460 2003-07-05 Martin Baulig <martin@ximian.com>
5462 * pending.cs (PendingImplementation.ParentImplements): Don't
5463 create the proxy if the parent is abstract.
5465 * class.cs (TypeContainer.DefineIndexers): Process explicit
5466 interface implementations first. Fixes #37714.
5468 2003-07-04 Miguel de Icaza <miguel@ximian.com>
5470 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
5471 defined recursively; but since we modify the input parameters
5472 (left is set to `this' temporarily), we reset this value if the
5473 left_is_explicit is false, which gives the original semantics to
5476 * literal.cs (NullPointer): new class used to represent a null
5477 literal in a pointer context.
5479 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
5480 type is a pointer, use a NullPointer object instead of a
5481 NullLiteral. Closes 43687
5483 (ExplicitConversion): Convert pointer values using
5484 the conv opcode to the proper type.
5486 * ecore.cs (New): change ValueTypeVariable property into a method,
5487 that returns whether the valuetype is suitable for being used.
5489 * expression.cs (Binary.DoNumericPromotions): Only return if we
5490 the int constant was a valid uint, and we can return both left and
5491 right as uints. If not, we continue processing, to trigger the
5492 type conversion. This fixes 39018.
5494 * statement.cs (Block.EmitMeta): During constant resolution, set
5495 the CurrentBlock property on the emitcontext, so that we resolve
5496 constants propertly.
5498 2003-07-02 Martin Baulig <martin@ximian.com>
5500 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
5501 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
5503 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
5504 than emitting it here.
5506 * statement.cs: Fixed some more flow analysis bugs.
5508 2003-07-02 Martin Baulig <martin@ximian.com>
5510 * class.cs (MethodData.Define): When implementing interface
5511 methods, set Final unless we're Virtual.
5513 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
5514 check work for interface methods.
5516 2003-07-01 Martin Baulig <martin@ximian.com>
5518 * ecore.cs (EmitContext.This): Replaced this property with a
5519 GetThis() method which takes a Location argument. This ensures
5520 that we get the correct error location for a CS0188.
5522 2003-07-01 Miguel de Icaza <miguel@ximian.com>
5524 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
5525 ImplicitStandardConversion.
5527 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
5529 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
5531 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
5534 2003-06-30 Miguel de Icaza <miguel@ximian.com>
5536 * class.cs (Constructor.Define): Turn off initlocals for unsafe
5539 (MethodData.Define): Turn off initlocals for unsafe methods.
5541 2003-06-29 Miguel de Icaza <miguel@ximian.com>
5543 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
5544 complete; Fixes #37521.
5546 * delegate.cs: Use Modifiers.TypeAttr to compute the
5547 TypeAttributes, instead of rolling our own. This makes the flags
5548 correct for the delegates.
5550 2003-06-28 Miguel de Icaza <miguel@ximian.com>
5552 * class.cs (Constructor.Define): Set the private flag for static
5553 constructors as well.
5555 * cs-parser.jay (statement_expression): Set the return value to
5556 null, to avoid a crash when we catch an error.
5558 2003-06-24 Miguel de Icaza <miguel@ximian.com>
5560 * cs-parser.jay: Applied patch from Jackson that adds support for
5561 extern and unsafe modifiers to destructor declarations.
5563 * expression.cs: Report error 21 if the user is trying to index a
5566 * driver.cs: Add an error message, suggested by the bug report.
5568 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
5569 if we do not have a ": this ()" constructor initializer. Fixes 45149
5571 2003-06-14 Miguel de Icaza <miguel@ximian.com>
5573 * namespace.cs: Add some information to reduce FAQs.
5575 2003-06-13 Miguel de Icaza <miguel@ximian.com>
5577 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
5578 underlying enumeration types. Fixes #43915.
5580 * expression.cs: Treat ushort/short as legal values to be used in
5583 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
5585 * delegate.cs: transfer custom attributes for paramenters from
5586 the delegate declaration to Invoke and BeginInvoke.
5588 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
5590 * attribute.cs: handle custom marshalers and emit marshal info
5593 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
5595 * makefile.gnu: Added anonymous.cs to the compiler sources.
5597 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5599 * iterators.cs: Change the name of the proxy class to include two
5602 * cs-parser.jay: Update grammar to include anonymous methods.
5604 * anonymous.cs: new file.
5606 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5608 * class.cs (Field.Define): Add missing test for pointers and
5611 2003-05-27 Ravi Pratap <ravi@ximian.com>
5613 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5614 we use the stobj opcode.
5616 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5617 since it wasn't the correct fix.
5619 It still is puzzling that we are required to use stobj for IntPtr
5620 which seems to be a ValueType.
5622 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5624 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5625 during regular simple name resolution. Now, the trick is that
5626 instead of returning for processing the simplename, we do a
5627 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5628 contextual lookup type). If a match is found, return that, if
5629 not, return for further composition.
5631 This fixes long-standing 30485.
5633 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5634 using the address to initialize an object, do an Stobj instead of
5635 using the regular Stelem.
5637 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5638 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5639 Because if we are a BaseIndexerAccess that value will be true.
5642 * statement.cs (GotoCase.Resolve): Return after reporting an
5643 error, do not attempt to continue.
5645 * expression.cs (PointerArithmetic.Emit): If our operand is a
5646 long, convert our constants to match the operand before
5647 multiplying. Convert to I type before adding. Fixes 43670.
5649 2003-05-14 Ravi Pratap <ravi@ximian.com>
5651 * enum.cs (ImplicitConversionExists) : Rename to
5652 ImplicitEnumConversionExists to remove ambiguity.
5654 * ecore.cs (NullCast): New type of cast expression class which
5655 basically is very similar to EmptyCast with the difference being
5656 it still is a constant since it is used only to cast a null to
5660 * convert.cs (ImplicitReferenceConversion): When casting a null
5661 literal, we return a NullCast.
5663 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5664 should be around anymore.
5666 The renaming (reported was slightly wrong). Corrections:
5668 ConvertImplicitStandard -> ImplicitConversionStandard
5669 ConvertExplicitStandard -> ExplicitConversionStandard
5671 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5672 before passing them in !
5674 * convert.cs (ImplicitConversionStandard): When comparing for
5675 equal expr and target types, ensure that expr is not a
5678 In general, we must not be checking (expr_type ==
5679 target_type) in the top level conversion methods
5680 (ImplicitConversion, ExplicitConversion etc). This checking is
5681 done in the methods that they delegate to.
5683 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5685 * convert.cs: Move Error_CannotConvertType,
5686 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5687 ImplicitNumericConversion, ImplicitConversionExists,
5688 ImplicitUserConversionExists, StandardConversionExists,
5689 FindMostEncompassedType, FindMostSpecificSource,
5690 FindMostSpecificTarget, ImplicitUserConversion,
5691 ExplicitUserConversion, GetConversionOperators,
5692 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5693 TryImplicitIntConversion, Error_CannotConvertImplicit,
5694 ConvertImplicitRequired, ConvertNumericExplicit,
5695 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5696 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5699 Perform the following renames:
5701 StandardConversionExists -> ImplicitStandardConversionExists
5702 ConvertImplicit -> ImplicitConversion
5703 ConvertImplicitStandard -> ImplicitStandardConversion
5704 TryImplicitIntConversion -> ImplicitIntConversion
5705 ConvertImplicitRequired -> ImplicitConversionRequired
5706 ConvertNumericExplicit -> ExplicitNumericConversion
5707 ConvertReferenceExplicit -> ExplicitReferenceConversion
5708 ConvertExplicit -> ExplicitConversion
5709 ConvertExplicitStandard -> ExplicitStandardConversion
5711 2003-05-19 Martin Baulig <martin@ximian.com>
5713 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5714 (TypeInfo): Added support for structs having structs as fields.
5716 * ecore.cs (FieldExpr): Implement IVariable.
5717 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5718 VariableInfo for the field.
5720 2003-05-18 Martin Baulig <martin@ximian.com>
5722 * expression.cs (This.DoResolve): Report a CS0027 if we're
5723 emitting a field initializer.
5725 2003-05-18 Martin Baulig <martin@ximian.com>
5727 * expression.cs (This.ResolveBase): New public function.
5728 (This.DoResolve): Check for CS0188.
5730 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5733 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5734 `instance_expression' to null if we don't have any non-static
5737 2003-05-18 Martin Baulig <martin@ximian.com>
5739 Reworked the way how local variables and parameters are handled by
5740 the flow analysis code.
5742 * statement.cs (TypeInfo, VariableMap): New public classes.
5743 (VariableInfo): New public class. This is now responsible for
5744 checking whether a variable has been assigned. It is used for
5745 parameters and local variables.
5746 (Block.EmitMeta): Take the InternalParameters as argument; compute
5747 the layout of the flow vectors here.
5748 (Block.LocalMap, Block.ParameterMap): New public properties.
5749 (FlowBranching): The .ctor doesn't get the InternalParameters
5750 anymore since Block.EmitMeta() now computes the layout of the flow
5752 (MyStructInfo): This class is now known as `StructInfo' and nested
5753 in `TypeInfo'; we don't access this directly anymore.
5755 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5756 property and removed IsAssigned(), IsFieldAssigned(),
5757 SetAssigned() and SetFieldAssigned(); we now call them on the
5758 VariableInfo so we don't need to duplicate this code everywhere.
5760 * expression.cs (ParameterReference): Added `Block block' argument
5762 (LocalVariableReference, ParameterReference, This): The new
5763 VariableInfo class is now responsible for all the definite
5766 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5767 IsParameterAssigned, SetParameterAssigned): Removed.
5769 2003-05-18 Martin Baulig <martin@ximian.com>
5771 * typemanager.cs (InitCoreTypes): Try calling
5772 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5773 the 3-args-version. Corlib now also needs our `void_type'.
5774 (GetMethod): Added overloaded version which takes an optional
5775 `bool report_errors' to allow lookups of optional methods.
5777 2003-05-12 Martin Baulig <martin@ximian.com>
5779 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5780 only used for locals and not for parameters.
5782 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5784 * support.cs (InternalParameters.ParameterType): Return the
5785 ExternalType of the parameter.
5787 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5790 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5792 * class.cs (MethodData.Define): Do not set the `newslot' on
5793 interface members, if they are also flagged as "override".
5795 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5796 better code for ++i and i++. This only works for static fields
5797 and local variables.
5799 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5800 want to pull the DeclSpace out of the builder_to_declspace instead
5801 of the TypeBuilder (like in TypeContainer.FindMembers).
5803 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
5804 instead of LookupTypeContainer. Fixes the crash on .NET for
5805 looking up interface members.
5807 * const.cs: Create our own emit context during the Definition
5808 stage, so that constants are evaluated in the proper context, when
5809 a recursive definition happens.
5811 2003-05-11 Martin Baulig <martin@ximian.com>
5813 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
5814 new block for a switch section.
5815 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
5816 the adding/lookup in the switch block. Fixes #39828.
5818 2003-05-09 Miguel de Icaza <miguel@ximian.com>
5820 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
5821 functionality: I needed to convert the data after I had performed
5822 the add/sub operation into the operands type size.
5824 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
5825 pass the type for the box operation, otherwise the resulting
5826 object would have been of type object.
5828 (BoxedCast): Add constructor to specify the type to box as.
5830 2003-05-07 Miguel de Icaza <miguel@ximian.com>
5832 * iterators.cs: I was reusing the `count' variable inadvertently,
5833 take steps to not allow this to happen.
5835 2003-05-06 Miguel de Icaza <miguel@ximian.com>
5837 * attribute.cs (Attribute.Resolve): Params attributes are encoded
5838 by creating an array at the point where the params starts and
5839 putting all those arguments there, then adjusting the size of the
5842 2003-05-05 Miguel de Icaza <miguel@ximian.com>
5844 * expression.cs (New.AddressOf): Implement interface
5845 IMemoryLocation. This is used when the `new' operator is used in
5846 the context of an invocation to a method on a value type.
5848 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
5851 * namespace.cs: Also check the using aliases here.
5853 * driver.cs: Move the test for using validity after the types have
5854 been entered, so we do a single pass that also includes the using
5857 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
5858 in the regular case. CreateSiblingForFinally is doing extra
5861 * attribute.cs (GetAttributeArgumentExpression): Store the result
5862 on an out value, and use the return value to indicate failure
5863 instead of using null (which is a valid return for Constant.GetValue).
5865 * statement.cs: Perform the analysis flow for the increment
5866 portion after the statement, because this will be the real flow of
5867 execution. Fixes #42385
5869 * codegen.cs (EmitContext.EmitArgument,
5870 EmitContext.EmitStoreArgument): New helper functions when the
5871 RemapToProxy flag is set.
5873 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
5876 Add support for remapping parameters.
5878 * iterators.cs: Propagate parameter values; Store parameter
5879 values in the proxy classes.
5881 2003-05-04 Miguel de Icaza <miguel@ximian.com>
5883 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
5884 need a proxy reference; I do not know what I was thinking
5886 * cs-parser.jay (constructor_initializer): catch another error,
5887 and display nice message.
5889 (field_declaration): catch void field declaration
5890 to flag a better error.
5892 * class.cs (MemberBase.CheckBase): Report an error instead of a
5893 warning if a new protected member is declared in a struct.
5894 (Field.Define): catch the error of readonly/volatile.
5896 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
5898 (FieldExpr.AddressOf): ditto. Catch error where the address of a
5899 volatile variable is taken
5901 2003-05-02 Miguel de Icaza <miguel@ximian.com>
5903 * statement.cs (Fixed.Resolve): Report an error if we are not in
5906 2003-05-01 Miguel de Icaza <miguel@ximian.com>
5908 * typemanager.cs: reuse the code that handles type clashes for
5909 delegates and enumerations.
5911 * class.cs (Report28): Always report.
5913 * expression.cs (EncodeAsAttribute): Allow nulls here.
5915 2003-04-28 Miguel de Icaza <miguel@ximian.com>
5917 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
5918 the functionality for testing whether an expression is valid for
5919 an attribute here. Also handle the case of arrays of elements
5922 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
5923 encoding a linear array into an array of objects that are suitable
5924 to be passed to an CustomAttributeBuilder.
5926 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
5928 * ecore.cs: (FieldExpr): Handle field remapping here.
5930 * iteratators.cs: Pass the instance variable (if the method is an
5931 instance method) to the constructors, so we can access the field
5932 variables on the class.
5934 TODO: Test this with structs. I think the THIS variable on
5935 structs might have to be a pointer, and not a refenrece
5937 2003-04-27 Miguel de Icaza <miguel@ximian.com>
5939 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
5940 local variables to fields in a proxy class.
5942 * iterators.cs (PopulateProxy): Rename our internal fields to
5944 Create a <THIS> field if we are an instance method, so we can
5945 reference our parent container variables.
5946 (MapVariable): Called back from the EmitContext code to enter a
5947 new variable to field mapping into the proxy class (we just create
5951 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
5952 for using the remapped locals to fields.
5954 I placed the code here, because that gives the same semantics to
5955 local variables, and only changes the Emit code.
5957 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
5958 statements inside iterators.
5959 (VariableInfo): Add a FieldBuilder for the cases when we are
5960 remapping local variables to fields in a proxy class
5962 * ecore.cs (SimpleNameResolve): Avoid testing two times for
5963 current_block != null.
5965 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
5966 not cope with strings, as it has been moved to the
5967 TableSwitchEmit. Fixed bug in switch generation.
5969 * expression.cs (New.DoResolve): Provide more context for the user
5970 when reporting an error.
5972 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5975 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5976 check the permissions for it. Note than in a type-resolution
5977 context the check was already present in DeclSpace.ResolveType,
5978 but was missing from the MemberAccess.
5980 (ArrayCreation.CheckIndices): warn if the user has
5981 more nested levels of expressions, but there are no more
5982 dimensions specified. Avoids crash on bug 41906.
5984 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5986 * statement.cs (Block): replace Implicit bool, for a generic
5988 New flag: `Unchecked'. This is used during the EmitMeta phase
5989 (which is out-of-line with the regular Resolve/Emit process for a
5990 statement, as this is done ahead of time, but still gets a chance
5991 to call constant resolve).
5993 (Block.Flags): new enum for adding a new flag.
5995 (Block.EmitMeta): track the state of unchecked.
5997 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5998 to enable constant resolution to work there as well.
6000 2003-04-22 Miguel de Icaza <miguel@ximian.com>
6002 * typemanager.cs (ienumerable_type): Also look up
6003 System.Collections.IEnumerable.
6005 2003-04-21 Miguel de Icaza <miguel@ximian.com>
6007 TODO: Test more than one conditional per method.
6009 * class.cs (Indexer.Define): Report the location where the user is
6010 referencing the unsupported feature.
6012 (MethodData): Overload the use of `conditionals' to
6013 minimize the creation of needless ArrayLists. This saves roughly
6014 212kb on my machine.
6016 (Method): Implement the new IIteratorContainer interface.
6017 (Method.SetYields): Implement the method by setting the ModFlags
6018 to contain METHOD_YIELDS.
6020 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
6021 which just got set to null.
6023 * iterators.cs: New file.
6025 (Yield, YieldBreak): New statements.
6027 * statement.cs (Return.Resolve): Flag an error if we are used in
6030 * codegen.cs (InIterator): New flag set if the code is being
6031 compiled in an iterator method.
6033 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
6034 internal modifier, and we just use it to avoid adding extra
6035 fields, as this is seldom used.
6037 * cs-parser.jay: Add yield_statement (yield and yield break).
6039 * driver.cs: New flag -v2 to turn on version 2 features.
6041 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
6042 hashtable when v2 is enabled.
6044 2003-04-20 Miguel de Icaza <miguel@ximian.com>
6046 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
6047 there is already a namespace defined with this name.
6049 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
6050 people upgraded their corlibs.
6052 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
6053 always use fully qualified types, no need to use the compiler
6056 (TypeManager.IsNamespace): Use binarysearch.
6058 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
6059 AddDelegate): I did not quite use the new IsValid API properly: I
6060 have to pass the short-name and the fullname. I was passing only
6061 the basename instead of the fullname sometimes.
6063 (TypeContainer.DefineType): call NamespaceClash.
6065 * interface.cs (Interface.DefineType): use NamespaceClash before
6068 * delegate.cs (Delegate.DefineType): use NamespaceClash before
6071 * enum.cs: (Enum.DefineType): use NamespaceClash before
6074 * typemanager.cs (: 3-line patch that gives us some tasty 11%
6075 speed increase. First, use the negative_hits cache when we get a
6076 negative. Second, add the type with its full original name
6077 instead of the new . and + encoded name (reflection uses + to
6078 separate type from a nested type). Use LookupTypeReflection
6079 directly which bypasses the type->name hashtable (that we already
6080 know does not contain the type.
6082 * decl.cs (DeclSpace.ResolveTypeExpr): track the
6083 location/container type.
6085 * driver.cs: When passing utf8, use directly the UTF8Encoding.
6087 2003-04-19 Miguel de Icaza <miguel@ximian.com>
6089 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
6091 * delegate.cs (NewDelegate.Resolve): Test whether an instance
6092 method is being referenced in the method group from a static
6093 context, and report error 120 if so.
6095 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
6098 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
6099 is created, we create the A namespace).
6101 * cs-parser.jay: A namespace also introduces a DeclarationFound.
6104 2003-04-18 Miguel de Icaza <miguel@ximian.com>
6106 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
6107 invocation to ModuleBuilder.GetType with the same values will
6108 return a new type instance, so we need to cache its return
6111 * expression.cs (Binary.ResolveOperator): Only allow the compare
6112 operators on enums if they are of the same type.
6114 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
6115 types of ValueType on their own case. Before we were giving them
6116 the same treatment as objects.
6118 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
6119 fullname. Short name is used to compare against container name.
6120 Fullname is used to check against defined namespace names.
6122 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
6123 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
6125 (Method.CheckBase): Call parent.
6126 (MemberBase.CheckBase): Check for protected members on sealed
6128 (PropertyBase.CheckBase): Call parent.
6129 (Field.Define): Call parent.
6131 * report.cs: Negative error codes are now mapped to 8000 - code,
6132 so that the display is render more nicely.
6134 * typemanager.cs: Do not use try/catch, instead report a regular
6137 (GetPointerType, GetReferenceType): These methods provide
6138 mechanisms to obtain the T* and T& from a T. We had the code
6139 previously scattered around the code base, and it also used
6140 TypeManager.LookupType that would go through plenty of caches.
6141 This one goes directly to the type source.
6143 In some places we did the Type.GetType followed by
6144 ModuleBuilder.GetType, but not in others, so this unifies the
6147 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
6148 statements now that we have namespace information.
6150 * typemanager.cs (IsNamespace): New method, returns whether the
6151 string presented is a namespace or not.
6153 (ComputeNamespaces): New public entry point, computes the list of
6154 available namespaces, using the GetNamespaces API call in Mono, or
6155 the slower version in MS.NET.
6157 Now before we start the semantic analysis phase, we have a
6158 complete list of namespaces including everything that the user has
6161 Deleted old code to cache namespaces in .nsc files.
6163 2003-04-17 Miguel de Icaza <miguel@ximian.com>
6165 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
6166 class/struct location definition Location for the implicit
6167 constructor location.
6169 (Operator.Define): Use the location of the operator for the
6170 implicit Method definition.
6172 (Constructor.Emit): use the constructor location for the implicit
6173 base initializer constructor.
6175 * ecore.cs: Remove ITypeExpression. This interface is now gone,
6176 and the Expression class now contains two new methods:
6178 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
6179 isolate type lookup from the rest of the resolution process.
6181 Since we use Expressions to hold type definitions due to the way
6182 we parse the input we have historically overloaded Resolve to
6183 perform the Type lookups if a special flag is passed. Now this is
6184 eliminated and two methods take their place.
6186 The differences in the two methods between xStep and xTerminal is
6187 that xStep is involved in our current lookup system that uses
6188 SimpleNames to compose a name, while xTerminal is used just to
6189 catch the case where the simplename lookup failed.
6191 2003-04-16 Miguel de Icaza <miguel@ximian.com>
6193 * expression.cs (ResolveMemberAccess): Remove redundant code.
6194 TypeExpr expressions are always born fully resolved.
6196 * interface.cs (PopulateMethod): Do not lookup the types twice.
6197 We were doing it once during SemanticAnalysis and once during
6200 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
6201 in local variable type definitions, were being returned as a
6202 SimpleName (we decomposed everything into a string), that is
6203 because primary_expression was being used instead of a type in the
6204 grammar (reduce/reduce conflicts).
6206 The part that was wrong is that we converted the expression into a
6207 string (an oversimplification in one hand, compounded with primary
6208 expressions doing string concatenation).
6214 Would return "A.B.C[]" as a SimpleName. This stopped things like
6215 using clauses from working on this particular context. And a type
6216 was being matched directly against "A.B.C[]".
6218 We now use the correct approach, and allow for ComposedCast to be
6219 part of the unary expression. So the "A.B.C []" become a composed
6220 cast of "A.B.C" (as a nested group of MemberAccess with a
6221 SimpleName at the end) plus the rank composition "[]".
6225 2003-04-10 Miguel de Icaza <miguel@ximian.com>
6227 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
6228 for the access level checking.
6230 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
6231 `TypeContainer container', because I kept getting confused when I
6232 was debugging this code.
6234 * expression.cs (Indexers): Instead of tracking getters/setters,
6235 we now track them in parallel. We create one arraylist less, but
6236 most importantly it is possible now for the LValue code to find a
6237 matching get for a set.
6239 (IndexerAccess.DoResolveLValue): Update the code.
6240 GetIndexersForType has been modified already to extract all the
6241 indexers from a type. The code assumed it did not.
6243 Also make the code set the correct return type for the indexer.
6244 This was fixed a long time ago for properties, but was missing for
6245 indexers. It used to be void_type.
6247 (Binary.Emit): Test first for doubles instead of
6248 floats, as they are more common.
6250 (Binary.EmitBranchable): Use the .un version of the branch opcodes
6251 when dealing with floats and the <=, >= operators. This fixes bug
6254 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
6255 to load the array value by emitting a load on the foreach variable
6256 type. This was incorrect.
6258 We now emit the code to load an element using the the array
6259 variable type, and then we emit the conversion operator.
6263 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
6265 * attribute.cs: Avoid allocation of ArrayLists in the common case.
6267 2003-04-09 Miguel de Icaza <miguel@ximian.com>
6269 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
6270 test for protection before we test for signatures.
6272 (MethodSignature.ToString): implement.
6274 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
6275 to the case where we reduced into a LongConstant.
6277 * decl.cs (CheckAccessLevel): If the type is an array, we can not
6278 depend on whether the information is acurrate, because the
6279 Microsoft runtime will always claim that the array type is public,
6280 regardless of the real state.
6282 If the type is a pointer, another problem happens: the type is
6283 reported as non-public in Microsoft.
6285 In both cases we have to call CheckAccessLevel recursively with
6286 the underlying type as the argument to be tested.
6288 2003-04-08 Miguel de Icaza <miguel@ximian.com>
6290 * assign.cs (Assign.Emit): If we are dealing with a compound
6291 assignment expression, we should use the code path that stores the
6292 intermediate result in a temporary value. This fixes #40903.
6294 *expression.cs (Indirection.ToString): Provide ToString method for
6297 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
6299 * class.cs: Null out fields holding references to Block objects so
6300 they can be garbage collected.
6302 * expression.cs (OverloadResolve): Remove unused local.
6304 2003-04-07 Martin Baulig <martin@ximian.com>
6306 * codegen.cs (EmitContext.CurrentFile): New public field.
6307 (EmitContext.Mark): Use the CurrentFile to check whether the
6308 location is in the correct file.
6309 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
6311 2003-04-07 Martin Baulig <martin@ximian.com>
6313 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
6315 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
6316 location. [FIXME: The location argument which gets passed to this
6317 method is sometimes wrong!]
6319 2003-04-07 Nick Drochak <ndrochak@gol.com>
6321 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
6323 2003-04-07 Miguel de Icaza <miguel@ximian.com>
6325 * expression.cs (Indirection.EmitAssign): We were using the
6326 temporary, but returning immediately instead of continuing the
6329 2003-04-06 Martin Baulig <martin@ximian.com>
6331 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
6332 if it's a nested child, but also deriving from the outer class.
6335 * typemanager.cs (IsNestedChildOf): Make this work if it's a
6336 nested child, but also deriving from the outer class. See
6338 (FilterWithClosure): We may access private members of the outer
6339 class if we're a nested child and deriving from the outer class.
6340 (RealMemberLookup): Only set `closure_private_ok' if the
6341 `original_bf' contained BindingFlags.NonPublic.
6343 2003-04-05 Martin Baulig <martin@ximian.com>
6345 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
6347 2003-04-02 Miguel de Icaza <miguel@ximian.com>
6349 * class.cs (Event.Define): Do not allow abstract events to have
6352 2003-04-01 Miguel de Icaza <miguel@ximian.com>
6354 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
6355 block in event declarations.
6357 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
6358 value type, get its address.
6360 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
6361 leaving a class on the stack instead of a boolean value (int
6362 0/1). Change the code so we compare against null, and then the
6363 result against zero.
6365 * class.cs (TypeContainer.GetClassBases): We were checking for the
6366 parent class being sealed too late.
6368 * expression.cs (Binary.Emit): For <= and >= when dealing with
6369 floating point values, use cgt.un and clt.un instead of cgt and
6372 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
6374 * statement.cs: Apply the same optimization as MS: skip the
6375 GetEnumerator returning an IEnumerator, and use the one returning a
6376 CharEnumerator instead. This allows us to avoid the try-finally block
6379 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
6381 * cs-parser.jay: Attributes cannot be applied to
6382 namespaces. Fixes #40473
6384 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6387 (Add*): check if the name is valid using the full name for constants,
6388 fields, properties and events.
6390 2003-03-28 Miguel de Icaza <miguel@ximian.com>
6392 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
6393 char constants to be part of the enumeration.
6395 * expression.cs (Conditional.DoResolve): Add support for operator
6396 true. Implements the missing functionality from 14.12
6398 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
6399 operator true/false as required by the spec.
6401 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
6402 implicit conversion to boolean.
6404 * statement.cs (Statement.ResolveBoolean): A boolean expression is
6405 also one where the type implements `operator true'.
6407 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
6408 get an expression that will invoke operator true based on an
6411 (GetConversionOperators): Removed the hack that called op_True
6414 (Expression.ResolveBoolean): Move this from Statement.
6416 2003-03-17 Miguel de Icaza <miguel@ximian.com>
6418 * ecore.cs (FieldExpr): do not allow initialization of initonly
6419 fields on derived classes
6421 2003-03-13 Martin Baulig <martin@ximian.com>
6423 * statement.cs (Block.Emit): Call ig.BeginScope() and
6424 ig.EndScope() when compiling with debugging info; call
6425 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
6427 2003-03-08 Miguel de Icaza <miguel@ximian.com>
6429 * expression.cs (Indexers): Do not construct immediately, allow
6430 for new members to be appended as we go. Fixes 38143
6432 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6434 * expression.cs: save/restore context when resolving an unchecked
6437 2003-03-05 Miguel de Icaza <miguel@ximian.com>
6439 * cfold.cs: Catch division by zero in modulus operator during
6442 2003-03-03 Miguel de Icaza <miguel@ximian.com>
6444 * interface.cs (Interface.DefineMembers): Avoid defining members
6447 2003-02-27 Miguel de Icaza <miguel@ximian.com>
6449 * driver.cs: handle the +/- options for -noconfig
6451 * statement.cs (Unckeched.Resolve): Also track the state of
6452 unchecked in the Resolve phase.
6454 2003-02-27 Martin Baulig <martin@ximian.com>
6456 * ecore.cs (Expression.MemberLookup): Don't create a
6457 MethodGroupExpr for something which is not a method. Fixes #38291.
6459 2003-02-25 Miguel de Icaza <miguel@ximian.com>
6461 * class.cs (MemberBase.CheckParameters): Also check that the type
6462 is unmanaged if it is a pointer.
6464 * expression.cs (SizeOf.Resolve): Add location information.
6466 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
6467 a managed type is declared.
6469 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
6470 parameter modifiers as well. Fixes bug 38606
6472 * class.cs: Very sad. Am backing out the speed up changes
6473 introduced by the ArrayList -> Array in the TypeContainer, as they
6474 were not actually that much faster, and introduced a bug (no error
6475 reports on duplicated methods).
6477 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
6478 source first, this will guarantee that we have a valid expression
6479 before calling in lower levels functions that will require a
6480 resolved object. Then use this original_source in the
6481 target.ResolveLValue instead of the original source that was
6484 Another change. Use target.Resolve instead of LValueResolve.
6485 Although we are resolving for LValues, we will let the Assign code
6486 take care of that (it will be called again from Resolve). This
6487 basically allows code like this:
6489 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
6490 class Y { void A (X x) { x [0] += o; }
6492 The problem was that the indexer was trying to resolve for
6493 set_Item (idx, object o) and never finding one. The real set_Item
6494 was set_Item (idx, X). By delaying the process we get the right
6499 2003-02-23 Martin Baulig <martin@ximian.com>
6501 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
6502 while calling DoEmit ().
6504 * codegen.cs (EmitContext.Mark): Don't mark locations in other
6505 source files; if you use the #line directive inside a method, the
6506 compiler stops emitting line numbers for the debugger until it
6507 reaches the end of the method or another #line directive which
6508 restores the original file.
6510 2003-02-23 Martin Baulig <martin@ximian.com>
6512 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
6514 2003-02-23 Martin Baulig <martin@ximian.com>
6516 * statement.cs (Block.AddChildVariableNames): We need to call this
6517 recursively, not just for our immediate children.
6519 2003-02-23 Martin Baulig <martin@ximian.com>
6521 * class.cs (Event.Define): Always make the field private, like csc does.
6523 * typemanager.cs (TypeManager.RealMemberLookup): Make events
6524 actually work, fixes bug #37521.
6526 2003-02-23 Miguel de Icaza <miguel@ximian.com>
6528 * delegate.cs: When creating the various temporary "Parameters"
6529 classes, make sure that we call the ComputeAndDefineParameterTypes
6530 on those new parameters (just like we do with the formal ones), to
6531 allow them to be resolved in the context of the DeclSpace.
6533 This fixes the bug that Dick observed in Bugzilla #38530.
6535 2003-02-22 Miguel de Icaza <miguel@ximian.com>
6537 * expression.cs (ResolveMemberAccess): When resolving a constant,
6538 do not attempt to pull a constant if the value was not able to
6539 generate a valid constant.
6541 * const.cs (LookupConstantValue): Do not report more errors than required.
6543 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6545 * expression.cs: fixes bug #38328.
6547 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6549 * class.cs: Changed all the various members that can be part of a
6550 class from being an ArrayList to be an Array of the right type.
6551 During the DefineType type_list, interface_list, delegate_list and
6552 enum_list are turned into types, interfaces, delegates and enums
6555 And during the member population, indexer_list, event_list,
6556 constant_list, field_list, instance_constructor_list, method_list,
6557 operator_list and property_list are turned into their real arrays.
6559 Although we could probably perform this operation earlier, for
6560 good error reporting we need to keep the lists and remove the
6561 lists for longer than required.
6563 This optimization was triggered by Paolo profiling the compiler
6564 speed on the output of `gen-sample-program.pl' perl script.
6566 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
6567 not crash in methods like MemberLookupFailed that use this field.
6569 This problem arises when the compiler fails to resolve a type
6570 during interface type definition for example.
6572 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6574 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
6575 inherit from System.Object, so we have to stop at null, not only
6576 when reaching System.Object.
6578 2003-02-17 Miguel de Icaza <miguel@ximian.com>
6580 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
6581 DeclaredOnly because the parent indexer might have had a different
6582 name, but did not loop until the top of the hierarchy was reached.
6584 The problem this one fixes is 35492: when a class implemented an
6585 indexer from an interface, we were getting the interface method
6586 (which was abstract) and we were flagging an error (can not invoke
6589 This also keeps bug 33089 functioning, and test-148 functioning.
6591 * typemanager.cs (IsSpecialMethod): The correct way of figuring
6592 out if a method is special is to see if it is declared in a
6593 property or event, or whether it is one of the predefined operator
6594 names. This should fix correctly #36804.
6596 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6598 The goal here is to remove the dependency on EmptyCast.Peel ().
6599 Killing it completely.
6601 The problem is that currently in a number of places where
6602 constants are expected, we have to "probe" for an EmptyCast, and
6603 Peel, which is not the correct thing to do, as this will be
6604 repetitive and will likely lead to errors.
6606 The idea is to remove any EmptyCasts that are used in casts that
6607 can be reduced to constants, so we only have to cope with
6610 This bug hunt was triggered by Bug 37363 and the desire to remove
6611 the duplicate pattern where we were "peeling" emptycasts to check
6612 whether they were constants. Now constants will always be
6615 * ecore.cs: Use an enumconstant here instead of wrapping with
6618 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6619 throwing me off. By handling this we can get rid of a few hacks.
6621 * statement.cs (Switch): Removed Peel() code.
6623 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6625 * class.cs: Location information for error 508
6627 * expression.cs (New.DoResolve): Add a guard against double
6628 resolution of an expression.
6630 The New DoResolve might be called twice when initializing field
6631 expressions (see EmitFieldInitializers, the call to
6632 GetInitializerExpression will perform a resolve on the expression,
6633 and later the assign will trigger another resolution
6635 This leads to bugs (#37014)
6637 * delegate.cs: The signature for EndInvoke should contain any ref
6638 or out parameters as well. We were not doing this in the past.
6640 * class.cs (Field.Define): Do not overwrite the type definition
6641 inside the `volatile' group. Turns out that volatile enumerations
6642 were changing the type here to perform a validity test, which
6645 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6647 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6648 and structs, we do not want to load the instance variable
6650 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6651 enum_type has to be handled like an object reference (implicit
6652 conversions exists from this to object), but the regular IsClass
6653 and IsValueType tests will never return true for this one.
6655 Also we use TypeManager.IsValueType instead of type.IsValueType,
6656 just for consistency with the rest of the code (this is only
6657 needed if we ever use the construct exposed by test-180.cs inside
6658 corlib, which we dont today).
6660 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6662 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6665 2003-02-09 Martin Baulig <martin@ximian.com>
6667 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6668 (Namespace.DefineNamespaces): New static public method; this is
6669 called when we're compiling with debugging to add all namespaces
6672 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6673 pass it to the Namespace's .ctor.
6675 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6676 and MethodBase arguments; pass the namespace ID to the symwriter;
6677 pass the MethodBase instead of the token to the symwriter.
6678 (SymbolWriter.DefineNamespace): New method to add a namespace to
6681 2003-02-09 Martin Baulig <martin@ximian.com>
6683 * symbolwriter.cs: New file. This is a wrapper around
6684 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6685 methods here in near future.
6687 2003-02-09 Martin Baulig <martin@ximian.com>
6689 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6690 ILGenerator.MarkSequencePoint() which are actually used by the
6693 2003-02-09 Martin Baulig <martin@ximian.com>
6695 * location.cs (SourceFile): New public sealed class. This
6696 contains the name and an index which is used in the location's token.
6697 (Location): Reserve an appropriate number of bits in the token for
6698 the source file instead of walking over that list, this gives us a
6699 really huge performance improvement when compiling with debugging.
6701 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6702 `SourceFile' argument instead of a string.
6703 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6704 but don't parse/tokenize here, we need to generate the list of all
6705 source files before we do that.
6706 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6709 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6710 instead of a string.
6712 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6715 2003-02-09 Martin Baulig <martin@ximian.com>
6717 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6718 filename on `#line default'.
6720 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6722 * statement.cs: don't clear the pinned var when the fixed statement
6723 returns from the method (fixes bug#37752).
6725 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6727 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6730 2003-02-07 Martin Baulig <martin@ximian.com>
6732 * driver.cs: Removed the `--debug-args' command line argument.
6734 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6735 automatically by the AsssemblyBuilder.
6736 (CodeGen.InitializeSymbolWriter): We don't need to call any
6737 initialization function on the symbol writer anymore. This method
6738 doesn't take any arguments.
6740 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6742 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6743 from referenced assemblies as well.
6745 2003-02-02 Martin Baulig <martin@ximian.com>
6747 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6749 2003-02-02 Martin Baulig <martin@ximian.com>
6751 * class.cs (Constructor.Emit): Open the symbol writer before
6752 emitting the constructor initializer.
6753 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6754 single-stepping through constructor initializers.
6756 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6758 * class.cs: Handle error 549: do not allow virtual methods in
6761 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6763 * decl.cs: Check access levels when resolving types
6765 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6767 * statement.cs: Add parameters and locals set in catch blocks that might
6768 return to set vector
6770 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6772 * class.cs (Operator): Set the SpecialName flags for operators.
6774 * expression.cs (Invocation.DoResolve): Only block calls to
6775 accessors and operators on SpecialName methods.
6777 (Cast.TryReduce): Handle conversions from char constants.
6780 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
6782 * statement.cs: small memory and time optimization in FlowBranching.
6784 2003-01-28 Pedro Mart <yoros@wanadoo.es>
6786 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
6787 problem that the last fix but in the other sid (Set).
6789 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
6790 access when there is no indexer in the hierarchy.
6792 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
6794 * class.cs: Combine some if statements.
6796 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6798 * driver.cs: fixed bug #37187.
6800 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
6802 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
6803 any indexer, it's needed to build a list with all the indexers in the
6804 hierarchy (AllGetters), else we have problems. Fixes #35653.
6806 2003-01-23 Miguel de Icaza <miguel@ximian.com>
6808 * class.cs (MethodData.Define): It is wrong for an interface
6809 implementation to be static in both cases: explicit and implicit.
6810 We were only handling this in one case.
6812 Improve the if situation there to not have negations.
6814 * class.cs (Field.Define): Turns out that we do not need to check
6815 the unsafe bit on field definition, only on usage. Remove the test.
6817 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6819 * driver.cs: use assembly.Location instead of Codebase (the latest
6820 patch made mcs fail when using MS assemblies).
6822 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
6824 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
6825 get the path to *corlib.dll.
6827 2003-01-21 Nick Drochak <ndrochak@gol.com>
6831 * typemanager.cs: Remove compiler warnings
6833 2003-01-20 Duncan Mak <duncan@ximian.com>
6835 * AssemblyInfo.cs: Bump the version number to 0.19.
6837 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6839 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
6841 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
6843 * class.cs (Constructor::Emit): Emit debugging info for constructors.
6845 2003-01-17 Miguel de Icaza <miguel@ximian.com>
6847 * cs-parser.jay: Small fix: we were not comparing the constructor
6848 name correctly. Thanks to Zoltan for the initial pointer.
6850 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
6852 * cs-tokenizer.cs: Set file name when specified with #line
6854 2003-01-15 Miguel de Icaza <miguel@ximian.com>
6856 * cs-parser.jay: Only perform the constructor checks here if we
6857 are named like the class; This will help provider a better
6858 error. The constructor path is taken when a type definition is
6859 not found, but most likely the user forgot to add the type, so
6860 report that rather than the constructor error.
6862 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
6864 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
6867 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6869 * cs-parser.jay: Add cleanup call.
6871 2003-01-13 Duncan Mak <duncan@ximian.com>
6873 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
6874 consistent with other methods.
6876 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6878 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
6880 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
6882 * attribute.cs: only set GuidAttr to true when we have a
6885 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6889 * typemanager.cs: fixes to allow mcs compile corlib with the new
6890 Type.IsSubclassOf fix.
6892 2003-01-08 Miguel de Icaza <miguel@ximian.com>
6894 * expression.cs (LocalVariableReference.DoResolve): Classify a
6895 constant as a value, not as a variable. Also, set the type for
6898 * cs-parser.jay (fixed_statement): take a type instead of a
6899 pointer_type, so we can produce a better error message later.
6901 * statement.cs (Fixed.Resolve): Flag types that are not pointers
6904 (For.DoEmit): Make inifinite loops have a
6905 non-conditional branch back.
6907 (Fixed.DoEmit): First populate the pinned variables, then emit the
6908 statement, then clear the variables. Before I was emitting the
6909 code once for each fixed piece.
6912 2003-01-08 Martin Baulig <martin@ximian.com>
6914 * statement.cs (FlowBranching.MergeChild): A break in a
6915 SWITCH_SECTION does not leave a loop. Fixes #36155.
6917 2003-01-08 Martin Baulig <martin@ximian.com>
6919 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
6920 lives in the same number space than `param_map'. Fixes #36154.
6922 2003-01-07 Miguel de Icaza <miguel@ximian.com>
6924 * cs-parser.jay (constructor_declaration): Set the
6925 Constructor.ModFlags before probing for it. This makes the
6926 compiler report 514, 515 and 132 (the code was there, but got
6929 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
6930 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
6931 (GotoCase.Resolve): Set `Returns' to ALWAYS.
6933 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
6935 * enum.cs: create the enum static fields using the enum type.
6937 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
6939 * class.cs: don't try to create the ParamBuilder for the return
6940 type if it's not needed (and handle it breaking for the ms runtime
6943 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
6945 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
6947 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6949 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6950 the command. This showed up while compiling the JANET source
6951 code, which used \r as its only newline separator.
6953 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6955 * class.cs (Method.Define): If we are an operator (because it
6956 reuses our code), then set the SpecialName and HideBySig. #36128
6958 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6960 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6961 exception, report error 120 `object reference required'.
6963 * driver.cs: Add --pause option, used during to measure the size
6964 of the process as it goes with --timestamp.
6966 * expression.cs (Invocation.DoResolve): Do not allow methods with
6967 SpecialName to be invoked.
6969 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6971 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6972 number before adding it.
6974 2002-12-21 Ravi Pratap <ravi@ximian.com>
6976 * ecore.cs (StandardImplicitConversion): When in an unsafe
6977 context, we allow conversion between void * to any other pointer
6978 type. This fixes bug #35973.
6980 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6982 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6983 is not thrown when extensionless outputs are used
6985 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6987 * rootcontext.cs: fixed compilation of corlib.
6989 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6991 * attribute.cs (Attributes.Contains): Add new method.
6993 * class.cs (MethodCore.LabelParameters): if the parameter is an
6994 `out' parameter, check that no attribute `[In]' has been passed.
6996 * enum.cs: Handle the `value__' name in an enumeration.
6998 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
7000 * decl.cs: Added special case to allow overrides on "protected
7003 2002-12-18 Ravi Pratap <ravi@ximian.com>
7005 * attribute.cs (Attributes.AddAttributeSection): Rename to this
7006 since it makes much more sense.
7008 (Attributes.ctor): Don't require a Location parameter.
7010 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
7012 * attribute.cs (ApplyAttributes): Remove extra Location parameters
7013 since we already have that information per attribute.
7015 * everywhere : make appropriate changes.
7017 * class.cs (LabelParameters): Write the code which actually
7018 applies attributes to the return type. We can't do this on the MS
7019 .NET runtime so we flag a warning in the case an exception is
7022 2002-12-18 Miguel de Icaza <miguel@ximian.com>
7024 * const.cs: Handle implicit null conversions here too.
7026 2002-12-17 Ravi Pratap <ravi@ximian.com>
7028 * class.cs (MethodCore.LabelParameters): Remove the extra
7029 Type [] parameter since it is completely unnecessary. Instead
7030 pass in the method's attributes so that we can extract
7031 the "return" attribute.
7033 2002-12-17 Miguel de Icaza <miguel@ximian.com>
7035 * cs-parser.jay (parse): Use Report.Error to flag errors instead
7036 of ignoring it and letting the compile continue.
7038 * typemanager.cs (ChangeType): use an extra argument to return an
7039 error condition instead of throwing an exception.
7041 2002-12-15 Miguel de Icaza <miguel@ximian.com>
7043 * expression.cs (Unary.TryReduce): mimic the code for the regular
7044 code path. Perform an implicit cast in the cases where we can
7045 implicitly convert to one of the integral types, and then reduce
7046 based on that constant. This fixes bug #35483.
7048 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7050 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
7052 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7054 * namespace.cs: fixed bug #35489.
7056 2002-12-12 Miguel de Icaza <miguel@ximian.com>
7058 * class.cs: Remove some dead code.
7060 * cs-parser.jay: Estimate the number of methods needed
7061 (RootContext.MethodCount);
7063 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
7064 numbers instead of StringBuilders.
7066 * support.cs (PtrHashtable): Add constructor with initial size;
7067 We can now reduce reallocations of the method table.
7069 2002-12-10 Ravi Pratap <ravi@ximian.com>
7071 * attribute.cs (ApplyAttributes): Keep track of the emitted
7072 attributes on a per-target basis. This fixes bug #35413.
7074 2002-12-10 Miguel de Icaza <miguel@ximian.com>
7076 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
7077 default to the Windows 1252 encoding.
7079 (UnixParseOption): Support version, thanks to Alp for the missing
7082 * AssemblyInfo.cs: Add nice assembly information.
7084 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
7087 * cs-parser.jay: Allow a trailing comma before the close bracked
7088 in the attribute_section production.
7090 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
7091 address of the instance was being taken, I will take this out,
7092 because we take the address of the object immediately here.
7094 2002-12-09 Ravi Pratap <ravi@ximian.com>
7096 * typemanager.cs (AreMultipleAllowed): Take care of the most
7097 obvious case where attribute type is not in the current assembly -
7100 2002-12-08 Miguel de Icaza <miguel@ximian.com>
7102 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
7103 definitions, instead of doing that afterwards.
7105 Also we use a nice little hack, depending on the constructor, we
7106 know if we are a "composed" name or a simple name. Hence, we
7107 avoid the IndexOf test, and we avoid
7109 * codegen.cs: Add code to assist in a bug reporter to track down
7110 the source of a compiler crash.
7112 2002-12-07 Ravi Pratap <ravi@ximian.com>
7114 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
7115 types have been emitted for a given element and flag an error
7116 if something which does not have AllowMultiple set is used more
7119 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
7120 attribute types and their corresponding AllowMultiple properties
7122 (AreMultipleAllowed): Check the property for a given type.
7124 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
7125 property in the case we have a TypeContainer.
7127 (Attributes.AddAttribute): Detect duplicates and just skip on
7128 adding them. This trivial fix catches a pretty gross error in our
7129 attribute emission - global attributes were being emitted twice!
7131 Bugzilla bug #33187 is now fixed.
7133 2002-12-06 Miguel de Icaza <miguel@ximian.com>
7135 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
7138 * expression.cs (Binary.ResolveOperator): I can only use the
7139 Concat (string, string, string) and Concat (string, string,
7140 string, string) if the child is actually a concatenation of
7143 2002-12-04 Miguel de Icaza <miguel@ximian.com>
7145 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
7146 context where we need a 2-character lookahead.
7148 * pending.cs (PendingImplementation): Rework so we can keep track
7149 of interface types all the time, and flag those which were
7150 implemented by parents as optional.
7152 2002-12-03 Miguel de Icaza <miguel@ximian.com>
7154 * expression.cs (Binary.ResolveOperator): Use
7155 String.Concat(string,string,string) or
7156 String.Concat(string,string,string,string) when possible.
7158 * typemanager: More helper methods.
7161 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
7163 * pending.cs: remove the bogus return from GetMissingInterfaces()
7164 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
7166 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7168 * namespace.cs: avoid duplicated 'using xxx' being added to
7169 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
7170 when we get more than one 'using' statement for the same namespace.
7171 Report a CS0105 warning for it.
7173 2002-11-30 Miguel de Icaza <miguel@ximian.com>
7175 * cs-tokenizer.cs (consume_identifier): use read directly, instead
7176 of calling getChar/putback, uses internal knowledge of it.
7178 (xtoken): Reorder tokenizer so most common patterns are checked
7179 first. This reduces the compilation time in another 5% (from 8.11s
7180 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
7182 The parsing time is 22% of the compilation in mcs, and from that
7183 64% is spent on the tokenization process.
7185 I tried using a binary search for keywords, but this is slower
7186 than the hashtable. Another option would be to do a couple of
7189 * Not use a StringBuilder, instead use an array of chars,
7190 with a set value. Notice that this way we could catch
7191 the 645 error without having to do it *afterwards*.
7193 * We could write a hand-parser to avoid the hashtable
7194 compares altogether.
7196 The identifier consumption process takes 37% of the tokenization
7197 time. Another 15% is spent on is_number. 56% of the time spent
7198 on is_number is spent on Int64.Parse:
7200 * We could probably choose based on the string length to
7201 use Int32.Parse or Int64.Parse and avoid all the 64-bit
7204 Another 3% is spend on wrapping `xtoken' in the `token' function.
7206 Handle 0xa0 as whitespace (#34752)
7208 2002-11-26 Miguel de Icaza <miguel@ximian.com>
7210 * typemanager.cs (IsCLRType): New routine to tell whether a type
7211 is one of the builtin types.
7213 Maybe it needs to use TypeCodes to be faster. Maybe we could use
7214 typecode in more places instead of doing pointer comparissions.
7215 We could leverage some knowledge about the way the typecodes are
7218 New code to cache namespaces in assemblies, it is currently not
7219 invoked, to be used soon.
7221 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
7223 * expression.cs (Binary.ResolveOperator): specially handle
7224 strings, and do not perform user-defined operator overloading for
7227 2002-11-24 Miguel de Icaza <miguel@ximian.com>
7229 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
7230 internalcall as it is a pretty simple operation; Avoid whenever
7231 possible to call Char.IsLetter.
7233 (consume_identifier): Cut by half the number of
7234 hashtable calls by merging the is_keyword and GetKeyword behavior.
7236 Do not short-circuit, because if we do, we
7237 report errors (ie, #if false && true would produce an invalid
7241 2002-11-24 Martin Baulig <martin@ximian.com>
7243 * expression.cs (Cast.TryReduce): If we're in checked syntax,
7244 check constant ranges and report a CS0221. Fixes #33186.
7246 2002-11-24 Martin Baulig <martin@ximian.com>
7248 * cs-parser.jay: Make this work for uninitialized variable
7249 declarations in the `for' initializer. Fixes #32416.
7251 2002-11-24 Martin Baulig <martin@ximian.com>
7253 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
7254 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
7256 2002-11-24 Martin Baulig <martin@ximian.com>
7258 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
7259 argument; if true, we also check for user-defined conversions.
7260 This is only needed if both arguments are of a user-defined type.
7261 Fixes #30443, added test-175.cs.
7262 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
7264 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
7266 2002-11-24 Martin Baulig <martin@ximian.com>
7268 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
7269 function to get the store opcode.
7270 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
7271 only emit the Ldelema if the store opcode is Stobj. You must run
7272 both test-34 and test-167 to test this. Fixes #34529.
7274 2002-11-23 Martin Baulig <martin@ximian.com>
7276 * ecore.cs (Expression.MemberLookup): Added additional
7277 `qualifier_type' argument which is used when we're being called
7278 from MemberAccess.DoResolve() and null if we're called from a
7280 (Expression.MemberLookupFailed): New method to report errors; this
7281 does the CS1540 check and reports the correct error message.
7283 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
7284 argument for the CS1540 check and redone the way how we're dealing
7285 with private members. See the comment in the source code for details.
7286 (FilterWithClosure): Reverted this back to revision 1.197; renamed
7287 `closure_start_type' to `closure_qualifier_type' and check whether
7288 it's not null. It was not this filter being broken, it was just
7289 being called with the wrong arguments.
7291 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
7292 and pass it the correct `qualifier_type'; this also does the error
7295 2002-11-22 Miguel de Icaza <miguel@ximian.com>
7297 * expression.cs (Invocation.EmitParams): If the we are dealing
7298 with a non-built-in value type, load its address as well.
7300 (ArrayCreation): Use a a pretty constant instead
7301 of the hardcoded value 2. Use 6 instead of 2 for the number of
7302 static initializers.
7304 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
7305 because they are not really value types, just glorified integers.
7307 * driver.cs: Do not append .exe, the CSC compiler does not do it.
7309 * ecore.cs: Remove redundant code for enumerations, make them use
7310 the same code path as everything else, fixes the casting issue
7311 with enumerations in Windows.Forms.
7313 * attribute.cs: Do only cast to string if it is a string, the
7314 validation happens later.
7316 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
7317 people upgrade their corlibs.
7319 * ecore.cs: Oops, enumerations were not following the entire code path
7321 2002-11-21 Miguel de Icaza <miguel@ximian.com>
7323 * typemanager.cs (FilterWithClosure): Commented out the test for
7324 1540 in typemanager.cs, as it has problems when accessing
7325 protected methods from a parent class (see test-174.cs).
7327 * attribute.cs (Attribute.ValidateGuid): new method.
7328 (Attribute.Resolve): Use above.
7330 2002-11-19 Miguel de Icaza <miguel@ximian.com>
7332 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
7334 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
7335 handling for enumerations, as we only needed the TypeContainer
7336 functionality to begin with (this is required for the fix below to
7337 work for enums that reference constants in a container class for
7340 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
7342 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
7343 a valid TypeBuilder to perform lookups on.o
7345 * class.cs (InheritableMemberSignatureCompare): Use true in the
7346 call to GetGetMethod and GetSetMethod, because we are comparing
7347 the signature, and we need to get the methods *even* if they are
7350 (PropertyBase.CheckBase): ditto.
7352 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
7353 GotoCase.Resolve): Use Peel on EmpytCasts.
7355 * ecore.cs (EmptyCast): drop child, add Peel method.
7357 2002-11-17 Martin Baulig <martin@ximian.com>
7359 * ecore.cs (EmptyCast.Child): New public property.
7361 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
7362 label resolved to an EmptyCast. Fixes #34162.
7363 (GotoCase.Resolve): Likewise.
7364 (Block.EmitMeta): Likewise.
7366 2002-11-17 Martin Baulig <martin@ximian.com>
7368 * expression.cs (Invocation.BetterConversion): Prefer int over
7369 uint; short over ushort; long over ulong for integer literals.
7370 Use ImplicitConversionExists instead of StandardConversionExists
7371 since we also need to check for user-defined implicit conversions.
7372 Fixes #34165. Added test-173.cs.
7374 2002-11-16 Martin Baulig <martin@ximian.com>
7376 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
7377 with the `true' and `false' literals. Fixes #33151.
7379 2002-11-16 Martin Baulig <martin@ximian.com>
7381 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
7382 October 22nd; don't do the cs1540 check for static members.
7384 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
7385 now using our own filter here and doing the cs1540 check again.
7387 2002-11-16 Martin Baulig <martin@ximian.com>
7389 * support.cs (InternalParameters): Don't crash if we don't have
7390 any fixed parameters. Fixes #33532.
7392 2002-11-16 Martin Baulig <martin@ximian.com>
7394 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
7395 when looking up static methods to make this work on Windows.
7398 2002-11-16 Martin Baulig <martin@ximian.com>
7400 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
7401 a setter rather than using PropertyInfo.CanWrite.
7403 2002-11-15 Nick Drochak <ndrochak@gol.com>
7405 * class.cs: Allow acces to block member by subclasses. Fixes build
7408 2002-11-14 Martin Baulig <martin@ximian.com>
7410 * class.cs (Constructor.Emit): Added the extern/block check.
7413 2002-11-14 Martin Baulig <martin@ximian.com>
7415 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
7416 iteration while looking for indexers, this is needed because the
7417 indexer may have a different name in our base classes. Fixed the
7418 error reporting (no indexers at all, not get accessor, no
7419 overloaded match). Fixes bug #33089.
7420 (IndexerAccess.DoResolveLValue): Likewise.
7422 2002-11-14 Martin Baulig <martin@ximian.com>
7424 * class.cs (PropertyBase.CheckBase): Make this work for multiple
7425 indexers. Fixes the first part of bug #33089.
7426 (MethodSignature.InheritableMemberSignatureCompare): Added support
7429 2002-11-13 Ravi Pratap <ravi@ximian.com>
7431 * attribute.cs (Attribute.Resolve): Catch the
7432 NullReferenceException and report it since it isn't supposed to
7435 2002-11-12 Miguel de Icaza <miguel@ximian.com>
7437 * expression.cs (Binary.EmitBranchable): Also handle the cases for
7438 LogicalOr and LogicalAnd that can benefit from recursively
7439 handling EmitBranchable. The code now should be nice for Paolo.
7441 2002-11-08 Miguel de Icaza <miguel@ximian.com>
7443 * typemanager.cs (LookupType): Added a negative-hit hashtable for
7444 the Type lookups, as we perform quite a number of lookups on
7445 non-Types. This can be removed once we can deterministically tell
7446 whether we have a type or a namespace in advance.
7448 But this might require special hacks from our corlib.
7452 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
7453 and double which avoids a conversion from an integer to a double.
7455 * expression.cs: tiny optimization, avoid calling IsConstant,
7456 because it effectively performs the lookup twice.
7458 2002-11-06 Miguel de Icaza <miguel@ximian.com>
7460 But a bogus return here to keep the semantics of the old code
7461 until the Mono runtime is fixed.
7463 * pending.cs (GetMissingInterfaces): New method used to remove all
7464 the interfaces that are already implemented by our parent
7465 classes from the list of pending methods.
7467 * interface.cs: Add checks for calls after ResolveTypeExpr.
7469 2002-11-05 Miguel de Icaza <miguel@ximian.com>
7471 * class.cs (Class.Emit): Report warning 67: event not used if the
7472 warning level is beyond 3.
7474 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
7475 being a NullLiteral.
7477 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
7480 * class.cs (TypeContainer.GetClassBases): Cover a missing code
7481 path that might fail if a type can not be resolved.
7483 * expression.cs (Binary.Emit): Emit unsigned versions of the
7486 * driver.cs: use error 5.
7488 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
7490 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
7492 2002-11-01 Miguel de Icaza <miguel@ximian.com>
7494 * cs-parser.jay (switch_section): A beautiful patch from Martin
7495 Baulig that fixed 33094.
7497 2002-10-31 Miguel de Icaza <miguel@ximian.com>
7499 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
7500 Check whether the base is abstract and report an error if so.
7502 * expression.cs (IndexerAccess.DoResolveLValue,
7503 IndexerAccess.DoResolve): ditto.
7505 (Invocation.DoResolve): ditto.
7507 (Invocation.FullMethodDesc): Improve the report string.
7509 * statement.cs (Block): Eliminate IsVariableDefined as it is
7510 basically just a wrapper for GetVariableInfo.
7512 * ecore.cs (SimpleName): Use new
7514 * support.cs (ReflectionParamter.ParameterType): We unwrap the
7515 type, as we return the actual parameter ref/unref state on a
7518 2002-10-30 Miguel de Icaza <miguel@ximian.com>
7520 * support.cs: Return proper flags REF/OUT fixing the previous
7523 * expression.cs: Reverted last patch, that was wrong. Is_ref is
7524 not used to mean `ref' but `ref or out' in ParameterReference
7526 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
7527 full type signature instead of calling TypeManger.CSharpName
7530 * support.cs (InternalParameters.ParameterDesc): Do not compare
7531 directly to the modflags, because REF/OUT will actually be bitsets
7534 * delegate.cs (VerifyMethod): Check also the modifiers.
7536 * cs-tokenizer.cs: Fix bug where floating point values with an
7537 exponent where a sign was missing was ignored.
7539 * driver.cs: Allow multiple assemblies to be specified in a single
7542 2002-10-28 Miguel de Icaza <miguel@ximian.com>
7544 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
7545 because identifiers after a parenthesis would end up in this kind
7546 of production, and we needed to desamiguate it for having casts
7549 (UserDefinedType *) xxx
7551 2002-10-24 Miguel de Icaza <miguel@ximian.com>
7553 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
7554 we should set on the Bindingflags.NonPublic, but not turn on
7555 private_ok. private_ok controls whether a Private member is
7556 returned (this is chekced on the filter routine), while the
7557 BindingFlags.NonPublic just controls whether private/protected
7558 will be allowed. This fixes the problem part of the problem of
7559 private properties being allowed to be used in derived classes.
7561 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
7562 so we can call the children DoResolveLValue method (this will
7563 properly signal errors on lvalue assignments to base properties)
7565 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
7566 getter are null, and we have a property info, we know that this
7567 happened because the lookup failed, so we report an error 122 for
7568 protection level violation.
7570 We also silently return if setter and getter are null in the
7571 resolve functions, this condition only happens if we have flagged
7572 the error before. This is the other half of the problem.
7574 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
7575 not have accessibility information, that is why we were returning
7576 true in the filter function in typemanager.cs.
7578 To properly report 122 (property is inaccessible because of its
7579 protection level) correctly, we report this error in ResolveAccess
7580 by failing if both the setter and the getter are lacking (ie, the
7583 DoResolve and DoLResolve have been modified to check for both
7584 setter/getter being null and returning silently, the reason being
7585 that I did not want to put the knowledge about this error in upper
7588 int old = Report.Errors;
7589 x = new PropertyExpr (...);
7590 if (old != Report.Errors)
7595 So the property expr is returned, but it is invalid, so the error
7596 will be flagged during the resolve process.
7598 * class.cs: Remove InheritablePropertySignatureCompare from the
7599 class, as we no longer depend on the property signature to compute
7600 whether it is possible to implement a method or not.
7602 The reason is that calling PropertyInfo.GetGetMethod will return
7603 null (in .NET, in Mono it works, and we should change this), in
7604 cases where the Get Method does not exist in that particular
7609 class X { public virtual int A { get { return 1; } } }
7611 class Z : Y { public override int A { get { return 2; } } }
7613 Would fail in Z because the parent (Y) would not have the property
7614 defined. So we avoid this completely now (because the alternative
7615 fix was ugly and slow), and we now depend exclusively on the
7618 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7619 reference method, instead of using the property.
7621 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7622 routines are gone now.
7624 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7625 names, they were incorrectly named.
7627 * cs-tokenizer.cs: Return are more gentle token on failure.
7629 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7630 had an out-of-sync index variable, which caused it to remove from
7631 the list of pending methods the wrong method sometimes.
7633 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7635 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7636 CanWrite, because those refer to this particular instance of the
7637 property, and do not take into account the fact that we can
7638 override single members of a property.
7640 Constructor requires an EmitContext. The resolution process does
7641 not happen here, but we need to compute the accessors before,
7642 because the resolution does not always happen for properties.
7644 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7645 subclass, before we did not update this flag, but we did update
7648 (GetAccessors): Drop this routine, as it did not work in the
7649 presence of partially overwritten set/get methods.
7651 Notice that this broke the cs1540 detection, but that will require
7654 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7658 * driver.cs: issue a warning instead of an error if we don't support
7659 debugging for the platform. Also ignore a couple of errors that may
7660 arise when trying to write the symbols. Undo my previous patch.
7662 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7664 * driver.cs: ignore /debug switch except for Unix platforms.
7666 2002-10-23 Nick Drochak <ndrochak@gol.com>
7668 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7670 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7672 * driver.cs: Do not make mcs-debug conditional, so we do not break
7675 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7676 review this patch. But basically after all the children variables
7677 have been merged, the value of "Breaks" was not being set to
7678 new_breaks for Switch blocks. I think that it should be set after
7679 it has executed. Currently I set this to the value of new_breaks,
7680 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7681 conservative, but I do not understand this code very well.
7683 I did not break anything in the build, so that is good ;-)
7685 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7687 2002-10-20 Mark Crichton <crichton@gimp.org>
7689 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7691 2002-10-20 Nick Drochak <ndrochak@gol.com>
7693 * cfold.cs: Fixed compile blocker.
7695 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7697 * driver.cs: I was chekcing the key, not the file.
7699 2002-10-19 Ravi Pratap <ravi@ximian.com>
7701 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7702 message that we were generating - we just need to silently return
7705 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7707 * class.cs (Event.Define): Change my previous commit, as this
7708 breaks the debugger. This is a temporary hack, as it seems like
7709 the compiler is generating events incorrectly to begin with.
7711 * expression.cs (Binary.ResolveOperator): Added support for
7712 "U operator - (E x, E y)"
7714 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7717 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7718 init-only variables, but this path did not take into account that
7719 there might be also instance readonly variables. Correct this
7722 This fixes bug 32253
7724 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7727 * driver.cs: Change the extension for modules to `netmodule'
7729 * cs-parser.jay: Improved slightly the location tracking for
7730 the debugger symbols.
7732 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7733 modifiers that were specified instead of the hardcoded value
7734 (FamAndAssem). This was basically ignoring the static modifier,
7735 and others. Fixes 32429.
7737 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7738 fixed a bug in the process (32476)
7740 * expression.cs (ArrayAccess.EmitAssign): Patch from
7741 hwang_rob@yahoo.ca that fixes bug 31834.3
7743 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7745 * driver.cs: Make the module extension .netmodule.
7747 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7749 * driver.cs: Report an error if the resource file is not found
7750 instead of crashing.
7752 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7753 false, like Emit does.
7755 2002-10-16 Nick Drochak <ndrochak@gol.com>
7757 * typemanager.cs: Remove unused private member. Also reported mcs
7758 bug to report this as a warning like csc.
7760 2002-10-15 Martin Baulig <martin@gnome.org>
7762 * statement.cs (Statement.Emit): Made this a virtual method; emits
7763 the line number info and calls DoEmit().
7764 (Statement.DoEmit): New protected abstract method, formerly knows
7765 as Statement.Emit().
7767 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7769 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7771 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7772 have fixed a remaining problem: not every AddXXXX was adding a
7773 fully qualified name.
7775 Now everyone registers a fully qualified name in the DeclSpace as
7776 being defined instead of the partial name.
7778 Downsides: we are slower than we need to be due to the excess
7779 copies and the names being registered this way.
7781 The reason for this is that we currently depend (on the corlib
7782 bootstrap for instance) that types are fully qualified, because
7783 we dump all the types in the namespace, and we should really have
7784 types inserted into the proper namespace, so we can only store the
7785 basenames in the defined_names array.
7787 2002-10-10 Martin Baulig <martin@gnome.org>
7789 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
7790 from bug #31834, see the bug report for a testcase which is
7793 2002-10-10 Martin Baulig <martin@gnome.org>
7795 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
7796 flow analysis code for this.
7798 * statement.cs (Do, While, For): Tell the flow analysis code about
7800 (FlowBranching.UsageVector): Added support for infinite loops.
7801 (Block.Resolve): Moved the dead code elimination here and use flow
7804 2002-10-09 Miguel de Icaza <miguel@ximian.com>
7806 * class.cs (Field.Define): Catch cycles on struct type
7809 * typemanager.cs (IsUnmanagedtype): Do not recursively check
7810 fields if the fields are static. We only need to check instance
7813 * expression.cs (As.DoResolve): Test for reference type.
7815 * statement.cs (Using.ResolveExpression): Use
7816 ConvertImplicitRequired, not ConvertImplicit which reports an
7818 (Using.ResolveLocalVariableDecls): ditto.
7820 * expression.cs (Binary.ResolveOperator): Report errors in a few
7821 places where we had to.
7823 * typemanager.cs (IsUnmanagedtype): Finish implementation.
7825 2002-10-08 Miguel de Icaza <miguel@ximian.com>
7827 * expression.cs: Use StoreFromPtr instead of extracting the type
7828 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
7830 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
7831 an enumeration value to a System.Enum, but System.Enum is not a
7832 value type, but an class type, so we need to box.
7834 (Expression.ConvertExplicit): One codepath could return
7835 errors but not flag them. Fix this. Fixes #31853
7837 * parameter.cs (Resolve): Do not allow void as a parameter type.
7839 2002-10-06 Martin Baulig <martin@gnome.org>
7841 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
7842 if it's a class type and not a struct. Fixes #31815.
7844 2002-10-06 Martin Baulig <martin@gnome.org>
7846 * statement.cs: Reworked the flow analysis code a bit to make it
7847 usable for dead code elimination.
7849 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7851 * cs-parser.jay: allow empty source files. Fixes bug #31781.
7853 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7855 * expression.cs (ComposedCast.DoResolveType): A quick workaround
7856 to fix the test 165, will investigate deeper.
7858 2002-10-04 Martin Baulig <martin@gnome.org>
7860 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
7861 finally blocks actually work.
7862 (Try.Resolve): We don't need to create a sibling for `finally' if
7863 there is no finally block.
7865 2002-10-04 Martin Baulig <martin@gnome.org>
7867 * class.cs (Constructor.Define): The default accessibility for a
7868 non-default constructor is private, not public.
7870 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7872 * class.cs (Constructor): Make AllowedModifiers public, add
7875 * cs-parser.jay: Perform the modifiers test here, as the
7876 constructor for the Constructor class usually receives a zero
7877 because of the way we create it (first we create, later we
7878 customize, and we were never checking the modifiers).
7880 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
7881 is a version of LookupTypeReflection that includes the type-name
7882 cache. This can be used as a fast path for functions that know
7883 the fully qualified name and are only calling into *.GetType() to
7884 obtain a composed type.
7886 This is also used by TypeManager.LookupType during its type
7889 (LookupType): We now also track the real type name, as sometimes
7890 we can get a quey for the real type name from things like
7891 ComposedCast. This fixes bug 31422.
7893 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
7894 complete type fullname, it does not have to go through the type
7895 resolution system to obtain the composed version of the type (for
7896 obtaining arrays or pointers).
7898 (Conditional.Emit): Use the EmitBoolExpression to
7899 generate nicer code, as requested by Paolo.
7901 (ArrayCreation.CheckIndices): Use the patch from
7902 hwang_rob@yahoo.ca to validate the array initializers.
7904 2002-10-03 Miguel de Icaza <miguel@ximian.com>
7906 * class.cs (ConstructorInitializer.Emit): simplify code by using
7907 Invocation.EmitCall, and at the same time, fix the bugs in calling
7908 parent constructors that took variable arguments.
7910 * ecore.cs (Expression.ConvertNumericExplicit,
7911 Expression.ImplicitNumericConversion): Remove the code that
7912 manually wrapped decimal (InternalTypeConstructor call is now gone
7915 * expression.cs (Cast.TryReduce): Also handle decimal types when
7916 trying to perform a constant fold on the type.
7918 * typemanager.cs (IsUnmanagedtype): Partially implemented.
7920 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
7921 that only turned off an error report, and did nothing else.
7923 2002-10-02 Miguel de Icaza <miguel@ximian.com>
7925 * driver.cs: Handle and ignore /fullpaths
7927 2002-10-01 Miguel de Icaza <miguel@ximian.com>
7929 * expression.cs (Binary.ResolveOperator): Catch the case where
7930 DoNumericPromotions returns true,
7932 (Binary.DoNumericPromotions): Simplify the code, and the tests.
7934 2002-09-27 Miguel de Icaza <miguel@ximian.com>
7936 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
7939 2002-09-26 Miguel de Icaza <miguel@ximian.com>
7941 * ecore.cs (ConvertNumericExplicit): It is not enough that the
7942 conversion exists, but it is also required that the conversion be
7943 performed. This manifested in "(Type64Enum) 2".
7945 * class.cs (TypeManager.AddMethod): The fix is not to change
7946 AddEnum, because that one was using a fully qualified name (every
7947 DeclSpace derivative does), but to change the AddMethod routine
7948 that was using an un-namespaced name. This now correctly reports
7949 the duplicated name.
7951 Revert patch until I can properly fix it. The issue
7952 is that we have a shared Type space across all namespaces
7953 currently, which is wrong.
7955 Options include making the Namespace a DeclSpace, and merge
7956 current_namespace/current_container in the parser.
7958 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7960 * cs-parser.jay: Improve error reporting when we get a different
7961 kind of expression in local_variable_type and
7962 local_variable_pointer_type.
7964 Propagate this to avoid missleading errors being reported.
7966 * ecore.cs (ImplicitReferenceConversion): treat
7967 TypeManager.value_type as a target just like object_type. As
7972 Is valid, and needs to result in the int 1 being boxed before it
7973 is assigned to the value type v.
7975 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7976 to validate the enumeration name.
7978 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7979 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7980 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7982 * ecore.cs (TryImplicitIntConversion): When doing an
7983 implicit-enumeration-conversion, check if the type is 64-bits and
7984 perform a conversion before passing to EnumConstant.
7986 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7988 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7989 report ambiguous type references. Unlike the MS version, we
7990 report what the ambiguity is. Innovation at work ;-)
7992 (DeclSpace.FindType): Require a location argument to
7993 display when we display an ambiguous error.
7995 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7997 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7999 * expression.cs (EmitDynamicInitializers): Apply patch from
8000 hwang_rob@yahoo.ca that fixes the order in which we emit our
8003 2002-09-21 Martin Baulig <martin@gnome.org>
8005 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
8006 delegate takes no arguments.
8008 2002-09-20 Miguel de Icaza <miguel@ximian.com>
8010 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
8013 * expression.cs: Extract the underlying type.
8015 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
8017 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
8019 2002-09-19 Miguel de Icaza <miguel@ximian.com>
8021 * class.cs (TypeContainer.DefineType): We can not use the nice
8022 PackingSize with the size set to 1 DefineType method, because it
8023 will not allow us to define the interfaces that the struct
8026 This completes the fixing of bug 27287
8028 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
8029 means also structs. This fixes part of the problem.
8030 (Expresion.ImplicitReferenceConversionExists): ditto.
8032 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
8033 error if there were no errors reported during the type lookup
8034 process, to avoid duplicates or redundant errors. Without this
8035 you would get an ambiguous errors plus a type not found. We have
8036 beaten the user enough with the first error.
8038 (DeclSparce.FindType): Emit a warning if we have an ambiguous
8041 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
8042 during the resolution process, stop the lookup, this avoids
8043 repeated error reports (same error twice).
8045 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
8047 * typemanager.cs (LookupType): Redo the type lookup code to match
8048 the needs of System.Reflection.
8050 The issue is that System.Reflection requires references to nested
8051 types to begin with a "+" sign instead of a dot. So toplevel
8052 types look like: "NameSpace.TopLevelClass", and nested ones look
8053 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
8056 2002-09-19 Martin Baulig <martin@gnome.org>
8058 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
8059 says that a method always returns or always throws an exception,
8060 don't report the CS0161.
8062 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
8063 set `Returns = new_returns'.
8065 2002-09-19 Martin Baulig <martin@gnome.org>
8067 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
8068 to an enum constant, check for a CS0176.
8070 2002-09-18 Miguel de Icaza <miguel@ximian.com>
8072 * class.cs (TypeContainer.CheckPairedOperators): Now we check
8073 for operators that must be in pairs and report errors.
8075 * ecore.cs (SimpleName.DoResolveType): During the initial type
8076 resolution process, when we define types recursively, we must
8077 check first for types in our current scope before we perform
8078 lookups in the enclosing scopes.
8080 * expression.cs (MakeByteBlob): Handle Decimal blobs.
8082 (Invocation.VerifyArgumentsCompat): Call
8083 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
8084 I thought we were supposed to always call this, but there are a
8085 few places in the code where we dont do it.
8087 2002-09-17 Miguel de Icaza <miguel@ximian.com>
8089 * driver.cs: Add support in -linkres and -resource to specify the
8090 name of the identifier.
8092 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8094 * ecore.cs (StandardConversionExists): Sync with the conversion
8095 code: allow anything-* to void* conversions.
8097 (FindMostSpecificSource): Use an Expression argument
8098 instead of a Type, because we might be handed over a Literal which
8099 gets a few more implicit conversions that plain types do not. So
8100 this information was being lost.
8102 Also, we drop the temporary type-holder expression when not
8105 2002-09-17 Martin Baulig <martin@gnome.org>
8107 * class.cs (PropertyBase.CheckBase): Don't check the base class if
8108 this is an explicit interface implementation.
8110 2002-09-17 Martin Baulig <martin@gnome.org>
8112 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
8113 different `IndexerName' attributes.
8115 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
8116 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
8117 virtual CommonResolve().
8119 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8121 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
8122 and convert that to the UnderlyingType.
8124 * statement.cs (Foreach.Resolve): Indexers are just like variables
8125 or PropertyAccesses.
8127 * cs-tokenizer.cs (consume_string): Track line numbers and columns
8128 inside quoted strings, we were not doing this before.
8130 2002-09-16 Martin Baulig <martin@gnome.org>
8132 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
8133 resolve it. This is needed for the definite assignment check of the
8134 instance expression, fixes bug #29846.
8135 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
8137 2002-09-16 Nick Drochak <ndrochak@gol.com>
8139 * parameter.cs: Fix compile error. Cannot reference static member
8140 from an instance object. Is this an mcs bug?
8142 2002-09-14 Martin Baulig <martin@gnome.org>
8144 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
8145 multiple times. Fixes bug #30295, added test-166.cs.
8147 2002-09-14 Martin Baulig <martin@gnome.org>
8149 * statement.cs (Block.Emit): Don't emit unreachable code.
8150 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
8152 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
8154 2002-09-14 Martin Baulig <martin@gnome.org>
8156 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
8159 2002-09-14 Martin Baulig <martin@gnome.org>
8161 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
8162 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
8163 be false on the ms runtime.
8165 2002-09-13 Martin Baulig <martin@gnome.org>
8167 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
8168 the CS0038 error message.
8170 2002-09-12 Miguel de Icaza <miguel@ximian.com>
8172 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
8173 constant inside, return it.
8175 2002-09-12 Martin Baulig <martin@gnome.org>
8177 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
8178 implicit conversion can be done between enum types.
8180 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
8181 check whether an implicit conversion to the current enum's UnderlyingType
8182 exists and report an error if not.
8184 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
8185 without debugging support.
8187 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
8188 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
8190 2002-09-12 Martin Baulig <martin@gnome.org>
8192 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
8194 * ecore.cs (IMemberExpr.DeclaringType): New property.
8195 (SimpleName.SimpleNameResolve): Check whether we're accessing a
8196 nonstatic member of an outer type (CS0038).
8198 2002-09-11 Miguel de Icaza <miguel@ximian.com>
8200 * driver.cs: Activate the using-error detector at warning level
8201 4 (at least for MS-compatible APIs).
8203 * namespace.cs (VerifyUsing): Small buglett fix.
8205 * pending.cs (PendingImplementation): pass the container pointer.
8207 * interface.cs (GetMethods): Allow for recursive definition. Long
8208 term, I would like to move every type to support recursive
8209 definitions, not the current ordering mechanism that we have right
8212 The situation is this: Attributes are handled before interfaces,
8213 so we can apply attributes to interfaces. But some attributes
8214 implement interfaces, we will now handle the simple cases
8215 (recursive definitions will just get an error).
8217 * parameter.cs: Only invalidate types at the end if we fail to
8220 2002-09-09 Martin Baulig <martin@gnome.org>
8222 * ecore.cs (PropertyExpr.Emit): Also check for
8223 TypeManager.system_int_array_get_length so this'll also work when
8224 compiling corlib. Fixes #30003.
8226 2002-09-09 Martin Baulig <martin@gnome.org>
8228 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
8229 and throw an exception if we can't get the type's size. Fixed #30040,
8232 2002-09-09 Martin Baulig <martin@gnome.org>
8234 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
8236 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
8237 context. Fixes bug #30027.
8239 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
8240 virtual functions. Fixes bug #30043, added test-164.cs.
8242 2002-09-08 Ravi Pratap <ravi@ximian.com>
8244 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
8246 2002-09-08 Nick Drochak <ndrochak@gol.com>
8248 * driver.cs: Use an object to get the windows codepage since it's not a
8251 2002-09-08 Miguel de Icaza <miguel@ximian.com>
8253 * statement.cs (For.Emit): for infinite loops (test == null)
8254 return whether there is a break inside, not always "true".
8256 * namespace.cs (UsingEntry): New struct to hold the name of the
8257 using definition, the location where it is defined, and whether it
8258 has been used in a successful type lookup.
8260 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
8265 2002-09-06 Ravi Pratap <ravi@ximian.com>
8267 * attribute.cs : Fix incorrect code which relied on catching
8268 a NullReferenceException to detect a null being passed in
8269 where an object was expected.
8271 2002-09-06 Miguel de Icaza <miguel@ximian.com>
8273 * statement.cs (Try): flag the catch variable as assigned
8275 * expression.cs (Cast): Simplified by using ResolveType instead of
8278 * statement.cs (Catch): Fix bug by using ResolveType.
8280 2002-09-06 Ravi Pratap <ravi@ximian.com>
8282 * expression.cs (BetterConversion): Special case for when we have
8283 a NullLiteral as the argument and we have to choose between string
8284 and object types - we choose string the way csc does.
8286 * attribute.cs (Attribute.Resolve): Catch the
8287 NullReferenceException and report error #182 since the Mono
8288 runtime no more has the bug and having this exception raised means
8289 we tried to select a constructor which takes an object and is
8292 2002-09-05 Ravi Pratap <ravi@ximian.com>
8294 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
8295 message (1502, 1503) when we can't locate a method after overload
8296 resolution. This is much more informative and closes the bug
8299 * interface.cs (PopulateMethod): Return if there are no argument
8300 types. Fixes a NullReferenceException bug.
8302 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
8303 expressions too. Previously we were checking only in one place for
8304 positional arguments leaving out named arguments.
8306 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
8307 type to the enum type is not allowed. Remove code corresponding to
8310 (ConvertNumericExplicit): Allow explicit conversions from
8311 the underlying type to enum type. This precisely follows the spec
8312 and closes a bug filed by Gonzalo.
8314 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8317 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
8319 2002-09-03 Miguel de Icaza <miguel@ximian.com>
8321 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
8322 it was important that we stored the right value after the
8323 reduction in `converted'.
8325 2002-09-04 Martin Baulig <martin@gnome.org>
8327 * location.cs (Location.SymbolDocument): Use full pathnames for the
8330 2002-08-30 Miguel de Icaza <miguel@ximian.com>
8332 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
8333 of the expression resolve mechanism, because that will catch the
8334 SimpleName error failures.
8336 (Conditional): If we can not resolve the
8337 expression, return, do not crash.
8339 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8342 (location): display token name instead of its number.
8344 2002-08-28 Martin Baulig <martin@gnome.org>
8346 * expression.cs (Binary.ResolveOperator): Don't silently return
8347 but return an error if an operator cannot be applied between two
8350 2002-08-28 Martin Baulig <martin@gnome.org>
8352 * class.cs (Constructor.Define): Set the permission attributes
8353 correctly instead of making all constructors public.
8355 2002-08-28 Martin Baulig <martin@gnome.org>
8357 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
8358 for private members before reporting a CS0103; if we find anything,
8361 2002-08-28 Martin Baulig <martin@gnome.org>
8363 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
8364 to check whether `closure_start_type == closure_invocation_type',
8365 we also need to check whether `m.DeclaringType == closure_invocation_type'
8366 before bypassing the permission checks. We might be accessing
8367 protected/private members from the base class.
8368 (TypeManager.RealMemberLookup): Only set private_ok if private
8369 members were requested via BindingFlags.NonPublic.
8371 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
8373 * expression.cs (MemberAccess.ResolveMemberAccess): Set
8374 MethodGroupExpr.IsExplicitImpl if appropriate.
8375 (Invocation.DoResolve): Don't report the CS0120 for explicit
8376 interface implementations.
8378 2002-08-27 Martin Baulig <martin@gnome.org>
8380 * expression.cs (Invocation.DoResolve): If this is a static
8381 method and we don't have an InstanceExpression, we must report
8384 2002-08-25 Martin Baulig <martin@gnome.org>
8386 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
8387 `==' between a valuetype and an object.
8389 2002-08-25 Miguel de Icaza <miguel@ximian.com>
8391 * ecore.cs (TypeExpr): Provide a ToString method.
8393 2002-08-24 Martin Baulig <martin@gnome.org>
8395 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
8396 now called proggie.dbg and it's a binary file.
8398 2002-08-23 Martin Baulig <martin@gnome.org>
8400 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
8402 2002-08-23 Martin Baulig <martin@gnome.org>
8404 * struct.cs (MyStructInfo.ctor): Make this work with empty
8405 structs; it's not allowed to use foreach() on null.
8407 2002-08-23 Martin Baulig <martin@gnome.org>
8409 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
8410 writer the full pathname of the generated assembly.
8412 2002-08-23 Martin Baulig <martin@gnome.org>
8414 * statements.cs (FlowBranching.UsageVector.MergeChildren):
8415 A `finally' block never returns or breaks; improved handling of
8418 2002-08-23 Martin Baulig <martin@gnome.org>
8420 * statement.cs (Throw.Resolve): Allow `throw null'.
8422 2002-08-23 Martin Baulig <martin@gnome.org>
8424 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
8425 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
8426 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
8427 MemberLookup would return a wrong event if this is an explicit
8428 interface implementation and the class has an event with the same
8431 2002-08-23 Martin Baulig <martin@gnome.org>
8433 * statement.cs (Block.AddChildVariableNames): New public method.
8434 (Block.AddChildVariableName): Likewise.
8435 (Block.IsVariableNameUsedInChildBlock): Likewise.
8436 (Block.AddVariable): Check whether a variable name has already
8437 been used in a child block.
8439 * cs-parser.jay (declare_local_variables): Mark all variable names
8440 from the current block as being used in a child block in the
8443 2002-08-23 Martin Baulig <martin@gnome.org>
8445 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
8446 find the symbol writer.
8448 * driver.cs: csc also allows the arguments to /define being
8449 separated by commas, not only by semicolons.
8451 2002-08-23 Martin Baulig <martin@gnome.org>
8453 * interface.cs (Interface.GetMembers): Added static check for events.
8455 2002-08-15 Martin Baulig <martin@gnome.org>
8457 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
8458 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
8460 * ecore.cs (Expression.MemberLookup): Added documentation and explained
8461 why the MethodData.EmitDestructor() change was necessary.
8463 2002-08-20 Martin Baulig <martin@gnome.org>
8465 * class.cs (TypeContainer.FindMembers): Added static check for events.
8467 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
8469 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
8470 use Type.GetEvents(), not Type.FindMembers().
8472 2002-08-20 Martin Baulig <martin@gnome.org>
8474 * decl.cs (MemberCache): Added a special method cache which will
8475 be used for method-only searched. This ensures that a method
8476 search will return a MethodInfo with the correct ReflectedType for
8479 2002-08-20 Martin Baulig <martin@gnome.org>
8481 * decl.cs (DeclSpace.FindMembers): Made this public.
8483 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8485 * delegate.cs: fixed build on windows.
8486 [FIXME: Filed as bug #29150: MCS must report these errors.]
8488 2002-08-19 Ravi Pratap <ravi@ximian.com>
8490 * ecore.cs (StandardConversionExists): Return a false
8491 if we are trying to convert the void type to anything else
8492 since that is not allowed.
8494 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
8495 we flag error 70 in the event an event is trying to be accessed
8496 directly from outside the declaring type.
8498 2002-08-20 Martin Baulig <martin@gnome.org>
8500 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
8501 MemberCache from typemanager.cs to decl.cs.
8503 2002-08-19 Martin Baulig <martin@gnome.org>
8505 * class.cs (TypeContainer): Implement IMemberContainer.
8506 (TypeContainer.DefineMembers): Create the MemberCache.
8507 (TypeContainer.FindMembers): Do better BindingFlags checking; only
8508 return public members if BindingFlags.Public was given, check
8509 whether members are static.
8511 2002-08-16 Martin Baulig <martin@gnome.org>
8513 * decl.cs (DeclSpace.Define): Splitted this in Define and
8514 DefineMembers. DefineMembers is called first and initializes the
8517 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
8518 DefineMembers() on all our DeclSpaces.
8520 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
8521 but call DefineMembers() on all nested interfaces. We call their
8522 Define() in our new Define() function.
8524 * interface.cs (Interface): Implement IMemberContainer.
8525 (Interface.Define): Moved all code except the attribute stuf to
8527 (Interface.DefineMembers): Initialize the member cache.
8529 * typemanager.cs (IMemberFinder): Removed this interface, we don't
8530 need this anymore since we can use MemberCache.FindMembers directly.
8532 2002-08-19 Martin Baulig <martin@gnome.org>
8534 * typemanager.cs (MemberCache): When creating the cache for an
8535 interface type, add all inherited members.
8536 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
8537 to `out bool used_cache' and documented it.
8538 (TypeManager.MemberLookup): If we already used the cache in the first
8539 iteration, we don't need to do the interfaces check.
8541 2002-08-19 Martin Baulig <martin@gnome.org>
8543 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
8544 here from IMemberFinder and don't implement this interface anymore.
8545 (DeclSpace.MemberCache): Moved here from IMemberFinder.
8547 * typemanager.cs (IMemberFinder): This interface is now only used by
8548 classes which actually support the member cache.
8549 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
8550 since we only put DeclSpaces into this Hashtable.
8551 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
8552 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
8554 2002-08-16 Martin Baulig <martin@gnome.org>
8556 * typemanager.cs (ICachingMemberFinder): Removed.
8557 (IMemberFinder.MemberCache): New property.
8558 (TypeManager.FindMembers): Merged this with RealFindMembers().
8559 This function will never be called from TypeManager.MemberLookup()
8560 so we can't use the cache here, just the IMemberFinder.
8561 (TypeManager.MemberLookup_FindMembers): Check whether the
8562 IMemberFinder has a MemberCache and call the cache's FindMembers
8564 (MemberCache): Rewrote larger parts of this yet another time and
8565 cleaned it up a bit.
8567 2002-08-15 Miguel de Icaza <miguel@ximian.com>
8569 * driver.cs (LoadArgs): Support quoting.
8571 (Usage): Show the CSC-like command line arguments.
8573 Improved a few error messages.
8575 2002-08-15 Martin Baulig <martin@gnome.org>
8577 * typemanager.cs (IMemberContainer.Type): New property.
8578 (IMemberContainer.IsInterface): New property.
8580 The following changes are conditional to BROKEN_RUNTIME, which is
8581 defined at the top of the file.
8583 * typemanager.cs (MemberCache.MemberCache): Don't add the base
8584 class'es members, but add all members from TypeHandle.ObjectType
8585 if we're an interface.
8586 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
8587 is the current type.
8588 (MemberCache.CacheEntry.Container): Removed this field.
8589 (TypeHandle.GetMembers): Include inherited members.
8591 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8593 * typemanager.cs: fixed compilation and added a comment on a field that
8596 2002-08-15 Martin Baulig <martin@gnome.org>
8598 * class.cs (ConstructorInitializer.Resolve): In the
8599 Expression.MemberLookup call, use the queried_type as
8602 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8603 declared' attribute, it's always true.
8604 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8605 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8606 temporary wrapper for FindMembers which tells MemberLookup whether
8607 members from the base classes are included in the return value.
8608 This will go away soon.
8609 (TypeManager.MemberLookup): Use this temporary hack here; once the
8610 new MemberCache is completed, we don't need to do the DeclaredOnly
8611 looping here anymore since the MemberCache will take care of this.
8612 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8613 (MemberCache): When creating the MemberCache for a class, get
8614 members from the current class and all its base classes.
8615 (MemberCache.CacheEntry.Container): New field. This is a
8616 temporary hack until the Mono runtime is fixed to distinguish
8617 between ReflectedType and DeclaringType. It allows us to use MCS
8618 with both the MS runtime and the unfixed Mono runtime without
8619 problems and without accecting performance.
8620 (MemberCache.SearchMembers): The DeclaredOnly looping from
8621 TypeManager.MemberLookup is now done here.
8623 2002-08-14 Martin Baulig <martin@gnome.org>
8625 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8626 Type.GetFields on dynamic types but get the fields from the
8627 corresponding TypeContainer.
8628 (MyStructInfo.GetStructInfo): Added check for enum types.
8630 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8631 (MemberList.SyncRoot): Implemented.
8632 (TypeManager.FilterWithClosure): No need to check permissions if
8633 closure_start_type == closure_invocation_type, don't crash if
8634 closure_invocation_type is null.
8636 2002-08-13 Martin Baulig <martin@gnome.org>
8638 Rewrote TypeContainer.FindMembers to use a member cache. This
8639 gives us a speed increase of about 35% for the self-hosting MCS
8640 build and of about 15-20% for the class libs (both on GNU/Linux).
8642 * report.cs (Timer): New class to get enhanced profiling. This
8643 whole class is "TIMER" conditional since it remarkably slows down
8646 * class.cs (MemberList): New class. This is an IList wrapper
8647 which we're now using instead of passing MemberInfo[]'s around to
8648 avoid copying this array unnecessarily.
8649 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8650 (ICachingMemberFinder, IMemberContainer): New interface.
8651 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8652 has already been checked, otherwise use it for the name comparision.
8653 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8654 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8655 if possible. Returns a MemberList, not a MemberInfo [].
8656 (TypeHandle): New class, implements IMemberContainer. We create
8657 one instance of this class per type, it contains a MemberCache
8658 which is used to do the member lookups.
8659 (MemberCache): New class. Each instance of this class contains
8660 all members of a type and a name-based hash table.
8661 (MemberCache.FindMembers): This is our new member lookup
8662 function. First, it looks up all members of the requested name in
8663 the hash table. Then, it walks this list and sorts out all
8664 applicable members and returns them.
8666 2002-08-13 Martin Baulig <martin@gnome.org>
8668 In addition to a nice code cleanup, this gives us a performance
8669 increase of about 1.4% on GNU/Linux - not much, but it's already
8670 half a second for the self-hosting MCS compilation.
8672 * typemanager.cs (IMemberFinder): New interface. It is used by
8673 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8674 Enum, Delegate or Interface.
8675 (TypeManager.finder_to_member_finder): New PtrHashtable.
8676 (TypeManager.finder_to_container): Removed.
8677 (TypeManager.finder_to_delegate): Removed.
8678 (TypeManager.finder_to_interface): Removed.
8679 (TypeManager.finder_to_enum): Removed.
8681 * interface.cs (Interface): Implement IMemberFinder.
8683 * delegate.cs (Delegate): Implement IMemberFinder.
8685 * enum.cs (Enum): Implement IMemberFinder.
8687 * class.cs (TypeContainer): Implement IMemberFinder.
8689 2002-08-12 Martin Baulig <martin@gnome.org>
8691 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8693 2002-08-12 Martin Baulig <martin@gnome.org>
8695 * ecore.cs (ITypeExpression): New interface for expressions which
8697 (TypeExpression): Renamed to TypeLookupExpression.
8698 (Expression.DoResolve): If we're doing a types-only lookup, the
8699 expression must implement the ITypeExpression interface and we
8700 call DoResolveType() on it.
8701 (SimpleName): Implement the new ITypeExpression interface.
8702 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8703 hack, the situation that we're only looking up types can't happen
8704 anymore when this method is called. Moved the type lookup code to
8705 DoResolveType() and call it.
8706 (SimpleName.DoResolveType): This ITypeExpression interface method
8707 is now doing the types-only lookup.
8708 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8709 (ResolveFlags): Added MaskExprClass.
8711 * expression.cs (MemberAccess): Implement the ITypeExpression
8713 (MemberAccess.DoResolve): Added support for a types-only lookup
8714 when we're called via ITypeExpression.DoResolveType().
8715 (ComposedCast): Implement the ITypeExpression interface.
8717 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8718 Expression.Resolve() with ResolveFlags.Type instead.
8720 2002-08-12 Martin Baulig <martin@gnome.org>
8722 * interface.cs (Interface.Define): Apply attributes.
8724 * attribute.cs (Attribute.ApplyAttributes): Added support for
8725 interface attributes.
8727 2002-08-11 Martin Baulig <martin@gnome.org>
8729 * statement.cs (Block.Emit): Only check the "this" variable if we
8730 do not always throw an exception.
8732 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8733 whether the property has a set accessor.
8735 2002-08-11 Martin Baulig <martin@gnome.org>
8737 Added control flow analysis support for structs.
8739 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8740 with control flow analysis turned off.
8741 (IVariable): New interface.
8742 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8743 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8744 (FieldExpr.DoResolve): Resolve the instance expression with flow
8745 analysis turned off and do the definite assignment check after the
8746 resolving when we know what the expression will resolve to.
8748 * expression.cs (LocalVariableReference, ParameterReference):
8749 Implement the new IVariable interface, only call the flow analysis
8750 code if ec.DoFlowAnalysis is true.
8751 (This): Added constructor which takes a Block argument. Implement
8752 the new IVariable interface.
8753 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8754 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8755 This does the definite assignment checks for struct members.
8757 * class.cs (Constructor.Emit): If this is a non-static `struct'
8758 constructor which doesn't have any initializer, call
8759 Block.AddThisVariable() to tell the flow analysis code that all
8760 struct elements must be initialized before control returns from
8763 * statement.cs (MyStructInfo): New public class.
8764 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8765 argument to this indexer. If non-zero, check an individual struct
8766 member, not the whole struct.
8767 (FlowBranching.CheckOutParameters): Check struct members.
8768 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8769 overloaded versions of these methods which take an additional
8770 `int field_idx' argument to check struct members.
8771 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8772 overloaded versions of these methods which take an additional
8773 `string field_name' argument to check struct member.s
8774 (VariableInfo): Implement the IVariable interface.
8775 (VariableInfo.StructInfo): New public property. Returns the
8776 MyStructInfo instance of the variable if it's a struct or null.
8777 (Block.AddThisVariable): New public method. This is called from
8778 Constructor.Emit() for non-static `struct' constructor which do
8779 not have any initializer. It creates a special variable for the
8780 "this" instance variable which will be checked by the flow
8781 analysis code to ensure that all of the struct's fields are
8782 initialized before control returns from the constructor.
8783 (UsageVector): Added support for struct members. If a
8784 variable/parameter is a struct with N members, we reserve a slot
8785 in the usage vector for each member. A struct is considered fully
8786 initialized if either the struct itself (slot 0) or all its
8787 members are initialized.
8789 2002-08-08 Martin Baulig <martin@gnome.org>
8791 * driver.cs (Driver.MainDriver): Only report an error CS5001
8792 if there were no compilation errors.
8794 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
8795 `UnsafeContext' property to determine whether the parent is in
8796 unsafe context rather than checking the parent's ModFlags:
8797 classes nested in an unsafe class are unsafe as well.
8799 2002-08-08 Martin Baulig <martin@gnome.org>
8801 * statement.cs (UsageVector.MergeChildren): Distinguish between
8802 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
8803 we return. Added test17() and test18() to test-154.cs.
8805 2002-08-08 Martin Baulig <martin@gnome.org>
8807 * typemanager.cs (TypeManager.FilterWithClosure): If we have
8808 Family access, make sure the invoking type isn't a subclass of the
8809 queried type (that'd be a CS1540).
8811 * ecore.cs (Expression.MemberLookup): Added overloaded version of
8812 this method which takes an additional `Type invocation_type'.
8814 * expression.cs (BaseAccess.DoResolve): Use the base type as
8815 invocation and query type.
8816 (MemberAccess.DoResolve): If the lookup failed and we're about to
8817 report a CS0122, try a lookup with the ec.ContainerType - if this
8818 succeeds, we must report a CS1540.
8820 2002-08-08 Martin Baulig <martin@gnome.org>
8822 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
8823 (MethodGroupExpr): Implement the IMemberExpr interface.
8825 * expression (MemberAccess.ResolveMemberAccess): No need to have
8826 any special code for MethodGroupExprs anymore, they're now
8829 2002-08-08 Martin Baulig <martin@gnome.org>
8831 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
8832 Family, FamANDAssem and FamORAssem permissions.
8833 (TypeManager.IsSubclassOrNestedChildOf): New public method.
8835 2002-08-08 Martin Baulig <martin@gnome.org>
8837 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
8838 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
8841 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
8843 * driver.cs: implemented /resource option to embed managed resources.
8845 2002-08-07 Martin Baulig <martin@gnome.org>
8847 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
8848 (FieldBase.HasFieldInitializer): New public property.
8849 (FieldBase.GetInitializerExpression): New public method. Resolves and
8850 returns the field initializer and makes sure it is only resolved once.
8851 (TypeContainer.EmitFieldInitializers): Call
8852 FieldBase.GetInitializerExpression to get the initializer, this ensures
8853 that it isn't resolved multiple times.
8855 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
8856 the resolving process (SimpleName/MemberLookup) that we're currently
8857 emitting a field initializer (which must not access any instance members,
8858 this is an error CS0236).
8860 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
8861 argument, if the `IsFieldInitializer' flag is set, we must report and
8862 error CS0236 and not an error CS0120.
8864 2002-08-07 Martin Baulig <martin@gnome.org>
8866 * ecore.cs (IMemberExpr): New public interface.
8867 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
8868 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
8869 if the expression is an IMemberExpr.
8871 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
8872 to be null, implicitly default to `this' if we're non-static in
8873 this case. Simplified the code a lot by using the new IMemberExpr
8874 interface. Also fixed bug #28176 here.
8876 2002-08-06 Martin Baulig <martin@gnome.org>
8878 * cs-parser.jay (SimpleLookup): Removed. We need to create
8879 ParameterReferences during semantic analysis so that we can do a
8880 type-only search when resolving Cast, TypeOf and SizeOf.
8881 (block): Pass the `current_local_parameters' to the Block's
8884 * class.cs (ConstructorInitializer): Added `Parameters parameters'
8885 argument to the constructor.
8886 (ConstructorInitializer.Resolve): Create a temporary implicit
8887 block with the parameters.
8889 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
8890 references here if we aren't doing a type-only search.
8892 * statement.cs (Block): Added constructor which takes a
8893 `Parameters parameters' argument.
8894 (Block.Parameters): New public property.
8896 * support.cs (InternalParameters.Parameters): Renamed `parameters'
8897 to `Parameters' and made it public readonly.
8899 2002-08-06 Martin Baulig <martin@gnome.org>
8901 * ecore.cs (Expression.Warning): Made this public as well.
8903 * report.cs (Report.Debug): Print the contents of collections.
8905 2002-08-06 Martin Baulig <martin@gnome.org>
8907 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
8908 used to tell Resolve() which kinds of expressions it may return.
8909 (Expression.Resolve): Added overloaded version of this method which
8910 takes a `ResolveFlags flags' argument. This can be used to tell
8911 Resolve() which kinds of expressions it may return. Reports a
8913 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
8914 ResolveFlags.SimpleName.
8915 (Expression.Error118): Added overloaded version of this method which
8916 takes a `ResolveFlags flags' argument. It uses the flags to determine
8917 which kinds of expressions are allowed.
8919 * expression.cs (Argument.ResolveMethodGroup): New public method.
8920 Resolves an argument, but allows a MethodGroup to be returned.
8921 This is used when invoking a delegate.
8923 * TODO: Updated a bit.
8925 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8927 Fixed compilation with csc.
8929 * ecore.cs: Expression.Error made public. Is this correct? Should
8930 Warning be made public too?
8932 * expression.cs: use ea.Location instead of ea.loc.
8933 [FIXME: Filed as bug #28607: MCS must report these errors.]
8935 2002-08-06 Martin Baulig <martin@gnome.org>
8937 * ecore.cs (Expression.loc): Moved the location here instead of
8938 duplicating it in all derived classes.
8939 (Expression.Location): New public property.
8940 (Expression.Error, Expression.Warning): Made them non-static and
8941 removed the location argument.
8942 (Expression.Warning): Added overloaded version which takes an
8943 `int level' argument.
8944 (Expression.Error118): Make this non-static and removed the
8945 expression and location arguments.
8946 (TypeExpr): Added location argument to the constructor.
8948 * expression.cs (StaticCallExpr): Added location argument to
8950 (Indirection, PointerArithmetic): Likewise.
8951 (CheckedExpr, UnCheckedExpr): Likewise.
8952 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8953 (StringPtr): Likewise.
8956 2002-08-05 Martin Baulig <martin@gnome.org>
8958 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8960 * assign.cs (Assign.DoResolve): Check whether the source
8961 expression is a value or variable.
8963 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8964 while resolving the corresponding blocks.
8966 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8967 an error, don't silently return null.
8969 * statement.cs (Block.AddVariable): Do the error reporting here
8970 and distinguish between CS0128 and CS0136.
8971 (Block.DoResolve): Report all unused labels (warning CS0164).
8972 (LabeledStatement): Pass the location to the constructor.
8973 (LabeledStatement.HasBeenReferenced): New property.
8974 (LabeledStatement.Resolve): Set it to true here.
8976 * statement.cs (Return.Emit): Return success even after reporting
8977 a type mismatch error (CS0126 or CS0127), this is what csc does and
8978 it avoids confusing the users with any consecutive errors.
8980 2002-08-05 Martin Baulig <martin@gnome.org>
8982 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8984 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8986 * expression.cs (MemberAccess.DoResolve): Silently return if an
8987 error has already been reported.
8989 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8990 error has already been reported.
8992 2002-08-05 Martin Baulig <martin@gnome.org>
8994 * statement.cs (UsageVector): Only initialize the `parameters'
8995 vector if we actually have any "out" parameters.
8997 2002-08-05 Martin Baulig <martin@gnome.org>
8999 * expression.cs (Binary.ResolveOperator): When combining delegates,
9000 they must have the same type.
9002 2002-08-05 Martin Baulig <martin@gnome.org>
9004 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
9005 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
9006 work with the ms runtime and we also don't need it: if we're a
9007 PropertyBuilder and not in the `indexer_arguments' hash, then we
9008 are a property and not an indexer.
9010 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
9011 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
9012 since the latter one doesn't work with the ms runtime.
9014 2002-08-03 Martin Baulig <martin@gnome.org>
9016 Fixed bugs #27998 and #22735.
9018 * class.cs (Method.IsOperator): New public field.
9019 (Method.CheckBase): Report CS0111 if there's already a method
9020 with the same parameters in the current class. Report CS0508 when
9021 attempting to change the return type of an inherited method.
9022 (MethodData.Emit): Report CS0179 if a method doesn't have a body
9023 and it's not marked abstract or extern.
9024 (PropertyBase): New abstract base class for Property and Indexer.
9025 (PropertyBase.CheckBase): Moved here from Property and made it work
9027 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
9028 the same so we can reuse it there.
9029 (Property, Indexer): Derive from PropertyBase.
9030 (MethodSignature.inheritable_property_signature_filter): New delegate
9031 to find properties and indexers.
9033 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
9034 argument and improved error reporting.
9036 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
9037 EmptyReadOnlyParameters and made it a property.
9039 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
9040 version of this method which takes a `PropertyInfo indexer'.
9041 (TypeManager.RegisterIndexer): New method.
9043 * class.cs: Added myself as author of this file :-)
9045 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9047 * class.cs: fixed compilation on windoze.
9049 2002-08-03 Martin Baulig <martin@gnome.org>
9051 * interface.cs (Interface.GetInterfaceBases): Check whether all
9052 base interfaces are at least as accessible than the current one.
9054 * class.cs (TypeContainer.GetClassBases): Check whether base types
9055 are at least as accessible than the current type.
9056 (TypeContainer.AsAccessible): Implemented and made non-static.
9057 (MemberBase.CheckParameters): Report errors if the accessibility
9060 * delegate.cs (Delegate.Delegate): The default visibility is
9061 internal for top-level types and private for nested types.
9062 (Delegate.Define): Report errors if the accessibility checks fail.
9064 * enum.cs (Enum.Enum): The default visibility is internal for
9065 top-level types and private for nested types.
9066 (Enum.DefineType): Compute the correct visibility.
9068 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
9069 function which takes a `bool is_toplevel' instead of a TypeContainer.
9071 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
9074 2002-08-02 Martin Baulig <martin@gnome.org>
9076 * expression.cs (LocalVariableReferenc): Added constructor which
9077 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
9078 (LocalVariableReference.IsReadOnly): New property.
9079 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
9080 variable is readonly, use our own readonly flag to do this; you can
9081 use the new constructor to get a writable reference to a read-only
9084 * cs-parser.jay (foreach_statement, using_statement): Get a writable
9085 reference to the local variable.
9087 2002-08-01 Miguel de Icaza <miguel@ximian.com>
9089 * rootcontext.cs (ResolveCore): Also include System.Exception
9091 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
9092 we reach an EmptyStatement.
9094 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
9097 * expression.cs (Binary.ResolveOperator): Check error result in
9100 use brtrue/brfalse directly and avoid compares to null.
9102 2002-08-02 Martin Baulig <martin@gnome.org>
9104 * class.cs (TypeContainer.Define): Define all nested interfaces here.
9105 Fixes bug #28407, added test-155.cs.
9107 2002-08-01 Martin Baulig <martin@gnome.org>
9109 * class.cs (Event.EmitDefaultMethod): Make this work with static
9110 events. Fixes #28311, added verify-3.cs.
9112 2002-08-01 Martin Baulig <martin@gnome.org>
9114 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
9115 `is_disposable' fields.
9116 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
9117 `hm.is_disposable' if we're using the collection pattern.
9118 (Foreach.EmitCollectionForeach): Use the correct type for the
9119 enumerator's local variable, only emit the try/finally block if
9120 necessary (fixes #27713).
9122 2002-08-01 Martin Baulig <martin@gnome.org>
9124 * ecore.cs (Expression.report118): Renamed to Error118 and made
9127 * statement.cs (Throw.Resolve): Check whether the expression is of
9128 the correct type (CS0118) and whether the type derives from
9129 System.Exception (CS0155).
9130 (Catch.Resolve): New method. Do the type lookup here and check
9131 whether it derives from System.Exception (CS0155).
9132 (Catch.CatchType, Catch.IsGeneral): New public properties.
9134 * typemanager.cs (TypeManager.exception_type): Added.
9136 2002-07-31 Miguel de Icaza <miguel@ximian.com>
9138 * driver.cs: Updated About function.
9140 2002-07-31 Martin Baulig <martin@gnome.org>
9142 Implemented Control Flow Analysis.
9144 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
9145 (EmitContext.CurrentBranching): Added.
9146 (EmitContext.StartFlowBranching): Added.
9147 (EmitContext.EndFlowBranching): Added.
9148 (EmitContext.KillFlowBranching): Added.
9149 (EmitContext.IsVariableAssigned): Added.
9150 (EmitContext.SetVariableAssigned): Added.
9151 (EmitContext.IsParameterAssigned): Added.
9152 (EmitContext.SetParameterAssigned): Added.
9153 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
9154 Added control flow analysis stuff here.
9156 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
9157 resolve the expression as lvalue.
9158 (LocalVariableReference.DoResolve): Check whether the variable has
9159 already been assigned.
9160 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
9161 the parameter as assigned here.
9162 (ParameterReference.DoResolve): Check whether the parameter has already
9164 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
9165 expression as lvalue.
9167 * statement.cs (FlowBranching): New class for the flow analysis code.
9168 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
9169 (LabeledStatement.IsDefined): New public property.
9170 (LabeledStatement.AddUsageVector): New public method to tell flow
9171 analyis that the label may be reached via a forward jump.
9172 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
9174 (VariableInfo.Number): New public field. This is used by flow analysis
9175 to number all locals of a block.
9176 (Block.CountVariables): New public property. This is the number of
9177 local variables in this block (including the locals from all parent
9179 (Block.EmitMeta): Number all the variables.
9181 * statement.cs: Added flow analysis support to all classes.
9183 2002-07-31 Martin Baulig <martin@gnome.org>
9185 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
9186 To get debugging messages, compile mcs with /define:MCS_DEBUG and
9187 then use this argument.
9189 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
9191 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
9192 use this to specify /define options.
9194 2002-07-29 Martin Baulig <martin@gnome.org>
9196 * statement.cs (Fixed): Moved all code that does variable lookups
9197 and resolvings from Emit to Resolve.
9199 * statement.cs (For): Moved all code that does variable lookups
9200 and resolvings from Emit to Resolve.
9202 * statement.cs (Using): Moved all code that does variable lookups
9203 and resolvings from Emit to Resolve.
9205 2002-07-29 Martin Baulig <martin@gnome.org>
9207 * attribute.cs (Attribute.Resolve): Explicitly catch a
9208 System.NullReferenceException when creating the
9209 CustromAttributeBuilder and report a different warning message.
9211 2002-07-29 Martin Baulig <martin@gnome.org>
9213 * support.cs (ParameterData.ParameterName): Added method to
9214 get the name of a parameter.
9216 * typemanager.cs (TypeManager.IsValueType): New public method.
9218 2002-07-29 Martin Baulig <martin@gnome.org>
9220 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
9221 is a flag which specifies that it's either ref or out.
9222 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
9223 the out parameter to `out Parameter.Modifier mod', also set the
9224 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
9226 * support.cs (InternalParameters.ParameterModifier): Distinguish
9227 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9228 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9230 * expression.cs (Argument.GetParameterModifier): Distinguish
9231 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9232 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9234 2002-07-29 Martin Baulig <martin@gnome.org>
9236 * expression.cs (ParameterReference.ParameterReference): Added
9237 `Location loc' argument to the constructor.
9239 * cs-parser.jay: Pass location to ParameterReference.
9241 2002-07-28 Miguel de Icaza <miguel@ximian.com>
9243 * statement.cs (Try): Initialize the location.
9245 * cs-parser.jay: pass location to Try.
9247 * expression.cs (Unary.Reduce): Change the prototype to return
9248 whether a constant fold could be performed or not. The result is
9249 returned in an out parameters. In the case of Indirection and
9250 AddressOf, we want to perform the full tests.
9252 2002-07-26 Miguel de Icaza <miguel@ximian.com>
9254 * statement.cs (Statement.Emit): Flag dead code.
9256 2002-07-27 Andrew Birkett <andy@nobugs.org>
9258 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
9260 2002-07-27 Martin Baulig <martin@gnome.org>
9262 * class.cs (MethodData.Define): Put back call to
9263 TypeManager.AddMethod(), accidentally commented this out.
9265 * report.cs (Debug): New public method to print debugging information,
9266 this is `[Conditional ("DEBUG")]'.
9268 2002-07-26 Martin Baulig <martin@gnome.org>
9270 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
9271 (switch_statement): Push the current_block to the switch_stack and
9272 pop it again when we're done with the switch.
9273 (switch_section): The new block is a child of the current_block.
9274 Fixes bug #24007, added test-152.cs.
9276 2002-07-27 Martin Baulig <martin@gnome.org>
9278 * expression.cs (Invocation.EmitArguments): When calling a varargs
9279 function with only its fixed arguments, we need to pass an empty
9282 2002-07-27 Martin Baulig <martin@gnome.org>
9284 Mono 0.13 has been released.
9286 2002-07-25 Miguel de Icaza <miguel@ximian.com>
9288 * driver.cs: Rename --resource to --linkres, because that is what
9289 we do currently, we dont support --resource yet.
9291 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
9293 2002-07-25 Martin Baulig <martin@gnome.org>
9295 * class.cs (MethodData): New public class. This is a `method builder'
9296 class for a method or one accessor of a Property/Indexer/Event.
9297 (MethodData.GetMethodFlags): Moved here from MemberBase.
9298 (MethodData.ApplyAttributes): Likewise.
9299 (MethodData.ApplyObsoleteAttribute): Likewise.
9300 (MethodData.ApplyConditionalAttribute): Likewise.
9301 (MethodData.ApplyDllImportAttribute): Likewise.
9302 (MethodData.CheckAbstractAndExternal): Likewise.
9303 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
9304 (MethodData.Emit): Formerly known as Method.Emit().
9305 (MemberBase): Moved everything which was specific to a single
9306 accessor/method to MethodData.
9307 (Method): Create a new MethodData and call Define() and Emit() on it.
9308 (Property, Indexer, Event): Create a new MethodData objects for each
9309 accessor and call Define() and Emit() on them.
9311 2002-07-25 Martin Baulig <martin@gnome.org>
9313 Made MethodCore derive from MemberBase to reuse the code from there.
9314 MemberBase now also checks for attributes.
9316 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
9317 (MemberBase.GetMethodFlags): Moved here from class Method and marked
9319 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
9320 `CallingConventions cc' and `Attributes opt_attrs' arguments.
9321 (MemberBase.ApplyAttributes): New virtual method; applies the
9322 attributes to a method or accessor.
9323 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
9324 (MemberBase.ApplyConditionalAttribute): Likewise.
9325 (MemberBase.ApplyDllImportAttribute): Likewise.
9326 (MemberBase.CheckAbstractAndExternal): Likewise.
9327 (MethodCore.ParameterTypes): This is now a property instead of a
9328 method, it's initialized from DoDefineParameters().
9329 (MethodCore.ParameterInfo): Removed the set accessor.
9330 (MethodCore.DoDefineParameters): New protected virtual method to
9331 initialize ParameterTypes and ParameterInfo.
9332 (Method.GetReturnType): We can now simply return the MemberType.
9333 (Method.GetMethodFlags): Override the MemberBase version and add
9334 the conditional flags.
9335 (Method.CheckBase): Moved some code from Define() here, call
9336 DoDefineParameters() here.
9337 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
9338 here to avoid some larger code duplication.
9339 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
9340 ensure that abstract and external accessors don't declare a body.
9342 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
9343 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
9344 lookup in the attribute's parent classes, so we need to abort as soon
9345 as we found the first match.
9346 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
9347 the attribute has no arguments.
9349 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
9352 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9354 * cs-parser.jay: reverted previous patch.
9356 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9358 * cs-parser.jay: fixed bug #22119.
9360 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9362 * attribute.cs: fixed compilation. The error was:
9363 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
9364 be assigned to before control leaves the current method."
9365 [FIXME: Filed as bug #28186: MCS must report this error.]
9367 2002-07-25 Martin Baulig <martin@gnome.org>
9369 * attribute.cs (Attribute.Conditional_GetConditionName): New static
9370 method to pull the condition name ouf of a Conditional attribute.
9371 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
9372 the obsolete message and error flag out of an Obsolete attribute.
9374 * class.cs (Method.GetMethodFlags): New public method to get the
9375 TypeManager.MethodFlags for this method.
9376 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
9378 (Method.Define): Get and apply the Obsolete and Conditional attributes;
9379 if we're overriding a virtual function, set the new private variable
9380 `parent_method'; call the new TypeManager.AddMethod().
9382 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
9383 the MethodBuilder and the Method in a PtrHashtable.
9384 (TypeManager.builder_to_method): Added for this purpose.
9385 (TypeManager.MethodFlags): Added IsObsoleteError.
9386 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
9387 Obsolete and Conditional arguments in MethodBuilders. If we discover
9388 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
9389 the message from the attribute.
9391 2002-07-24 Martin Baulig <martin@gnome.org>
9393 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
9394 preprocessor directives, ensure that the argument to #define/#undef is
9395 exactly one identifier and that it's actually an identifier.
9397 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
9400 2002-07-24 Martin Baulig <martin@gnome.org>
9402 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
9403 initialize it to TypeManager.object_type in the constructor.
9404 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
9405 of the `hm.get_current' method if we're using the collection pattern.
9406 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
9407 for the explicit conversion to make it work when we're using the collection
9408 pattern and the `Current' property has a different return type than `object'.
9411 2002-07-24 Martin Baulig <martin@gnome.org>
9413 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
9414 does not match, but don't report any errors. This method is called in
9415 order for all methods in a MethodGroupExpr until a matching method is
9416 found, so we don't want to bail out if the first method doesn't match.
9417 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
9418 matches, report the 123. Fixes #28070.
9420 2002-07-24 Martin Baulig <martin@gnome.org>
9422 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
9423 TypeManager.TypeToCoreType() to the top of the method so the
9424 following equality checks will work. Fixes #28107.
9426 2002-07-24 Martin Baulig <martin@gnome.org>
9428 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
9429 operand is of type uint, and the other operand is of type sbyte,
9430 short or int, the operands are converted to type long." -
9431 Actually do what this comment already told us. Fixes bug #28106,
9434 2002-07-24 Martin Baulig <martin@gnome.org>
9436 * class.cs (MethodBase): New abstract class. This is now a base
9437 class for Property, Indexer and Event to avoid some code duplication
9438 in their Define() and DefineMethods() methods.
9439 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
9440 generic methods for Define() and DefineMethods().
9441 (FieldBase): Derive from MemberBase, not MemberCore.
9442 (Property): Derive from MemberBase, not MemberCore.
9443 (Property.DefineMethod): Moved all the code from this method to the
9444 new MethodBase.DefineAccessor(), just call it with appropriate
9446 (Property.Define): Call the new Property.DoDefine(), this does some
9447 sanity checks and we don't need to duplicate the code everywhere.
9448 (Event): Derive from MemberBase, not MemberCore.
9449 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
9450 accessors, this will also make them work with interface events.
9451 (Indexer): Derive from MemberBase, not MemberCore.
9452 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
9453 (Indexer.Define): Use the new MethodBase functions.
9455 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
9456 argument to the constructor.
9457 (Interface.FindMembers): Added support for interface events.
9458 (Interface.PopluateEvent): Implemented.
9460 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
9462 2002-07-22 Miguel de Icaza <miguel@ximian.com>
9464 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
9465 but this is required to check for a method name being the same as
9466 the containing class.
9470 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9472 * interface.cs: initialize variable.
9474 2002-07-23 Martin Baulig <martin@gnome.org>
9476 Implemented the IndexerName attribute in interfaces.
9478 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
9479 name if this is an explicit interface implementation.
9480 (Indexer.InterfaceIndexerName): New public variable. If we're
9481 implementing an interface indexer, this is the IndexerName in that
9482 interface. Otherwise, it's the IndexerName.
9483 (Indexer.DefineMethod): If we're implementing interface indexer,
9484 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
9485 and Pending.ImplementIndexer methods.
9486 (Indexer.Define): Also define the PropertyBuilder if we're
9487 implementing an interface indexer and this is neither an explicit
9488 interface implementation nor do the IndexerName match the one in
9491 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
9492 If a method is defined here, then we always need to create a proxy
9493 for it. This is used when implementing interface indexers.
9494 (Pending.IsInterfaceIndexer): New public method.
9495 (Pending.ImplementIndexer): New public method.
9496 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
9497 This is used when implementing interface indexers to define a proxy
9499 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
9500 define a proxy if necessary.
9502 * interface.cs (Interface.IndexerName): New public variable.
9503 (Interface.PopulateIndexer): Set the IndexerName.
9504 (Interface.DefineIndexers): New private method. Populate all the
9505 indexers and make sure their IndexerNames match.
9507 * typemanager.cs (IndexerPropertyName): Added support for interface
9510 2002-07-22 Martin Baulig <martin@gnome.org>
9512 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
9513 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
9514 ret if HasReturnLabel.
9515 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
9518 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
9519 and set the ec.LoopBeginTryCatchLevel.
9520 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
9521 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
9522 the current ec.TryCatchLevel, the branch goes out of an exception
9523 block. In this case, we need to use Leave and not Br.
9525 2002-07-22 Martin Baulig <martin@gnome.org>
9527 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
9528 block unless the block does not always return or it is contained in
9529 another try { ... } catch { ... } block. Fixes bug #26506.
9530 Added verify-1.cs to the test suite.
9532 2002-07-22 Martin Baulig <martin@gnome.org>
9534 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
9535 then we do not always return. Fixes bug #24985.
9537 2002-07-22 Martin Baulig <martin@gnome.org>
9539 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
9540 lookup on a per-class level; ie. walk up the class hierarchy until we
9541 found at least one applicable method, then choose the best among them.
9542 Fixes bug #24463 and test-29.cs.
9544 2002-07-22 Martin Baulig <martin@gnome.org>
9546 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
9547 return types of the methods. The return type is not part of the
9548 signature and we must not check it to make the `new' modifier work.
9549 Fixes bug #27999, also added test-147.cs.
9550 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
9552 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
9553 on the method's return type.
9555 2002-07-21 Martin Baulig <martin@gnome.org>
9557 * assign.cs: Make this work if the rightmost source is a constant and
9558 we need to do an implicit type conversion. Also adding a few more tests
9559 to test-38.cs which should have caught this.
9561 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
9562 target in the makefile for this. The makefile.gnu is primarily intended
9563 for end-users who don't want to debug the compiler.
9565 2002-07-21 Martin Baulig <martin@gnome.org>
9567 * assign.cs: Improved the Assign class so it can now handle embedded
9568 assignments (X = Y = Z = something). As a side-effect this'll now also
9569 consume less local variables. test-38.cs now passes with MCS, added
9570 a few new test cases to that test.
9572 2002-07-20 Martin Baulig <martin@gnome.org>
9574 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
9575 instructions. Fixes bug #27977, also added test-146.cs.
9577 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9579 * cs-tokenizer.cs: fixed getHex ().
9581 2002-07-19 Martin Baulig <martin@gnome.org>
9583 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
9584 not Type.GetType() to lookup the array type. This is needed when
9585 we're constructing an array of a user-defined type.
9586 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
9587 single-dimensional arrays, but also for single-dimensial arrays of
9590 2002-07-19 Martin Baulig <martin@gnome.org>
9592 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
9593 this function is called, it's not allowed to share LocalBuilders
9596 2002-07-19 Martin Baulig <martin@gnome.org>
9598 * expression.cs (Argument.Resolve): Report an error 118 when trying
9599 to pass a type as argument.
9601 2002-07-18 Martin Baulig <martin@gnome.org>
9603 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9604 Conv_R_Un for the signed `long' type.
9606 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9608 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9609 `expr' for the temporary result, as that will fail if we do
9610 multiple resolves on the same expression.
9612 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9614 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9615 ec.TypeContainer for looking up aliases.
9617 * class.cs (TypeContainer): Remove LookupAlias from here.
9619 * decl.cs (DeclSpace); Move here.
9621 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9623 * class.cs (FindMembers): Only call filter if the constructor
9624 bulider is not null.
9626 Also handle delegates in `NestedTypes' now. Now we will perform
9627 type lookups using the standard resolution process. This also
9630 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9631 This uses Expressions (the limited kind that can be parsed by the
9632 tree) instead of strings.
9634 * expression.cs (ComposedCast.ToString): Implement, used to flag
9635 errors since now we have to render expressions.
9637 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9640 * ecore.cs (SimpleName.ToString): ditto.
9642 * cs-parser.jay: Instead of using strings to assemble types, use
9643 Expressions to assemble the type (using SimpleName, ComposedCast,
9644 MemberAccess). This should fix the type lookups in declarations,
9645 because we were using a different code path for this.
9647 * statement.cs (Block.Resolve): Continue processing statements
9648 even when there is an error.
9650 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9652 * class.cs (Event.Define): Also remove the `remove' method from
9653 the list of pending items.
9655 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9656 generate more compact code.
9658 2002-07-17 Martin Baulig <martin@gnome.org>
9660 * const.cs (Const.LookupConstantValue): Add support for constant
9661 `unchecked' and `checked' expressions.
9662 Also adding test case test-140.cs for this.
9664 2002-07-17 Martin Baulig <martin@gnome.org>
9666 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9667 check whether mi.ReturnType implements the IEnumerator interface; the
9668 `==' and the IsAssignableFrom() will fail in this situation.
9670 2002-07-16 Ravi Pratap <ravi@ximian.com>
9672 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9675 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9677 * expression.cs: fixed bug #27811.
9679 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9681 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9682 Molaro: when we are a ref, the value already contains a pointer
9683 value, do not take the address of it.
9685 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9686 * removed mb-parser.jay and mb-tokenizer.cs
9688 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9690 * expression.cs: check against the building corlib void type.
9692 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9694 * ecore.cs: fix for valuetype static readonly fields: when
9695 initializing them, we need their address, not the address of a copy.
9697 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9699 * typemanager.cs: register also enum_type in corlib.
9701 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9703 * class.cs: allow calling this (but not base) initializers in structs.
9705 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9707 * ecore.cs: make sure we compare against the building base types
9710 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9712 * typemanager.cs: fix TypeToCoreType() to handle void and object
9713 (corlib gets no more typerefs after this change).
9715 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9717 * expression.cs (ArrayCreation.EmitArrayArguments): use
9718 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9720 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9721 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9722 array indexes, the runtime actually forbids them.
9724 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9725 for array arguments here.
9727 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9728 instead of the default for ValueTypes.
9730 (New.DoEmit): Use IsValueType instead of
9731 IsSubclassOf (value_type)
9732 (New.DoResolve): ditto.
9733 (Invocation.EmitCall): ditto.
9735 * assign.cs (Assign): ditto.
9737 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9738 Statements *are* currently doing part of their resolution during
9741 Expressions do always resolve during resolve, but statements are
9742 only required to propagate resolution to their children.
9744 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9746 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9748 (LoadAssembly): Do not add the dll if it is already specified
9750 (MainDriver): Add the System directory to the link path at the end,
9751 after all the other -L arguments.
9753 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9754 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9755 ldelem.u1) and using the opposite for sbytes.
9757 This fixes Digger, and we can finally run it.
9759 * driver.cs (UnixParseOption): Move the option parsing here.
9760 (CSCParseOption): Implement CSC-like parsing of options.
9762 We now support both modes of operation, the old Unix way, and the
9763 new CSC-like way. This should help those who wanted to make cross
9766 The only thing broken is that /r:, /reference: and /lib: are not
9767 implemented, because I want to make those have the same semantics
9768 as the CSC compiler has, and kill once and for all the confussion
9769 around this. Will be doing this tomorrow.
9771 * statement.cs (Unsafe.Resolve): The state is checked during
9772 resolve, not emit, so we have to set the flags for IsUnsfe here.
9774 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9776 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9777 not catch the Error_ObjectRefRequired in SimpleName (as it is
9778 possible to have a class/instance variable name that later gets
9779 deambiguated), we have to check this here.
9781 2002-07-10 Ravi Pratap <ravi@ximian.com>
9783 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
9784 make static and put into Expression.
9786 (Event.Define): Register the private field of the event with the
9787 TypeManager so that GetFieldFromEvent can get at it.
9789 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
9790 keep track of the private field associated with an event which
9793 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
9796 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
9798 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9800 * expression.cs (Binary.EmitBranchable): this routine emits the
9801 Binary expression in a branchable context. This basically means:
9802 we need to branch somewhere, not just get the value on the stack.
9804 This works together with Statement.EmitBoolExpression.
9806 * statement.cs (Statement.EmitBoolExpression): Use
9809 2002-07-09 Miguel de Icaza <miguel@ximian.com>
9811 * statement.cs (For): Reduce the number of jumps in loops.
9813 (For): Implement loop inversion for the For statement.
9815 (Break): We can be breaking out of a Try/Catch controlled section
9816 (foreach might have an implicit try/catch clause), so we need to
9817 use Leave instead of Br.
9819 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
9820 now). If the instace expression supports IMemoryLocation, we use
9821 the AddressOf method from the IMemoryLocation to extract the
9822 address instead of emitting the instance.
9824 This showed up with `This', as we were emitting the instance
9825 always (Emit) instead of the Address of This. Particularly
9826 interesting when This is a value type, as we dont want the Emit
9827 effect (which was to load the object).
9829 2002-07-08 Miguel de Icaza <miguel@ximian.com>
9831 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
9833 * statement.cs (Checked): Set the CheckedState during the resolve
9834 process too, as the ConvCast operations track the checked state on
9835 the resolve process, and not emit.
9837 * cs-parser.jay (namespace_member_declaration): Flag that we have
9838 found a declaration when we do. This is used to flag error 1529
9840 * driver.cs: Report ok when we display the help only.
9842 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
9844 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
9846 2002-07-04 Miguel de Icaza <miguel@ximian.com>
9848 * cs-tokenizer.cs (define): We also have to track locally the
9849 defines. AllDefines is just used for the Conditional Attribute,
9850 but we also need the local defines for the current source code.
9852 2002-07-03 Miguel de Icaza <miguel@ximian.com>
9854 * statement.cs (While, For, Do): These loops can exit through a
9855 Break statement, use this information to tell whether the
9856 statement is the last piece of code.
9858 (Break): Flag that we break.
9860 * codegen.cs (EmitContexts): New `Breaks' state variable.
9862 2002-07-03 Martin Baulig <martin@gnome.org>
9864 * class.cs (TypeContainer.MethodModifiersValid): Allow override
9865 modifiers in method declarations in structs. Otherwise, you won't
9866 be able to override things like Object.Equals().
9868 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9870 * class.cs (Method, Property, Indexer): Do not allow the public
9871 modifier to be used in explicit interface implementations.
9873 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
9874 override modifiers in method declarations in structs
9876 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
9878 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
9879 integer or real overflow, report an error
9881 2002-07-02 Martin Baulig <martin@gnome.org>
9883 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
9884 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
9885 to tell the runtime about our newly created System.Object and
9886 System.ValueType types.
9888 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9890 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
9891 struct instead of Ldarg/Starg.
9893 2002-07-02 Martin Baulig <martin@gnome.org>
9895 * expression.cs (Indirection.Indirection): Call
9896 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
9898 2002-07-02 Martin Baulig <martin@gnome.org>
9900 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
9901 ValueType, call TypeManager.TypeToCoreType() on it.
9902 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
9903 the OpCodes.Newarr argument.
9905 2002-07-02 Martin Baulig <martin@gnome.org>
9907 * expression.cs (Invocation.EmitCall): When compiling corlib,
9908 replace all calls to the system's System.Array type to calls to
9909 the newly created one.
9911 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
9912 System.Array methods.
9913 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
9914 from the system's System.Array type which must be replaced.
9916 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
9918 * typemanager.cs: load unverifiable_code_ctor so we can build
9919 corlib using the correct type. Avoid using GetTypeCode() with
9921 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
9922 TypeManager.object_type to allow building corlib.
9924 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
9926 * ecore.cs: handle System.Enum separately in LoadFromPtr().
9928 2002-07-01 Martin Baulig <martin@gnome.org>
9930 * class.cs: Make the last change actually work, we need to check
9931 whether `ifaces != null' to avoid a crash.
9933 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9935 * class.cs: when we build structs without fields that implement
9936 interfaces, we need to add the interfaces separately, since there is
9937 no API to both set the size and add the interfaces at type creation
9940 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9942 * expression.cs: the dimension arguments to the array constructors
9943 need to be converted if they are a long.
9945 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
9947 * class.cs: don't emit ldarg.0 if there is no parent constructor
9948 (fixes showstopper for corlib).
9950 2002-06-29 Martin Baulig <martin@gnome.org>
9952 MCS now compiles corlib on GNU/Linux :-)
9954 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9955 ie. check for MethodImplOptions.InternalCall.
9957 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9958 and TypeManager.attribute_type are null, so we must explicitly check
9959 whether parent is not null to find out whether it's an attribute type.
9960 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9961 and SetBuilder, not only if the property is neither abstract nor external.
9962 This is necessary to set the MethodImplOptions on the accessor methods.
9963 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9964 SetBuilder, see Property.Emit().
9966 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9967 populate "System.Object", "System.ValueType" and "System.Attribute" since
9968 they've already been populated from BootCorlib_PopulateCoreTypes().
9970 2002-06-29 Martin Baulig <martin@gnome.org>
9972 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9973 is the NullLiteral, we also need to make sure that target_type is not
9976 2002-06-29 Martin Baulig <martin@gnome.org>
9978 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9979 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9980 before calling BootstrapCorlib_ResolveDelegate ().
9982 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9984 * statement.cs: fixed build-breaker. All tests passed ok.
9986 2002-06-27 Martin Baulig <martin@gnome.org>
9988 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9989 for System.Decimal when compiling corlib.
9991 2002-06-27 Martin Baulig <martin@gnome.org>
9993 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9994 switch blocks which contain nothing but a default clause.
9996 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9998 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
10000 2002-06-27 Martin Baulig <martin@gnome.org>
10002 * ecore.cs (PropertyExpr.PropertyExpr): Call
10003 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
10005 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
10006 is already a TypeBuilder.
10008 2002-06-27 Martin Baulig <martin@gnome.org>
10010 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
10011 `target_type == TypeManager.array_type', not IsAssignableFrom() in
10012 the "from an array-type to System.Array" case. This makes it work
10013 when compiling corlib.
10015 2002-06-27 Martin Baulig <martin@gnome.org>
10017 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
10018 non-static PropertyExpr, set its InstanceExpression. This makes
10019 the `ICollection.Count' property work in System/Array.cs.
10021 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
10023 * driver.cs: Made error handling more consistent. Errors now
10024 tracked by Report class, so many methods which used to return int
10025 now return void. Main() now prints success/failure and
10026 errors/warnings message.
10028 Renamed '--probe' compiler argument to '--expect-error'. Removed
10029 the magic number return values (123 and 124). Now, if the
10030 expected error occurs, the compiler exits with success (exit value
10031 0). If the compilation completes without seeing that particular
10032 error, the compiler exits with failure (exit value 1). The
10033 makefile in mcs/errors has been changed to handle the new behaviour.
10035 * report.cs: Made 'expected error' number a property and renamed
10036 it from 'Probe' to 'ExpectedError'.
10038 * genericparser.cs: Removed error handling support, since it is
10039 now all done by Report class.
10041 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
10042 class, so parse() no longer returns an int.
10044 * namespace.cs: Use Report.Error instead of GenericParser.error
10046 2002-06-22 Miguel de Icaza <miguel@ximian.com>
10048 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
10049 TypeContainer.AddOperator): At the front of the list put the
10050 explicit implementations, so they get resolved/defined first.
10052 2002-06-21 Miguel de Icaza <miguel@ximian.com>
10054 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
10055 interface type is implemented by this TypeContainer. Used during
10056 explicit interface implementation.
10058 (Property.Define, Indexer.Define, Method.Define): Validate that
10059 the given interface in the explicit implementation is one of the
10060 base classes for the containing type.
10062 Also if we are explicitly implementing an interface, but there is
10063 no match in the pending implementation table, report an error.
10065 (Property.Define): Only define the property if we are
10066 not explicitly implementing a property from an interface. Use the
10067 correct name also for those properties (the same CSC uses,
10068 although that is really not needed).
10070 (Property.Emit): Do not emit attributes for explicitly implemented
10071 properties, as there is no TypeBuilder.
10073 (Indexer.Emit): ditto.
10075 Hiding then means that we do not really *implement* a pending
10076 implementation, which makes code fail.
10078 2002-06-22 Martin Baulig <martin@gnome.org>
10080 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
10081 the return value of Object.GetType(). [FIXME: we need to do this whenever
10082 we get a type back from the reflection library].
10084 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
10086 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
10088 2002-06-20 Miguel de Icaza <miguel@ximian.com>
10090 * attribute.cs: Return null if we can not look up the type.
10092 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
10093 the interface types found.
10095 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
10096 interface types found.
10098 * typemanager.cs (GetInterfaces): Make this routine returns alll
10099 the interfaces and work around the lame differences between
10100 System.Type and System.Reflection.Emit.TypeBuilder in the results
10101 result for GetInterfaces.
10103 (ExpandInterfaces): Given an array of interface types, expand and
10104 eliminate repeated ocurrences of an interface. This expands in
10105 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
10108 2002-06-21 Martin Baulig <martin@gnome.org>
10110 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
10113 2002-06-21 Martin Baulig <martin@gnome.org>
10115 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
10116 and called with one of the core types, return the corresponding typebuilder for
10119 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
10122 2002-06-21 Martin Baulig <martin@gnome.org>
10124 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
10125 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
10126 (Expression.ConvertReferenceExplicit): Likewise.
10128 * expression.cs (ElementAccess.DoResolve): Likewise.
10129 (ElementAccess.DoResolveLValue): Likewise.
10131 2002-06-10 Martin Baulig <martin@gnome.org>
10133 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
10134 add the "value" parameter to the parameter list.
10136 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
10139 2002-06-19 Miguel de Icaza <miguel@ximian.com>
10141 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
10142 the argument to an int, uint, long or ulong, per the spec. Also
10143 catch negative constants in array creation.
10145 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
10147 * class.cs: do not allow the same interface to appear twice in
10148 the definition list.
10150 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
10152 * ecore.cs: don't use ldlen with System.Array.
10154 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
10156 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
10158 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
10160 * modifiers.cs: produce correct field attributes for protected
10161 internal. Easy fix so miguel can work on ther harder stuff:-)
10163 2002-06-18 Miguel de Icaza <miguel@ximian.com>
10165 * pending.cs: New file. Move the code from class.cs here.
10166 Support clearning the pending flag for all methods (when not doing
10167 explicit interface implementation).
10169 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
10171 * rootcontext.cs: added a couple more types needed to bootstrap.
10173 2002-06-17 Miguel de Icaza <miguel@ximian.com>
10175 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
10176 constructor in the type, instead of any constructor in the type
10177 hierarchy. Thanks to Paolo for finding this bug (it showed up as
10178 a bug in the Mono runtime when applying the params attribute).
10180 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
10181 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
10183 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
10185 * expression.cs (Unary.ResolveOperator): Use TypeManager
10186 to resolve the type.
10188 2002-06-13 Ravi Pratap <ravi@ximian.com>
10190 * cs-parser.jay (enum_member_declaration): Pass in the attributes
10193 * enum.cs (AddEnumMember): Add support to store the attributes associated
10194 with each member too.
10196 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
10197 field builders too - this takes care of the enum member case.
10199 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
10201 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
10202 address-of operator on both value types and pointers.
10204 2002-06-10 Martin Baulig <martin@gnome.org>
10206 * interface.cs (Interface.PopulateIndexer): Add the indexer's
10207 PropertyBuilder to the `property_builders' list.
10209 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
10210 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
10211 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
10212 find any indexers which are inherited from an interface.
10214 2002-06-09 Martin Baulig <martin@gnome.org>
10216 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
10217 the same type as the constant if necessary. There's also a test-130.cs
10220 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
10222 * typemanager.cs (TypeManager.ChangeType): Previously known as
10223 Enum.ChangeEnumType().
10225 2002-06-09 Martin Baulig <martin@gnome.org>
10227 * expression.cs (Cast.TryReduce): Added support for consts.
10229 2002-06-08 Ravi Pratap <ravi@ximian.com>
10231 * class.cs (Accessor): Hold attributes information so we can pass
10234 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
10235 Modify to pass in attributes attached to the methods.
10237 (add_accessor_declaration, remove_accessor_declaration): Ditto.
10239 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
10240 to handle the Accessor kind :-)
10242 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
10244 2002-06-08 Martin Baulig <martin@gnome.org>
10246 * expression.cs (Unary.TryReduceNegative): Added support for
10249 2002-06-08 Martin Baulig <martin@gnome.org>
10251 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
10252 name can't be found in the `defined_names' - the caller will do a
10253 MemberLookup in this case and thus find methods in System.Enum
10254 such as Enum.IsDefined().
10256 2002-06-08 Martin Baulig <martin@gnome.org>
10258 * enum.cs (Enum.ChangeEnumType): This is a custom version of
10259 Convert.ChangeType() which works with TypeBuilder created types.
10260 (Enum.LookupEnumValue, Enum.Define): Use it here.
10262 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
10263 `TypeBuilder.BaseType != null' check.
10264 (TypeContainer.FindMembers): Only lookup parent members if we
10265 actually have a parent.
10266 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
10267 (ConstructorInitializer.Resolve): Likewise.
10269 * interface.cs (Interface.FindMembers): Added
10270 `TypeBuilder.BaseType != null' check.
10272 * rootcontext.cs (RootContext.ResolveCore): Added
10273 "System.Runtime.CompilerServices.IndexerNameAttribute" to
10274 classes_second_stage.
10276 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
10277 debug_type and trace_type when compiling with --nostdlib.
10279 2002-06-07 Martin Baulig <martin@gnome.org>
10281 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
10282 (AddField): Set it to true when adding a non-static field.
10283 (DefineType): Use `have_nonstatic_fields' to find out whether we
10284 have non-static fields, not `Fields != null'.
10286 2002-06-02 Miguel de Icaza <miguel@ximian.com>
10288 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
10289 dereferencing a null on the static-field code path)
10291 2002-05-30 Martin Baulig <martin@gnome.org>
10293 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
10294 to take command line arguments. Use reflection to call the new
10295 custom `Initialize' function on the symbol writer and pass it the
10296 command line arguments.
10298 * driver.cs (--debug-args): New command line argument to pass command
10299 line arguments to the symbol writer.
10301 2002-05-28 Miguel de Icaza <miguel@ximian.com>
10303 * assign.cs (DoResolve): Forgot to do the implicit conversion to
10304 the target type for indexers and properties. Thanks to Joe for
10307 2002-05-27 Miguel de Icaza <miguel@ximian.com>
10309 * typemanager.cs (MethodFlags): returns the method flags
10310 (Obsolete/ShouldIgnore) that control warning emission and whether
10311 the invocation should be made, or ignored.
10313 * expression.cs (Invocation.Emit): Remove previous hack, we should
10314 not do this on matching a base type, we should do this based on an attribute
10316 Only emit calls to System.Diagnostics.Debug and
10317 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
10318 on the command line.
10320 * rootcontext.cs: Global settings for tracing and debugging.
10322 * cs-tokenizer.cs (define): New utility function to track
10323 defines. Set the global settings for TRACE and DEBUG if found.
10325 2002-05-25 Ravi Pratap <ravi@ximian.com>
10327 * interface.cs (Populate*): Pass in the TypeContainer as well as
10328 the DeclSpace as parameters so that we can create EmitContexts and
10329 then use that to apply attributes etc.
10331 (PopulateMethod, PopulateEvent, PopulateProperty)
10332 (PopulateIndexer): Apply attributes everywhere.
10334 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
10337 (ApplyAttributes): Update accordingly.
10339 We now apply interface attributes for all members too.
10341 2002-05-26 Miguel de Icaza <miguel@ximian.com>
10343 * class.cs (Indexer.Define); Correctly check if we are explicit
10344 implementation (instead of checking the Name for a ".", we
10345 directly look up if the InterfaceType was specified).
10347 Delay the creation of the PropertyBuilder.
10349 Only create the PropertyBuilder if we are not an explicit
10350 interface implementation. This means that explicit interface
10351 implementation members do not participate in regular function
10352 lookups, and hence fixes another major ambiguity problem in
10353 overload resolution (that was the visible effect).
10355 (DefineMethod): Return whether we are doing an interface
10358 * typemanager.cs: Temporary hack until we get attributes in
10359 interfaces (Ravi is working on that) and we get IndexerName
10360 support in interfaces.
10362 * interface.cs: Register the indexers as properties.
10364 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
10365 warning, I have verified that this is a bug in the .NET runtime
10366 (JavaScript suffers of the same problem).
10368 * typemanager.cs (MemberLookup): When looking up members for
10369 interfaces, the parent of an interface is the implicit
10370 System.Object (so we succeed in searches of Object methods in an
10371 interface method invocation. Example: IEnumerable x; x.ToString
10374 2002-05-25 Miguel de Icaza <miguel@ximian.com>
10376 * class.cs (Event): Events should also register if they do
10377 implement the methods that an interface requires.
10379 * typemanager.cs (MemberLookup); use the new GetInterfaces
10382 (GetInterfaces): The code used to lookup interfaces for a type is
10383 used in more than one place, factor it here.
10385 * driver.cs: Track the errors at the bottom of the file, we kept
10388 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
10389 instance if the method we are calling is static!
10391 2002-05-24 Miguel de Icaza <miguel@ximian.com>
10393 * attribute.cs (ApplyAttributes): Make this function filter out
10394 the IndexerName attribute (as that attribute in reality is never
10395 applied) and return the string constant for the IndexerName
10398 * class.cs (TypeContainer.Emit): Validate that all the indexers
10399 have the same IndexerName attribute, and if so, set the
10400 DefaultName attribute on the class.
10402 * typemanager.cs: The return value might contain other stuff (not
10403 only methods). For instance, consider a method with an "Item"
10404 property and an Item method.
10406 * class.cs: If there is a problem with the parameter types,
10409 2002-05-24 Ravi Pratap <ravi@ximian.com>
10411 * ecore.cs (ImplicitConversionExists): Wrapper function which also
10412 looks at user defined conversion after making a call to
10413 StandardConversionExists - we need this for overload resolution.
10415 * expression.cs : Update accordingly the various method calls.
10417 This fixes 2 bugs filed against implicit user defined conversions
10419 2002-05-22 Miguel de Icaza <miguel@ximian.com>
10421 * statement.cs: Track the result of the assignment.
10423 2002-05-21 Miguel de Icaza <miguel@ximian.com>
10425 * expression.cs (MemberAccess): Improved error reporting for
10426 inaccessible members.
10428 2002-05-22 Martin Baulig <martin@gnome.org>
10430 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
10431 itself with debugging support.
10433 2002-05-22 Martin Baulig <martin@gnome.org>
10435 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
10436 Removed, this isn't needed anymore.
10438 2002-05-20 Martin Baulig <martin@gnome.org>
10440 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
10441 be underlying type for an enum.
10443 2002-05-20 Miguel de Icaza <miguel@ximian.com>
10445 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
10446 that splits out the loading of just the core types.
10448 * rootcontext.cs (ResolveCore): Split the struct resolution in
10449 two, so we can load the enumeration underlying types before any
10452 * expression.cs (Is): Bandaid until we fix properly Switch (see
10453 bug #24985 for details).
10455 * typemanager.cs (ImplementsInterface): The hashtable will contain
10456 a null if there are no interfaces implemented.
10458 2002-05-18 Miguel de Icaza <miguel@ximian.com>
10460 * cs-parser.jay (indexer_declarator): It is fine to have array
10463 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10465 * typemanager.cs: (RegisterBuilder): New function used to register
10466 TypeBuilders that implement interfaces. Since
10467 TypeBuilder.GetInterfaces (as usual) does not work with lame
10469 (AddUserType): register interfaces.
10471 (ImplementsInterface): Use the builder_to_ifaces hash if we are
10472 dealing with TypeBuilder. Also, arrays are showing up as
10473 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
10474 methods can not be invoked on them!
10476 * ecore.cs (ExplicitReferenceConversionExists): Made public.
10477 (ImplicitReferenceConversionExists): Split out from
10478 StandardConversionExists.
10480 * expression.cs (As): We were only implementing one of the three
10481 cases for the as operator. We now implement them all.
10482 (Is): Implement the various other cases for Is as well.
10484 * typemanager.cs (CACHE): New define used to control if we want or
10485 not the FindMembers cache. Seems to have a negative impact on
10486 performance currently
10488 (MemberLookup): Nested types have full acess to
10489 enclosing type members
10491 Remove code that coped with instance/static returns for events, we
10492 now catch this in RealFindMembers.
10494 (RealFindMembers): only perform static lookup if the instance
10495 lookup did not return a type or an event.
10497 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10499 * assign.cs (CompoundAssign): We pass more semantic information
10500 now to Compound Assignments than we did before: now we have all
10501 the information at hand, and now we resolve the target *before* we
10502 do the expression expansion, which allows the "CacheValue" method
10503 to have the effect we intended (before, a [x] += 1 would generate
10504 two differen ArrayAccess expressions from the ElementAccess,
10505 during the resolution process).
10507 (CompoundAssign.DoResolve): Resolve target and original_source here.
10509 2002-05-16 Miguel de Icaza <miguel@ximian.com>
10511 * expression.cs (ArrayAccess): dropped debugging information.
10513 * typemanager.cs: Small bug fix: I was always returning i_members,
10514 instead of one of i_members or s_members (depending on which had
10517 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
10518 method is invoked before any code generation takes place, and it
10519 is a mechanism to inform that the expression will be invoked more
10520 than once, and that the method should use temporary values to
10521 avoid having side effects
10523 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
10525 * ecore.cs (Expression.CacheTemporaries): Provide empty default
10528 * expression.cs (Indirection, ArrayAccess): Add support for
10529 CacheTemporaries in these two bad boys.
10531 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
10532 ldobj or ldind_ref.
10533 (StoreFromPtr): Handle stobj as well.
10535 * expression.cs (UnaryMutator): Share more code.
10537 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
10538 down: I was not tracking the Filter function as well, which
10539 was affecting the results of the cache.
10541 2002-05-15 Miguel de Icaza <miguel@ximian.com>
10543 * attribute.cs: Remove the hack to handle the CharSet property on
10546 2002-05-14 Miguel de Icaza <miguel@ximian.com>
10548 * attribute.cs (DoResolve): More uglyness, we now only try to
10549 resolve the attribute partially, to extract the CharSet
10550 information (only if we are a StructLayout attribute). Otherwise
10552 (GetExtraTypeInfo): Add some code to conditionally kill in the
10553 future this. I am more and more convinced that the .NET
10554 framework has special code to handle the attribute setting on
10557 * expression.cs (IsParamsMethodApplicable): Revert my previous
10558 foreach change here, it was wrong.
10560 2002-05-13 Miguel de Icaza <miguel@ximian.com>
10562 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
10563 (pp_expr): do not abort on unknown input, just return.
10564 (eval): abort if there are pending chars.
10566 * attribute.cs (Attribute.Resolve): Positional parameters are
10567 optional. Deal with that case.
10569 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
10570 the Ansi/Unicode/Auto information for the type.
10572 (TypeContainer.DefineType): instantiate the EmitContext here, as
10573 we will be using it during the type definition (to resolve
10574 attributes) and during the emit phase.
10576 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
10577 to pull type information out of the attributes
10579 (Attribute.Resolve): track the constructor builder, and allow for
10580 multiple invocations (structs and classes will use this).
10582 * ecore.cs (MemberLookupFinal): new version with all the
10583 parameters customizable.
10585 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
10586 constructors. Return if the result value is null (as the error
10587 would have been flagged already by MemberLookupFinal)
10589 Do not allow instances of abstract classes or interfaces to be
10592 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
10593 We have to compare the assembly property here when dealing with
10594 FamANDAssem and Assembly access modifiers, because we might be
10595 creating an assembly from *modules* (that means that we are not
10596 getting TypeBuilders for types defined in other modules that are
10597 part of this assembly).
10599 (Method.Emit): If the method is marked abstract and has a body,
10602 (TypeContainer.DefineMembers): If both the defined member and the
10603 parent name match are methods, then do not emit any warnings: let
10604 the Method.Define routine take care of flagging warnings. But if
10605 there is a mismatch (method overrides something else, or method is
10606 overriwritten by something, then emit warning).
10608 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10609 set to null, this means `do not check for the return type on the
10612 (Method.Define): set the return type for the method signature to
10613 null, so that we get methods with the same name and parameters and
10614 different return types. This is used to flag warning 114 (you are
10615 hiding a method, and you probably want to use the new/override
10618 * typemanager.cs (MemberLookup): Implemented proper access
10619 control, closing a long standing set of bug reports. The problem
10620 was that the Framework only has two bits: Public and NonPublic,
10621 and NonPublic includes private and protected methods, but we need
10622 to enforce the FamANDAssem, FamOrAssem and Family.
10624 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10626 * statement.cs (GotoCase): Return true: Ammounts to giving up
10627 knowledge on whether we return or not, and letting the other case
10628 be responsible for it.
10630 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10632 * driver.cs: Do not load directories for each file processed, only
10633 do it if there is a pattern.
10635 * ecore.cs: Report readonly assigns here as well, as we might have
10636 been resolved only by MemberAccess.
10638 (SimpleName.SimpleNameResolve): Also be useful for LValue
10639 resolution. We need this to propagate assign to local readonly variables
10641 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10642 do not want to reuse potential criteria memory.
10644 * class.cs (MyEventBuilder): Set reflected_type;
10646 * ecore.cs (Constantify): Added support for constifying bools.
10648 (RootContext.LookupType): Added a cache for values looked up in
10649 the declaration space.
10651 * typemanager.cs (FindMembers): Now is a front-end to
10652 RealFindMembers, and provides a two-level hashtable-based cache to
10655 15% performance improvement: from 22.5 to 19.2 seconds.
10657 * expression.cs (IsParamsMethodApplicable): use foreach.
10658 (Invocation.DoResolve): ditto.
10659 (New.DoResolve): ditto.
10660 (ArrayCreation.DoResolve): ditto.
10662 * ecore.cs (FindMostEncompassingType): use foreach.
10664 * delegate.cs (NewDelegate.DoResolve): Use foreach
10666 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10667 (RemoveMethods): use foreach.
10669 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10670 nested foreach statements instead of for, and also break out of
10671 the inner loop once a match is found.
10673 (Invocation.OverloadResolve): Use foreach, simplify the code.
10675 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10677 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10678 we actually unwrap the expression to allow for extra information
10681 * expression.cs: Use Shr_Un on unsigned operations.
10683 2002-05-08 Ravi Pratap <ravi@ximian.com>
10685 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10686 applicable operators was not being considered correctly. This closes
10687 the bug Miguel reported.
10689 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10691 * attribute.cs: check that the type derives from System.Attribute
10692 and report the correct error in that case (moved the duplicate code to
10693 its own method, too).
10695 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10697 * attribute.cs: lookup attribute type name as the spec says: first the
10698 bare attribute name and then name + "Attribute" (nant compiles with
10699 mcs after this fix).
10701 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10703 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10704 Because of the way we parse things, we should try to see if a
10705 UIntConstant can fit in an integer.
10707 2002-05-07 Ravi Pratap <ravi@ximian.com>
10709 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10710 when we are in an explicit context.
10712 (ConvertReferenceExplicit): When converting from Iface type S to Class
10713 T make sure the rules are implemented as an OR.
10715 * parameter.cs (ParameterType): Make it a property for now although the
10716 purpose really isn't anything immediate.
10718 * expression.cs (Is*Applicable): Do better checking on the parameter type
10719 of a ref/out parameter. The ones from the system assemblies are already
10720 marked with the correct type so we don't need to do any correction.
10722 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10723 the object type is standard too so include that.
10725 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10727 * ecore.cs (StandardConversionExists): Augment with missing code:
10728 deal with IntConstant, LongConstants and Enumerations.
10730 * assign.cs: Report the error, instead of failing silently
10732 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10733 typecontainer that they are declared, because the
10734 typecontainer/namespace will have the list of using clauses that
10735 need to be applied.
10737 Assembly Attributes were escaping the normal registration
10740 (EmitCode): Apply attributes within an EmitContext that represents
10741 the container they were declared on.
10743 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10745 2002-05-06 Ravi Pratap <ravi@ximian.com>
10747 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10748 Revamp completely - make much cleaner as we now operate only
10751 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10752 to implement the logic detailed in the spec more correctly.
10754 (UserDefinedConversion): Update accordingly.
10756 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10758 * statement.cs: Return flow analysis information up.
10760 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10763 (token): Do not consume an extra character before calling
10766 2002-05-06 Piers Haken <piersh@friskit.com>
10768 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10770 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10772 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10773 EmitContext during the instance constructor initializer
10774 resolution, to stop access to instance variables.
10776 This is mandated by the spec, last paragraph of the `constructor
10777 initializers' section.
10779 2002-05-05 Miguel de Icaza <miguel@ximian.com>
10781 * cs-parser.jay, class.cs (Accessor): new class used to represent
10782 an accessor (get or set). In the past we used `null' to represent
10783 a missing accessor. But this is ambiguous because there was no
10784 way to tell in abstract indexers/properties if one of them was
10787 Now there is a way of addressing that.
10789 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
10790 instead of FindMembers.
10792 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
10793 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
10795 * attribute.cs: Treat indexers and properties as the same in terms
10796 of applying attributes
10798 * ecore.cs (FindMostEncompassedType): Use statically initialized
10799 EmptyExpressions()s like we do elsewhere to avoid creating useless
10800 objects (and we take this out of the tight loop).
10802 (GetConversionOperators): Move the code to extract the actual
10803 operators to a separate routine to clean things up.
10805 2002-05-04 Miguel de Icaza <miguel@ximian.com>
10807 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
10808 events are always registered FieldBuilders.
10810 * class.cs (FieldBase): New class shared by Fields
10812 * delegate.cs: If we are a toplevel delegate, use our full name.
10813 If we are a nested delegate, then only use our tail name.
10815 2002-05-02 Ravi Pratap <ravi@ximian.com>
10817 * expression.cs (IsApplicable): Ensure that we add the "&" to
10818 ref/out types before comparing it with the type of the argument.
10820 (IsParamsMethodApplicable): Ditto.
10822 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
10825 * delegate.cs : Handle the case when we have more than one applicable
10826 method. Flag an error only when we finish checking all.
10828 2002-05-02 Miguel de Icaza <miguel@ximian.com>
10830 * expression.cs: Add support for boolean static initializers.
10832 2002-05-01 Miguel de Icaza <miguel@ximian.com>
10834 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
10836 * parameter.cs (ComputeParameterTypes,
10837 ComputeAndDefineParameterTypes): Better error handling: now we
10838 clear the `types' cache if we fail during any of the type lookups.
10839 We also return the status code correctly to our caller
10841 * delegate.cs: If we fail to define a delegate, abort the extra
10844 * expression.cs (Binary.ResolveOperator): for
10845 operator==(object,object) and operator !=(object, object) we also
10846 have to verify that there is an implicit conversion from one to
10849 (ArrayAccess.DoResolve): Array Access can operate on
10852 2002-04-30 Miguel de Icaza <miguel@ximian.com>
10854 * assign.cs (CompoundAssign): A new class used as a "flag" that
10855 the assignment actually is happening as part of a compound
10856 assignment operator.
10858 During compound assignment, a few new rules exist to enable things
10865 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
10866 to the type of x) if y is implicitly convertible to the type of x,
10867 and the operator is a builtin operator and the return type of the
10868 operator is explicitly convertible to the type of x.
10870 * rootcontext.cs: Reset warning level to 2. 4 catches various
10871 "interesting" features in mcs, we must clean this up at some
10872 point, but currently am trying to kill other bugs ;-)
10874 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
10875 in container classes as well.
10877 * expression.cs (Binary.ResolveOperator): Handle string case
10878 before anything else (as operator overloading does emit an error
10879 before doing anything else).
10881 This code could go away when we move to a table driven model, but
10882 i could not come up with a good plan last night.
10884 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
10886 * typemanager.cs (CSharpName): reimplementation using regex.
10887 * class.cs: added null check for fields in Emit
10888 * rootcontext.cs: set warninglevel to 4
10890 2002-04-29 Miguel de Icaza <miguel@ximian.com>
10892 * typemanager.cs (CSharpName): reimplemented with Lupus
10895 2002-04-28 Miguel de Icaza <miguel@ximian.com>
10897 * statement.cs (If): correclty implement Resolve, because we were
10898 not catching sem errors in there. The same process is needed
10900 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
10903 (Statement.Warning_DeadCodeFound): Factorize code.
10904 (While): Report dead code here too.
10906 (Statement): Added Resolve virtual method to allow
10907 for resolution split from the emit code.
10909 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10911 * statement.cs (EmitBoolExpression): No longer try to resolve the
10913 (MakeBoolean): New utility function that resolve, implicitly
10914 converts to boolean and tags the expression.
10917 (If, Do): Implement dead code elimination.
10918 (While): Implement loop inversion
10920 (Do, While, For, If): Resolve the expression prior to calling our
10923 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
10926 - added method Report28 (warning: program has more than one entry point)
10927 - added method IsEntryPoint, implements paragraph 10.1 of the spec
10928 - modified method Method.Define, the part at the end of the method
10930 * rootcontext.cs: added static public Location EntryPointLocation;
10932 * ../errors/cs0028.cs : Add test case for the above warning.
10935 - modified method CSharpName to allow arrays of primitive type to
10936 be printed nicely (e.g. instead of System.Int32[][] it now prints
10938 - added method CSharpSignature: returns the signature of a method
10939 in string format to be used in reporting errors, warnings, etc.
10941 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
10944 2002-04-26 Ravi Pratap <ravi@ximian.com>
10946 * delegate.cs (Define): Fix extremely silly bug where I was
10947 setting the type of the 'object' parameter of the BeginInvoke
10948 method to System.IAsyncResult instead of System.Object ;-)
10950 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10952 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10955 (Constructor.Emit): return if we fail to initialize the
10956 constructor. Another door closed!
10958 * expression.cs (New.DoResolve): Improve error message (from -6 to
10959 1501). Use DeclaredOnly lookup to find the exact constructor.
10961 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10962 loop. This is useful.
10964 * cs-parser.jay: Adjust the default parameters so that destructors
10965 have the proper signature.
10967 2002-04-26 Martin Baulig <martin@gnome.org>
10969 * driver.cs (LoadAssembly): If `assembly' contains any characters
10970 which are only valid in path names and not in assembly names
10971 (currently slash, backslash and point), use Assembly.LoadFrom ()
10972 instead of Assembly.Load () on the `assembly' (before iteration
10973 over the link_paths).
10975 2002-04-26 Martin Baulig <martin@gnome.org>
10977 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10979 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10981 * class.cs (Property): use the new typemanager.MemberLookup
10983 (TypeContainer.MemberLookup): Implement using the
10984 TypeManager.MemberLookup now.
10986 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10987 and return MemberInfos, so that these can be used without an
10988 EmitContext (what we had before).
10990 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10992 * expression.cs: Fix the case where the argument to params if the
10993 type of the params. I omitted handling this before. Fixed
10995 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10997 * driver.cs: Call BootCorlib_PopulateCoreType
10999 * class.cs (Property.CheckBase): Check for properties only, not
11002 * interface.cs: Temporary hack: try/catch around the
11003 CustomAttributeBuilder, because I am getting an exception that I
11006 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
11007 types whose definitions are required to be there (attributes are
11008 defined before standard types).
11010 Compute definitions as we boot the various types, as they are used
11011 immediately (value_type class will need object_type, but if we do
11012 not initialize object_type, we will pass a null, which will let
11013 the runtime pick the System.Object from the existing corlib, which
11014 is not what we want).
11016 2002-04-22 Patrik Torstensson <totte@labs2.com>
11018 * cs-tokenizer.cs: fixed a number of trim() issues.
11020 2002-04-22 Ravi Pratap <ravi@ximian.com>
11022 * expression.cs (Argument.Type): Ensure that we return the correct
11023 type when we have out or ref parameters [in which case we
11026 2002-04-22 Miguel de Icaza <miguel@ximian.com>
11028 * class.cs (Property, Indexer): Allow extern modifier in there.
11030 * typemanager.cs (InitBaseTypes): Initializes object_type and
11031 value_type, since those will be used early on during the bootstrap
11032 process to compile corlib.
11034 (InitCoreTypes): Move code from here to InitBaseTypes.
11036 2002-04-21 Miguel de Icaza <miguel@ximian.com>
11038 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
11039 single-dimension arrays as using the ldlen opcode.
11041 Daniel Lewis discovered this optimization.
11043 * typemanager.cs: Add signature for System.Array::get_Length
11045 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11047 * statement.cs: report the error when the foreach does not apply to an
11048 array nor a collection.
11050 2002-04-19 Miguel de Icaza <miguel@ximian.com>
11052 * expression.cs: Add implicit conversions to the operator ~.
11054 * constant.cs (DecimalConstant.Emit): Emit decimal value.
11056 * typemanager.cs: Locate the decimal constructor.
11058 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11060 * attribute.cs: use the new property of TypeOf.
11061 * expression.cs: added 'get' property around typearg.
11063 These changes fix a build breaker reported by NickD. Is this the
11064 correct way to fix? If not, please, revert my changes and make it
11067 2002-04-17 Miguel de Icaza <miguel@ximian.com>
11069 * attribute.cs: Add support for typeof in attribute invocations.
11070 I am not sure that this is right though.
11072 2002-04-14 Duncan Mak <duncan@ximian.com>
11074 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
11075 Binary.Operator.Division case.
11077 2002-04-13 Ravi Pratap <ravi@ximian.com>
11079 * class.cs (DefineType): Ensure that we do a proper check on
11080 attribute types and also register it with the TypeManager.
11082 (TypeContainer.Targets): The default for attribute types is
11083 AttributeTargets.All.
11085 * attribute.cs (ApplyAttributes): Registering the attribute type
11086 is done elsewhere, not when we discover we have a Usage attribute.
11088 2002-04-12 Ravi Pratap <ravi@ximian.com>
11090 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
11091 and get rid of is_delegate parameter.
11093 * everywhere : update.
11095 2002-04-12 Ravi Pratap <ravi@ximian.com>
11097 * cs-parser.jay (compilation_unit): Revamp completely to use
11098 some new ideas that I got from Rhys' grammar to solve the problems
11099 with assembly level attributes.
11101 (outer_declaration): New grammar production.
11103 (attribute_sections): Add.
11105 (opt_attributes): Base on attribute_sections
11107 (namespace_declaration): Allow opt_attributes to tackle the case
11108 when we have assembly level attributes - we are clever in this
11111 * attribute.cs (ApplyAttributes): Do not worry about assembly
11112 attributes in the non-global context.
11114 * rootcontext.cs (AddGlobalAttributes): Go back to using this
11115 instead of SetGlobalAttributes.
11117 * class.cs, rootcontext.cs : Ensure we define and generate
11118 attribute types before anything else.
11120 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
11121 and flag the new error -20 for the case when the attribute type
11122 does not have valid targets specified. csc does not catch this.
11124 * ../errors/errors.txt : update for error # -20
11126 2002-04-11 Ravi Pratap <ravi@ximian.com>
11128 * support.cs (InternalParameters.ParameterModifier): Do some null
11129 checking and return sane values.
11131 * class.cs (Method.Define): If we are a PInvoke method, ensure
11132 that we are static and extern. Report error # 601
11134 * ../errors/cs0601.cs : Add test case for the above error.
11136 2002-04-07 Ravi Pratap <ravi@ximian.com>
11138 * rootcontext.cs (attribute_types): We need to keep type of
11139 all attribute types separately and emit code for them first.
11141 (RegisterAttribute) : Implement.
11143 * class.cs (DefineType): Check if the current Type is a custom
11144 attribute type and register it accordingly.
11146 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
11147 adding the first attribute twice and rename to
11149 (SetGlobalAttributes): this.
11151 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
11154 * attribute.cs (ApplyAttributes): Take an additional argument telling us
11155 if we are processing global arguments. Hmm, I am unsure of this.
11157 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11159 * expression.cs: added static array of strings to avoid calling
11160 Enum.ToString () for Operator in Binary. Significant recover of
11163 2002-04-10 Miguel de Icaza <miguel@ximian.com>
11165 * class.cs (FindMembers): Allow the Builders of the various
11166 members to be null. If they are skip them. This only happens
11167 during the PInvoke declaration.
11169 2002-04-09 Miguel de Icaza <miguel@ximian.com>
11171 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
11172 failure, so we do not keep going afterwards.
11174 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
11175 wanted to pass `false' as the `is_delegate' argument. If this is
11176 the case, why not use delegate_type == null to mean `is_delegate =
11177 false' and anything else as is_delegate = true.
11179 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
11181 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
11182 code for the section, not the beginning of the tests.
11184 2002-04-08 Miguel de Icaza <miguel@ximian.com>
11186 * cfold.cs: Handle operator + (Enum x, Underlying x)
11188 * expression.cs (Binary): same. Warn about errors where we have
11189 Enum/Enum in operator + as well.
11191 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
11194 - added support for switch(bool)
11195 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
11196 - add TableSwitchEmit() to handle table-based switch statements
11198 2002-04-05 Ravi Pratap <ravi@ximian.com>
11200 * expression.cs (Invocation.OverloadResolve): Factor out code which
11201 does parameter compatibility checking with arguments so that we can
11202 re-use the code even from Delegate.VerifyApplicability
11204 (VerifyArgumentsCompat): Move above code here.
11206 * delegate.cs (VerifyApplicability): Get rid of duplicate code
11207 and instead make a call to the above method.
11209 2002-03-31 Ravi Pratap <ravi@ximian.com>
11211 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
11212 We use it to keep track of classes which are attribute types.
11214 2002-04-02 Miguel de Icaza <miguel@ximian.com>
11216 * delegate.cs (Delegate.Define): Correctly define the types in the
11217 presence of fixed and array parameters.
11219 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
11222 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
11223 include NonPublic after the first iteration.
11225 * class.cs (Indexer.CheckBase): Only check if both parents are
11228 * cs-parser.jay (accessor_body): If empty, set to null.
11230 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
11231 same code path here to resolve constants names that we did have in
11232 MemberAccess.DoResolve. There is too much code duplicated here.
11234 2002-04-01 Miguel de Icaza <miguel@ximian.com>
11236 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
11238 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
11241 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
11242 tokens, numbers and strings.
11244 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
11247 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
11248 asyncronous parameters and the regular parameters.
11250 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
11251 specify the target directory.
11253 * expression.cs: (This.DoResolve): Simplify
11254 (As.Emit): Optimize, do not generate IsInst if the expression is
11255 always of the given type.
11257 (Is.DoResolve): Bug fix, we were reporting both always/never for
11260 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
11261 creating too many unnecessary arrays.
11263 2002-03-31 Miguel de Icaza <miguel@ximian.com>
11265 * class.cs (EmitFieldInitializer): Use Assign expression to assign
11266 fields instead of rolling our own initializer. Takes care of all
11267 implicit conversions, and drops unnecessary static checks/argument.
11269 2002-03-31 Dick Porter <dick@ximian.com>
11271 * driver.cs: use the GetDirectories() return values properly, and
11272 use "/" as path separator.
11274 2002-03-30 Miguel de Icaza <miguel@ximian.com>
11276 * expression.cs (Unary): Optimize - - expr into expr.
11277 (Binary): Optimize a + (-b) into a -b.
11279 * codegen.cs (CodeGen): Made all methods static.
11281 2002-03-29 Miguel de Icaza <miguel@ximian.com>
11285 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
11286 TypeBuilder property.
11288 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
11291 * tree.cs: Removed the various RecordXXXX, and replaced with a
11292 single RecordDecl. Removed all the accessor methods, and just
11293 left a single access point Type
11295 * enum.cs: Rename DefineEnum to DefineType.
11297 * decl.cs: New abstract method `DefineType' used to unify the
11298 Defines for Enumerations, Interfaces, TypeContainers and
11301 (FindType): Moved LookupInterfaceOrClass here. Moved the
11302 LookupBaseClasses method that used to live in class.cs and
11303 interface.cs here, and renamed to FindType.
11305 * delegate.cs: Implement DefineType. Take advantage of the
11306 refactored pattern for locating the parent builder without taking
11307 the parent_builder argument (which we know does not work if we are
11308 nested, and triggering a toplevel definition).
11310 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11312 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
11313 accessibility of a member has changed during override and report
11316 * class.cs (Method.Define, Property.Define): Only complain on
11317 overrides if the method is private, any other accessibility is
11318 fine (and since we just checked the permission is the same, we are
11321 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
11322 and elif are processed always. The other pre-processing
11323 directives are only processed if we are "taking" the path
11325 2002-03-29 Martin Baulig <martin@gnome.org>
11327 * class.cs (Method.Emit): Only emit symbolic debugging info if the
11328 current location is not Null.
11330 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
11331 a separate method so we can profile it.
11333 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
11334 `span.Seconds' are just seconds, but no minutes or hours.
11335 (MainDriver): Profile the CodeGen.SaveSymbols calls.
11337 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11339 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
11340 Remove the gratuitous set of Final:
11342 // If an interface implementation, then we can set Final.
11343 if (((flags & MethodAttributes.Abstract) == 0) &&
11344 implementing.DeclaringType.IsInterface)
11345 flags |= MethodAttributes.Final;
11347 I do not know what I was smoking when I used that.
11350 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
11351 step into fixing the name resolution issues for delegates and
11352 unifying the toplevel name resolution.
11354 2002-03-28 Martin Baulig <martin@gnome.org>
11356 * class.cs (Method.Emit): If we have a symbol writer, call its
11357 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
11358 tell it about the current method.
11360 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
11361 writer that we're going to emit the first byte of IL code for a new
11362 statement (a new source line).
11363 (EmitContext.EmitTopBlock): If we have a symbol writer, call
11364 EmitContext.Mark() before emitting any code.
11366 * location.cs (SymbolDocument): Return null when we're Null.
11368 * statement.cs (Statement): Moved the `Location loc' variable here.
11369 (Statement.EmitBoolExpression): If we have a symbol writer, call
11370 ec.Mark() before emitting any code to tell it that we're at the
11371 beginning of a new statement.
11372 (StatementExpression): Added `Location' argument to the constructor.
11373 (Block): Added public readonly variable `StartLocation' and public
11374 variable `EndLocation'. The latter is to be set using SetEndLocation().
11375 (Block): Added constructor which takes a start and end location.
11376 (Block.SetEndLocation): New method. This sets the end location.
11377 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
11378 local variables we create.
11379 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
11380 each statement and do also mark the begin and end of the block.
11382 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
11383 tell it the current lexer.Location, use Location.Null for the end of the
11385 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
11386 current block, set its end location using SetEndLocation().
11387 (statement_expression): StatementExpression constructor now takes the
11388 lexer.Location as additional argument.
11389 (for_statement, declare_local_variables): Likewise.
11390 (declare_local_variables): When creating a new implicit block, use the
11391 new Block constructor and pass it the lexer.Location.
11393 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11395 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
11396 members also on the parent interfaces recursively.
11398 2002-03-27 Miguel de Icaza <miguel@ximian.com>
11400 * report.cs: Use new formats, since Gonzalo finished the missing
11403 * expression.cs (Binary.ResolveOperator): added missing operator|
11404 operator& and operator^ for bool/bool.
11406 * cs-parser.jay: CheckDef now takes a Location argument that is
11407 used to report errors more precisly (instead of reporting the end
11408 of a definition, we try to track something which is a lot closer
11409 to the source of the problem).
11411 * cs-tokenizer.cs: Track global token use, so we can properly flag
11412 the use of #define/#undef after the first token has been seen.
11414 Also, rename the reportXXXX to Error_DescriptiveName
11416 * decl.cs (DeclSpace.IsTopLevel): Move property here from
11417 TypeContainer, so that Enum and Interface can use this too.
11419 * class.cs (TypeContainer.LookupInterfaceOrClass,
11420 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
11421 `builder' argument. Typically this was used to pass the parent
11422 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
11425 The problem is that a nested class could trigger the definition of
11426 a toplevel class, and the builder would be obviously wrong in that
11429 So we drop this argument, and we compute dynamically the
11430 TypeBuilder/ModuleBuilder (the correct information was available
11431 to us anyways from DeclSpace.Parent)
11433 * interface.cs (Interface.DefineInterface): Drop builder
11434 parameter cleanup like class.cs
11436 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
11439 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
11442 (Try.Emit): Propagate the returns value from the statement.
11444 (Return.Emit): Even if we are leavning
11446 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
11448 * modifiers.cs: Fix the computation of MethodAttributes flags.
11450 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
11452 * driver.cs: allow compilation of files that start with '/'.
11453 Add a default case when checking the argument of --target.
11455 2002-03-25 Miguel de Icaza <miguel@ximian.com>
11457 * interface.cs: Implement the same search algorithm for types in
11458 the interface code.
11460 * delegate.cs: Do not allow multiple definition.
11462 * Recovered ChangeLog that got accidentally amputated
11464 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
11466 * rootcontext.cs: Load manually enum to allow core classes to
11467 contain enumerations.
11469 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
11470 Update to new static methods in TypeManager.
11472 * typemanager.cs (GetMethod, GetConstructor): Use our
11473 implementation of FindMembers to find the members, since during
11474 corlib compilation, the types are TypeBuilders and GetMethod and
11475 GetConstructor do not work.
11477 Make all methods in TypeManager static.
11479 (InitCodeHelpers): Split the functionality from
11480 the InitCodeTypes function.
11482 * driver.cs: Call InitCodeHelpers after we have populated the
11485 * cs-parser.jay (delegate_declaration): we did not used to compute
11486 the delegate name correctly for void delegates.
11488 2002-03-24 Miguel de Icaza <miguel@ximian.com>
11490 * rootcontext.cs (RootContext): Init the interface_resolve_order
11491 and type_container_resolve_order always.
11493 (ResolveCore, BootstrapCorlib_ResolveClass,
11494 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
11495 compiler when compiling with --nostdlib
11497 * class.cs (TypeContainer.DefineType): Check that our parent is
11498 not null. This test is most important when we are bootstraping
11501 * codegen.cs: Split out the symbol writing code.
11503 2002-03-25 Martin Baulig <martin@gnome.org>
11505 * driver.cs (-g): Made -g an alias for --debug.
11507 2002-03-24 Martin Baulig <martin@gnome.org>
11509 * codegen.cs (SymbolWriter): New public variable. Returns the
11510 current symbol writer.
11511 (CodeGen): Added `bool want_debugging_support' argument to the
11512 constructor. If true, tell the ModuleBuild that we want debugging
11513 support and ask it for the ISymbolWriter.
11514 (Save): If we have a symbol writer, call it's Close() method after
11515 saving the assembly.
11517 * driver.c (--debug): New command line argument to create a
11518 debugger information file.
11520 * location.cs (SymbolDocument): New public property. Returns an
11521 ISymbolDocumentWriter object for the current source file or null
11522 if we don't have a symbol writer.
11524 2002-03-21 Miguel de Icaza <miguel@ximian.com>
11526 * driver.cs (LoadAssembly): Correctly return when all the paths
11527 have been tried and not before.
11529 * statement.cs (Switch.Emit): return the actual coverage for this
11530 statement (returns/not-returns)
11532 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
11533 switch of the statement if we are the last switch section. That
11534 kills two problems: try/catch problems (we used to emit an empty
11535 nop at the end) and switch statements where all branches would
11538 2002-03-19 Miguel de Icaza <miguel@ximian.com>
11540 * driver.cs: Add default assemblies (the equivalent to the
11541 Microsoft CSC.RSP file)
11543 * cs-tokenizer.cs: When updating `cols and setting it to zero,
11544 also update tokens_seen and set it to false.
11546 * driver.cs: Implement --recurse for Mike.
11548 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
11549 correctly splitting out the paths.
11551 2002-03-18 Miguel de Icaza <miguel@ximian.com>
11553 * interface.cs (Interface.PopulateProperty): Instead of using
11554 `parent' as the declaration space for the set parameters, use
11557 * support.cs (InternalParameters): InternalParameters constructor
11558 takes a DeclSpace instead of a TypeContainer.
11560 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
11561 types are being initialized, load the address of it before calling
11564 (New): Provide a mechanism to disable the generation of local
11565 value type temporaries when the caller will be providing us with
11566 an address to store it.
11568 (ArrayCreation.EmitDynamicInitializers): Use it.
11570 2002-03-17 Miguel de Icaza <miguel@ximian.com>
11572 * expression.cs (Invocation.EmitArguments): Only probe for array
11573 property if there is more than one argument. Sorry about that.
11575 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
11576 empty param arrays.
11578 * class.cs (Method.LabelParameters): Fix incorrect code path that
11579 prevented the `ParamArrayAttribute' from being applied to the
11582 2002-03-16 Miguel de Icaza <miguel@ximian.com>
11584 * support.cs (ReflectionParameters): Correctly compute whether the
11585 last argument is a params array. Fixes the problem with
11588 * typemanager.cs: Make the assemblies array always be non-null
11589 (empty, but non-null)
11591 * tree.cs (RecordDecl): New function that abstracts the recording
11592 of names. This reports error 101, and provides a pointer to the
11593 previous declaration. Fixes a crash in the compiler.
11595 * cs-parser.jay (constructor_declaration): Update to new grammar,
11596 and provide a constructor_body that can be empty.
11598 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11600 * driver.cs: Add support for --resources.
11602 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11603 Make all types for the various array helper methods be integer.
11605 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11606 CheckState to ConvCast.
11608 (ConvCast): Now it takes a `checked' state argument, to avoid
11609 depending on the emit context for the conversion, and just using
11610 the resolve time setting.
11612 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11613 instead of Invocation.EmitArguments. We do not emit the original
11614 arguments, instead we emit those which have been converted to
11615 unsigned int expressions.
11617 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11619 * codegen.cs: ditto.
11621 * expression.cs (LocalVariableReference): Drop the use of the
11622 Store function that depended on the variable index.
11624 * statement.cs (VariableInfo): Drop the `Idx' property from this
11625 class, as this is not taking into account the indexes for
11626 temporaries tat we generate during the execution, getting the
11629 * class.cs: First emit class initializers, then call the parent
11632 * expression.cs (Binary): Fix opcode emision.
11633 (UnaryMutator.EmitCode): Support checked code generation
11635 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11636 matches for events for both the Static and Instance scans,
11637 pointing to the same element. Fix that.
11639 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11641 * rootcontext.cs (ResolveTree): Always set the
11642 interface_resolve_order, because nested interfaces will be calling
11645 * class.cs (GetInterfaceOrClass): Track the same resolution
11646 process used by TypeManager.LookupType. This fixes the nested
11647 type lookups in class declarations (separate path from
11650 (TypeContainer.DefineType): Also define nested interfaces.
11651 (TypeContainer.RegisterOrder): New public function used to
11652 register the order in which child interfaces need to be closed.
11654 Nested interfaces need to be closed after their parents have been
11657 * interface.cs (InterfaceAttr): Put all the logic for computing
11658 the interface attribute here.
11660 (DefineInterface): Register our interface order with the
11661 RootContext or with the TypeContainer depending on the case.
11663 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11665 * cs-parser.jay: rework foreach statement to work with the new
11666 changes to the policy on SimpleNames.
11668 * report.cs: support Stacktrace on warnings as well.
11670 * makefile: drop --unsafe and /unsafe from the compile.
11672 2002-03-13 Ravi Pratap <ravi@ximian.com>
11674 * ecore.cs (StandardConversionExists): Modify to take an Expression
11675 as the first parameter. Ensure we do null -> reference type conversion
11678 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11679 temporary Expression objects.
11681 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11683 * interface.cs: workaround bug in method overloading resolution
11684 (there is already a bugzilla bug for it).
11686 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11688 We could also solve this problem by having a separate path for
11689 performing type lookups, instead of DoResolve, we could have a
11690 ResolveType entry point, and only participating pieces of the
11691 production (simplename, deref, array) would implement this.
11693 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11694 signal SimpleName to only resolve type names and not attempt to
11695 resolve anything else.
11697 * expression.cs (Cast): Set the flag.
11699 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11701 * class.cs: Only report 108 if there is no `new' modifier.
11703 * cs-parser.jay: rework foreach statement to work with the new
11704 changes to the policy on SimpleNames.
11706 * report.cs: support Stacktrace on warnings as well.
11708 * makefile: drop --unsafe and /unsafe from the compile.
11710 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11712 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11713 lookups here, instead of doing that at parse time. This means
11714 that our grammar will not introduce `LocalVariableReferences' as
11715 expressions at this point. That solves the problem of code like
11719 static void Main ()
11723 This is only half the fix. The full fix requires parameters to
11724 also be handled in this way.
11726 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11727 makes the use more obvious of the DeclSpace. The
11728 ec.TypeContainer.TypeBuilder is now only used to pull the
11729 TypeBuilder for it.
11731 My theory is that I can get rid of the TypeBuilder completely from
11732 the EmitContext, and have typecasts where it is used (from
11733 DeclSpace to where it matters).
11735 The only pending problem is that the code that implements Aliases
11736 is on TypeContainer, and probably should go in DeclSpace.
11738 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11739 lookups here, instead of doing that at parse time. This means
11740 that our grammar will not introduce `LocalVariableReferences' as
11741 expressions at this point. That solves the problem of code like
11745 static void Main ()
11749 This is only half the fix. The full fix requires parameters to
11750 also be handled in this way.
11752 * class.cs (Property.DefineMethod): When implementing an interface
11753 method, set newslot, when implementing an abstract method, do not
11754 set the flag (before we tried never setting it, or always setting
11755 it, which is the difference).
11756 (Indexer.DefineMethod): same.
11757 (Method.DefineMethod): same.
11759 * ecore.cs: Only set the status used flag if we get back a Field.
11761 * attribute.cs: Temporary hack, so Paolo can keep working.
11763 2002-03-08 Ravi Pratap <ravi@ximian.com>
11765 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11766 the unmanaged type in the case we have a MarshalAs attribute.
11768 (Resolve): Handle the case when we are parsing the special MarshalAs
11769 attribute [we need to store the unmanaged type to use later]
11771 * typemanager.cs (marshal_as_attr_type): Built in type for the
11772 MarshalAs Attribute.
11774 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11775 on parameters and accordingly set the marshalling info.
11777 2002-03-09 Miguel de Icaza <miguel@ximian.com>
11779 * class.cs: Optimizing slightly by removing redundant code after
11780 we switched to the `NoTypes' return value.
11781 (Property.DefineMethod): use NoTypes here too.
11783 This fixes the bug I introduced in my last batch of changes.
11785 2002-03-05 Ravi Pratap <ravi@ximian.com>
11787 * tree.cs (RecordEnum): Add. We now keep track of enums too.
11789 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
11790 Enums since those are types too.
11792 * cs-parser.jay (enum_declaration): Record enums as we parse them.
11794 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
11795 thanks to a call during the lookup process.
11797 2002-03-07 Miguel de Icaza <miguel@ximian.com>
11799 * statement.cs (Foreach): Lots of work to accomodate a particular
11800 kind of foreach statement that I had not kept in mind. It is
11801 possible to have foreachs on classes that provide a GetEnumerator
11802 method that return objects that implement the "pattern" for using
11803 a foreach, there is no need to support GetEnumerator
11806 This is needed to compile nant.
11808 * decl.cs: Only report 114 if the member is not `Finalize' and if
11809 the warning level is at least 2.
11811 * class.cs: Moved the compare function from Method to
11814 (MethodSignature.InheritableMemberSignatureCompare): Add new
11815 filter function that is used to extract inheritable methods from a
11818 (Method.Define): Use the new `inheritable_method_signature_filter'
11821 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
11824 2002-03-06 Miguel de Icaza <miguel@ximian.com>
11826 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
11828 * cs-parser.jay: Add opt_semicolon to the interface declaration.
11830 * expression.cs: Pass location information to
11831 ConvertImplicitStandard.
11833 * class.cs: Added debugging code to track return values from
11836 2002-03-05 Miguel de Icaza <miguel@ximian.com>
11838 * expression.cs (Is.DoResolve): If either side of the `is' is an
11839 interface, do not flag the warning.
11841 * ecore.cs (ImplicitReferenceConversion): We need a separate test
11844 * report.cs: Allow for --fatal to be used with --probe.
11846 * typemanager.cs (NoTypes): Move the definition for the empty Type
11849 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
11851 (TypeContainer.DefineProxy): New function used to proxy to parent
11852 implementations when implementing interfaces.
11853 (TypeContainer.ParentImplements): used to lookup if our parent
11854 implements a public function that is required by an interface.
11855 (TypeContainer.VerifyPendingMethods): Hook this up.
11857 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
11858 `modules' and `assemblies' arraylists into arrays. We only grow
11859 these are the very early start up of the program, so this improves
11860 the speedof LookupType (nicely measured).
11862 * expression.cs (MakeByteBlob): Replaced unsafe code with
11863 BitConverter, as suggested by Paolo.
11865 * cfold.cs (ConstantFold.Binary): Special case: perform constant
11866 folding of string concatenation, but if either side is a string,
11867 and the other is not, then return null, and let the runtime use
11868 the concatenation on the string plus the object (using
11869 `Object.ToString').
11871 2002-03-04 Miguel de Icaza <miguel@ximian.com>
11873 Constant Folding has been implemented now.
11875 * expression.cs (Unary.Reduce): Do not throw an exception, catch
11876 the error instead on types that are not supported in one's
11879 * constant.cs (Constant and all children): New set of functions to
11880 perform implict and explicit conversions.
11882 * ecore.cs (EnumConstant): Implement the new functions to perform
11883 conversion by proxying to the child expression.
11885 * codegen.cs: (ConstantCheckState): Constant evaluation has its
11886 own separate setting that can not be turned off from the command
11887 line using --unchecked or --checked and is only controlled using
11888 the checked/unchecked statements and expressions. This setting is
11889 used by the constant folder to flag errors.
11891 * expression.cs (CheckedExpr, UncheckedExpr): Set the
11892 ConstantCheckState as well.
11894 During Resolve, they also have to flag the state, because the
11895 constant folder runs completely in the Resolve phase.
11897 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
11900 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11902 * cfold.cs: New file, this file contains the constant folder.
11904 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
11905 argument to track whether we are using the resulting address to
11906 load or store a value and provide better error messages.
11908 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
11909 new AddressOf arguments.
11911 * statement.cs (Foreach.EmitCollectionForeach): Update
11913 * expression.cs (Argument.Emit): Call AddressOf with proper
11914 arguments to track usage.
11916 (New.DoEmit): Call AddressOf with new arguments.
11918 (Unary.Emit): Adjust AddressOf call.
11920 2002-03-01 Ravi Pratap <ravi@ximian.com>
11922 * cs-parser.jay (member_access): Change the case for pre-defined types
11923 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
11926 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
11929 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
11930 essentially like methods and apply attributes like MethodImplOptions to them too.
11932 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
11935 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
11936 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
11939 * Update code everywhere accordingly.
11941 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
11943 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
11945 2002-02-28 Ravi Pratap <ravi@ximian.com>
11947 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11948 try performing lookups against those instead of jumping straight into using
11949 the 'using' clauses.
11951 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11953 (LookupType): Perform lookups in implicit parents too.
11955 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11956 sequence as RootContext.LookupType.
11958 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11959 the various cases of namespace lookups into this method.
11961 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11963 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11964 in positional arguments)
11966 * class.cs (Operator): Update the AllowedModifiers to contain
11969 * cs-parser.jay: Update operator declaration to allow for the
11970 operator body to be empty.
11972 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11975 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11977 * class.cs (Method.Emit): Label parameters.
11979 * driver.cs: Return 1 or 0 as the program exit code.
11981 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11983 * expression.cs: Special case the `null' object when trying to
11984 auto-compute the type, as anything can be explicitly converted to
11987 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11988 spotting this Paolo.
11990 (Expression.ImplicitNumericConversion): Perform comparissions of
11991 the type using the underlying type in the case of an enumeration
11992 rather than using the enumeration type for the compare.
11994 Cope with the underlying == type case, which is not possible to
11997 (Expression.ConvertNumericExplicit): Perform comparissions of
11998 the type using the underlying type in the case of an enumeration
11999 rather than using the enumeration type for the compare.
12001 * driver.cs: If the user does not supply an extension, assume .exe
12003 * cs-parser.jay (if_statement): Rewrote so that we can track the
12004 location for the if statement.
12006 * expression.cs (Binary.ConstantFold): Only concat strings when
12007 the operation is "+", not everything ;-)
12009 * statement.cs (Statement.EmitBoolExpression): Take a location
12011 (If, While, Do): Track location.
12013 * expression.cs (Binary.ResolveOperator): In the object + string
12014 case, I was missing a call to ConvertImplicit
12016 2002-02-25 Ravi Pratap <ravi@ximian.com>
12018 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
12019 Location arguments. Ensure we use RootContext.LookupType to do our work
12020 and not try to do a direct Type.GetType and ModuleBuilder.GetType
12022 * interface.cs (PopulateMethod): Handle the type of the parameter being
12025 * expression.cs (Invocation.BetterFunction): Handle the case when we
12026 have a params method with no fixed arguments and a call is made with no
12029 2002-02-25 Miguel de Icaza <miguel@ximian.com>
12031 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
12032 the verbatim-string-literal
12034 * support.cs (InternalParameters.ParameterModifier): handle null
12036 (InternalParameters.ParameterType): ditto.
12038 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
12039 duplicating the name of the variable parameter.
12040 (GetParameterByName): Fix bug where we were not looking up array
12041 paramters if they were the only present (thanks Paolo!).
12042 (GetParameterInfo): We only have an empty set of types if both
12043 fixed and array are set to null.
12044 (GetParameterInfo-idx): Handle FixedParameter == null
12046 * cs-parser.jay: Handle the case where there is no catch
12047 statements (missing null test).
12049 2002-02-22 Miguel de Icaza <miguel@ximian.com>
12051 * driver.cs (MainDriver): Be conservative on our command line
12054 Catch DirectoryNotFoundException when calling GetFiles.
12056 (SplitPathAndPattern): Used to split the input specification into
12057 a path and a pattern that we can feed to Directory.GetFiles.
12059 2002-02-21 Miguel de Icaza <miguel@ximian.com>
12061 * statement.cs (Fixed): Implement the last case of the Fixed
12062 statement (string handling).
12064 * expression.cs (StringPtr): New class used to return a char * to
12065 a string; Used by the Fixed statement.
12067 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
12069 * expression.cs (Binary.ResolveOperator): Remove redundant
12070 MemberLookup pn parent type.
12071 Optimize union call, we do not need a union if the types are the same.
12072 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
12075 Specialize the use of MemberLookup everywhere, instead of using
12076 the default settings.
12078 (StackAlloc): Implement stackalloc keyword.
12080 * cs-parser.jay: Add rule to parse stackalloc.
12082 * driver.cs: Handle /h, /help, /?
12084 * expression.cs (MakeByteBlob): Removed the hacks we had in place
12085 before we supported unsafe code.
12087 * makefile: add --unsafe to the self compilation of mcs.
12089 2002-02-20 Miguel de Icaza <miguel@ximian.com>
12091 * expression.cs (PointerArithmetic): New class that is used to
12092 perform pointer arithmetic.
12093 (Binary.Resolve): Handle pointer arithmetic
12094 Handle pointer comparission.
12095 (ArrayPtr): Utility expression class that is used to take the
12096 address of an array.
12098 (ElementAccess): Implement array access for pointers
12100 * statement.cs (Fixed): Implement fixed statement for arrays, we
12101 are missing one more case before we are done.
12103 * expression.cs (Indirection): Implement EmitAssign and set the
12104 ExprClass to Variable. This allows pointer dereferences to be
12105 treated as variables, and to have values assigned to them.
12107 * ecore.cs (Expression.StoreFromPtr): New utility function to
12108 store values dereferencing.
12110 2002-02-20 Ravi Pratap <ravi@ximian.com>
12112 * expression.cs (Binary.ResolveOperator): Ensure that we are
12113 not trying to operate on a void type - this fixes the reported
12116 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
12117 the parent implementation is sealed.
12119 * ../errors/cs0239.cs : Add.
12121 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
12123 * typemanager.cs (unverifiable_code_type): Corresponds to
12124 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
12125 which have unsafe code in them.
12127 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
12130 2002-02-19 Miguel de Icaza <miguel@ximian.com>
12132 * cs-tokenizer.cs: Add support for @"litreal strings"
12134 Make tokenizer accept pre-processor directives
12135 on any column (remove the old C-like limitation).
12137 * rootcontext.cs (EmitCode): Emit any global attributes.
12138 (AddGlobalAttributes): Used to keep track of assembly attributes.
12140 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
12142 * cs-parser.jay: Add support for global attributes.
12144 2002-02-17 Miguel de Icaza <miguel@ximian.com>
12146 * expression.cs (Indirection): New helper class. Unary will
12147 create Indirection classes to be able to implement the
12148 IMemoryLocation interface on it.
12150 2002-02-16 Miguel de Icaza <miguel@ximian.com>
12152 * cs-parser.jay (fixed_statement): reference the right statement.
12154 * statement.cs (Fixed.Emit): Finish implementing the fixed
12155 statement for the &x case.
12157 2002-02-14 Miguel de Icaza <miguel@ximian.com>
12159 * class.cs (Property.Define, Method.Define): Remove newslot when
12162 * modifiers.cs: My use of NewSlot when `Abstract' was set was
12163 wrong. NewSlot should only be used if the `new' keyword is present.
12165 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
12166 locating our system dir. Sorry about this.
12168 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12170 * driver.cs (GetSystemDir): Compute correctly the location of our
12171 system assemblies. I was using the compiler directory instead of
12172 the library directory.
12174 2002-02-13 Ravi Pratap <ravi@ximian.com>
12176 * expression.cs (BetterFunction): Put back in what Miguel commented out
12177 since it is the correct fix. The problem is elsewhere ;-)
12179 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
12180 parameters of the parms method are themselves compatible or not !
12182 (StandardConversionExists): Fix very dangerous bug where we were forgetting
12183 to check that a class implements an interface before saying that an implicit
12184 conversion was allowed. Use ImplementsInterface to do the checking.
12186 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12188 * class.cs (Method.Define): Track whether we are an explicit
12189 implementation or not. And only call DefineMethodOverride if we
12190 are an explicit implementation.
12192 (Property.DefineMethod): Ditto.
12194 2002-02-11 Ravi Pratap <ravi@ximian.com>
12196 * expression.cs (BetterFunction): Catch hideous bug which was
12197 preventing us from detecting ambiguous calls due to implicit casts i.e
12200 2002-01-29 Miguel de Icaza <miguel@ximian.com>
12202 * support.cs (Pair): Remove un-needed method. I figured why I was
12203 getting the error in cs-parser.jay, the variable in a foreach loop
12204 is readonly, and the compiler does not really treat this as a variable.
12206 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
12207 instead of EQUALS in grammar.
12209 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
12211 * expression.cs (Unary.DoResolve): Check whether the argument is
12214 2002-01-28 Miguel de Icaza <miguel@ximian.com>
12216 * support.cs: Api for Pair to set a value. Despite the fact that
12217 the variables are public the MS C# compiler refuses to compile
12218 code that accesses the field if the variable is part of a foreach
12221 * statement.cs (Fixed): Begin implementation of the fixed
12224 (Block.AddVariable): Return the VariableInfo on success and null
12225 on failure instead of true/false.
12227 * cs-parser.jay (foreach): Catch errors on variables already
12228 defined (we were ignoring this value before) and properly unwind
12229 the block hierarchy
12231 (fixed_statement): grammar for the fixed statement.
12233 2002-01-25 Miguel de Icaza <miguel@ximian.com>
12235 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
12236 pointer types to be incretemented.
12238 (SizeOf): Implement.
12240 * cs-parser.jay (pointer_member_access): Implement
12241 expr->IDENTIFIER production.
12243 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
12244 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
12247 (Unary): Implement indirection.
12249 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
12250 use in non-unsafe context).
12252 (SimpleName.DoResolve): Check for pointers in field access on safe
12255 (Expression.LoadFromPtr): Factor the load-indirect code in this
12256 function. This was duplicated in UnboxCast and ParameterReference
12258 2002-01-24 Miguel de Icaza <miguel@ximian.com>
12260 * expression.cs (ComposedCast): report an error if a pointer cast
12261 is used in a safe region.
12263 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
12264 pointer type casts in unsafe context.
12266 * codegen.cs (EmitContext): Set up IsUnsafe.
12268 * cs-parser.jay (non_expression_type): Add productions for pointer
12271 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
12272 code. We should not use force into static mode if the method is
12273 not virtual. Fixes bug in MIS
12275 * statement.cs (Do.Emit, While.Emit, For.Emit,
12276 Statement.EmitBoolExpression): Add support to Do and While to
12277 propagate infinite loop as `I do return' semantics.
12279 Improve the For case to also test for boolean constants.
12281 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
12282 to the list of attributes we can add.
12284 Remove `EmitContext' argument.
12286 * class.cs (Method.Define): Apply parameter attributes.
12287 (Constructor.Define): Apply parameter attributes.
12288 (MethodCore.LabelParameters): Move here the core of labeling
12291 * support.cs (ReflectionParameters.ParameterModifier,
12292 InternalParameters.ParameterModifier): Use IsByRef on the type and
12293 only return the OUT bit for these parameters instead of in/out/ref
12296 This is because I miss-understood things. The ParameterInfo.IsIn
12297 and IsOut represent whether the parameter has the [In] and [Out]
12300 2002-01-22 Miguel de Icaza <miguel@ximian.com>
12302 * ecore.cs (FieldExpr.Emit): Release temporaries.
12304 * assign.cs (LocalTemporary.Release): new function.
12306 * codegen.cs (EmitContext.GetTemporaryStorage,
12307 EmitContext.FreeTemporaryStorage): Rework the way we deal with
12308 temporary storage. Now we can "put back" localbuilders when we
12311 2002-01-21 Miguel de Icaza <miguel@ximian.com>
12313 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
12314 need to make a copy of the variable to generate verifiable code.
12316 2002-01-19 Miguel de Icaza <miguel@ximian.com>
12318 * driver.cs: Compute dynamically the system directory.
12320 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
12321 Slower, but more generally useful. Used by the abstract
12322 registering implementation.
12324 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
12325 the rules for the special rule on Type/instances. First check if
12326 we have the same name, and if so, try that special static path
12327 rather than the instance path.
12329 2002-01-18 Miguel de Icaza <miguel@ximian.com>
12331 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
12334 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
12335 Enum, ValueType, Delegate or Array for non-corlib compiles.
12337 * cs-tokenizer.cs: Catch long identifiers (645)
12339 * typemanager.cs (IndexerPropetyName): Ravi never tested this
12342 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
12343 fix, we were returning too early, so we were not registering
12344 pending methods from abstract classes.
12346 Do not register pending methods if the class is abstract.
12348 * expression.cs (Conditional.DoResolve): Report circular implicit
12349 conversions when we neecd to compute it for conditional
12352 (Is.DoResolve): If the expression is always of the provided type,
12353 flag warning 183. If the expression can not ever be of the
12354 provided type flag warning 184.
12356 * class.cs: Catch 169 as well.
12358 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
12361 2002-01-18 Nick Drochak <ndrochak@gol.com>
12363 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
12365 2002-01-17 Miguel de Icaza <miguel@ximian.com>
12367 * interface.cs: (PopulateMethod): Check for pointers being defined
12368 only if the unsafe context is active.
12369 (PopulateProperty): ditto.
12370 (PopulateIndexer): ditto.
12372 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
12373 specified. If pointers are present, make sure that they are
12374 present in an unsafe context.
12375 (Constructor, Constructor.Define): ditto.
12376 (Field, Field.Define): ditto.
12377 (Property, Property.Define): ditto.
12378 (Event, Event.Define): ditto.
12380 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
12381 hashtable if there are classes or structs defined.
12383 * expression.cs (LocalVariableReference.DoResolve): Simplify this
12384 code, as the constant resolution moved.
12386 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
12387 the metadata, so we can flag error 133.
12389 * decl.cs (MemberCore.UnsafeOK): New function to test that a
12390 pointer is being declared in an unsafe context.
12392 2002-01-16 Miguel de Icaza <miguel@ximian.com>
12394 * modifiers.cs (Modifiers.Check): Require a Location argument.
12395 Report error 227 for Unsafe use.
12397 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
12399 * statement.cs (For.Emit): If the test is null, then report that
12400 we do `return', as we wont reach anything afterwards.
12402 (Switch.SwitchGoverningType): Track the expression that matched
12405 * driver.cs: Allow negative numbers as an error code to flag.
12407 * cs-parser.jay: Handle 1551.
12409 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
12411 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12413 * cs-parser.jay: Report 1518 (type declaration can only contain
12414 class, struct, interface, enum or delegate)
12416 (switch_label): Report 1523 (keywords `case' or `default' must
12419 (opt_switch_sections): Report 1522 (empty switch)
12421 * driver.cs: Report 1515 (response file specified multiple times)
12422 Report 1516 (Source file specified multiple times).
12424 * expression.cs (Argument.Resolve): Signal 1510
12426 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
12427 access not allowed in static code)
12429 2002-01-11 Ravi Pratap <ravi@ximian.com>
12431 * typemanager.cs (IsPointerType): Utility method which we are going
12434 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
12435 the object type, so we take care of that.
12437 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
12439 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
12440 added to non-params parameters :-)
12442 * typemanager.cs (CSharpName): Include 'void' type too.
12444 (void_ptr_type): Include in the set of core types.
12446 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
12449 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
12452 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
12453 completely forgotten about it.
12455 2002-01-10 Ravi Pratap <ravi@ximian.com>
12457 * cs-parser.jay (pointer_type): Add. This begins our implementation
12458 of parsing rules for unsafe code.
12460 (unsafe_statement): Implement.
12462 (embedded_statement): Modify to include the above.
12464 * statement.cs (Unsafe): Implement new class for unsafe blocks.
12466 * codegen.cs (EmitContext.InUnsafe): Add. This determines
12467 if the current context is an unsafe one.
12469 * cs-parser.jay (local_variable_pointer_type): Since local variable types
12470 are handled differently, we need separate rules for them.
12472 (local_variable_declaration): Update to use local_variable_pointer_type
12473 to allow variable declarations of unmanaged pointer types.
12475 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
12476 in unsafe contexts.
12478 * ../errors/cs0214.cs : Add.
12480 2002-01-16 Nick Drochak <ndrochak@gol.com>
12482 * makefile: remove 'response' file when cleaning.
12484 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12486 * cs-parser.jay: Report 1524.
12488 2002-01-14 Miguel de Icaza <miguel@ximian.com>
12490 * typemanager.cs (RegisterMethod): drop checking if we have
12491 registered this from here
12493 2002-01-12 Miguel de Icaza <miguel@ximian.com>
12495 * class.cs (Method.EmitDestructor): Implement calling our base
12498 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
12499 value of InFinally.
12501 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
12502 this routine and will wrap the call in a try/catch block. Deal
12505 2002-01-11 Miguel de Icaza <miguel@ximian.com>
12507 * ecore.cs (Expression.MemberLookup): instead of taking a
12508 parameter `same_type' that was used to tell whether we could
12509 access private members we compute our containing type from the
12512 (FieldExpr): Added partial support for volatile fields. This does
12513 not work for volatile fields exposed from assemblies, as I can not
12514 figure out how to extract the modreq from it.
12516 Updated all the source files to use this.
12518 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
12519 because it is referenced by MemberLookup very often.
12521 2002-01-09 Ravi Pratap <ravi@ximian.com>
12523 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
12524 TypeBuilder.GetCustomAttributes to retrieve what we need.
12526 Get rid of redundant default_member_attr_type as this is the same as
12527 default_member_type which already exists.
12529 * interface.cs, attribute.cs : Update accordingly.
12531 2002-01-08 Miguel de Icaza <miguel@ximian.com>
12533 * typemanager.cs: Enable IndexerPropertyName again. It does not
12534 work for TYpeBuilders though. Ravi, can you please fix this?
12536 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
12538 * expression.cs (Argument.Emit): Handle the case of ref objects
12539 being passed to ref functions;
12541 (ParameterReference.EmitLoad): Loads the content of the pointer
12542 without dereferencing.
12544 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12546 * cs-tokenizer.cs: Implemented the pre-processing expressions.
12548 2002-01-08 Ravi Pratap <ravi@ximian.com>
12550 * class.cs (Indexer.DefineMethod): Incorporate the interface
12551 type in the name of the method if we are doing explicit interface
12554 * expression.cs (ConversionExists): Remove as it is completely obsolete.
12556 (BetterConversion): Fix extremely trivial bug where we were referring to
12557 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
12560 * ../errors/bug16.cs : Add although we have fixed it.
12562 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12564 * expression.cs (BaseIndexer): Begin implementation.
12566 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
12568 * cs-parser.jay (indexer_declarator): Use qualified_identifier
12569 production directly to remove a shift/reduce, and implement
12570 explicit interface implementation.
12572 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
12573 after a floating point suffix.
12575 * expression.cs (DoNumericPromotions): Improved the conversion for
12576 uint/uint. If we have a constant, we avoid doing a typecast to a
12579 * class.cs (Indexer): Implement explicit interface implementation
12582 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
12584 * class.cs: make the default instance constructor public and hidebysig.
12586 2001-01-03 Ravi Pratap <ravi@ximian.com>
12588 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
12589 so we can call it from elsewhere.
12591 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
12592 we emit it internally if the class has a defined indexer; otherwise the user
12593 emits it by decorating the class definition with the DefaultMemberAttribute.
12595 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
12596 attribute is not used on a type which defines an indexer.
12598 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12599 character when we skip whitespace.
12601 * ../errors/cs0646.cs : Add.
12603 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12605 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12608 * makefile: Add practical target `mcs3.exe' which builds the third
12609 generation compiler.
12611 * expression.cs (New): Fix structures constructor calling.
12613 * class.cs (Property, Method, Indexer): Emit Final flag on the
12614 method if we are an interface implementation and we are not
12617 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12618 whether this property is referencing a `base' method.
12620 * expression.cs (Invocation.EmitCall): take an extra argument:
12621 is_base, this is used to determine whether the `call' or
12622 `callvirt' opcode should be used.
12625 * delegate.cs: update EmitCall.
12627 * class.cs (Method.Define): Set NewSlot for the cases where we are
12628 not implementing an interface method.
12630 (Property.Define): ditto.
12632 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12634 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12635 'r'. Allows mcs to parse itself fully.
12637 2002-01-02 Ravi Pratap <ravi@ximian.com>
12639 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12640 of the number of initializers that require the InitializeArray method.
12642 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12643 update the above field where necessary.
12645 (MakeByteBlob): Update accordingly.
12647 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12650 (EmitDynamicInitializers): Update in accordance with the new optimization.
12652 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12653 same OpCode applies.
12655 * cs-parser.jay : Fix some glaring errors I introduced.
12657 2002-01-01 Ravi Pratap <ravi@ximian.com>
12659 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12660 so that we can check for name clashes there too.
12662 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12663 for interface indexers.
12665 * interfaces.cs (Define): Emit the default member attribute.
12667 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12668 variable was being referred to while setting the value ;-)
12670 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12672 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12673 byte-by-byte information when we know the data is zero.
12675 Make the block always a multiple of 4, because
12676 DefineInitializedData has a bug.
12678 * assign.cs: Fix, we should assign from the temporary, not from
12681 * expression.cs (MakeByteBlob): Fix my incorrect code.
12683 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12685 * typemanager.cs (EnumToUnderlying): This function is used to get
12686 the underlying type from an enumeration, because it does not
12689 * constant.cs: Use the I4_S form for values between -128 and 127.
12691 * statement.cs (Block.LookupLabel): Looks up a label.
12692 (Block): Drop support for labeled blocks.
12694 (LabeledStatement): New kind of statement that represents a label
12697 (Goto): Finally implement this bad boy.
12699 * cs-parser.jay: Update to reflect new mechanism to implement
12702 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12704 * codegen.cs (EmitContext.This): a codegen property that keeps the
12705 a single instance of this instead of creating many different this
12708 * delegate.cs (Delegate.DoResolve): Update to use the property;
12710 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12712 * expression.cs (BaseAccess.DoResolve): Ditto.
12714 2001-12-29 Ravi Pratap <ravi@ximian.com>
12716 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12717 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12719 (InitCoreTypes): Update accordingly.
12721 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12722 so we can quickly store the state.
12724 (ApplyAttributes): Set the correct implementation flags
12725 for InternalCall methods.
12727 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12729 * expression.cs (EmitCall): if a method is not virtual, then do
12730 not use callvirt on it.
12732 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12733 user defined stuff) requires the use of stobj, which takes an
12734 address on the stack instead of an array and an index. So emit
12735 the Ldelema operation for it.
12737 (EmitStoreOpcode): Use stobj for valuetypes.
12739 (UnaryMutator.EmitCode): Use the right 1 value depending on
12740 whether we are dealing with int64/uint64, float or doubles.
12742 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12743 constructors that I implemented last night.
12745 (Constructor.IsDefault): Fix to work properly for static
12748 * cs-parser.jay (CheckDef): report method signature errors.
12749 Update error number 103 to be 132.
12751 * decl.cs: New AdditionResult enumeration value: MethodExists.
12752 Although we do this check for methods later on in the semantic
12753 analysis, catching repeated default constructors is so easy that
12754 we catch these here.
12756 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12759 (ParameterReference.EmitAssign, Emit): handle
12762 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12763 (ArrayAccess.EmitStoreOpcode): ditto.
12765 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12767 * expression.cs (MakeByteBlob): Complete all the missing types
12768 (uint, short, ushort, byte, sbyte)
12770 * class.cs: Only init instance field initializers on instance
12773 Rename `constructors' to instance_constructors.
12775 (TypeContainer.AddConstructor): Only add constructors to the list
12776 if it is not static.
12778 Make sure that we handle default_static_constructor independently
12779 everywhere where we handle instance_constructors
12781 2001-12-28 Miguel de Icaza <miguel@ximian.com>
12783 * class.cs: Do not lookup or create a base initializer for a
12784 static constructor.
12786 (ConstructorInitializer.Resolve): use the proper type to lookup
12789 * cs-parser.jay: Report error 1585 (modifiers between type and name).
12791 * enum.cs, interface.cs: Remove CloseType, this is taken care by
12794 * decl.cs: CloseType is now an virtual method, the default
12795 implementation just closes this type.
12797 2001-12-28 Ravi Pratap <ravi@ximian.com>
12799 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
12800 to PreserveSig by default. Also emit HideBySig on such methods.
12802 Basically, set the defaults to standard values.
12804 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
12805 argument, if candidate is better, it can't be worse than the best !
12807 (Invocation): Re-write bits to differentiate between methods being
12808 applicable in their expanded form and their normal form - for params
12811 Get rid of use_standard everywhere as only standard conversions are allowed
12812 in overload resolution.
12814 More spec conformance.
12816 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12818 * driver.cs: Add --timestamp, to see where the compiler spends
12821 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
12822 `this' in static code.
12824 (SimpleName.DoResolve): Implement in terms of a helper function
12825 that allows static-references to be passed upstream to
12828 (Expression.ResolveWithSimpleName): Resolve specially simple
12829 names when called by MemberAccess to implement the special
12832 (Expression.ImplicitReferenceConversion): Handle conversions from
12833 Null to reference types before others, as Null's type is
12836 * expression.cs (Invocation.EmitCall): Handle the special case of
12837 calling methods declared on a reference type from a ValueType
12838 (Base classes System.Object and System.Enum)
12840 (MemberAccess.Resolve): Only perform lookups on Enumerations if
12841 the left hand side is a TypeExpr, not on every enumeration.
12843 (Binary.Resolve): If types are reference types, then do a cast to
12844 object on operators != and == of both arguments.
12846 * typemanager.cs (FindMembers): Extract instance and static
12847 members if requested.
12849 * interface.cs (PopulateProperty): Use void_type instead of null
12850 as the return type for the setter method.
12852 (PopulateIndexer): ditto.
12854 2001-12-27 Ravi Pratap <ravi@ximian.com>
12856 * support.cs (ReflectionParameters): Fix minor bug where we
12857 were examining the wrong parameter for the ParamArray attribute.
12859 Cope with requests for the type of the parameter at position
12860 greater than the params parameter's. We now return the element
12861 type of the params array as that makes more sense.
12863 * expression.cs (Invocation.IsParamsMethodApplicable): Update
12864 accordingly as we no longer have to extract the element type
12867 (Invocation.OverloadResolve): Update.
12869 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12871 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
12872 against IEnumerator, test whether the return value is a descendant
12873 of the IEnumerator interface.
12875 * class.cs (Indexer.Define): Use an auxiliary method to implement
12876 the other bits of the method definition. Begin support for
12877 explicit interface implementation.
12879 (Property.DefineMethod): Use TypeManager.void_type instead of null
12880 for an empty return value.
12882 2001-12-26 Miguel de Icaza <miguel@ximian.com>
12884 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
12885 dealing with a FieldExpr which is composed of a FieldBuilder, in
12886 the code path we did extract the constant, but we should have
12887 obtained the underlying value to be able to cast it (otherwise we
12888 end up in an infinite loop, this is what Ravi was running into).
12890 (ArrayCreation.UpdateIndices): Arrays might be empty.
12892 (MemberAccess.ResolveMemberAccess): Add support for section
12893 14.5.4.1 that deals with the special case of E.I when E is a type
12894 and something else, that I can be a reference to a static member.
12896 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
12897 handle a particular array type to create byte blobs, it is just
12898 something we dont generate byteblobs for.
12900 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
12903 * location.cs (Push): remove the key from the hashtable that we
12904 are about to add. This happens for empty files.
12906 * driver.cs: Dispose files after we have parsed them.
12908 (tokenize): new function that only runs the tokenizer on its
12909 input, for speed testing.
12911 2001-12-26 Ravi Pratap <ravi@ximian.com>
12913 * class.cs (Event.Define): Define the private field only if there
12914 are no accessors defined.
12916 * expression.cs (ResolveMemberAccess): If there is no associated
12917 field with the event, that means we have an event defined with its
12918 own accessors and we should flag error cs0070 since transforming
12919 ourselves into a field is not valid in that case.
12921 * ecore.cs (SimpleName.DoResolve): Same as above.
12923 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
12924 and charset to sane values.
12926 2001-12-25 Ravi Pratap <ravi@ximian.com>
12928 * assign.cs (DoResolve): Perform check on events only if they
12929 are being accessed outside the declaring type.
12931 * cs-parser.jay (event_declarations): Update rules to correctly
12932 set the type of the implicit parameter etc.
12934 (add_accessor, remove_accessor): Set current local parameters.
12936 * expression.cs (Binary): For delegate addition and subtraction,
12937 cast the return value from the method into the appropriate delegate
12940 2001-12-24 Ravi Pratap <ravi@ximian.com>
12942 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
12943 of these as the workaround is unnecessary.
12945 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
12946 delegate data - none of that is needed at all.
12948 Re-write bits to extract the instance expression and the delegate method
12951 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12954 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12955 of attaching attributes instead of duplicating code everywhere.
12957 * everywhere : Update code to do attribute emission using the above method.
12959 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12961 * expression.cs (IsParamsMethodApplicable): if there are not
12962 parameters, return immediately.
12964 * ecore.cs: The 0 literal can be implicity converted to an enum
12967 (SimpleName.DoResolve): First lookup the type, then lookup the
12970 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12971 want to get its address. If the InstanceExpression is not
12972 addressable, store the result in a temporary variable, then get
12975 * codegen.cs: Only display 219 errors on warning level or above.
12977 * expression.cs (ArrayAccess): Make it implement the
12978 IMemoryLocation interface.
12980 (Binary.DoResolve): handle the operator == (object a, object b)
12981 and operator != (object a, object b) without incurring into a
12982 BoxedCast (because 5 != o should never be performed).
12984 Handle binary enumerator operators.
12986 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12987 value type, otherwise use Ldelem_ref.
12989 Use precomputed names;
12991 (AddressOf): Implement address of
12993 * cs-parser.jay (labeled_statement): Fix recursive block
12994 addition by reworking the production.
12996 * expression.cs (New.DoEmit): New has a special case:
12998 If we are dealing with a ValueType, we have a few
12999 situations to deal with:
13001 * The target of New is a ValueType variable, that is
13002 easy, we just pass this as the variable reference
13004 * The target of New is being passed as an argument,
13005 to a boxing operation or a function that takes a
13008 In this case, we need to create a temporary variable
13009 that is the argument of New.
13012 2001-12-23 Ravi Pratap <ravi@ximian.com>
13014 * rootcontext.cs (LookupType): Check that current_type is not null before
13015 going about looking at nested types.
13017 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
13018 not implement the IAssignMethod interface any more.
13020 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
13021 where we tranform them into FieldExprs if they are being resolved from within
13022 the declaring type.
13024 * ecore.cs (SimpleName.DoResolve): Do the same here.
13026 * assign.cs (DoResolve, Emit): Clean up code considerably.
13028 * ../errors/bug10.cs : Add.
13030 * ../errors/cs0070.cs : Add.
13032 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
13034 * assign.cs : Get rid of EventIsLocal everywhere.
13036 2001-12-23 Miguel de Icaza <miguel@ximian.com>
13038 * ecore.cs (ConvertIntLiteral): finished the implementation.
13040 * statement.cs (SwitchLabel): Convert the value we are using as a
13041 key before looking up the table.
13043 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13045 * codegen.cs (EmitTopBlock): Require a Location argument now.
13047 * cs-parser.jay (constructor_declarator): We need to setup
13048 current_local_parameters before we parse the
13049 opt_constructor_initializer, to allow the variables to be bound
13050 to the constructor arguments.
13052 * rootcontext.cs (LookupType): First lookup nested classes in our
13053 class and our parents before we go looking outside our class.
13055 * expression.cs (ConstantFold): Extract/debox the values at the
13058 * rootcontext.cs (EmitCode): Resolve the constants first before we
13059 resolve the types. This is not really needed, but it helps debugging.
13061 * statement.cs: report location.
13063 * cs-parser.jay: pass location to throw statement.
13065 * driver.cs: Small bug fix.
13067 * report.cs: Updated format to be 4-zero filled digits.
13069 2001-12-22 Ravi Pratap <ravi@ximian.com>
13071 * expression.cs (CheckIndices): Fix minor bug where the wrong
13072 variable was being referred to ;-)
13074 (DoEmit): Do not call EmitStaticInitializers when the
13075 underlying type is System.Object.
13077 2001-12-21 Ravi Pratap <ravi@ximian.com>
13079 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
13080 and do the usual workaround for SRE.
13082 * class.cs (MyEventBuilder.EventType): New member to get at the type
13083 of the event, quickly.
13085 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
13087 * assign.cs (Assign.DoResolve): Handle the case when the target
13088 is an EventExpr and perform the necessary checks.
13090 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
13093 (SimpleName.MemberStaticCheck): Include check for EventExpr.
13095 (EventExpr): Set the type in the constructor itself since we
13096 are meant to be born fully resolved.
13098 (EventExpr.Define): Revert code I wrote earlier.
13100 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
13101 instance expression is null. The instance expression is a This in that case
13102 or a null, depending on whether it is a static method or not.
13104 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
13105 refers to more than one method.
13107 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
13108 and accordingly flag errors.
13110 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13112 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
13114 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13116 * location.cs (ToString): Provide useful rutine.
13118 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13120 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
13121 objects, return the actual integral boxed.
13123 * statement.cs (SwitchLabel): define an ILLabel for each
13126 (Switch.CheckSwitch): If the value is a Literal, extract
13127 the underlying literal.
13129 Also in the unused hashtable we had, add the SwitchLabel so we can
13130 quickly look this value up.
13132 * constant.cs: Implement a bunch of new constants. Rewrite
13133 Literal based on this. Made changes everywhere to adapt to this.
13135 * expression.cs (Expression.MakeByteBlob): Optimize routine by
13136 dereferencing array only once, and also copes with enumrations.
13138 bytes are two bytes wide, not one.
13140 (Cast): Perform constant conversions.
13142 * ecore.cs (TryImplicitIntConversion): Return literals instead of
13143 wrappers to the literals here.
13145 * expression.cs (DoNumericPromotions): long literals can converted
13146 to ulong implicity (this is taken care of elsewhere, but I was
13147 missing this spot).
13149 * ecore.cs (Expression.Literalize): Make the return type Literal,
13150 to improve type checking.
13152 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
13154 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13156 * literal.cs: Revert code from ravi that checked the bounds. The
13157 bounds are sane by the definition of the type itself.
13159 * typemanager.cs: Fix implementation of ImplementsInterface. We
13160 need to actually look up in our parent hierarchy for interfaces
13163 * const.cs: Use the underlying type for enumerations
13165 * delegate.cs: Compute the basename for the delegate creation,
13166 that should fix the delegate test case, and restore the correct
13167 Type Lookup semantics in rootcontext
13169 * rootcontext.cs: Revert Ravi's last patch. The correct way of
13170 referencing a nested type with the Reflection API is using the "+"
13173 * cs-parser.jay: Do not require EOF token at the end.
13175 2001-12-20 Ravi Pratap <ravi@ximian.com>
13177 * rootcontext.cs (LookupType): Concatenate type names with
13178 a '.' instead of a '+' The test suite passes again.
13180 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
13181 field of the enumeration.
13183 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
13184 the case when the member is an EventExpr.
13186 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
13187 static has an associated instance expression.
13189 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
13191 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
13193 * class.cs (Event.Define): Register event and perform appropriate checks
13196 We define the Add and Remove methods even if the use provides none because
13197 in that case, we provide default implementations ourselves.
13199 Define a private field of the type of the event. This is done by the CSC compiler
13200 and we should be doing it too ;-)
13202 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
13203 More methods we use in code we generate.
13205 (multicast_delegate_type, delegate_type): Two separate types since the distinction
13208 (InitCoreTypes): Update accordingly for the above.
13210 * class.cs (Event.Emit): Generate code for default accessors that we provide
13212 (EmitDefaultMethod): Do the job in the above.
13214 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
13217 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13219 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
13220 builders even if we were missing one.
13222 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
13223 pass the Basename as our class name instead of the Name. The
13224 basename will be correctly composed for us.
13226 * parameter.cs (Paramters): Now takes a Location argument.
13228 * decl.cs (DeclSpace.LookupType): Removed convenience function and
13229 make all the code call directly LookupType in RootContext and take
13230 this chance to pass the Location information everywhere.
13232 * Everywhere: pass Location information.
13234 2001-12-19 Miguel de Icaza <miguel@ximian.com>
13236 * class.cs (Constructor.Define): Updated way of detecting the
13237 length of the parameters.
13239 (TypeContainer.DefineType): Use basename as the type name for
13242 (TypeContainer.Define): Do not recursively define types here, as
13243 definition is taken care in order by the RootContext.
13245 * tree.cs: Keep track of namespaces in a per-file basis.
13247 * parameter.cs (Parameter.ComputeSignature): Update to use
13250 (Parameters.GetSignature): ditto.
13252 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
13253 instead of a TypeContainer.
13255 (Interface.SemanticAnalysis): Use `this' instead of our parent to
13256 resolve names. Because we need to be resolve in our context, not
13259 * driver.cs: Implement response files.
13261 * class.cs (TypeContainer.DefineType): If we are defined, do not
13262 redefine ourselves.
13264 (Event.Emit): Emit the code for add/remove handlers.
13265 (Event.Define): Save the MethodBuilders for add/remove.
13267 * typemanager.cs: Use pair here too.
13269 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
13270 DictionaryEntry requires the first argument to be non-null.
13272 (enum_declaration): Compute full name for registering the
13275 (delegate_declaration): Instead of using
13276 formal_parameter_list, use opt_formal_parameter_list as the list
13279 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
13280 (EventParsing): New property that controls whether `add' and
13281 `remove' are returned as tokens or identifiers (for events);
13283 2001-12-19 Ravi Pratap <ravi@ximian.com>
13285 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
13286 use MyEventBuilder only and let it wrap the real builder for us.
13288 (MyEventBuilder): Revamp constructor etc.
13290 Implement all operations that we perform on EventBuilder in precisely the same
13293 (FindMembers): Update to use the EventBuilder member.
13295 (Event.Emit): Update accordingly.
13297 2001-12-18 Ravi Pratap <ravi@ximian.com>
13299 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
13300 by calling the appropriate methods.
13302 (GetCustomAttributes): Make stubs as they cannot possibly do anything
13305 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
13307 2001-12-17 Ravi Pratap <ravi@ximian.com>
13309 * delegate.cs (Delegate.Populate): Check that the return type
13310 and various parameters types are indeed accessible.
13312 * class.cs (Constructor.Define): Same here.
13314 (Field.Define): Ditto.
13316 (Event.Define): Ditto.
13318 (Operator.Define): Check that the underlying Method defined itself
13319 correctly - so it's MethodBuilder should not be null.
13321 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
13322 expression happens to be null.
13324 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
13325 members but as of now we don't seem to be able to do anything really useful with it.
13327 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
13328 not the EventBuilder.
13330 2001-12-18 Miguel de Icaza <miguel@ximian.com>
13332 * cs-tokenizer.cs: Add support for defines.
13333 Add support for #if, #elif, #else, #endif
13335 (eval_var): evaluates a variable.
13336 (eval): stubbed for evaluating functions.
13338 * cs-parser.jay: Pass the defines information
13340 * driver.cs: Add --define command line option.
13342 * decl.cs: Move MemberCore here.
13344 Make it the base class for DeclSpace. This allows us to catch and
13345 report 108 and 109 for everything now.
13347 * class.cs (TypeContainer.Define): Extract all the members
13348 before populating and emit the warning 108 (new keyword required
13349 to override) instead of having each member implement this.
13351 (MemberCore.Define): New abstract method, we will be using this in
13352 the warning reporting engine in Populate.
13354 (Operator.Define): Adjust to new MemberCore protocol.
13356 * const.cs (Const): This does not derive from Expression, it is a
13357 temporary object we use to create fields, it is a MemberCore.
13359 * class.cs (Method.Define): Allow the entry point to be in a
13362 * driver.cs: Rewrite the argument handler to clean it up a bit.
13364 * rootcontext.cs: Made it just an auxiliary namespace feature by
13365 making everything static.
13367 * driver.cs: Adapt code to use RootContext type name instead of
13370 * delegate.cs: Remove RootContext argument.
13372 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
13375 * class.cs (Event.Define): The lookup can fail.
13377 * cs-tokenizer.cs: Begin implementation of pre-procesor.
13379 * expression.cs: Resolve the this instance before invoking the code.
13381 2001-12-17 Miguel de Icaza <miguel@ximian.com>
13383 * cs-parser.jay: Add a production in element_access that allows
13384 the thing to become a "type" reference. This way we can parse
13385 things like "(string [])" as a type.
13387 Note that this still does not handle the more complex rules of
13391 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
13393 * ecore.cs: (CopyNewMethods): new utility function used to
13394 assemble the list of methods from running FindMembers.
13396 (MemberLookup): Rework FindMembers so that
13398 2001-12-16 Miguel de Icaza <miguel@ximian.com>
13400 * class.cs (TypeContainer): Remove Delegates who fail to be
13403 * delegate.cs (Populate): Verify that we dont get null return
13404 values. TODO: Check for AsAccessible.
13406 * cs-parser.jay: Use basename to emit error 574 (destructor should
13407 have the same name as container class), not the full name.
13409 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
13410 possible representation.
13412 Also implements integer type suffixes U and L.
13414 2001-12-15 Miguel de Icaza <miguel@ximian.com>
13416 * expression.cs (ArrayCreation.DoResolve): We need to do the
13417 argument resolution *always*.
13419 * decl.cs: Make this hold the namespace. Hold the root context as
13421 (LookupType): Move here.
13423 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
13425 * location.cs (Row, Name): Fixed the code, it was always returning
13426 references to the first file.
13428 * interface.cs: Register properties defined through interfaces.
13430 * driver.cs: Add support for globbing on the command line
13432 * class.cs (Field): Make it derive from MemberCore as well.
13435 2001-12-15 Ravi Pratap <ravi@ximian.com>
13437 * class.cs (Event::Define): Check that the type of the event is a delegate
13438 type else flag error #66.
13440 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
13443 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
13444 values of EntryPoint, CharSet etc etc.
13446 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
13448 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
13449 be null and we should ignore this. I am not sure if this is really clean. Apparently,
13450 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
13451 which needs this to do its work.
13453 * ../errors/cs0066.cs : Add.
13455 2001-12-14 Miguel de Icaza <miguel@ximian.com>
13457 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
13460 * class.cs: (MethodSignature.MethodSignature): Removed hack that
13461 clears out the parameters field.
13462 (MemberSignatureCompare): Cleanup
13464 (MemberCore): New base class used to share code between MethodCore
13467 (RegisterRequiredImplementations) BindingFlags.Public requires
13468 either BindingFlags.Instace or Static. Use instance here.
13470 (Property): Refactored code to cope better with the full spec.
13472 * parameter.cs (GetParameterInfo): Return an empty array instead
13475 * class.cs (Property): Abstract or extern properties have no bodies.
13477 * parameter.cs (GetParameterInfo): return a zero-sized array.
13479 * class.cs (TypeContainer.MethodModifiersValid): Move all the
13480 method modifier validation to the typecontainer so we can reuse
13481 this on properties.
13483 (MethodCore.ParameterTypes): return an empty sized array of types.
13485 (Property.Define): Test property modifier validity.
13487 Add tests for sealed/override too.
13489 (Method.Emit): abstract or extern methods have no bodies.
13491 2001-12-14 Ravi Pratap <ravi@ximian.com>
13493 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
13496 (Method::Define, ::Emit): Modify accordingly.
13498 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
13500 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
13502 * makefile: Pass in /unsafe.
13504 2001-12-13 Miguel de Icaza <miguel@ximian.com>
13506 * class.cs (MakeKey): Kill routine.
13508 * class.cs (TypeContainer.Define): Correctly define explicit
13509 method implementations (they require the full interface name plus
13512 * typemanager.cs: Deply the PtrHashtable here and stop using the
13513 lame keys. Things work so much better.
13515 This of course broke everyone who depended on `RegisterMethod' to
13516 do the `test for existance' test. This has to be done elsewhere.
13518 * support.cs (PtrHashtable): A hashtable that avoid comparing with
13519 the object stupid Equals method (because, that like fails all over
13520 the place). We still do not use it.
13522 * class.cs (TypeContainer.SetRequiredInterface,
13523 TypeContainer.RequireMethods): Killed these two routines and moved
13524 all the functionality to RegisterRequiredImplementations.
13526 (TypeContainer.RegisterRequiredImplementations): This routine now
13527 registers all the implementations required in an array for the
13528 interfaces and abstract methods. We use an array of structures
13529 which can be computed ahead of time to reduce memory usage and we
13530 also assume that lookups are cheap as most classes will not
13531 implement too many interfaces.
13533 We also avoid creating too many MethodSignatures.
13535 (TypeContainer.IsInterfaceMethod): Update and optionally does not
13536 clear the "pending" bit if we find that there are problems with
13539 (TypeContainer.VerifyPendingMethods): Update to report errors of
13540 methods that look like implementations but are not.
13542 (TypeContainer.Define): Add support for explicit interface method
13545 2001-12-12 Miguel de Icaza <miguel@ximian.com>
13547 * typemanager.cs: Keep track of the parameters here instead of
13548 being a feature of the TypeContainer.
13550 * class.cs: Drop the registration of parameters here, as
13551 InterfaceMethods are also interface declarations.
13553 * delegate.cs: Register methods with the TypeManager not only with
13554 the TypeContainer. This code was buggy.
13556 * interface.cs: Full registation here.
13558 2001-12-11 Miguel de Icaza <miguel@ximian.com>
13560 * expression.cs: Remove reducer for binary expressions, it can not
13563 * const.cs: Put here the code that used to go into constant.cs
13565 * constant.cs: Put here the code for constants, this is a new base
13566 class for Literals.
13568 * literal.cs: Make Literal derive from Constant.
13570 2001-12-09 Miguel de Icaza <miguel@ximian.com>
13572 * statement.cs (Return.Emit): Report error 157 if the user
13573 attempts to return from a finally block.
13575 (Return.Emit): Instead of emitting a return, jump to the end of
13578 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
13579 LocalBuilder to store the result of the function. ReturnLabel is
13580 the target where we jump.
13583 2001-12-09 Radek Doulik <rodo@ximian.com>
13585 * cs-parser.jay: remember alias in current namespace
13587 * ecore.cs (SimpleName::DoResolve): use aliases for types or
13590 * class.cs (LookupAlias): lookup alias in my_namespace
13592 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
13594 (LookupAlias): lookup alias in this and if needed in parent
13597 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13601 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13602 making things static. I need this to avoid passing the
13603 TypeContainer when calling ParameterType.
13605 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13606 that did string manipulation to compute the type and then call
13607 GetType. Use Parameter.ParameterType instead.
13609 * cs-tokenizer.cs: Consume the suffix for floating values.
13611 * expression.cs (ParameterReference): figure out whether this is a
13612 reference parameter or not. Kill an extra variable by computing
13613 the arg_idx during emission.
13615 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13616 function that returns whether a parameter is an out/ref value or not.
13618 (Parameter.ParameterType): The type of the parameter (base,
13619 without ref/out applied).
13621 (Parameter.Resolve): Perform resolution here.
13622 (Parameter.ExternalType): The full type (with ref/out applied).
13624 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13625 support for expressions on the using statement.
13627 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13629 * statement.cs (Using.EmitLocalVariableDecls): Split the
13630 localvariable handling of the using statement.
13632 (Block.EmitMeta): Keep track of variable count across blocks. We
13633 were reusing slots on separate branches of blocks.
13635 (Try.Emit): Emit the general code block, we were not emitting it.
13637 Check the type of the declaration to be an IDisposable or
13638 something that can be implicity converted to it.
13640 Emit conversions if required.
13642 * ecore.cs (EmptyExpression): New utility class.
13643 (Expression.ImplicitConversionExists): New utility function.
13645 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13647 * statement.cs (Using): Implement.
13649 * expression.cs (LocalVariableReference): Support read only variables.
13651 * statement.cs: Remove the explicit emit for the Leave opcode.
13652 (VariableInfo): Add a readonly field.
13654 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13656 * ecore.cs (ConvCast): new class used to encapsulate the various
13657 explicit integer conversions that works in both checked and
13658 unchecked contexts.
13660 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13661 properly generate the overflow opcodes.
13663 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13665 * statement.cs: The correct type for the EmptyExpression is the
13666 element_type, not the variable type. Ravi pointed this out.
13668 2001-12-04 Ravi Pratap <ravi@ximian.com>
13670 * class.cs (Method::Define): Handle PInvoke methods specially
13671 by using DefinePInvokeMethod instead of the usual one.
13673 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13674 above to do the task of extracting information and defining the method.
13676 2001-12-04 Ravi Pratap <ravi@ximian.com>
13678 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13679 of the condition for string type.
13681 (Emit): Move that here.
13683 (ArrayCreation::CheckIndices): Keep string literals in their expression
13686 (EmitDynamicInitializers): Handle strings appropriately.
13688 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13690 * codegen.cs (EmitContext): Replace multiple variables with a
13691 single pointer to the current Switch statement.
13693 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13696 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13700 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13703 (Foreach.Emit): Foreach on arrays was not setting
13704 up the loop variables (for break/continue).
13706 (GotoCase): Semi-implented.
13708 2001-12-03 Ravi Pratap <ravi@ximian.com>
13710 * attribute.cs (CheckAttribute): Handle system attributes by using
13711 Attribute.GetAttributes to examine information we need.
13713 (GetValidPlaces): Same here.
13715 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13717 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13719 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13721 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13723 (Method::Emit): Handle the case when we are a PInvoke method.
13725 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13727 * expression.cs: Use ResolveWithSimpleName on compound names.
13729 2001-12-02 Ravi Pratap <ravi@ximian.com>
13731 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13732 before trying to reduce it.
13734 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13736 * constant.cs (LookupConstantValue): Implement.
13738 (EmitConstant): Use the above in emitting the constant.
13740 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13741 that are user-defined by doing a LookupConstantValue on them.
13743 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13746 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13748 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13750 (BaseAccess.DoResolve): Implement.
13752 (MemberAccess.DoResolve): Split this routine into a
13753 ResolveMemberAccess routine that can be used independently
13755 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13757 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13758 As that share bits of the implementation. Is returns a boolean,
13759 while As returns the Type that is being probed.
13761 2001-12-01 Ravi Pratap <ravi@ximian.com>
13763 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13764 instead of a Literal - much easier.
13766 (EnumInTransit): Remove - utterly useless :-)
13768 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13770 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13772 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13773 chain when we have no associated expression.
13775 2001-11-30 Ravi Pratap <ravi@ximian.com>
13777 * constant.cs (Define): Use Location while reporting the errror.
13779 Also emit a warning when 'new' is used and there is no inherited
13782 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
13785 (LookupEnumValue): Implement to lookup an enum member's value and define it
13788 (Populate): Re-write accordingly to use the above routine.
13790 2001-11-27 Miguel de Icaza <miguel@ximian.com>
13792 * expression.cs (This): Fix prototype for DoResolveLValue to
13793 override the base class DoResolveLValue.
13795 * cs-parser.cs: Report errors cs574 and cs575 (destructor
13798 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
13799 (we need to load the address of the field here). This fixes
13802 (FieldExpr.DoResolveLValue): Call the DoResolve
13803 function to initialize the Instance expression.
13805 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
13806 correctly the GetEnumerator operation on a value type.
13808 * cs-parser.jay: Add more simple parsing error catches.
13810 * statement.cs (Switch): Add support for string switches.
13811 Handle null specially.
13813 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
13815 2001-11-28 Ravi Pratap <ravi@ximian.com>
13817 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
13819 (declare_local_constant): New helper function.
13821 * statement.cs (AddConstant): Keep a separate record of constants
13823 (IsConstant): Implement to determine if a variable is a constant.
13825 (GetConstantExpression): Implement.
13827 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
13829 * statement.cs (IsVariableDefined): Re-write.
13831 2001-11-27 Ravi Pratap <ravi@ximian.com>
13833 * class.cs (TypeContainer::FindMembers): Look for constants
13834 in the case when we are looking for MemberTypes.Field
13836 * expression.cs (MemberAccess::DoResolve): Check that in the
13837 case we are a FieldExpr and a Literal, we are not being accessed
13838 by an instance reference.
13840 * cs-parser.jay (local_constant_declaration): Implement.
13842 (declaration_statement): Implement for constant declarations.
13844 2001-11-26 Miguel de Icaza <miguel@ximian.com>
13846 * statement.cs (Switch): Catch double defaults.
13848 (Switch): More work on the switch() statement
13849 implementation. It works for integral values now, need to finish
13853 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13855 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
13856 integer literals into other integer literals. To be used by
13859 2001-11-24 Ravi Pratap <ravi@ximian.com>
13861 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
13864 (EmitDynamicInitializers): Cope with the above since we extract data
13865 directly from ArrayData now.
13867 (ExpectInitializers): Keep track of whether initializers are mandatory
13870 (Bounds): Make it a hashtable to prevent the same dimension being
13871 recorded for every element in that dimension.
13873 (EmitDynamicInitializers): Fix bug which prevented the Set array method
13876 Also fix bug which was causing the indices to be emitted in the reverse
13879 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13881 * expression.cs (ArrayCreation): Implement the bits that Ravi left
13882 unfinished. They do not work, because the underlying code is
13885 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13887 * cs-parser.jay: Remove bogus fixme.
13889 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
13890 on Switch statement.
13892 2001-11-23 Ravi Pratap <ravi@ximian.com>
13894 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
13897 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
13898 parameter. Apparently, any expression is allowed.
13900 (ValidateInitializers): Update accordingly.
13902 (CheckIndices): Fix some tricky bugs thanks to recursion.
13904 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
13905 I was being completely brain-dead.
13907 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
13908 and re-write acordingly.
13910 (DelegateInvocation): Re-write accordingly.
13912 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
13914 (MakeByteBlob): Handle types more correctly.
13916 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
13917 initialization from expressions but it is incomplete because I am a complete
13920 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13922 * statement.cs (If.Emit): Fix a bug that generated incorrect code
13923 on If. Basically, we have to return `true' (ie, we do return to
13924 our caller) only if both branches of the if return.
13926 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
13927 short-circuit operators, handle them as short circuit operators.
13929 (Cast.DoResolve): Resolve type.
13930 (Cast.Cast): Take an expression as the target type.
13932 * cs-parser.jay (cast_expression): Remove old hack that only
13933 allowed a limited set of types to be handled. Now we take a
13934 unary_expression and we resolve to a type during semantic
13937 Use the grammar productions from Rhys to handle casts (this is
13938 not complete like Rhys syntax yet, we fail to handle that corner
13939 case that C# has regarding (-x), but we will get there.
13941 2001-11-22 Ravi Pratap <ravi@ximian.com>
13943 * class.cs (EmitFieldInitializer): Take care of the case when we have a
13944 field which is an array type.
13946 * cs-parser.jay (declare_local_variables): Support array initialization too.
13948 * typemanager.cs (MakeKey): Implement.
13950 (everywhere): Use the above appropriately.
13952 * cs-parser.jay (for_statement): Update for array initialization while
13953 declaring variables.
13955 * ecore.cs : The error message was correct, it's the variable's names that
13956 were misleading ;-) Make the code more readable.
13958 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13959 the correct type etc.
13961 (ConvertExplicit): Handle Enum types by examining the underlying type.
13963 2001-11-21 Ravi Pratap <ravi@ximian.com>
13965 * parameter.cs (GetCallingConvention): Always return
13966 CallingConventions.Standard for now.
13968 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13970 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13971 and `r' after calling DoNumericPromotions.
13973 * ecore.cs: Fix error message (the types were in the wrong order).
13975 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13976 BindingFlags.Instance as well
13978 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13979 implicit int literal conversion in an empty cast so that we
13980 propagate the right type upstream.
13982 (UnboxCast): new class used to unbox value types.
13983 (Expression.ConvertExplicit): Add explicit type conversions done
13986 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13987 the target type before applying the implicit LongLiterals to ULong
13990 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13992 * cs-parser.jay (for_statement): Reworked the way For works: now
13993 we declare manually any variables that are introduced in
13994 for_initializer to solve the problem of having out-of-band code
13995 emition (that is what got for broken).
13997 (declaration_statement): Perform the actual variable declaration
13998 that used to be done in local_variable_declaration here.
14000 (local_variable_declaration): Do not declare anything, just pass
14001 the information on a DictionaryEntry
14003 2001-11-20 Ravi Pratap <ravi@ximian.com>
14005 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
14006 re-write of the logic to now make it recursive.
14008 (UpdateIndices): Re-write accordingly.
14010 Store element data in a separate ArrayData list in the above methods.
14012 (MakeByteBlob): Implement to dump the array data into a byte array.
14014 2001-11-19 Ravi Pratap <ravi@ximian.com>
14016 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
14019 * constant.cs (Define): Implement.
14021 (EmitConstant): Re-write fully.
14023 Pass in location info.
14025 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
14028 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
14029 DictionaryEntry since we need location info too.
14031 (constant_declaration): Update accordingly.
14033 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
14034 code into another method : UpdateIndices.
14036 2001-11-18 Ravi Pratap <ravi@ximian.com>
14038 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
14039 some type checking etc.
14041 2001-11-17 Ravi Pratap <ravi@ximian.com>
14043 * expression.cs (ArrayCreation::ValidateInitializers): Implement
14044 bits to provide dimension info if the user skips doing that.
14046 Update second constructor to store the rank correctly.
14048 2001-11-16 Ravi Pratap <ravi@ximian.com>
14050 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
14051 and try to implement.
14053 * ../errors/cs0150.cs : Add.
14055 * ../errors/cs0178.cs : Add.
14057 2001-11-16 Miguel de Icaza <miguel@ximian.com>
14059 * statement.cs: Implement foreach on multi-dimensional arrays.
14061 * parameter.cs (Parameters.GetParameterByName): Also lookup the
14062 name of the params argument.
14064 * expression.cs: Use EmitStoreOpcode to get the right opcode while
14065 initializing the array.
14067 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
14068 we can use this elsewhere.
14070 * statement.cs: Finish implementation of foreach for single
14073 * cs-parser.jay: Use an out-of-band stack to pass information
14074 around, I wonder why I need this.
14076 foreach_block: Make the new foreach_block the current_block.
14078 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
14079 function used to return a static Parameters structure. Used for
14080 empty parameters, as those are created very frequently.
14082 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
14084 2001-11-15 Ravi Pratap <ravi@ximian.com>
14086 * interface.cs : Default modifier is private, not public. The
14087 make verify test passes again.
14089 2001-11-15 Ravi Pratap <ravi@ximian.com>
14091 * support.cs (ReflectionParameters): Fix logic to determine
14092 whether the last parameter is a params one. Test 9 passes again.
14094 * delegate.cs (Populate): Register the builders we define with
14095 RegisterParameterForBuilder. Test 19 passes again.
14097 * cs-parser.jay (property_declaration): Reference $6 instead
14098 of $$ to get at the location.
14100 (indexer_declaration): Similar stuff.
14102 (attribute): Ditto.
14104 * class.cs (Property): Register parameters for the Get and Set methods
14105 if they exist. Test 23 passes again.
14107 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
14108 call to EmitArguments as we are sure there aren't any params arguments.
14109 Test 32 passes again.
14111 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
14112 IndexOutOfRangeException.
14114 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
14115 Test 33 now passes again.
14117 2001-11-15 Miguel de Icaza <miguel@ximian.com>
14119 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
14120 broke a bunch of things. Will have to come up with a better way
14121 of tracking locations.
14123 * statement.cs: Implemented foreach for single dimension arrays.
14125 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14127 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
14128 an error. This removes the lookup from the critical path.
14130 * cs-parser.jay: Removed use of temporary_loc, which is completely
14133 2001-11-14 Miguel de Icaza <miguel@ximian.com>
14135 * support.cs (ReflectionParameters.ParameterModifier): Report
14136 whether the argument is a PARAMS argument or not.
14138 * class.cs: Set the attribute `ParamArrayAttribute' on the
14139 parameter argument.
14141 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
14142 and cons_param_array_attribute (ConstructorInfo for
14143 ParamArrayAttribute).,
14145 * codegen.cs: Emit the return using the `Return' statement, that
14146 way we can report the error correctly for missing return values.
14148 * class.cs (Method.Emit): Clean up.
14150 * expression.cs (Argument.Resolve): Take another argument: the
14151 location where this argument is used. Notice that this is not
14152 part of the "Argument" class as to reduce the size of the
14153 structure (we know the approximate location anyways).
14155 Test if the argument is a variable-reference, if not, then
14156 complain with a 206.
14158 (Argument.Emit): Emit addresses of variables.
14160 (Argument.FullDesc): Simplify.
14162 (Invocation.DoResolve): Update for Argument.Resolve.
14164 (ElementAccess.DoResolve): ditto.
14166 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
14167 method should be virtual, as this method is always virtual.
14169 (NewDelegate.DoResolve): Update for Argument.Resolve.
14171 * class.cs (ConstructorInitializer.DoResolve): ditto.
14173 * attribute.cs (Attribute.Resolve): ditto.
14175 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14177 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
14179 * expression.cs (ParameterReference): Drop IStackStorage and implement
14180 IAssignMethod instead.
14182 (LocalVariableReference): ditto.
14184 * ecore.cs (FieldExpr): Drop IStackStorage and implement
14185 IAssignMethod instead.
14187 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14189 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
14190 enumerations that are used in heavily used structures derive from
14191 byte in a laughable and pathetic attempt to reduce memory usage.
14192 This is the kind of pre-optimzations that you should not do at
14193 home without adult supervision.
14195 * expression.cs (UnaryMutator): New class, used to handle ++ and
14196 -- separatedly from the other unary operators. Cleans up the
14197 code, and kills the ExpressionStatement dependency in Unary.
14199 (Unary): Removed `method' and `Arguments' from this class, making
14200 it smaller, and moving it all to SimpleCall, so I can reuse this
14201 code in other locations and avoid creating a lot of transient data
14202 strucutres when not required.
14204 * cs-parser.jay: Adjust for new changes.
14206 2001-11-11 Miguel de Icaza <miguel@ximian.com>
14208 * enum.cs (Enum.Populate): If there is a failure during
14211 * cs-parser.jay (opt_enum_base): we used to catch type errors
14212 here, but this is really incorrect. The type error should be
14213 catched during semantic analysis.
14215 2001-12-11 Ravi Pratap <ravi@ximian.com>
14217 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
14218 current_local_parameters as expected since I, in my stupidity, had forgotten
14221 * attribute.cs (GetValidPlaces): Fix stupid bug.
14223 * class.cs (Method::Emit): Perform check on applicability of attributes.
14225 (Constructor::Emit): Ditto.
14227 (Field::Emit): Ditto.
14229 (Field.Location): Store location information.
14231 (Property, Event, Indexer, Operator): Ditto.
14233 * cs-parser.jay (field_declaration): Pass in location for each field.
14235 * ../errors/cs0592.cs : Add.
14237 2001-11-12 Ravi Pratap <ravi@ximian.com>
14239 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
14241 (InitCoreTypes): Update accordingly.
14243 (RegisterAttrType, LookupAttr): Implement.
14245 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
14246 info about the same.
14248 (Resolve): Update to populate the above as necessary.
14250 (Error592): Helper.
14252 (GetValidPlaces): Helper to the above.
14254 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
14256 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
14258 2001-11-12 Ravi Pratap <ravi@ximian.com>
14260 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
14262 * ../errors/cs0617.cs : Add.
14264 2001-11-11 Ravi Pratap <ravi@ximian.com>
14266 * enum.cs (Emit): Rename to Populate to be more consistent with what
14267 we expect it to do and when exactly it is called.
14269 * class.cs, rootcontext.cs : Update accordingly.
14271 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
14272 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
14274 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
14276 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
14277 of a fieldinfo using the above, when dealing with a FieldBuilder.
14279 2001-11-10 Ravi Pratap <ravi@ximian.com>
14281 * ../errors/cs0031.cs : Add.
14283 * ../errors/cs1008.cs : Add.
14285 * ../errrors/cs0543.cs : Add.
14287 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
14290 (FindMembers): Implement.
14292 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
14293 enums and delegates too.
14295 (enum_types): Rename to builder_to_enum.
14297 (delegate_types): Rename to builder_to_delegate.
14299 * delegate.cs (FindMembers): Implement.
14301 2001-11-09 Ravi Pratap <ravi@ximian.com>
14303 * typemanager.cs (IsEnumType): Implement.
14305 * enum.cs (Emit): Re-write parts to account for the underlying type
14306 better and perform checking etc.
14308 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
14309 of the underlying type.
14311 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
14314 * enum.cs (error31): Helper to report error #31.
14316 * cs-parser.jay (enum_declaration): Store location of each member too.
14318 * enum.cs (member_to_location): New hashtable.
14320 (AddEnumMember): Update location hashtable.
14322 (Emit): Use the location of each member while reporting errors.
14324 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14326 * cs-parser.jay: A for_initializer if is a
14327 local_variable_declaration really ammount to have an implicit
14328 block with the variable declaration and no initializer for for.
14330 * statement.cs (For.Emit): Cope with null initializers.
14332 This fixes the infinite loop on for initializers.
14334 2001-11-08 Miguel de Icaza <miguel@ximian.com>
14336 * enum.cs: More cleanup.
14338 * ecore.cs: Remove dead code.
14340 * class.cs (Property.Emit): More simplification.
14341 (Event.Emit): ditto.
14343 Reworked to have less levels of indentation.
14345 2001-11-08 Ravi Pratap <ravi@ximian.com>
14347 * class.cs (Property): Emit attributes.
14357 * enum.cs (Emit): Ditto.
14359 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
14362 * class.cs (Field, Event, etc.): Move attribute generation into the
14363 Emit method everywhere.
14365 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
14366 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
14367 as we had no way of defining nested enums !
14369 * rootcontext.cs : Adjust code accordingly.
14371 * typemanager.cs (AddEnumType): To keep track of enum types separately.
14373 2001-11-07 Ravi Pratap <ravi@ximian.com>
14375 * expression.cs (EvalConstantExpression): Move into ecore.cs
14377 * enum.cs (Enum): Rename some members and make them public and readonly
14378 according to our convention.
14380 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
14383 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
14385 (Enum::Emit): Write a simple version for now which doesn't try to compute
14386 expressions. I shall modify this to be more robust in just a while.
14388 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
14390 (TypeContainer::CloseType): Create the Enum types too.
14392 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
14394 * expression.cs (EvalConstantExpression): Get rid of completely.
14396 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
14397 user-defined values and other cases.
14399 (IsValidEnumLiteral): Helper function.
14401 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
14402 out there in the case we had a literal FieldExpr.
14404 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
14406 (Literalize): Revamp a bit to take two arguments.
14408 (EnumLiteral): New class which derives from Literal to wrap enum literals.
14410 2001-11-06 Ravi Pratap <ravi@ximian.com>
14412 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
14414 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
14416 (Resolve): Use the above to ensure we have proper initializers.
14418 2001-11-05 Ravi Pratap <ravi@ximian.com>
14420 * expression.cs (Expression::EvalConstantExpression): New method to
14421 evaluate constant expressions.
14423 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
14425 2001-11-07 Miguel de Icaza <miguel@ximian.com>
14427 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
14430 (Binary.ResolveOperator): Handle operator != (object a, object b)
14431 and operator == (object a, object b);
14433 (Binary.DoNumericPromotions): Indicate whether the numeric
14434 promotion was possible.
14436 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
14439 Made the ArrayAccess implement interface IAssignMethod instead of
14440 IStackStore as the order in which arguments are passed reflects
14443 * assign.cs: Instead of using expr.ExprClass to select the way of
14444 assinging, probe for the IStackStore/IAssignMethod interfaces.
14446 * typemanager.cs: Load InitializeArray definition.
14448 * rootcontext.cs (RootContext.MakeStaticData): Used to define
14449 static data that can be used to initialize arrays.
14451 2001-11-05 Miguel de Icaza <miguel@ximian.com>
14453 * expression.cs: Handle operator== and operator!= for booleans.
14455 (Conditioal.Reduce): Implement reducer for the ?: operator.
14457 (Conditional.Resolve): Implement dead code elimination.
14459 (Binary.Resolve): Catch string literals and return a new
14460 concatenated string.
14462 (Unary.Reduce): Implement reduction of unary expressions.
14464 * ecore.cs: Split out the expression core handling here.
14466 (Expression.Reduce): New method used to perform constant folding
14467 and CSE. This is needed to support constant-expressions.
14469 * statement.cs (Statement.EmitBoolExpression): Pass true and false
14470 targets, and optimize for !x.
14472 2001-11-04 Ravi Pratap <ravi@ximian.com>
14474 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
14475 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
14476 set custom atttributes.
14478 * literal.cs (Literal::GetValue): New abstract method to return the actual
14479 value of the literal, cast as an object.
14481 (*Literal): Implement GetValue method.
14483 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
14484 expressions to the arraylist but objects of type Argument.
14486 * class.cs (TypeContainer::Emit): Emit our attributes too.
14488 (Method::Emit, Constructor::Emit): Ditto.
14490 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
14491 to be ignoring earlier.
14493 2001-11-03 Ravi Pratap <ravi@ximian.com>
14495 * attribute.cs (AttributeSection::Define): Implement to do the business
14496 of constructing a CustomAttributeBuilder.
14498 (Attribute): New trivial class. Increases readability of code.
14500 * cs-parser.jay : Update accordingly.
14502 (positional_argument_list, named_argument_list, named_argument): New rules
14504 (attribute_arguments): Use the above so that we are more correct.
14506 2001-11-02 Ravi Pratap <ravi@ximian.com>
14508 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
14509 to perform all checks for a method with a params parameter.
14511 (Invocation::OverloadResolve): Update to use the above method and therefore
14512 cope correctly with params method invocations.
14514 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
14517 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
14518 constructors in our parent too because we can't afford to miss out on
14521 * attribute.cs (AttributeSection): New name for the class Attribute
14523 Other trivial changes to improve readability.
14525 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
14526 use the new class names.
14528 2001-11-01 Ravi Pratap <ravi@ximian.com>
14530 * class.cs (Method::Define): Complete definition for params types too
14532 (Indexer::Define): Ditto.
14534 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
14535 Cope everywhere with a request for info about the array parameter.
14537 2001-11-01 Ravi Pratap <ravi@ximian.com>
14539 * tree.cs (RecordNamespace): Fix up to check for the correct key.
14541 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
14542 local_variable_type to extract the string corresponding to the type.
14544 (local_variable_type): Fixup the action to use the new helper method.
14546 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
14549 * expression.cs : Clean out code which uses the above.
14551 2001-10-31 Ravi Pratap <ravi@ximian.com>
14553 * typemanager.cs (RegisterMethod): Check if we already have an existing key
14554 and bale out if necessary by returning a false.
14556 (RegisterProperty): Ditto.
14558 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
14559 and print out appropriate error messages.
14561 * interface.cs (everywhere): Ditto.
14563 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
14564 location to constructor.
14566 * class.cs (Property, Event, Indexer): Update accordingly.
14568 * ../errors/cs111.cs : Added.
14570 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
14571 of a method, as laid down by the spec.
14573 (Invocation::OverloadResolve): Use the above method.
14575 2001-10-31 Ravi Pratap <ravi@ximian.com>
14577 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
14578 now take a TypeContainer and a Parameters object.
14580 (ParameterData): Modify return type of ParameterModifier method to be
14581 Parameter.Modifier and not a string.
14583 (ReflectionParameters, InternalParameters): Update accordingly.
14585 * expression.cs (Argument::GetParameterModifier): Same here.
14587 * support.cs (InternalParameters::ParameterType): Find a better way of determining
14588 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
14589 symbol in it at all so maybe this is only for now.
14591 2001-10-30 Ravi Pratap <ravi@ximian.com>
14593 * support.cs (InternalParameters): Constructor now takes an extra argument
14594 which is the actual Parameters class.
14596 (ParameterDesc): Update to provide info on ref/out modifiers.
14598 * class.cs (everywhere): Update call to InternalParameters to pass in
14599 the second argument too.
14601 * support.cs (ParameterData): Add ParameterModifier, which is a method
14602 to return the modifier info [ref/out etc]
14604 (InternalParameters, ReflectionParameters): Implement the above.
14606 * expression.cs (Argument::ParameterModifier): Similar function to return
14607 info about the argument's modifiers.
14609 (Invocation::OverloadResolve): Update to take into account matching modifiers
14612 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14613 a new SetFormalParameters object which we pass to InternalParameters.
14615 2001-10-30 Ravi Pratap <ravi@ximian.com>
14617 * expression.cs (NewArray): Merge into the ArrayCreation class.
14619 2001-10-29 Ravi Pratap <ravi@ximian.com>
14621 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14622 NewUserdefinedArray into one as there wasn't much of a use in having
14625 * expression.cs (Argument): Change field's name to ArgType from Type.
14627 (Type): New readonly property which returns the proper type, taking into
14628 account ref/out modifiers.
14630 (everywhere): Adjust code accordingly for the above.
14632 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14633 whether we are emitting for a ref or out parameter.
14635 * expression.cs (Argument::Emit): Use the above field to set the state.
14637 (LocalVariableReference::Emit): Update to honour the flag and emit the
14640 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14642 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14644 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14646 (ReflectionParameters, InternalParameters): Implement the above method.
14648 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14651 (Invocation::FullMethodDesc): Ditto.
14653 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14655 * cs-parser.jay: Add extra production for the second form of array
14658 * expression.cs (ArrayCreation): Update to reflect the above
14661 * Small changes to prepare for Array initialization.
14663 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14665 * typemanager.cs (ImplementsInterface): interface might be null;
14666 Deal with this problem;
14668 Also, we do store negative hits on the cache (null values), so use
14669 this instead of calling t.GetInterfaces on the type everytime.
14671 2001-10-28 Ravi Pratap <ravi@ximian.com>
14673 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14675 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14676 split functionality out into different classes.
14678 (New::FormArrayType): Move into NewBuiltinArray.
14680 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14683 (NewBuiltinArray): New class to handle creation of built-in arrays.
14685 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14686 account creation of one-dimensional arrays.
14688 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14690 (NewUserdefinedArray::DoResolve): Implement.
14692 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14694 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14695 we maintain inside the TypeManager. This is necessary to perform lookups on the
14698 (LookupType): Update to perform GetType on the module builders too.
14700 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14702 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14704 2001-10-23 Ravi Pratap <ravi@ximian.com>
14706 * expression.cs (New::DoResolve): Implement guts of array creation.
14708 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14710 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14712 * expression.cs: Fix bug I introduced lsat night that broke
14715 (Expression.Resolve): Report a 246 error (can not resolve name)
14716 if we find a SimpleName in the stream.
14718 (Expression.ResolveLValue): Ditto.
14720 (Expression.ResolveWithSimpleName): This function is a variant of
14721 ResolveName, this one allows SimpleNames to be returned without a
14722 warning. The only consumer of SimpleNames is MemberAccess
14724 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14726 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14727 might arrive here. I have my doubts that this is correct.
14729 * statement.cs (Lock): Implement lock statement.
14731 * cs-parser.jay: Small fixes to support `lock' and `using'
14733 * cs-tokenizer.cs: Remove extra space
14735 * driver.cs: New flag --checked, allows to turn on integer math
14738 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14739 Threading.Monitor.Exit
14741 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14743 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14744 Expression Class to be IndexerAccess.
14746 Notice that Indexer::DoResolve sets the eclass to Value.
14748 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14750 * class.cs (TypeContainer::Emit): Emit code for indexers.
14752 * assign.cs (IAssignMethod): New interface implemented by Indexers
14753 and Properties for handling assignment.
14755 (Assign::Emit): Simplify and reuse code.
14757 * expression.cs (IndexerAccess, PropertyExpr): Implement
14758 IAssignMethod, clean up old code.
14760 2001-10-22 Ravi Pratap <ravi@ximian.com>
14762 * typemanager.cs (ImplementsInterface): New method to determine if a type
14763 implements a given interface. Provides a nice cache too.
14765 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14768 (ConvertReferenceExplicit): Ditto.
14770 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14771 various methods, with correct names etc.
14773 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14774 Operator.UnaryNegation.
14776 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14777 we have a unary plus or minus operator.
14779 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
14782 * everywhere : update accordingly.
14784 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
14787 * class.cs (Method::Define): For the case where we are implementing a method
14788 inherited from an interface, we need to set the MethodAttributes.Final flag too.
14789 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
14791 2001-10-21 Ravi Pratap <ravi@ximian.com>
14793 * interface.cs (FindMembers): Implement to work around S.R.E
14796 * typemanager.cs (IsInterfaceType): Implement.
14798 (FindMembers): Update to handle interface types too.
14800 * expression.cs (ImplicitReferenceConversion): Re-write bits which
14801 use IsAssignableFrom as that is not correct - it doesn't work.
14803 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
14804 and accordingly override EmitStatement.
14806 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
14807 using the correct logic :-)
14809 2001-10-19 Ravi Pratap <ravi@ximian.com>
14811 * ../errors/cs-11.cs : Add to demonstrate error -11
14813 2001-10-17 Miguel de Icaza <miguel@ximian.com>
14815 * assign.cs (Assign::Resolve): Resolve right hand side first, and
14816 then pass this as a hint to ResolveLValue.
14818 * expression.cs (FieldExpr): Add Location information
14820 (FieldExpr::LValueResolve): Report assignment to readonly
14823 (Expression::ExprClassFromMemberInfo): Pass location information.
14825 (Expression::ResolveLValue): Add new method that resolves an
14828 (Expression::DoResolveLValue): Default invocation calls
14831 (Indexers): New class used to keep track of indexers in a given
14834 (IStackStore): Renamed from LValue, as it did not really describe
14835 what this did. Also ResolveLValue is gone from this interface and
14836 now is part of Expression.
14838 (ElementAccess): Depending on the element access type
14840 * typemanager.cs: Add `indexer_name_type' as a Core type
14841 (System.Runtime.CompilerServices.IndexerNameAttribute)
14843 * statement.cs (Goto): Take a location.
14845 2001-10-18 Ravi Pratap <ravi@ximian.com>
14847 * delegate.cs (Delegate::VerifyDelegate): New method to verify
14848 if two delegates are compatible.
14850 (NewDelegate::DoResolve): Update to take care of the case when
14851 we instantiate a delegate from another delegate.
14853 * typemanager.cs (FindMembers): Don't even try to look up members
14854 of Delegate types for now.
14856 2001-10-18 Ravi Pratap <ravi@ximian.com>
14858 * delegate.cs (NewDelegate): New class to take care of delegate
14861 * expression.cs (New): Split the delegate related code out into
14862 the NewDelegate class.
14864 * delegate.cs (DelegateInvocation): New class to handle delegate
14867 * expression.cs (Invocation): Split out delegate related code into
14868 the DelegateInvocation class.
14870 2001-10-17 Ravi Pratap <ravi@ximian.com>
14872 * expression.cs (New::DoResolve): Implement delegate creation fully
14873 and according to the spec.
14875 (New::DoEmit): Update to handle delegates differently.
14877 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
14878 because of which we were printing out arguments in reverse order !
14880 * delegate.cs (VerifyMethod): Implement to check if the given method
14881 matches the delegate.
14883 (FullDelegateDesc): Implement.
14885 (VerifyApplicability): Implement.
14887 * expression.cs (Invocation::DoResolve): Update to accordingly handle
14888 delegate invocations too.
14890 (Invocation::Emit): Ditto.
14892 * ../errors/cs1593.cs : Added.
14894 * ../errors/cs1594.cs : Added.
14896 * delegate.cs (InstanceExpression, TargetMethod): New properties.
14898 2001-10-16 Ravi Pratap <ravi@ximian.com>
14900 * typemanager.cs (intptr_type): Core type for System.IntPtr
14902 (InitCoreTypes): Update for the same.
14904 (iasyncresult_type, asynccallback_type): Ditto.
14906 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
14909 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
14912 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
14913 the builders for the 4 members of a delegate type :-)
14915 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
14918 * expression.cs (New::DoResolve): Implement guts for delegate creation.
14920 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
14922 2001-10-15 Miguel de Icaza <miguel@ximian.com>
14924 * statement.cs (Break::Emit): Implement.
14925 (Continue::Emit): Implement.
14927 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
14928 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
14929 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
14930 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
14933 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
14934 properties that track the label for the current loop (begin of the
14935 loop and end of the loop).
14937 2001-10-15 Ravi Pratap <ravi@ximian.com>
14939 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
14940 use of emitting anything at all.
14942 * class.cs, rootcontext.cs : Get rid of calls to the same.
14944 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
14946 (Populate): Define the constructor correctly and set the implementation
14949 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14952 (AddDelegateType): Implement.
14954 (IsDelegateType): Implement helper method.
14956 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14958 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14959 and accordingly handle it.
14961 * delegate.cs (Populate): Take TypeContainer argument.
14962 Implement bits to define the Invoke method. However, I still haven't figured out
14963 how to take care of the native int bit :-(
14965 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14966 Qualify the name of the delegate, not its return type !
14968 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14971 (StandardConversionExists): Checking for array types turns out to be recursive.
14973 (ConvertReferenceExplicit): Implement array conversion.
14975 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14977 2001-10-12 Ravi Pratap <ravi@ximian.com>
14979 * cs-parser.jay (delegate_declaration): Store the fully qualified
14980 name as it is a type declaration.
14982 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14985 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14986 as TypeContainer::DefineType.
14988 (Populate): Method in which all the definition of the various methods (Invoke)
14991 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14994 (CloseDelegate): Finally creates the delegate.
14996 * class.cs (TypeContainer::DefineType): Update to define delegates.
14997 (Populate, Emit and CloseType): Do the same thing here too.
14999 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
15000 delegates in all these operations.
15002 2001-10-14 Miguel de Icaza <miguel@ximian.com>
15004 * expression.cs: LocalTemporary: a new expression used to
15005 reference a temporary that has been created.
15007 * assign.cs: Handle PropertyAccess back here, so that we can
15008 provide the proper semantic access to properties.
15010 * expression.cs (Expression::ConvertReferenceExplicit): Implement
15011 a few more explicit conversions.
15013 * modifiers.cs: `NEW' modifier maps to HideBySig.
15015 * expression.cs (PropertyExpr): Make this into an
15016 ExpressionStatement, and support the EmitStatement code path.
15018 Perform get/set error checking, clean up the interface.
15020 * assign.cs: recognize PropertyExprs as targets, and if so, turn
15021 them into toplevel access objects.
15023 2001-10-12 Miguel de Icaza <miguel@ximian.com>
15025 * expression.cs: PropertyExpr::PropertyExpr: use work around the
15028 * typemanager.cs: Keep track here of our PropertyBuilders again to
15029 work around lameness in SRE.
15031 2001-10-11 Miguel de Icaza <miguel@ximian.com>
15033 * expression.cs (LValue::LValueResolve): New method in the
15034 interface, used to perform a second resolution pass for LValues.
15036 (This::DoResolve): Catch the use of this in static methods.
15038 (This::LValueResolve): Implement.
15040 (This::Store): Remove warning, assigning to `this' in structures
15043 (Invocation::Emit): Deal with invocation of
15044 methods on value types. We need to pass the address to structure
15045 methods rather than the object itself. (The equivalent code to
15046 emit "this" for structures leaves the entire structure on the
15047 stack instead of a pointer to it).
15049 (ParameterReference::DoResolve): Compute the real index for the
15050 argument based on whether the method takes or not a `this' pointer
15051 (ie, the method is static).
15053 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
15054 value types returned from functions when we need to invoke a
15055 method on the sturcture.
15058 2001-10-11 Ravi Pratap <ravi@ximian.com>
15060 * class.cs (TypeContainer::DefineType): Method to actually do the business of
15061 defining the type in the Modulebuilder or Typebuilder. This is to take
15062 care of nested types which need to be defined on the TypeBuilder using
15063 DefineNestedMethod.
15065 (TypeContainer::GetClassBases): Implement. Essentially the code from the
15066 methods in RootContext, only ported to be part of TypeContainer.
15068 (TypeContainer::GetInterfaceOrClass): Ditto.
15070 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
15072 * interface.cs (Interface::DefineInterface): New method. Does exactly
15073 what RootContext.CreateInterface did earlier, only it takes care of nested types
15076 (Interface::GetInterfaces): Move from RootContext here and port.
15078 (Interface::GetInterfaceByName): Same here.
15080 * rootcontext.cs (ResolveTree): Re-write.
15082 (PopulateTypes): Re-write.
15084 * class.cs (TypeContainer::Populate): Populate nested types too.
15085 (TypeContainer::Emit): Emit nested members too.
15087 * typemanager.cs (AddUserType): Do not make use of the FullName property,
15088 instead just use the name argument passed in as it is already fully
15091 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
15092 to TypeContainer mapping to see if a type is user-defined.
15094 * class.cs (TypeContainer::CloseType): Implement.
15096 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
15097 the default constructor.
15099 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
15102 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
15104 * interface.cs (CloseType): Create the type here.
15106 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
15109 Remove all the methods which are now in TypeContainer.
15111 2001-10-10 Ravi Pratap <ravi@ximian.com>
15113 * delegate.cs (Define): Re-write bits to define the delegate
15116 2001-10-10 Miguel de Icaza <miguel@ximian.com>
15118 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
15120 * expression.cs (ImplicitReferenceConversion): handle null as well
15121 as a source to convert to any reference type.
15123 * statement.cs (Return): Perform any implicit conversions to
15124 expected return type.
15126 Validate use of return statement.
15128 * codegen.cs (EmitContext): Pass the expected return type here.
15130 * class.cs (Method, Constructor, Property): Pass expected return
15131 type to EmitContext.
15133 2001-10-09 Miguel de Icaza <miguel@ximian.com>
15135 * expression.cs: Make DoResolve take an EmitContext instead of a
15138 Replaced `l' and `location' for `loc', for consistency.
15140 (Error, Warning): Remove unneeded Tc argument.
15142 * assign.cs, literal.cs, constant.cs: Update to new calling
15145 * codegen.cs: EmitContext now contains a flag indicating whether
15146 code is being generated in a static method or not.
15148 * cs-parser.jay: DecomposeQI, new function that replaces the old
15149 QualifiedIdentifier. Now we always decompose the assembled
15150 strings from qualified_identifier productions into a group of
15153 2001-10-08 Miguel de Icaza <miguel@ximian.com>
15155 * rootcontext.cs: Deal with field-less struct types correctly now
15156 by passing the size option to Define Type.
15158 * class.cs: Removed hack that created one static field.
15160 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15162 * statement.cs: Moved most of the code generation here.
15164 2001-10-09 Ravi Pratap <ravi@ximian.com>
15166 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
15169 (ElementAccess): Remove useless bits for now - keep checks as the spec
15172 2001-10-08 Ravi Pratap <ravi@ximian.com>
15174 * expression.cs (ElementAccess::DoResolve): Remove my crap code
15175 and start performing checks according to the spec.
15177 2001-10-07 Ravi Pratap <ravi@ximian.com>
15179 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
15180 rank_specifiers instead.
15182 (rank_specifiers): Change the order in which the rank specifiers are stored
15184 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
15186 * expression.cs (ElementAccess): Implement the LValue interface too.
15188 2001-10-06 Ravi Pratap <ravi@ximian.com>
15190 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
15191 except that user defined conversions are not included.
15193 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
15194 perform the conversion of the return type, if necessary.
15196 (New::DoResolve): Check whether we are creating an array or an object
15197 and accordingly do the needful.
15199 (New::Emit): Same here.
15201 (New::DoResolve): Implement guts of array creation.
15203 (New::FormLookupType): Helper function.
15205 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15207 * codegen.cs: Removed most of the code generation here, and move the
15208 corresponding code generation bits to the statement classes.
15210 Added support for try/catch/finalize and throw.
15212 * cs-parser.jay: Added support for try/catch/finalize.
15214 * class.cs: Catch static methods having the flags override,
15215 virtual or abstract.
15217 * expression.cs (UserCast): This user cast was not really doing
15218 what it was supposed to do. Which is to be born in fully resolved
15219 state. Parts of the resolution were being performed at Emit time!
15223 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15225 * expression.cs: Implicity convert the result from UserCast.
15227 2001-10-05 Ravi Pratap <ravi@ximian.com>
15229 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
15230 prevented it from working correctly.
15232 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
15233 merely ConvertImplicit.
15235 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15237 * typemanager.cs: Make the LookupTypeContainer function static,
15238 and not per-instance.
15240 * class.cs: Make static FindMembers (the one that takes a Type
15243 * codegen.cs: Add EmitForeach here.
15245 * cs-parser.jay: Make foreach a toplevel object instead of the
15246 inline expansion, as we need to perform semantic analysis on it.
15248 2001-10-05 Ravi Pratap <ravi@ximian.com>
15250 * expression.cs (Expression::ImplicitUserConversion): Rename to
15251 UserDefinedConversion.
15253 (Expression::UserDefinedConversion): Take an extra argument specifying
15254 whether we look for explicit user conversions too.
15256 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
15258 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
15260 (ExplicitUserConversion): Make it a call to UserDefinedConversion
15261 with the appropriate arguments.
15263 * cs-parser.jay (cast_expression): Record location too.
15265 * expression.cs (Cast): Record location info.
15267 (Expression::ConvertExplicit): Take location argument.
15269 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
15270 to determine if we are doing explicit conversions.
15272 (UserCast::Emit): Update accordingly.
15274 (Expression::ConvertExplicit): Report an error if everything fails.
15276 * ../errors/cs0030.cs : Add.
15278 2001-10-04 Miguel de Icaza <miguel@ximian.com>
15280 * modifiers.cs: If the ABSTRACT keyword is present, also set the
15281 virtual and newslot bits.
15283 * class.cs (TypeContainer::RegisterRequiredImplementations):
15284 Record methods we need.
15286 (TypeContainer::MakeKey): Helper function to make keys for
15287 MethodBases, since the Methodbase key is useless.
15289 (TypeContainer::Populate): Call RegisterRequiredImplementations
15290 before defining the methods.
15292 Create a mapping for method_builders_to_methods ahead of time
15293 instead of inside a tight loop.
15295 (::RequireMethods): Accept an object as the data to set into the
15296 hashtable so we can report interface vs abstract method mismatch.
15298 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15300 * report.cs: Make all of it static.
15302 * rootcontext.cs: Drop object_type and value_type computations, as
15303 we have those in the TypeManager anyways.
15305 Drop report instance variable too, now it is a global.
15307 * driver.cs: Use try/catch on command line handling.
15309 Add --probe option to debug the error reporting system with a test
15312 * report.cs: Add support for exiting program when a probe
15313 condition is reached.
15315 2001-10-03 Ravi Pratap <ravi@ximian.com>
15317 * expression.cs (Binary::DoNumericPromotions): Fix the case when
15318 we do a forcible conversion regardless of type, to check if
15319 ForceConversion returns a null.
15321 (Binary::error19): Use location to report error.
15323 (Unary::error23): Use location here too.
15325 * ../errors/cs0019.cs : Check in.
15327 * ../errors/cs0023.cs : Check in.
15329 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
15330 case of a non-null MethodInfo object with a length of 0 !
15332 (Binary::ResolveOperator): Flag error if overload resolution fails to find
15333 an applicable member - according to the spec :-)
15334 Also fix logic to find members in base types.
15336 (Unary::ResolveOperator): Same here.
15338 (Unary::report23): Change name to error23 and make first argument a TypeContainer
15339 as I was getting thoroughly confused between this and error19 :-)
15341 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
15342 (::FindMostEncompassedType): Implement.
15343 (::FindMostEncompassingType): Implement.
15344 (::StandardConversionExists): Implement.
15346 (UserImplicitCast): Re-vamp. We now need info about most specific
15347 source and target types so that we can do the necessary conversions.
15349 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
15350 mathematical union with no duplicates.
15352 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15354 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
15355 in order from base classes to child classes, so that we can in
15356 child classes look up in our parent for method names and
15357 attributes (required for handling abstract, virtual, new, override
15358 constructs: we need to instrospect our base class, and if we dont
15359 populate the classes in order, the introspection might be
15360 incorrect. For example, a method could query its parent before
15361 the parent has any methods and would determine that the parent has
15362 no abstract methods (while it could have had them)).
15364 (RootContext::CreateType): Record the order in which we define the
15367 2001-10-02 Miguel de Icaza <miguel@ximian.com>
15369 * class.cs (TypeContainer::Populate): Also method definitions can
15370 fail now, keep track of this.
15372 (TypeContainer::FindMembers): Implement support for
15373 DeclaredOnly/noDeclaredOnly flag.
15375 (Constructor::Emit) Return the ConstructorBuilder.
15377 (Method::Emit) Return the MethodBuilder.
15378 Check for abstract or virtual methods to be public.
15380 * rootcontext.cs (RootContext::CreateType): Register all the
15381 abstract methods required for the class to be complete and the
15382 interface methods that must be implemented.
15384 * cs-parser.jay: Report error 501 (method requires body if it is
15385 not marked abstract or extern).
15387 * expression.cs (TypeOf::Emit): Implement.
15389 * typemanager.cs: runtime_handle_type, new global type.
15391 * class.cs (Property::Emit): Generate code for properties.
15393 2001-10-02 Ravi Pratap <ravi@ximian.com>
15395 * expression.cs (Unary::ResolveOperator): Find operators on base type
15396 too - we now conform exactly to the spec.
15398 (Binary::ResolveOperator): Same here.
15400 * class.cs (Operator::Define): Fix minor quirk in the tests.
15402 * ../errors/cs0215.cs : Added.
15404 * ../errors/cs0556.cs : Added.
15406 * ../errors/cs0555.cs : Added.
15408 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15410 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
15411 single integer which is really efficient
15413 2001-10-01 Ravi Pratap <ravi@ximian.com>
15415 * expression.cs (Expression::ImplicitUserConversion): Use location
15416 even in the case when we are examining True operators.
15418 * class.cs (Operator::Define): Perform extensive checks to conform
15419 with the rules for operator overloading in the spec.
15421 * expression.cs (Expression::ImplicitReferenceConversion): Implement
15422 some of the other conversions mentioned in the spec.
15424 * typemanager.cs (array_type): New static member for the System.Array built-in
15427 (cloneable_interface): For System.ICloneable interface.
15429 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
15430 we start resolving the tree and populating types.
15432 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
15434 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15436 * expression.cs (Expression::ExprClassFromMemberInfo,
15437 Expression::Literalize): Create literal expressions from
15438 FieldInfos which are literals.
15440 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
15441 type casts, because they were wrong. The test suite in tests
15444 (ImplicitNumericConversion): ushort to ulong requires a widening
15447 Int32 constant to long requires widening cast as well.
15449 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
15450 for integers because the type on the stack is not i4.
15452 2001-09-30 Miguel de Icaza <miguel@ximian.com>
15454 * expression.cs (report118): require location argument.
15456 * parameter.cs: Do not dereference potential null value.
15458 * class.cs: Catch methods that lack the `new' keyword when
15459 overriding a name. Report warnings when `new' is used without
15460 anything being there to override.
15462 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
15464 * class.cs: Only add constructor to hashtable if it is non-null
15465 (as now constructors can fail on define).
15467 (TypeManager, Class, Struct): Take location arguments.
15469 Catch field instance initialization in structs as errors.
15471 accepting_filter: a new filter for FindMembers that is static so
15472 that we dont create an instance per invocation.
15474 (Constructor::Define): Catch errors where a struct constructor is
15477 * cs-parser.jay: Pass location information for various new
15480 * delegate.cs (Delegate): take a location argument.
15482 * driver.cs: Do not call EmitCode if there were problesm in the
15483 Definition of the types, as many Builders wont be there.
15485 * decl.cs (Decl::Decl): Require a location argument.
15487 * cs-tokenizer.cs: Handle properly hex constants that can not fit
15488 into integers, and find the most appropiate integer for it.
15490 * literal.cs: Implement ULongLiteral.
15492 * rootcontext.cs: Provide better information about the location of
15493 failure when CreateType fails.
15495 2001-09-29 Miguel de Icaza <miguel@ximian.com>
15497 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
15500 * expression.cs (Binary::CheckShiftArguments): Add missing type
15502 (Binary::ResolveOperator): Add type to the logical and and logical
15503 or, Bitwise And/Or and Exclusive Or code paths, it was missing
15506 (Binary::DoNumericPromotions): In the case where either argument
15507 is ulong (and most signed types combined with ulong cause an
15508 error) perform implicit integer constant conversions as well.
15510 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15512 * expression.cs (UserImplicitCast): Method should always be
15514 (Invocation::BetterConversion): Simplified test for IntLiteral.
15516 (Expression::ImplicitNumericConversion): Split this routine out.
15517 Put the code that performs implicit constant integer conversions
15520 (Expression::Resolve): Become a wrapper around DoResolve so we can
15521 check eclass and type being set after resolve.
15523 (Invocation::Badness): Remove this dead function
15525 (Binary::ResolveOperator): Do not compute the expensive argumnets
15526 unless we have a union for it.
15528 (Probe::Emit): Is needs to do an isinst and then
15529 compare against null.
15531 (::CanConvert): Added Location argument. If the Location argument
15532 is null (Location.Null), then we do not report errors. This is
15533 used by the `probe' mechanism of the Explicit conversion. We do
15534 not want to generate an error for something that the user
15535 explicitly requested to be casted. But the pipeline for an
15536 explicit cast first tests for potential implicit casts.
15538 So for now, if the Location is null, it means `Probe only' to
15539 avoid adding another argument. Might have to revise this
15542 (ClassCast): New class used to type cast objects into arbitrary
15543 classes (used in Explicit Reference Conversions).
15545 Implement `as' as well.
15547 Reverted all the patches from Ravi below: they were broken:
15549 * The use of `level' as a mechanism to stop recursive
15550 invocations is wrong. That was there just to catch the
15551 bug with a strack trace but not as a way of addressing
15554 To fix the problem we have to *understand* what is going
15555 on and the interactions and come up with a plan, not
15556 just get things going.
15558 * The use of the type conversion cache that I proposed
15559 last night had an open topic: How does this work across
15560 protection domains. A user defined conversion might not
15561 be public in the location where we are applying the
15562 conversion, a different conversion might be selected
15563 (ie, private A->B (better) but public B->A (worse),
15564 inside A, A->B applies, but outside it, B->A will
15567 * On top of that (ie, even if the above is solved),
15568 conversions in a cache need to be abstract. Ie, `To
15569 convert from an Int to a Short use an OpcodeCast', not
15570 `To convert from an Int to a Short use the OpcodeCast on
15571 the variable 5' (which is what this patch was doing).
15573 2001-09-28 Ravi Pratap <ravi@ximian.com>
15575 * expression.cs (Invocation::ConversionExists): Re-write to use
15576 the conversion cache
15578 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
15579 cache all conversions done, not just user-defined ones.
15581 (Invocation::BetterConversion): The real culprit. Use ConversionExists
15582 to determine if a conversion exists instead of acutually trying to
15583 perform the conversion. It's faster too.
15585 (Expression::ConvertExplicit): Modify to use ConversionExists to check
15586 and only then attempt the implicit conversion.
15588 2001-09-28 Ravi Pratap <ravi@ximian.com>
15590 * expression.cs (ConvertImplicit): Use a cache for conversions
15591 already found. Check level of recursion and bail out if necessary.
15593 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15595 * typemanager.cs (string_concat_string_string, string_concat_object_object):
15596 Export standard methods that we expect for string operations.
15598 * statement.cs (Block::UsageWarning): Track usage of variables and
15599 report the errors for not used variables.
15601 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15604 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15606 * codegen.cs: remove unnneded code
15608 * expression.cs: Removed BuiltinTypeAccess class
15610 Fix the order in which implicit conversions are
15613 The previous fixed dropped support for boxed conversions (adding a
15614 test to the test suite now)
15616 (UserImplicitCast::CanConvert): Remove test for source being null,
15617 that code is broken. We should not feed a null to begin with, if
15618 we do, then we should track the bug where the problem originates
15619 and not try to cover it up here.
15621 Return a resolved expression of type UserImplicitCast on success
15622 rather than true/false. Ravi: this is what I was talking about,
15623 the pattern is to use a static method as a "constructor" for
15626 Also, do not create arguments until the very last minute,
15627 otherwise we always create the arguments even for lookups that
15628 will never be performed.
15630 (UserImplicitCast::Resolve): Eliminate, objects of type
15631 UserImplicitCast are born in a fully resolved state.
15633 * typemanager.cs (InitCoreTypes): Init also value_type
15634 (System.ValueType).
15636 * expression.cs (Cast::Resolve): First resolve the child expression.
15638 (LValue): Add new method AddressOf to be used by
15641 Change the argument of Store to take an EmitContext instead of an
15642 ILGenerator, because things like FieldExpr need to be able to call
15643 their children expression to generate the instance code.
15645 (Expression::Error, Expression::Warning): Sugar functions for
15648 (Expression::MemberLookup): Accept a TypeContainer instead of a
15649 Report as the first argument.
15651 (Expression::ResolvePrimary): Killed. I still want to improve
15652 this as currently the code is just not right.
15654 (Expression::ResolveMemberAccess): Simplify, but it is still
15657 (Unary::Resolve): Catch errors in AddressOf operators.
15659 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15660 index to a byte for the short-version, or the compiler will choose
15661 the wrong Emit call, which generates the wrong data.
15663 (ParameterReference::Emit, ::Store): same.
15665 (FieldExpr::AddressOf): Implement.
15667 * typemanager.cs: TypeManager: made public variable instead of
15670 * driver.cs: document --fatal.
15672 * report.cs (ErrorMessage, WarningMessage): new names for the old
15673 Error and Warning classes.
15675 * cs-parser.jay (member_access): Turn built-in access to types
15676 into a normal simplename
15678 2001-09-27 Ravi Pratap <ravi@ximian.com>
15680 * expression.cs (Invocation::BetterConversion): Fix to cope
15681 with q being null, since this was introducing a bug.
15683 * expression.cs (ConvertImplicit): Do built-in conversions first.
15685 2001-09-27 Ravi Pratap <ravi@ximian.com>
15687 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15689 2001-09-27 Ravi Pratap <ravi@ximian.com>
15691 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15692 I had introduced long ago (what's new ?).
15694 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15695 the work of all the checking.
15696 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15697 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15699 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15700 that is the right way.
15702 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15703 overloading resolution. Use everywhere instead of cutting and pasting code.
15705 (Binary::ResolveOperator): Use MakeUnionSet.
15707 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15708 we have to convert to bool types. Not complete yet.
15710 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15712 * typemanager.cs (TypeManager::CSharpName): support ushort.
15714 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15715 to provide an expression that performsn an implicit constant int
15716 conversion (section 6.1.6).
15717 (Expression::ConvertImplicitRequired): Reworked to include
15718 implicit constant expression conversions.
15720 (Expression::ConvertNumericExplicit): Finished.
15722 (Invocation::Emit): If InstanceExpression is null, then it means
15723 that we perform a call on this.
15725 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15727 * expression.cs (Unary::Emit): Remove some dead code.
15728 (Probe): Implement Resolve and Emit for `is'.
15729 (Expression::ConvertImplicitRequired): Attempt to do constant
15730 expression conversions here. Maybe should be moved to
15731 ConvertImplicit, but I am not sure.
15732 (Expression::ImplicitLongConstantConversionPossible,
15733 Expression::ImplicitIntConstantConversionPossible): New functions
15734 that tell whether is it possible to apply an implicit constant
15735 expression conversion.
15737 (ConvertNumericExplicit): Started work on explicit numeric
15740 * cs-parser.jay: Update operator constants.
15742 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15743 (Parameters::GetSignature): Hook up VerifyArgs here.
15744 (Parameters::VerifyArgs): Verifies that no two arguments have the
15747 * class.cs (Operator): Update the operator names to reflect the
15748 ones that the spec expects (as we are just stringizing the
15751 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15752 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15753 previous usage did only work for our methods.
15754 (Expression::ConvertImplicit): Handle decimal implicit numeric
15755 conversions as well.
15756 (Expression::InternalTypeConstructor): Used to invoke constructors
15757 on internal types for default promotions.
15759 (Unary::Emit): Implement special handling for the pre/post
15760 increment/decrement for overloaded operators, as they need to have
15761 the same semantics as the other operators.
15763 (Binary::ResolveOperator): ditto.
15764 (Invocation::ConversionExists): ditto.
15765 (UserImplicitCast::Resolve): ditto.
15767 2001-09-26 Ravi Pratap <ravi@ximian.com>
15769 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15770 operator, return after emitting body. Regression tests pass again !
15772 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15773 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15774 (Invocation::OverloadResolve): Ditto.
15775 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15777 * everywhere : update calls to the above methods accordingly.
15779 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15781 * assign.cs (Assign): Make it inherit from ExpressionStatement.
15783 * expression.cs (ExpressionStatement): New base class used for
15784 expressions that can appear in statements, so that we can provide
15785 an alternate path to generate expression that do not leave a value
15788 (Expression::Emit, and all the derivatives): We no longer return
15789 whether a value is left on the stack or not. Every expression
15790 after being emitted leaves a single value on the stack.
15792 * codegen.cs (EmitContext::EmitStatementExpression): Use the
15793 facilties of ExpressionStatement if possible.
15795 * cs-parser.jay: Update statement_expression.
15797 2001-09-25 Miguel de Icaza <miguel@ximian.com>
15799 * driver.cs: Change the wording of message
15801 2001-09-25 Ravi Pratap <ravi@ximian.com>
15803 * expression.cs (Binary::ResolveOperator): Had forgottten to set
15804 the type of the expression to the return type of the method if
15805 we have an overloaded operator match ! The regression tests pass again !
15806 (Unary::ResolveOperator): Ditto.
15808 * expression.cs (Invocation::ConversionExists): Correct the member lookup
15809 to find "op_Implicit", not "implicit" ;-)
15810 (UserImplicitCast): New class to take care of user-defined implicit conversions.
15811 (ConvertImplicit, ForceConversion): Take TypeContainer argument
15813 * everywhere : Correct calls to the above accordingly.
15815 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
15816 (ConvertImplicit): Do user-defined conversion if it exists.
15818 2001-09-24 Miguel de Icaza <miguel@ximian.com>
15820 * assign.cs: track location.
15821 (Resolve): Use implicit conversions on assignment.
15823 * literal.cs: Oops. Not good, Emit of short access values should
15824 pass (Bytes) or the wrong argument will be selected.
15826 * expression.cs (Unary::Emit): Emit code for -expr.
15828 (Unary::ResolveOperator): Handle `Substract' for non-constants
15829 (substract from zero from the non-constants).
15830 Deal with Doubles as well.
15832 (Expression::ConvertImplicitRequired): New routine that reports an
15833 error if no implicit conversion exists.
15835 (Invocation::OverloadResolve): Store the converted implicit
15836 expressions if we make them
15838 2001-09-24 Ravi Pratap <ravi@ximian.com>
15840 * class.cs (ConstructorInitializer): Take a Location argument.
15841 (ConstructorBaseInitializer): Same here.
15842 (ConstructorThisInitializer): Same here.
15844 * cs-parser.jay : Update all calls accordingly.
15846 * expression.cs (Unary, Binary, New): Take location argument.
15847 Update accordingly everywhere.
15849 * cs-parser.jay : Update all calls to the above to take a location
15852 * class.cs : Ditto.
15854 2001-09-24 Ravi Pratap <ravi@ximian.com>
15856 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
15857 (Invocation::BetterConversion): Same here
15858 (Invocation::ConversionExists): Ditto.
15860 (Invocation::ConversionExists): Implement.
15862 2001-09-22 Ravi Pratap <ravi@ximian.com>
15864 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
15865 Also take an additional TypeContainer argument.
15867 * All over : Pass in TypeContainer as argument to OverloadResolve.
15869 * typemanager.cs (CSharpName): Update to check for the string type and return
15872 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
15875 2001-09-21 Ravi Pratap <ravi@ximian.com>
15877 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
15878 (Invocation::BetterFunction): Implement.
15879 (Invocation::BetterConversion): Implement.
15880 (Invocation::ConversionExists): Skeleton, no implementation yet.
15882 Okay, things work fine !
15884 2001-09-21 Miguel de Icaza <miguel@ximian.com>
15886 * typemanager.cs: declare and load enum_type, delegate_type and
15889 * expression.cs (Expression::Emit): Now emit returns a value that
15890 tells whether a value is left on the stack or not. This strategy
15891 might be reveted tomorrow with a mechanism that would address
15892 multiple assignments.
15893 (Expression::report118): Utility routine to report mismatches on
15896 (Unary::Report23): Report impossible type/operator combination
15899 (Unary::IsIncrementableNumber): Whether the type can be
15900 incremented or decremented with add.
15901 (Unary::ResolveOperator): Also allow enumerations to be bitwise
15903 (Unary::ResolveOperator): Implement ++, !, ~,
15905 (Invocation::Emit): Deal with new Emit convetion.
15907 * All Expression derivatives: Updated their Emit method to return
15908 whether they leave values on the stack or not.
15910 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
15911 stack for expressions that are statements.
15913 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15915 * expression.cs (LValue): New interface. Must be implemented by
15917 (LocalVariableReference, ParameterReference, FieldExpr): Implement
15920 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
15921 interface for generating code, simplifies the code.
15923 2001-09-20 Ravi Pratap <ravi@ximian.com>
15925 * expression.cs (everywhere): Comment out return statements in ::Resolve
15926 methods to avoid the warnings.
15928 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15930 * driver.cs (parse): Report error 2001 if we can not open the
15933 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
15936 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
15939 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
15940 otherwise nested blocks end up with the same index.
15942 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
15944 * expression.cs: Instead of having FIXMEs in the Resolve
15945 functions, throw exceptions so it is obvious that we are facing a
15948 * cs-parser.jay (invocation_expression): Pass Location information.
15950 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15951 Use a basename for those routines because .NET does not like paths
15954 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15957 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15959 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15960 are loading the correct data types (throws an exception if not).
15961 (TypeManager::InitCoreTypes): Use CoreLookupType
15963 * expression.cs (Unary::ResolveOperator): return the child
15964 expression for expressions which are just +expr.
15965 (Unary::ResolveOperator): Return negative literals for -LITERAL
15966 expressions (otherwise they are Unary {Literal}).
15967 (Invocation::Badness): Take into account `Implicit constant
15968 expression conversions'.
15970 * literal.cs (LongLiteral): Implement long literal class.
15971 (IntLiteral): export the `Value' of the intliteral.
15973 2001-09-19 Ravi Pratap <ravi@ximian.com>
15975 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15977 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15978 instead of 'Operator'
15980 * expression.cs (Binary::ResolveOperator): Update accordingly.
15981 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15984 * cs-parser.jay (unary_expression): Update to use the new names.
15986 * gen-treedump.cs (GetUnary): Same here.
15988 * expression.cs (Unary::Resolve): Implement.
15989 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15990 operators are found instead of making noise ;-)
15991 (Unary::ResolveOperator): New method to do precisely the same thing which
15992 Binary::ResolveOperator does for Binary expressions.
15993 (Unary.method, .Arguments): Add.
15994 (Unary::OperName): Implement.
15995 (Unary::ForceConversion): Copy and Paste !
15997 * class.cs (Operator::Define): Fix a small bug for the case when we have
16000 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
16001 for the inbuilt operators. Only overloading works for now ;-)
16003 2001-09-18 Miguel de Icaza <miguel@ximian.com>
16005 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
16006 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
16008 * expression.cs (This::Emit): Implement.
16009 (This::Resolve): Implement.
16010 (TypeOf:Resolve): Implement.
16011 (Expression::ResolveSimpleName): Add an implicit this to instance
16013 (MemberAccess::Resolve): Deal with Parameters and Fields.
16014 Bind instance variable to Field expressions.
16015 (FieldExpr::Instance): New field used to track the expression that
16016 represents the object instance.
16017 (FieldExpr::Resolve): Track potential errors from MemberLookup not
16019 (FieldExpr::Emit): Implement.
16021 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
16022 the last instruction contains a return opcode to avoid generating
16023 the last `ret' instruction (this generates correct code, and it is
16024 nice to pass the peverify output).
16026 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
16027 initializer for static and instance variables.
16028 (Constructor::Emit): Allow initializer to be null in the case of
16029 static constructors. Only emit initializer for instance
16032 (TypeContainer::FindMembers): Return a null array if there are no
16035 Also fix the code for the MemberTypes.Method branch, as it was not
16036 scanning that for operators (or tried to access null variables before).
16038 * assign.cs (Assign::Emit): Handle instance and static fields.
16042 * driver.cs: Stop compilation if there are parse errors.
16044 * cs-parser.jay (constructor_declaration): Provide default base
16045 initializer for non-static constructors.
16046 (constructor_declarator): Do not provide a default base
16047 initializers if none was specified.
16048 Catch the fact that constructors should not have parameters.
16050 * class.cs: Do not emit parent class initializers for static
16051 constructors, that should be flagged as an error.
16053 2001-09-18 Ravi Pratap <ravi@ximian.com>
16055 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
16056 Move back code into TypeContainer::Populate.
16058 2001-09-18 Ravi Pratap <ravi@ximian.com>
16060 * class.cs (TypeContainer::AddConstructor): Fix the check to
16061 compare against Name, not Basename.
16062 (Operator::OpType): Change Plus and Minus to Add and Subtract.
16064 * cs-parser.jay : Update accordingly.
16066 * class.cs (TypeContainer::FindMembers): For the case where we are searching
16067 for methods, don't forget to look into the operators too.
16068 (RegisterMethodBuilder): Helper method to take care of this for
16069 methods, constructors and operators.
16070 (Operator::Define): Completely revamp.
16071 (Operator.OperatorMethod, MethodName): New fields.
16072 (TypeContainer::Populate): Move the registering of builders into
16073 RegisterMethodBuilder.
16074 (Operator::Emit): Re-write.
16076 * expression.cs (Binary::Emit): Comment out code path to emit method
16077 invocation stuff for the case when we have a user defined operator. I am
16078 just not able to get it right !
16080 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16082 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
16085 (Expression::MemberLookup): Provide a version that allows to
16086 specify the MemberTypes and BindingFlags.
16088 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
16089 so it was not fetching variable information from outer blocks.
16091 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
16092 Beforefieldinit as it was buggy.
16094 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
16095 that Ravi put here.
16097 * class.cs (Constructor::Emit): Only emit if block is not null.
16098 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
16099 deal with this by semantically definining it as if the user had
16102 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
16103 constructors as we now "emit" them at a higher level.
16105 (TypeContainer::DefineDefaultConstructor): Used to define the
16106 default constructors if none was provided.
16108 (ConstructorInitializer): Add methods Resolve and Emit.
16110 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
16112 2001-09-17 Ravi Pratap <ravi@ximian.com>
16114 * class.cs (TypeContainer::EmitDefaultConstructor): Register
16115 the default constructor builder with our hashtable for methodbuilders
16118 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
16119 and argument_count is 0 in which case we have a match.
16120 (Binary::ResolveOperator): More null checking and miscellaneous coding
16123 2001-09-17 Ravi Pratap <ravi@ximian.com>
16125 * rootcontext.cs (IsNameSpace): Compare against null.
16127 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
16129 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
16130 and Unary::Operator.
16132 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
16135 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
16136 we have overloaded operators.
16137 (Binary::ResolveOperator): Implement the part which does the operator overload
16140 * class.cs (Operator::Emit): Implement.
16141 (TypeContainer::Emit): Emit the operators we have too.
16143 * expression.cs (Binary::Emit): Update to emit the appropriate code for
16144 the case when we have a user-defined operator.
16146 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16148 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
16150 2001-09-16 Ravi Pratap <ravi@ximian.com>
16152 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
16153 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
16154 (Constructor::Emit): Implement.
16155 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
16156 if we have no work to do.
16157 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
16160 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
16161 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
16163 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
16166 2001-09-15 Ravi Pratap <ravi@ximian.com>
16168 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
16170 (Tree::RecordNamespace): Method to do what the name says ;-)
16171 (Tree::Namespaces): Property to get at the namespaces hashtable.
16173 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
16176 * rootcontext.cs (IsNamespace): Fixed it :-)
16178 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16180 * class.cs (TypeContainer::FindMembers): Add support for
16182 (MethodCore): New class that encapsulates both the shared aspects
16183 of a Constructor and a Method.
16184 (Method, Constructor): Factored pieces into MethodCore.
16186 * driver.cs: Added --fatal which makes errors throw exceptions.
16187 Load System assembly as well as part of the standard library.
16189 * report.cs: Allow throwing exceptions on errors for debugging.
16191 * modifiers.cs: Do not use `parent', instead use the real type
16192 container to evaluate permission settings.
16194 * class.cs: Put Ravi's patch back in. He is right, and we will
16195 have to cope with the
16197 2001-09-14 Ravi Pratap <ravi@ximian.com>
16199 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
16200 FamORAssem, not FamANDAssem.
16202 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16204 * driver.cs: Added --parse option that only parses its input files
16207 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
16208 incorrect. IsTopLevel is not used to tell whether an object is
16209 root_types or not (that can be achieved by testing this ==
16210 root_types). But to see if this is a top-level *class* (not
16211 necessarly our "toplevel" container).
16213 2001-09-14 Ravi Pratap <ravi@ximian.com>
16215 * enum.cs (Enum::Define): Modify to call the Lookup method on the
16216 parent instead of a direct call to GetType.
16218 2001-09-14 Ravi Pratap <ravi@ximian.com>
16220 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
16221 Modifiers.TypeAttr. This should just be a call to that method.
16223 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
16224 object so that we can determine if we are top-level or not.
16226 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
16229 * enum.cs (Enum::Define): Ditto.
16231 * modifiers.cs (FieldAttr): Re-write.
16233 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
16234 (TypeContainer::HaveStaticConstructor): New property to provide access
16235 to precisely that info.
16237 * modifiers.cs (MethodAttr): Re-write.
16238 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
16240 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
16241 of top-level types as claimed.
16243 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16245 * expression.cs (MemberLookup): Fruitless attempt to lookup
16246 constructors. Maybe I need to emit default constructors? That
16247 might be it (currently .NET emits this for me automatically).
16248 (Invocation::OverloadResolve): Cope with Arguments == null.
16249 (Invocation::EmitArguments): new function, shared by the new
16250 constructor and us.
16251 (Invocation::Emit): Handle static and instance methods. Emit
16252 proper call instruction for virtual or non-virtual invocations.
16253 (New::Emit): Implement.
16254 (New::Resolve): Implement.
16255 (MemberAccess:Resolve): Implement.
16256 (MethodGroupExpr::InstanceExpression): used conforming to the spec
16257 to track instances.
16258 (FieldExpr::Resolve): Set type.
16260 * support.cs: Handle empty arguments.
16262 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
16263 SimpleLookup): Auxiliary routines to help parse a qualifier
16266 Update qualifier_identifier rule.
16268 * codegen.cs: Removed debugging messages.
16270 * class.cs: Make this a global thing, this acts just as a "key" to
16271 objects that we might have around.
16273 (Populate): Only initialize method_builders_to_methods once.
16275 * expression.cs (PropertyExpr): Initialize type from the
16278 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
16279 Resolve pattern. Attempt to implicitly convert value to boolean.
16282 * expression.cs: Set the type for the int32/int32 argument case.
16283 (Binary::ResolveOperator): Set the return type to boolean for
16284 comparission operators
16286 * typemanager.cs: Remove debugging print code.
16288 (Invocation::Resolve): resolve type.
16290 * class.cs: Allocate a MemberInfo of the correct size, as the code
16291 elsewhere depends on the test to reflect the correct contents.
16293 (Method::) Keep track of parameters, due to System.Reflection holes
16295 (TypeContainer::Populate): Keep track of MethodBuilders to Method
16298 (TypeContainer::FindMembers): Use ArrayList and then copy an array
16299 of the exact size and return that.
16301 (Class::LookupMethodByBuilder): New function that maps
16302 MethodBuilders to its methods. Required to locate the information
16303 on methods because System.Reflection bit us again.
16305 * support.cs: New file, contains an interface ParameterData and
16306 two implementations: ReflectionParameters and InternalParameters
16307 used to access Parameter information. We will need to grow this
16310 * expression.cs (Invocation::GetParameterData): implement a cache
16311 and a wrapper around the ParameterData creation for methods.
16312 (Invocation::OverloadResolve): Use new code.
16314 2001-09-13 Ravi Pratap <ravi@ximian.com>
16316 * class.cs (TypeContainer::EmitField): Remove and move into
16317 (Field::Define): here and modify accordingly.
16318 (Field.FieldBuilder): New member.
16319 (TypeContainer::Populate): Update accordingly.
16320 (TypeContainer::FindMembers): Implement.
16322 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16324 * statement.cs: (VariableInfo::VariableType): New field to be
16325 initialized with the full type once it is resolved.
16327 2001-09-12 Miguel de Icaza <miguel@ximian.com>
16329 * parameter.cs (GetParameterInfo): Use a type cache to compute
16330 things only once, and to reuse this information
16332 * expression.cs (LocalVariableReference::Emit): Implement.
16333 (OpcodeCast::Emit): fix.
16335 (ParameterReference::Resolve): Implement.
16336 (ParameterReference::Emit): Implement.
16338 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
16339 that are expressions need to stay as Expressions.
16341 * typemanager.cs (CSharpName): Returns the C# name of a type if
16344 * expression.cs (Expression::ConvertImplicit): New function that
16345 implements implicit type conversions.
16347 (Expression::ImplicitReferenceConversion): Implements implicit
16348 reference conversions.
16350 (EmptyCast): New type for transparent casts.
16352 (OpcodeCast): New type for casts of types that are performed with
16353 a sequence of bytecodes.
16355 (BoxedCast): New type used for casting value types into reference
16356 types. Emits a box opcode.
16358 (Binary::DoNumericPromotions): Implements numeric promotions of
16359 and computation of the Binary::Type.
16361 (Binary::EmitBranchable): Optimization.
16363 (Binary::Emit): Implement code emission for expressions.
16365 * typemanager.cs (TypeManager): Added two new core types: sbyte
16368 2001-09-12 Ravi Pratap <ravi@ximian.com>
16370 * class.cs (TypeContainer::FindMembers): Method which does exactly
16371 what Type.FindMembers does, only we don't have to use reflection. No
16372 implementation yet.
16374 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
16375 typecontainer objects as we need to get at them.
16376 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
16378 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
16379 typecontainer object.
16381 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
16382 of just a Report object.
16384 2001-09-11 Ravi Pratap <ravi@ximian.com>
16386 * class.cs (Event::Define): Go back to using the prefixes "add_" and
16388 (TypeContainer::Populate): Now define the delegates of the type too.
16389 (TypeContainer.Delegates): Property to access the list of delegates defined
16392 * delegates.cs (Delegate::Define): Implement partially.
16394 * modifiers.cs (TypeAttr): Handle more flags.
16396 2001-09-11 Ravi Pratap <ravi@ximian.com>
16398 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
16400 (Operator::Define): Re-write logic to get types by using the LookupType method
16401 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
16402 (Indexer::Define): Ditto.
16403 (Event::Define): Ditto.
16404 (Property::Define): Ditto.
16406 2001-09-10 Ravi Pratap <ravi@ximian.com>
16408 * class.cs (TypeContainer::Populate): Now define operators too.
16409 (TypeContainer.Operators): New property to access the list of operators
16411 (Operator.OperatorMethodBuilder): New member to hold the method builder
16412 for the operator we are defining.
16413 (Operator::Define): Implement.
16415 2001-09-10 Ravi Pratap <ravi@ximian.com>
16417 * class.cs (Event::Define): Make the prefixes of the accessor methods
16418 addOn_ and removeOn_
16420 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
16421 of the location being passed in too. Ideally, this should go later since all
16422 error reporting should be done through the Report object.
16424 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
16425 (Populate): Iterate thru the indexers we have and define them too.
16426 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
16427 for the get and set accessors.
16428 (Indexer::Define): Implement.
16430 2001-09-09 Miguel de Icaza <miguel@ximian.com>
16432 * expression.cs (Binary::Resolve): Beginning of it. I scratched
16433 my previous implementation, did not work.
16435 * typemanager.cs: Add a couple of missing types (the longs).
16437 * literal.cs: Use TypeManager.bool_type instead of getting it.
16439 * expression.cs (EventExpr): New kind of expressions.
16440 (Expressio::ExprClassFromMemberInfo): finish
16442 2001-09-08 Miguel de Icaza <miguel@ximian.com>
16444 * assign.cs: Emit stores to static fields differently.
16446 2001-09-08 Ravi Pratap <ravi@ximian.com>
16448 * Merge in changes and adjust code to tackle conflicts. Backed out my
16449 code in Assign::Resolve ;-)
16451 2001-09-08 Ravi Pratap <ravi@ximian.com>
16453 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
16454 instead Report.Error and also pass in the location.
16455 (CSharpParser::Lexer): New readonly property to return the reference
16456 to the Tokenizer object.
16457 (declare_local_variables): Use Report.Error with location instead of plain
16461 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
16462 (Operator.CheckBinaryOperator): Ditto.
16464 * cs-parser.jay (operator_declarator): Update accordingly.
16466 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
16467 (CheckBinaryOperator): Same here.
16469 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
16470 on the name without any prefixes of namespace names etc. This is because we
16471 already might have something already fully qualified like
16472 'System.Console.WriteLine'
16474 * assign.cs (Resolve): Begin implementation. Stuck ;-)
16476 2001-09-07 Ravi Pratap <ravi@ximian.com>
16478 * cs-tokenizer.cs (location): Return a string which also contains
16481 * expression.cs (ElementAccess): New class for expressions of the
16482 type 'element access.'
16483 (BaseAccess): New class for expressions of the type 'base access.'
16484 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
16487 * cs-parser.jay (element_access): Implement action.
16488 (base_access): Implement actions.
16489 (checked_expression, unchecked_expression): Implement.
16491 * cs-parser.jay (local_variable_type): Correct and implement.
16492 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
16494 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
16496 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
16497 name and the specifiers.
16499 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
16501 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
16502 making them all public ;-)
16504 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
16507 2001-09-07 Miguel de Icaza <miguel@ximian.com>
16509 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
16511 (FieldExpr, PropertyExprs): New resolved expressions.
16512 (SimpleName::MemberStaticCheck): Perform static checks for access
16513 to non-static fields on static methods. Maybe this should be
16514 generalized for MemberAccesses.
16515 (SimpleName::ResolveSimpleName): More work on simple name
16518 * cs-parser.jay (primary_expression/qualified_identifier): track
16519 the parameter index.
16521 * codegen.cs (CodeGen::Save): Catch save exception, report error.
16522 (EmitContext::EmitBoolExpression): Chain to expression generation
16523 instead of temporary hack.
16524 (::EmitStatementExpression): Put generic expression code generation.
16526 * assign.cs (Assign::Emit): Implement variable assignments to
16527 local variables, parameters and fields.
16529 2001-09-06 Miguel de Icaza <miguel@ximian.com>
16531 * statement.cs (Block::GetVariableInfo): New method, returns the
16532 VariableInfo for a variable name in a block.
16533 (Block::GetVariableType): Implement in terms of GetVariableInfo
16535 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
16536 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
16538 2001-09-06 Ravi Pratap <ravi@ximian.com>
16540 * cs-parser.jay (operator_declaration): Continue on my quest : update
16541 to take attributes argument.
16542 (event_declaration): Ditto.
16543 (enum_declaration): Ditto.
16544 (indexer_declaration): Ditto.
16546 * class.cs (Operator::Operator): Update constructor accordingly.
16547 (Event::Event): Ditto.
16549 * delegate.cs (Delegate::Delegate): Same here.
16551 * enum.cs (Enum::Enum): Same here.
16553 2001-09-05 Ravi Pratap <ravi@ximian.com>
16555 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
16557 * ../tests/cs0658.cs : New file to demonstrate error 0658.
16559 * attribute.cs (Attributes): New class to encapsulate all attributes which were
16560 being passed around as an arraylist.
16561 (Attributes::AddAttribute): Method to add attribute sections.
16563 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
16564 (struct_declaration): Update accordingly.
16565 (constant_declaration): Update.
16566 (field_declaration): Update.
16567 (method_header): Update.
16568 (fixed_parameter): Update.
16569 (parameter_array): Ditto.
16570 (property_declaration): Ditto.
16571 (destructor_declaration): Ditto.
16573 * class.cs (Struct::Struct): Update constructors accordingly.
16574 (Class::Class): Ditto.
16575 (Field::Field): Ditto.
16576 (Method::Method): Ditto.
16577 (Property::Property): Ditto.
16578 (TypeContainer::OptAttribute): update property's return type.
16580 * interface.cs (Interface.opt_attributes): New member.
16581 (Interface::Interface): Update to take the extra Attributes argument.
16583 * parameter.cs (Parameter::Parameter): Ditto.
16585 * constant.cs (Constant::Constant): Ditto.
16587 * interface.cs (InterfaceMemberBase): New OptAttributes field.
16588 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
16589 the attributes as a parameter.
16590 (InterfaceProperty): Update constructor call.
16591 (InterfaceEvent): Ditto.
16592 (InterfaceMethod): Ditto.
16593 (InterfaceIndexer): Ditto.
16595 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
16596 pass the attributes too.
16597 (interface_event_declaration): Ditto.
16598 (interface_property_declaration): Ditto.
16599 (interface_method_declaration): Ditto.
16600 (interface_declaration): Ditto.
16602 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16604 * class.cs (Method::Define): Track the "static Main" definition to
16605 create an entry point.
16607 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16608 EntryPoint if we find it.
16610 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16611 (EmitContext::ig): Make this variable public.
16613 * driver.cs: Make the default output file be the first file name
16614 with the .exe extension.
16616 Detect empty compilations
16618 Handle various kinds of output targets. Handle --target and
16619 rename -t to --dumper.
16621 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16622 methods inherited from Expression return now an Expression. This
16623 will is used during the tree rewriting as we resolve them during
16626 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16627 the spec. Missing entirely is the information about
16628 accessability of elements of it.
16630 (Expression::ExprClassFromMemberInfo): New constructor for
16631 Expressions that creates a fully initialized Expression based on
16632 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16635 (Invocation::Resolve): Begin implementing resolution of invocations.
16637 * literal.cs (StringLiteral): Implement Emit.
16639 2001-09-05 Ravi Pratap <ravi@ximian.com>
16641 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16644 2001-09-04 Ravi Pratap <ravi@ximian.com>
16646 * cs-parser.jay (attribute_arguments): Implement actions.
16647 (attribute): Fix bug in production. Implement action.
16648 (attribute_list): Implement.
16649 (attribute_target): Implement.
16650 (attribute_target_specifier, opt_target_specifier): Implement
16651 (CheckAttributeTarget): New method to check if the attribute target
16653 (attribute_section): Implement.
16654 (opt_attributes): Implement.
16656 * attribute.cs : New file to handle attributes.
16657 (Attribute): Class to hold attribute info.
16659 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16660 (attribute_section): Modify production to use 2 different rules to
16661 achieve the same thing. 1 s/r conflict down !
16662 Clean out commented, useless, non-reducing dimension_separator rules.
16664 * class.cs (TypeContainer.attributes): New member to hold list
16665 of attributes for a type.
16666 (Struct::Struct): Modify to take one more argument, the attribute list.
16667 (Class::Class): Ditto.
16668 (Field::Field): Ditto.
16669 (Method::Method): Ditto.
16670 (Property::Property): Ditto.
16672 * cs-parser.jay (struct_declaration): Update constructor call to
16673 pass in the attributes too.
16674 (class_declaration): Ditto.
16675 (constant_declaration): Ditto.
16676 (field_declaration): Ditto.
16677 (method_header): Ditto.
16678 (fixed_parameter): Ditto.
16679 (parameter_array): Ditto.
16680 (property_declaration): Ditto.
16682 * constant.cs (Constant::Constant): Update constructor similarly.
16683 Use System.Collections.
16685 * parameter.cs (Parameter::Parameter): Update as above.
16687 2001-09-02 Ravi Pratap <ravi@ximian.com>
16689 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16690 (TypeContainer.delegates): New member to hold list of delegates.
16692 * cs-parser.jay (delegate_declaration): Implement the action correctly
16693 this time as I seem to be on crack ;-)
16695 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16697 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16698 tell whether an identifier represents a namespace.
16700 * expression.cs (NamespaceExpr): A namespace expression, used only
16701 temporarly during expression resolution.
16702 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16703 utility functions to resolve names on expressions.
16705 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16707 * codegen.cs: Add hook for StatementExpressions.
16709 * class.cs: Fix inverted test for static flag in methods.
16711 2001-09-02 Ravi Pratap <ravi@ximian.com>
16713 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16714 to make it coincide with MS' number.
16715 (Operator::CheckBinaryOperator): Ditto.
16717 * ../errors/errors.txt : Remove error numbers added earlier.
16719 * ../errors/cs1019.cs : Test case for error # 1019
16721 * ../errros/cs1020.cs : Test case for error # 1020
16723 * cs-parser.jay : Clean out commented cruft.
16724 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16725 used anywhere - non-reducing rule.
16726 (namespace_declarations): Non-reducing rule - comment out.
16728 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16729 with TypeContainer::AddEnum.
16731 * delegate.cs : New file for delegate handling classes.
16732 (Delegate): Class for declaring delegates.
16734 * makefile : Update.
16736 * cs-parser.jay (delegate_declaration): Implement.
16738 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16740 * class.cs (Event::Define): Implement.
16741 (Event.EventBuilder): New member.
16743 * class.cs (TypeContainer::Populate): Update to define all enums and events
16745 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16746 readonly fields for all these cases ?
16748 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16750 * class.cs (Property): Revamp to use the convention of making fields readonly.
16751 Accordingly modify code elsewhere.
16753 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16754 the Define method of the Property class.
16756 * class.cs : Clean up applied patch and update references to variables etc. Fix
16758 (TypeContainer::Populate): Update to define all the properties we have. Also
16759 define all enumerations.
16761 * enum.cs (Define): Implement.
16763 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16765 * cs-parser.jay (overloadable_operator): The semantic value is an
16766 enum of the Operator class.
16767 (operator_declarator): Implement actions.
16768 (operator_declaration): Implement.
16770 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16771 validity of definitions.
16772 (Operator::CheckBinaryOperator): Static method to check for binary operators
16773 (TypeContainer::AddOperator): New method to add an operator to a type.
16775 * cs-parser.jay (indexer_declaration): Added line to actually call the
16776 AddIndexer method so it gets added ;-)
16778 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
16779 already taken care of by the MS compiler ?
16781 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16783 * class.cs (Operator): New class for operator declarations.
16784 (Operator::OpType): Enum for the various operators.
16786 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16788 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
16789 ostensibly handle this in semantic analysis.
16791 * cs-parser.jay (general_catch_clause): Comment out
16792 (specific_catch_clauses, specific_catch_clause): Ditto.
16793 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
16794 (catch_args, opt_catch_args): New productions.
16795 (catch_clause): Rewrite to use the new productions above
16796 (catch_clauses): Modify accordingly.
16797 (opt_catch_clauses): New production to use in try_statement
16798 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
16799 and re-write the code in the actions to extract the specific and
16800 general catch clauses by being a little smart ;-)
16802 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
16803 Hooray, try and catch statements parse fine !
16805 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16807 * statement.cs (Block::GetVariableType): Fix logic to extract the type
16808 string from the hashtable of variables.
16810 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
16811 I end up making that mistake ;-)
16812 (catch_clauses): Fixed gross error which made Key and Value of the
16813 DictionaryEntry the same : $1 !!
16815 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16817 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
16819 * cs-parser.jay (event_declaration): Correct to remove the semicolon
16820 when the add and remove accessors are specified.
16822 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16824 * cs-parser.jay (IndexerDeclaration): New helper class to hold
16825 information about indexer_declarator.
16826 (indexer_declarator): Implement actions.
16827 (parsing_indexer): New local boolean used to keep track of whether
16828 we are parsing indexers or properties. This is necessary because
16829 implicit_parameters come into picture even for the get accessor in the
16830 case of an indexer.
16831 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
16833 * class.cs (Indexer): New class for indexer declarations.
16834 (TypeContainer::AddIndexer): New method to add an indexer to a type.
16835 (TypeContainer::indexers): New member to hold list of indexers for the
16838 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16840 * cs-parser.jay (add_accessor_declaration): Implement action.
16841 (remove_accessor_declaration): Implement action.
16842 (event_accessors_declaration): Implement
16843 (variable_declarators): swap statements for first rule - trivial.
16845 * class.cs (Event): New class to hold information about event
16847 (TypeContainer::AddEvent): New method to add an event to a type
16848 (TypeContainer::events): New member to hold list of events.
16850 * cs-parser.jay (event_declaration): Implement actions.
16852 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16854 * cs-parser.jay (dim_separators): Implement. Make it a string
16855 concatenating all the commas together, just as they appear.
16856 (opt_dim_separators): Modify accordingly
16857 (rank_specifiers): Update accordingly. Basically do the same
16858 thing - instead, collect the brackets here.
16859 (opt_rank_sepcifiers): Modify accordingly.
16860 (array_type): Modify to actually return the complete type string
16861 instead of ignoring the rank_specifiers.
16862 (expression_list): Implement to collect the expressions
16863 (variable_initializer): Implement. We make it a list of expressions
16864 essentially so that we can handle the array_initializer case neatly too.
16865 (variable_initializer_list): Implement.
16866 (array_initializer): Make it a list of variable_initializers
16867 (opt_array_initializer): Modify accordingly.
16869 * expression.cs (New::NType): Add enumeration to help us
16870 keep track of whether we have an object/delegate creation
16871 or an array creation.
16872 (New:NewType, New::Rank, New::Indices, New::Initializers): New
16873 members to hold data about array creation.
16874 (New:New): Modify to update NewType
16875 (New:New): New Overloaded contructor for the array creation
16878 * cs-parser.jay (array_creation_expression): Implement to call
16879 the overloaded New constructor.
16881 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
16883 * class.cs (TypeContainer::Constructors): Return member
16884 constructors instead of returning null.
16886 2001-08-26 Miguel de Icaza <miguel@ximian.com>
16888 * typemanager.cs (InitCoreTypes): Initialize the various core
16889 types after we have populated the type manager with the user
16890 defined types (this distinction will be important later while
16891 compiling corlib.dll)
16893 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
16894 on Expression Classification. Now all expressions have a method
16895 `Resolve' and a method `Emit'.
16897 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
16898 generation from working. Also add some temporary debugging
16901 2001-08-24 Miguel de Icaza <miguel@ximian.com>
16903 * codegen.cs: Lots of code generation pieces. This is only the
16904 beginning, will continue tomorrow with more touches of polish. We
16905 handle the fundamentals of if, while, do, for, return. Others are
16906 trickier and I need to start working on invocations soon.
16908 * gen-treedump.cs: Bug fix, use s.Increment here instead of
16911 * codegen.cs (EmitContext): New struct, used during code
16912 emission to keep a context. Most of the code generation will be
16915 * cs-parser.jay: Add embedded blocks to the list of statements of
16916 this block. So code generation proceeds in a top down fashion.
16918 2001-08-23 Miguel de Icaza <miguel@ximian.com>
16920 * statement.cs: Add support for multiple child blocks.
16922 2001-08-22 Miguel de Icaza <miguel@ximian.com>
16924 * codegen.cs (EmitCode): New function, will emit the code for a
16925 Block of code given a TypeContainer and its ILGenerator.
16927 * statement.cs (Block): Standard public readonly optimization.
16928 (Block::Block constructors): Link children.
16929 (Block::Child): Child Linker.
16930 (Block::EmitVariables): Emits IL variable declarations.
16932 * class.cs: Drop support for MethodGroups here, delay until
16934 (Method::): Applied the same simplification that I did before, and
16935 move from Properties to public readonly fields.
16936 (Method::ParameterTypes): Returns the parameter types for the
16937 function, and implements a cache that will be useful later when I
16938 do error checking and the semantic analysis on the methods is
16940 (Constructor::GetCallingConvention): Renamed from CallingConvetion
16941 and made a method, optional argument tells whether this is a class
16942 or a structure to apply the `has-this' bit.
16943 (Method::GetCallingConvention): Implement, returns the calling
16945 (Method::Define): Defines the type, a second pass is performed
16946 later to populate the methods.
16948 (Constructor::ParameterTypes): implement a cache similar to the
16949 one on Method::ParameterTypes, useful later when we do semantic
16952 (TypeContainer::EmitMethod): New method. Emits methods.
16954 * expression.cs: Removed MethodGroup class from here.
16956 * parameter.cs (Parameters::GetCallingConvention): new method.
16958 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16960 * class.cs (TypeContainer::Populate): Drop RootContext from the
16963 (Constructor::CallingConvention): Returns the calling convention.
16964 (Constructor::ParameterTypes): Returns the constructor parameter
16967 (TypeContainer::AddConstructor): Keep track of default constructor
16968 and the default static constructor.
16970 (Constructor::) Another class that starts using `public readonly'
16971 instead of properties.
16973 (Constructor::IsDefault): Whether this is a default constructor.
16975 (Field::) use readonly public fields instead of properties also.
16977 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16978 track of static constructors; If none is used, turn on
16979 BeforeFieldInit in the TypeAttributes.
16981 * cs-parser.jay (opt_argument_list): now the return can be null
16982 for the cases where there are no arguments.
16984 (constructor_declarator): If there is no implicit `base' or
16985 `this', then invoke the default parent constructor.
16987 * modifiers.cs (MethodAttr): New static function maps a set of
16988 modifiers flags into a MethodAttributes enum
16989 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16990 MethodAttr, TypeAttr to represent the various mappings where the
16991 modifiers are used.
16992 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16994 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16996 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16999 * interface.cs (PopulateIndexer): Implemented the code generator
17000 for interface indexers.
17002 2001-08-17 Miguel de Icaza <miguel@ximian.com>
17004 * interface.cs (InterfaceMemberBase): Now we track the new status
17007 (PopulateProperty): Implement property population. Woohoo! Got
17008 Methods and Properties going today.
17010 Removed all the properties for interfaces, and replaced them with
17011 `public readonly' fields.
17013 2001-08-16 Miguel de Icaza <miguel@ximian.com>
17015 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
17016 initialize their hashtables/arraylists only when they are needed
17017 instead of doing this always.
17019 * parameter.cs: Handle refs and out parameters.
17021 * cs-parser.jay: Use an ArrayList to construct the arguments
17022 instead of the ParameterCollection, and then cast that to a
17025 * parameter.cs: Drop the use of ParameterCollection and use
17026 instead arrays of Parameters.
17028 (GetParameterInfo): Use the Type, not the Name when resolving
17031 2001-08-13 Miguel de Icaza <miguel@ximian.com>
17033 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
17034 and instead use public readonly fields.
17036 * class.cs: Put back walking code for type containers.
17038 2001-08-11 Miguel de Icaza <miguel@ximian.com>
17040 * class.cs (MakeConstant): Code to define constants.
17042 * rootcontext.cs (LookupType): New function. Used to locate types
17045 2001-08-08 Miguel de Icaza <miguel@ximian.com>
17047 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
17048 this System.Reflection code is. Kudos to Microsoft
17050 * typemanager.cs: Implement a type cache and avoid loading all
17051 types at boot time. Wrap in LookupType the internals. This made
17052 the compiler so much faster. Wow. I rule!
17054 * driver.cs: Make sure we always load mscorlib first (for
17055 debugging purposes, nothing really important).
17057 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
17058 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
17060 * rootcontext.cs: Lookup types on their namespace; Lookup types
17061 on namespaces that have been imported using the `using' keyword.
17063 * class.cs (TypeContainer::TypeAttr): Virtualize.
17064 (Class::TypeAttr): Return attributes suitable for this bad boy.
17065 (Struct::TypeAttr): ditto.
17066 Handle nested classes.
17067 (TypeContainer::) Remove all the type visiting code, it is now
17068 replaced with the rootcontext.cs code
17070 * rootcontext.cs (GetClassBases): Added support for structs.
17072 2001-08-06 Miguel de Icaza <miguel@ximian.com>
17074 * interface.cs, statement.cs, class.cs, parameter.cs,
17075 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
17076 Drop use of TypeRefs, and use strings instead.
17078 2001-08-04 Miguel de Icaza <miguel@ximian.com>
17082 * class.cs (Struct::Struct): set the SEALED flags after
17083 checking the modifiers.
17084 (TypeContainer::TypeAttr): new property, returns the
17085 TypeAttributes for a class.
17087 * cs-parser.jay (type_list): Oops, list production was creating a
17088 new list of base types.
17090 * rootcontext.cs (StdLib): New property.
17091 (GetInterfaceTypeByName): returns an interface by type name, and
17092 encapsulates error handling here.
17093 (GetInterfaces): simplified.
17094 (ResolveTree): Encapsulated all the tree resolution here.
17095 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
17098 * driver.cs: Add support for --nostdlib, to avoid loading the
17099 default assemblies.
17100 (Main): Do not put tree resolution here.
17102 * rootcontext.cs: Beginning of the class resolution.
17104 2001-08-03 Miguel de Icaza <miguel@ximian.com>
17106 * rootcontext.cs: Provide better error reporting.
17108 * cs-parser.jay (interface_base): set our $$ to be interfaces.
17110 * rootcontext.cs (CreateInterface): Handle the case where there
17111 are no parent interfaces.
17113 (CloseTypes): Routine to flush types at the end.
17114 (CreateInterface): Track types.
17115 (GetInterfaces): Returns an array of Types from the list of
17116 defined interfaces.
17118 * typemanager.c (AddUserType): Mechanism to track user types (puts
17119 the type on the global type hash, and allows us to close it at the
17122 2001-08-02 Miguel de Icaza <miguel@ximian.com>
17124 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
17125 RecordInterface instead.
17127 * cs-parser.jay: Updated to reflect changes above.
17129 * decl.cs (Definition): Keep track of the TypeBuilder type that
17130 represents this type here. Not sure we will use it in the long
17131 run, but wont hurt for now.
17133 * driver.cs: Smaller changes to accomodate the new code.
17135 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
17138 * rootcontext.cs (CreateInterface): New method, used to create
17139 the System.TypeBuilder type for interfaces.
17140 (ResolveInterfaces): new entry point to resolve the interface
17142 (CodeGen): Property, used to keep track of the code generator.
17144 2001-07-26 Miguel de Icaza <miguel@ximian.com>
17146 * cs-parser.jay: Add a second production for delegate_declaration
17149 (enum_body): Put an opt_comma here instead of putting it on
17150 enum_body or enum_member_declarations so we can handle trailing
17151 commas on enumeration members. Gets rid of a shift/reduce.
17153 (type_list): Need a COMMA in the middle.
17155 (indexer_declaration): Tell tokenizer to recognize get/set
17157 * Remove old targets.
17159 * Re-add the parser target.
17161 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17163 * cs-parser.jay: Add precendence rules for a number of operators
17164 ot reduce the number of shift/reduce conflicts in the grammar.
17166 2001-07-17 Miguel de Icaza <miguel@ximian.com>
17168 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
17171 Get rid of old crufty code.
17173 * rootcontext.cs: Use this to keep track of the parsed
17174 representation and the defined types available to the program.
17176 * gen-treedump.cs: adjust for new convention.
17178 * type.cs: Split out the type manager, and the assembly builder
17181 * typemanager.cs: the type manager will live here now.
17183 * cil-codegen.cs: And the code generator here.
17185 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
17187 * makefile: Fixed up for easy making.
17189 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17191 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
17194 (unary_expression): Expand pre_increment_expression and
17195 post_decrement_expression to reduce a shift/reduce.
17197 2001-07-11 Simon Cozens
17199 * cs-tokenizer.cs: Hex numbers should begin with a 0.
17201 Improve allow_keyword_as_indent name.
17203 2001-06-19 Miguel de Icaza <miguel@ximian.com>
17205 * Adjustments for Beta2.
17207 2001-06-13 Miguel de Icaza <miguel@ximian.com>
17209 * decl.cs: Added `Define' abstract method.
17210 (InTransit): new property, used to catch recursive definitions.
17212 * interface.cs: Implement `Define'.
17214 * modifiers.cs: Map Modifiers.constants to
17215 System.Reflection.TypeAttribute flags.
17217 * class.cs: Keep track of types and user-defined types.
17218 (BuilderInit): New method for creating an assembly
17219 (ResolveType): New function to launch the resolution process, only
17220 used by interfaces for now.
17222 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
17223 that are inserted into the name space.
17225 2001-06-08 Miguel de Icaza <miguel@ximian.com>
17227 * ARGH. I have screwed up my tree so many times due to the use of
17228 rsync rather than using CVS. Going to fix this at once.
17230 * driver.cs: Objetify driver. Load assemblies, use assemblies to
17233 2001-06-07 Miguel de Icaza <miguel@ximian.com>
17235 * Experiment successful: Use System.Type rather that our own
17238 2001-05-25 Miguel de Icaza <miguel@ximian.com>
17240 * cs-parser.jay: Removed nsAliases from here.
17242 Use new namespaces, handle `using XXX;'
17244 * namespace.cs: Reimplemented namespace handling, use a recursive
17245 definition of the class. Now we can keep track of using clauses
17246 and catch invalid using clauses.
17248 2001-05-24 Miguel de Icaza <miguel@ximian.com>
17250 * gen-treedump.cs: Adapted for all the renaming.
17252 * expression.cs (Expression): this class now has a Type property
17253 which returns an expression Type.
17255 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
17256 `Type', as this has a different meaning now in the base
17258 2001-05-22 Miguel de Icaza <miguel@ximian.com>
17260 * interface.cs, class.cs: Removed from all the sources the
17261 references to signature computation, as we can not do method
17262 signature computation during the parsing time, as we are not
17263 trying to solve at that point distinguishing:
17267 void a (NS.Blah x) {}
17270 Which depending on the context might be valid or not, as we do not
17271 know if Blah is the same thing as NS.Blah at that point.
17273 * Redid everything so the code uses TypeRefs now instead of
17274 Types. TypeRefs are just temporary type placeholders, that need
17275 to be resolved. They initially have a pointer to a string and the
17276 current scope in which they are used. This is used later by the
17277 compiler to resolve the reference to an actual Type.
17279 * DeclSpace is no longer a CIR.Type, and neither are
17280 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
17281 are all DeclSpaces, but no Types.
17283 * type.cs (TypeRefManager): This implements the TypeRef manager,
17284 which keeps track of all the types that need to be resolved after
17285 the parsing has finished.
17287 2001-05-13 Miguel de Icaza <miguel@ximian.com>
17289 * ARGH. We are going to have to store `foreach' as a class rather
17290 than resolving it, as we need to verify error 1579 after name
17291 resolution. *OR* we could keep a flag that says `This request to
17292 IEnumerator comes from a foreach statement' which we can then use
17293 to generate the error.
17295 2001-05-10 Miguel de Icaza <miguel@ximian.com>
17297 * class.cs (TypeContainer.AddMethod): we now add methods to the
17298 MethodGroup instead of the method hashtable.
17300 * expression.cs: Add MethodGroup abstraction, which gets us one
17301 step closer to the specification in the way we handle method
17304 * cs-parser.jay (primary_expression): qualified_identifier now
17305 tried to match up an identifier to a local variable reference or
17306 to a parameter reference.
17308 current_local_parameters is now a parser global variable that
17309 points to the current parameters for the block, used during name
17312 (property_declaration): Now creates an implicit `value' argument to
17315 2001-05-09 Miguel de Icaza <miguel@ximian.com>
17317 * parameter.cs: Do not use `param' arguments as part of the
17318 signature, per the spec.
17320 2001-05-08 Miguel de Icaza <miguel@ximian.com>
17322 * decl.cs: Base class for classes, structs and interfaces. This
17323 is the "Declaration Space"
17325 * cs-parser.jay: Use CheckDef for checking declaration errors
17326 instead of having one on each function.
17328 * class.cs: Factor out some code for handling error handling in
17329 accordance to the "Declarations" section in the "Basic Concepts"
17330 chapter in the ECMA C# spec.
17332 * interface.cs: Make all interface member classes derive from
17333 InterfaceMemberBase.
17335 2001-05-07 Miguel de Icaza <miguel@ximian.com>
17337 * Many things: all interfaces are parsed and generated in
17338 gen-treedump. Support for member variables, constructors,
17339 destructors, properties, constants is there.
17341 Beginning of the IL backend, but very little done, just there for
17344 2001-04-29 Miguel de Icaza <miguel@ximian.com>
17346 * cs-parser.jay: Fix labeled statement.
17348 * cs-tokenizer.cs (escape): Escape " and ' always.
17349 ref_line, ref_name: keep track of the line/filename as instructed
17350 by #line by the compiler.
17353 2001-04-27 Miguel de Icaza <miguel@ximian.com>
17355 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
17356 to match the values in System.CodeDOM.
17358 Divid renamed to Divide.
17360 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
17362 (Statements.set): remove.
17364 * System.CodeDOM/CodeCatchClause.cs: always have a valid
17367 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
17368 falseStatements always have valid values.
17370 * cs-parser.jay: Use System.CodeDOM now.