1 2004-11-05 Miguel de Icaza <miguel@ximian.com>
3 * Indexers were using the ShortName when defining themselves,
4 causing a regression in the compiler bootstrap when applying the
5 patch from 2004-11-02 (first part), now they use their full name
8 2004-11-04 Zoltan Varga <vargaz@freemail.hu>
10 * driver.cs: Strip the path from the names of embedded resources. Fixes
13 2004-11-04 Raja R Harinath <rharinath@novell.com>
15 Fix error message regression: cs0104-2.cs.
16 * namespace.cs (NamespaceEntry.Lookup): Remove 'silent' flag.
17 (AliasEntry.Resolve): Update.
18 * rootcontext.cs (RootContext.NamespaceLookup): Update. Remove
20 (RootContext.LookupType): Update.
22 2004-11-03 Carlos Alberto Cortez <carlos@unixmexico.org>
24 * cs-parser.jay: Add support for handling accessor modifiers
25 * class: Add support port accessor modifiers and error checking,
26 define PropertyMethod.Define as virtual (not abstract anymore)
27 * ecore.cs: Add checking for proeprties access with access modifiers
28 * iterators.cs: Modify Accessor constructor call based in the modified
30 2004-11-02 Ben Maurer <bmaurer@ximian.com>
32 * expression.cs (StringConcat): Handle being called twice,
33 as when we have a concat in a field init with more than two
36 2004-11-02 Miguel de Icaza <miguel@ximian.com>
38 * class.cs (Event.Define, Indexer.Define, Property.Define): Do not
39 special case explicit implementations, we should always produce
40 the .property or .event declaration.
42 * decl.cs (MemberName): Renamed GetFullName to GetPartialName
43 since it will not return correct data if people use this
44 unresolved in the presence of using statements (see test-313).
46 * class.cs (MethodData.Define): If we are an explicit interface
47 implementation, set the method name to the full name of the
48 interface plus the name of the method.
50 Notice that using the method.MethodName.GetFullName() does not
51 work, as it will only contain the name as declared on the source
52 file (it can be a shorthand in the presence of using statements)
53 and not the fully qualifed type name, for example:
57 class D : ICloneable {
58 object ICloneable.Clone () {
62 Would produce a method called `ICloneable.Clone' instead of
63 `System.ICloneable.Clone'.
65 * namespace.cs (Alias.Resolve): Use GetPartialName.
67 2004-11-01 Marek Safar <marek.safar@seznam.cz>
69 * cs-parser.jay: Add error 1055 report.
71 2004-11-01 Miguel de Icaza <miguel@ximian.com>
73 * assign.cs (Assign.DoResolve): Only do the transform of
74 assignment into a New if the types are compatible, if not, fall
75 through and let the implicit code deal with the errors and with
76 the necessary conversions.
78 2004-11-01 Marek Safar <marek.safar@seznam.cz>
80 * cs-parser.jay: Add error 1031 report.
82 * cs-tokenizer.cs: Add location for error 1038.
84 2004-10-31 Marek Safar <marek.safar@seznam.cz>
86 * cs-parser.jay: Add error 1016 report.
88 2004-10-31 Marek Safar <marek.safar@seznam.cz>
90 * cs-parser.jay: Add errors 1575,1611 report.
92 2004-10-31 Marek Safar <marek.safar@seznam.cz>
94 * cs-parser.jay: Add error 1001 report.
96 2004-10-31 Marek Safar <marek.safar@seznam.cz>
99 * attribute.cs (GetMarshal): Add method argument for
100 caller identification.
102 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
103 agument for GetMarshal and RuntimeMissingSupport.
105 2004-10-31 Marek Safar <marek.safar@seznam.cz>
107 * attribute.cs (ExtractSecurityPermissionSet): Removed
108 TypeManager.code_access_permission_type.
110 * typemanager.cs: Removed TypeManager.code_access_permission_type.
112 2004-10-27 Miguel de Icaza <miguel@ximian.com>
114 * expression.cs (LocalVariableReference.DoResolveLValue): Check
115 for obsolete use of a variable here. Fixes regression on errors
116 cs0619-25 and cs0619-26.
118 2004-10-27 Marek Safar <marek.safar@seznam.cz>
120 Fix #62358, implemented security attribute encoding.
122 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
123 Tests permitted SecurityAction for assembly or other types.
124 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
125 data from SecurityPermissionAttribute to PermisionSet class.
127 * class.cs (ApplyAttributeBuilder): Added special handling
128 for System.Security.Permissions.SecurityAttribute based types.
130 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
131 special handling for System.Security.Permissions.SecurityAttribute
134 * enum.cs (ApplyAttributeBuilder): Added special handling
135 for System.Security.Permissions.SecurityAttribute based types.
137 * parameter.cs (ApplyAttributeBuilder): Added special handling
138 for System.Security.Permissions.SecurityAttribute based types.
140 * rootcontext.cs: Next 2 core types.
142 * typemanager.cs (TypeManager.security_permission_attr_type):
143 Built in type for the SecurityPermission Attribute.
144 (code_access_permission_type): Build in type.
146 2004-10-17 Miguel de Icaza <miguel@ximian.com>
148 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
149 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
150 all of this information into
151 EmitContext.EmitCapturedVariableInstance.
153 * codegen.cs (EmitCapturedVariableInstance): move here the
154 funcionality of emitting an ldarg.0 in the presence of a
155 remapping. This centralizes the instance emit code.
157 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
158 then emit a load of this: it means that we have reached the
159 topmost ScopeInfo: the one that contains the pointer to the
160 instance of the class hosting the anonymous method.
162 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
163 captures to the topmost CaptureContext.
165 2004-10-12 Miguel de Icaza <miguel@ximian.com>
167 * expression.cs (LocalVariableReference): Move the knowledge about
168 the iterators into codegen's EmitCapturedVariableInstance.
170 2004-10-11 Miguel de Icaza <miguel@ximian.com>
172 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
173 all code paths return a value from an anonymous method (it is the
174 same as the 161 error, but for anonymous methods).
176 2004-10-08 Miguel de Icaza <miguel@ximian.com>
178 The introduction of anonymous methods in the compiler changed
179 various ways of doing things in the compiler. The most
180 significant one is the hard split between the resolution phase
181 and the emission phases of the compiler.
183 For instance, routines that referenced local variables no
184 longer can safely create temporary variables during the
185 resolution phase: they must do so from the emission phase,
186 since the variable might have been "captured", hence access to
187 it can not be done with the local-variable operations from the runtime.
191 (Block.Flags): New flag `IsTopLevel' to indicate that this block
194 (ToplevelBlock): A new kind of Block, these are the blocks that
195 are created by the parser for all toplevel method bodies. These
196 include methods, accessors and anonymous methods.
198 These contain some extra information not found in regular blocks:
199 A pointer to an optional CaptureContext (for tracking captured
200 local variables and parameters). A pointer to the parent
203 (Return.Resolve): Catch missmatches when returning a value from an
204 anonymous method (error 1662).
205 Invoke NeedReturnLabel from the Resolve phase instead of the emit
208 (Break.Resolve): ditto.
210 (SwitchLabel): instead of defining the labels during the
211 resolution phase, we now turned the public ILLabel and ILLabelCode
212 labels into methods called GetILLabelCode() and GetILLabel() that
213 only define the label during the Emit phase.
215 (GotoCase): Track the SwitchLabel instead of the computed label
216 (its contained therein). Emit the code by using
217 SwitchLabel.GetILLabelCode ().
219 (LocalInfo.Flags.Captured): A new flag has been introduce to track
220 whether the Local has been captured or not.
222 (LocalInfo.IsCaptured): New property, used to tell whether the
223 local has been captured.
225 * anonymous.cs: Vastly updated to contain the anonymous method
228 The main classes here are: CaptureContext which tracks any
229 captured information for a toplevel block and ScopeInfo used to
230 track the activation frames for various local variables.
232 Each toplevel block has an optional capture context associated
233 with it. When a method contains an anonymous method both the
234 toplevel method and the anonymous method will create a capture
235 context. When variables or parameters are captured, they are
236 recorded on the CaptureContext that owns them, for example:
240 MyDelegate d = delegate {
245 Here `a' will be recorded as captured on the toplevel
246 CapturedContext, the inner captured context will not have anything
247 (it will only have data if local variables or parameters from it
248 are captured in a nested anonymous method.
250 The ScopeInfo is used to track the activation frames for local
251 variables, for example:
253 for (int i = 0; i < 10; i++)
254 for (int j = 0; j < 10; j++){
255 MyDelegate d = delegate {
260 At runtime this captures a single captured variable `i', but it
261 captures 10 different versions of the variable `j'. The variable
262 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
265 The toplevel ScopeInfo will also track information like the `this'
266 pointer if instance variables were referenced (this is necessary
267 as the anonymous method lives inside a nested class in the host
270 (AnonymousMethod): Expanded to track the Toplevel, implement
271 `AnonymousMethod.Compatible' to tell whether an anonymous method
272 can be converted to a target delegate type.
274 The routine now also produces the anonymous method content
276 (AnonymousDelegate): A helper class that derives from
277 DelegateCreation, this is used to generate the code necessary to
278 produce the delegate for the anonymous method that was created.
280 * assign.cs: API adjustments for new changes in
281 Convert.ImplicitStandardConversionExists.
283 * class.cs: Adjustments to cope with the fact that now toplevel
284 blocks are of type `ToplevelBlock'.
286 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
287 insteda of standard blocks.
289 Flag errors if params arguments are passed to anonymous methods.
291 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
292 `CurrentAnonymousMethod' which points to the current Anonymous
293 Method. The variable points to the AnonymousMethod class that
294 holds the code being compiled. It is set in the new EmitContext
295 created for the anonymous method.
297 (EmitContext.Phase): Introduce a variable and an enumeration to
298 assist in enforcing some rules about when and where we are allowed
299 to invoke certain methods (EmitContext.NeedsReturnLabel is the
300 only one that enfonces this right now).
302 (EmitContext.HaveCaptureInfo): new helper method that returns
303 whether we have a CapturedContext initialized.
305 (EmitContext.CaptureVariable): New method used to register that a
306 LocalInfo must be flagged for capturing.
308 (EmitContext.CapturedParameter): New method used to register that a
309 parameters must be flagged for capturing.
311 (EmitContext.CapturedField): New method used to register that a
312 field must be flagged for capturing.
314 (EmitContext.HaveCapturedVariables,
315 EmitContext.HaveCapturedFields): Return whether there are captured
318 (EmitContext.EmitMethodHostInstance): This is used to emit the
319 instance for the anonymous method. The instance might be null
320 (static methods), this (for anonymous methods that capture nothing
321 and happen to live side-by-side with the current method body) or a
322 more complicated expression if the method has a CaptureContext.
324 (EmitContext.EmitTopBlock): Routine that drives the emission of
325 code: it will first resolve the top block, then emit any metadata
326 and then emit the code. The split is done so that we can extract
327 any anonymous methods and flag any captured variables/parameters.
329 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
330 during this phase, the ILGenerator should not be used as labels
331 and local variables declared here might not be accessible to any
332 code that is part of an anonymous method.
334 Exceptions to this include the temporary variables that are
335 created by some statements internally for holding temporary
338 (EmitContext.EmitMeta): New routine, in charge of emitting all the
341 (EmitContext.TemporaryReturn): This method is typically called
342 from the Emit phase, and its the only place where we allow the
343 ReturnLabel to be defined other than the EmitMeta. The reason is
344 that otherwise we would have to duplicate a lot of logic in the
345 Resolve phases of various methods that today is on the Emit
348 (EmitContext.NeedReturnLabel): This no longer creates the label,
349 as the ILGenerator is not valid during the resolve phase.
351 (EmitContext.EmitThis): Extended the knowledge in this class to
352 work in anonymous methods in addition to iterators.
354 (EmitContext.EmitCapturedVariableInstance): This emits whatever
355 code is necessary on the stack to access the instance to a local
356 variable (the variable will be accessed as a field).
358 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
359 EmitContext.EmitAddressOfParameter): Routines to support
360 parameters (not completed at this point).
362 Removals: Removed RemapLocal and RemapLocalLValue. We probably
363 will also remove the parameters.
365 * convert.cs (Convert): Define a `ConstantEC' which points to a
366 null. This is just to prefity some code that uses
367 ImplicitStandardConversion code and do not have an EmitContext
370 The idea is to flag explicitly that at that point in time, it is
371 known that the conversion will not trigger the delegate checking
372 code in implicit conversions (which requires a valid
375 Everywhere: pass new EmitContext parameter since
376 ImplicitStandardConversionExists now requires it to check for
377 anonymous method conversions.
379 (Convert.ImplicitStandardConversionExists): If the type of an
380 expression is the anonymous_method_type, and the type is a
381 delegate, we invoke the AnonymousMethod.Compatible method to check
382 whether an implicit conversion is possible.
384 (Convert.ImplicitConversionStandard): Only do implicit method
385 group conversions if the language level is not ISO_1.
387 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
388 MethodInfo for the Invoke method. used by Delegate and
391 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
392 method conversions if the target type is a delegate.
394 Removed extra debugging nops.
396 (LocalVariableReference): Turn the `local_info' into a public
399 Add `prepared' field, the same hack used for FieldExprs to cope
400 with composed assignments, as Local variables do not necessarily
401 operate purely on the stack as they used to: they can be captured
404 Add `temp' for a temporary result, like fields.
406 Refactor DoResolve and DoResolveLValue into DoResolveBase.
408 It now copes with Local variables that are captured and emits the
409 proper instance variable to load it from a field in the captured
412 (ParameterReference.DoResolveBase): During the resolve phase,
413 capture parameters if we are in an anonymous method.
415 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
416 anonymous method, use the EmitContext helper routines to emit the
419 * iterators.cs: Set RemapToProxy to true/false during the
422 * parameters.cs (GetParameterByName): New helper method.
424 * typemanager.cs (anonymous_method_type) a new type that
425 represents an anonyous method. This is always an internal type,
426 used as a fencepost to test against the anonymous-methodness of an
429 2004-10-24 Marek Safar <marek.safar@seznam.cz>
431 Fixed bugs #63705, #67130
432 * decl.cs (MemberCache.MemberCache): Add parameter to distinguish
433 imported and defined interfaces.
434 (CacheEntry, EntryType): Changed to protected internal.
436 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
439 * typemanager.cs (LookupInterfaceContainer): New method.
440 Fills member container from base interfaces.
442 2004-10-20 Marek Safar <marek.safar@seznam.cz>
444 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
446 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
448 2004-10-18 Martin Baulig <martin@ximian.com>
450 Merged latest changes into gmcs. Please keep this comment in
451 here, it makes it easier for me to see what changed in MCS since
452 the last time I merged.
454 2004-10-18 Martin Baulig <martin@ximian.com>
456 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
457 `Type' directly, but call ResolveType() on it.
458 (Catch.Resolve): Likewise.
459 (Foreach.Resolve): Likewise.
461 2004-10-18 Martin Baulig <martin@ximian.com>
463 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
464 `Type' directly, but call ResolveType() on it.
465 (Probe.DoResolve): Likewise.
466 (ArrayCreation.LookupType): Likewise.
467 (TypeOf.DoResolve): Likewise.
468 (SizeOf.DoResolve): Likewise.
470 2004-10-18 Martin Baulig <martin@ximian.com>
472 * expression.cs (Invocation.BetterFunction): Put back
473 TypeManager.TypeToCoreType().
475 2004-10-18 Raja R Harinath <rharinath@novell.com>
477 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
480 2004-10-18 Martin Baulig <martin@ximian.com>
482 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
483 `Type' directly, but call ResolveType() on it.
485 2004-10-18 Martin Baulig <martin@ximian.com>
487 * class.cs (FieldMember.Define): Don't access the TypeExpr's
488 `Type' directly, but call ResolveType() on it.
489 (MemberBase.DoDefine): Likewise.
491 * expression.cs (New.DoResolve): Don't access the TypeExpr's
492 `Type' directly, but call ResolveType() on it.
493 (ComposedCast.DoResolveAsTypeStep): Likewise.
495 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
496 `Type' directly, but call ResolveType() on it.
498 2004-10-17 John Luke <john.luke@gmail.com>
500 * class.cs (Operator.GetSignatureForError): use CSharpName
502 * parameter.cs (Parameter.GetSignatureForError): Returns
503 correct name even if was not defined.
505 2004-10-13 Raja R Harinath <rharinath@novell.com>
508 * class.cs (TypeContainer.EmitContext): New property.
509 (DefineNestedTypes): Create an emitcontext for each part.
510 (MethodCore.DoDefineParameters): Use container's emitcontext.
511 Pass type array to InternalParameters.
512 (MemberBase.DoDefine): Use container's emitcontext.
513 (FieldMember.Define): Likewise.
514 (Event.Define): Likewise.
515 (SetMethod.GetParameterInfo): Change argument to EmitContext.
516 Pass type array to InternalParameters.
517 (SetIndexerMethod.GetParameterInfo): Likewise.
518 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
519 * delegate.cs (Define): Pass emitcontext to
520 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
521 array to InternalParameters.
522 * expression.cs (ParameterReference.DoResolveBase): Pass
523 emitcontext to GetParameterInfo.
524 (ComposedCast.DoResolveAsTypeStep): Remove check on
525 ec.ResolvingTypeTree.
526 * parameter.cs (Parameter.Resolve): Change argument to
527 EmitContext. Use ResolveAsTypeTerminal.
528 (Parameter.GetSignature): Change argument to EmitContext.
529 (Parameters.ComputeSignature): Likewise.
530 (Parameters.ComputeParameterTypes): Likewise.
531 (Parameters.GetParameterInfo): Likewise.
532 (Parameters.ComputeAndDefineParameterTypes): Likewise.
533 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
534 * support.cs (InternalParameters..ctor): Remove variant that takes
536 * typemanager.cs (system_intptr_expr): New.
537 (InitExpressionTypes): Initialize it.
539 2004-10-12 Chris Toshok <toshok@ximian.com>
541 * cs-parser.jay: fix location for try_statement and catch_clause.
543 2004-10-11 Martin Baulig <martin@ximian.com>
545 * report.cs: Don't make --fatal abort on warnings, we have
546 -warnaserror for that.
548 2004-10-07 Raja R Harinath <rharinath@novell.com>
550 More DeclSpace.ResolveType avoidance.
551 * decl.cs (MemberCore.InUnsafe): New property.
552 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
553 with newly created EmitContext.
554 (FieldMember.Define): Likewise.
555 * delegate.cs (Delegate.Define): Likewise.
556 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
557 only if normal name-lookup fails.
558 (TypeExpr.DoResolve): Enable error-checking.
559 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
560 (SizeOf.DoResolve): Likewise.
561 (ComposedCast.DoResolveAsTypeStep): Likewise.
562 (StackAlloc.DoResolve): Likewise.
563 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
564 (Block.Unsafe): New property.
565 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
566 (Unsafe): Set 'unsafe' flag of contained block.
567 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
568 (Fixed.Resolve): Likewise.
569 (Catch.Resolve): Likewise.
570 (Using.ResolveLocalVariableDecls): Likewise.
571 (Foreach.Resolve): Likewise.
573 2004-10-05 John Luke <john.luke@gmail.com>
575 * cs-parser.jay: add location to error CS0175
577 2004-10-04 Miguel de Icaza <miguel@ximian.com>
579 * ecore.cs (Expression.Constantity): Add support for turning null
582 * const.cs (Const.Define): Allow constants to be reference types
583 as long as the value is Null.
585 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
587 * namespace.cs (NamespaceEntry.Using): No matter which warning
588 level is set, check if this namespace name has already been added.
590 2004-10-03 Ben Maurer <bmaurer@ximian.com>
592 * expression.cs: reftype [!=]= null should always use br[true,false].
595 2004-10-03 Marek Safar <marek.safar@seznam.cz>
598 * attribute.cs: Enum conversion moved to
599 GetAttributeArgumentExpression to be applied to the all
602 2004-10-01 Raja R Harinath <rharinath@novell.com>
604 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
605 * class.c (TypeContainer.DefineType): Flag error if
606 base types aren't accessible due to access permissions.
607 * decl.cs (DeclSpace.ResolveType): Move logic to
608 Expression.ResolveAsTypeTerminal.
609 (DeclSpace.ResolveTypeExpr): Thin layer over
610 Expression.ResolveAsTypeTerminal.
611 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
612 Refactor code into NestedAccess. Use it.
613 (DeclSpace.NestedAccess): New.
614 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
615 argument to silence errors. Check access permissions.
616 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
617 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
618 (Cast.DoResolve): Likewise.
619 (New.DoResolve): Likewise.
620 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
621 (TypeOf.DoResolve): Likewise.
623 * expression.cs (Invocation.BetterConversion): Return the Type of
624 the better conversion. Implement section 14.4.2.3 more faithfully.
625 (Invocation.BetterFunction): Make boolean. Make correspondence to
626 section 14.4.2.2 explicit.
627 (Invocation.OverloadResolve): Update.
628 (Invocation): Remove is_base field.
629 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
630 (Invocation.Emit): Likewise.
632 2004-09-27 Raja R Harinath <rharinath@novell.com>
634 * README: Update to changes.
636 2004-09-24 Marek Safar <marek.safar@seznam.cz>
638 * cs-parser.jay: Reverted 642 warning fix.
640 2004-09-23 Marek Safar <marek.safar@seznam.cz>
643 * decl.cs (FindMemberWithSameName): Indexer can have more than
646 2004-09-23 Marek Safar <marek.safar@seznam.cz>
648 * expression.cs (LocalVariableReference.DoResolveLValue):
649 Do not report warning 219 for out values.
650 (EmptyExpression.Null): New member to avoid extra allocations.
652 2004-09-23 Marek Safar <marek.safar@seznam.cz>
654 * cs-parser.jay: Fix wrong warning 642 report.
656 * cs-tokenizer.cs (CheckNextToken): New helper;
657 Inspect next character if is same as expected.
659 2004-09-23 Martin Baulig <martin@ximian.com>
661 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
662 (Convert.ImplicitReferenceConversionExists): Likewise.
664 2004-09-23 Marek Safar <marek.safar@seznam.cz>
666 * class.cs (Operator.Define): Add error 448 and 559 report.
668 2004-09-22 Marek Safar <marek.safar@seznam.cz>
670 * class.cs (MemberBase.IsTypePermitted): New protected
671 method for checking error CS0610.
673 2004-09-22 Marek Safar <marek.safar@seznam.cz>
675 * class.cs (TypeContainer.HasExplicitLayout): New property
676 Returns whether container has StructLayout attribute set Explicit.
677 (FieldMember): New abstract class for consts and fields.
678 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
679 (Field): Reuse FieldMember.
681 * const.cs (Const): Reuse FieldMember.
683 * rootcontext.cs: EmitConstants call moved to class.
685 2004-09-22 Martin Baulig <martin@ximian.com>
687 Thanks to Peter Sestoft for this bug report.
689 * expression.cs (Conditional): If both the `trueExpr' and the
690 `falseExpr' is a NullLiteral, return a NullLiteral.
692 2004-09-22 Martin Baulig <martin@ximian.com>
694 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
695 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
696 for the "get_Current" call.
698 2004-09-22 Martin Baulig <martin@ximian.com>
700 Marek and me just fixed one of our oldest bugs: #28562 :-)
702 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
704 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
705 we're an EnumConstant, just return that.
706 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
707 an EnumConstant. In this case, we need to use GetValueAsEnumType()
708 to get the value which'll actually be written into the attribute.
709 However, we have to use GetValue() to access the attribute's value
712 2004-09-22 Marek Safar <marek.safar@seznam.cz>
714 * constant.cs (Constant.IsNegative): New abstract property
717 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
718 (StackAlloc.DoResolve): Reused IsNegative.
720 2004-09-21 Martin Baulig <martin@ximian.com>
722 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
723 if we're used in an iterator, we may be called from different
726 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
727 we actually have an exception block.
729 2004-09-20 John Luke <jluke@cfl.rr.com>
731 * class.cs, cs-parser.jay: Improve the error report for 1520:
732 report the actual line where the error happens, not where the
735 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
736 Pass location information that was available elsewhere.
738 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
740 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
741 runtime to delay sign assemblies.
743 2004-09-19 Miguel de Icaza <miguel@ximian.com>
745 * cs-parser.jay: Do not report the stack trace, this is barely
748 2004-08-22 John Luke <john.luke@gmail.com>
750 * driver.cs : check that a resource id is not already used
751 before adding it, report CS1508 if it is, bug #63637
753 2004-09-19 Miguel de Icaza <miguel@ximian.com>
755 * ecore.cs: Removed dead code.
757 2004-09-18 Marek Safar <marek.safar@seznam.cz>
759 * class.cs: Do not report warning CS0067 on the interfaces.
761 2004-09-16 Marek Safar <marek.safar@seznam.cz>
763 * cs-parser.jay: Add error 504 report.
765 2004-09-16 Marek Safar <marek.safar@seznam.cz>
767 * rootcontext.cs: WarningLevel is 4 by default now.
769 * statement.cs (Fixed.Resolve): Do not null
772 2004-09-16 Marek Safar <marek.safar@seznam.cz>
775 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
776 deep search when property is not virtual.
777 (PropertyExpr.ResolveAccessors): Make one call for both
780 2004-09-15 Marek Safar <marek.safar@seznam.cz>
783 * statement.cs: Error 152 report constains also location.
785 2004-09-15 Marek Safar <marek.safar@seznam.cz>
788 * const.cs: Explicitly set constant as static.
790 2004-09-15 Marek Safar <marek.safar@seznam.cz>
793 * cs-parser.jay: Add error 1017 report.
795 2004-09-15 Marek Safar <marek.safar@seznam.cz>
797 Fixed bug #59980, #64224
798 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
800 * typemanager.cs (IsSpecialMethod): Simplified
802 2004-09-14 Marek Safar <marek.safar@seznam.cz>
804 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
805 condition with better params.
807 2004-09-14 Marek Safar <marek.safar@seznam.cz>
810 * attribute.cs (Resolve): Property has to have both
813 2004-09-14 Martin Baulig <martin@ximian.com>
815 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
817 2004-09-14 Marek Safar <marek.safar@seznam.cz>
820 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
821 called and is obsolete then this member suppress message
822 when call is inside next [Obsolete] method or type.
824 * expression.cs: Use TestObsoleteMethodUsage member.
826 2004-09-14 Martin Baulig <martin@ximian.com>
828 * cs-parser.jay: Sync a bit with the GMCS version.
830 2004-09-14 Martin Baulig <martin@ximian.com>
832 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
833 (CSharpParser.yacc_verbose_flag): New public field.
835 * genericparser.cs: Removed.
837 2004-09-14 Raja R Harinath <rharinath@novell.com>
839 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
841 2004-09-13 Marek Safar <marek.safar@seznam.cz>
843 * class.cs (MethodCore.CheckBase): Fix bug #65757.
845 2004-09-10 Martin Baulig <martin@ximian.com>
847 Backported my MemberName changes from GMCS into MCS.
849 - we are now using a special `MemberName' class instead of using
850 strings; in GMCS, the `MemberName' also contains the type
853 - changed the grammar rules a bit:
854 * the old `member_name' is now a `namespace_or_type_name':
855 The rule is that we use `namespace_or_type_name' everywhere
856 where we expect either a "member name" (GetEnumerator) or a
857 "member name" with an explicit interface name
858 (IEnumerable.GetEnumerator).
859 In GMCS, the explicit interface name may include type arguments
860 (IEnumerable<T>.GetEnumerator).
861 * we use `member_name' instead of just `IDENTIFIER' for
863 The rule is that we use `member_name' wherever a member may
864 have type parameters in GMCS.
866 * decl.cs (MemberName): New public class.
867 (MemberCore.MemberName): New public readonly field.
868 (MemberCore.ctor): Take a `MemberName' argument, not a string.
869 (DeclSpace): Likewise.
871 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
872 * enum.cs (Enum.ctor): Likewise.
874 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
876 (AliasEntry.ctor): Take a MemberName, not an Expression.
877 (AliasEntry.UsingAlias): Likewise.
879 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
880 (IMethodData.MemberName): Changed type from string to MemberName.
881 (MemberBase.ExplicitInterfaceName): Likewise.
882 (AbstractPropertyEventMethod.SetupName): Make this private.
883 (AbstractPropertyEventMethod.ctor): Added `string prefix'
884 argument; compute the member name here.
885 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
886 on the `member.MemberName' and the `prefix'.
888 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
890 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
891 thus, we get a `MemberName' instead of a `string'. These
892 declarations may have type parameters in GMCS.
893 (interface_method_declaration, delegate_declaration): Likewise.
894 (class_declaration, interface_declaration): Likewise.
895 (method_header): Use `namespace_or_type_name' instead of
896 `member_name'. We may be an explicit interface implementation.
897 (property_declaration, event_declaration): Likewise.
898 (member_name): This is now just an `IDENTIFIER', not a
899 `namespace_or_type_name'.
900 (type_name, interface_type): Removed.
901 (namespace_or_type_name): Return a MemberName, not an Expression.
902 (primary_expression): Use `member_name' instead of `IDENTIFIER';
903 call GetTypeExpression() on the MemberName to get an expression.
904 (IndexerDeclaration.interface_type): Changed type from string to
906 (MakeName): Operate on MemberName's instead of string's.
908 2004-09-13 Raja R Harinath <rharinath@novell.com>
911 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
912 (NamespaceEntry.Lookup): Add new argument to flag if we want the
913 lookup to avoid symbols introduced by 'using'.
914 * rootcontext.cs (NamespaceLookup): Update.
916 2004-09-12 Marek Safar <marek.safar@seznam.cz>
918 * class.cs (TypeContainer.DoDefineMembers): Do not call
919 DefineDefaultConstructor for static classes.
921 2004-09-12 Marek Safar <marek.safar@seznam.cz>
923 * attribute.cs (Attribute.Resolve): Add error 653 report.
925 * class.cs (Class.ApplyAttributeBuilder): Add error 641
927 (Method.ApplyAttributeBuilder): Add error 685 report.
928 (Operator.Define): Add error 564 report.
930 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
932 * expression.cs (Invocation.DoResolve): Add error
935 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
938 2004-09-11 Marek Safar <marek.safar@seznam.cz>
940 * class.cs (ConstructorInitializer.Resolve):
941 Wrong error number (515->516).
943 2004-09-11 Marek Safar <marek.safar@seznam.cz>
945 * class.cs (Indexer.Define): Add error 631 report.
947 2004-09-11 Marek Safar <marek.safar@seznam.cz>
949 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
951 2004-09-11 Marek Safar <marek.safar@seznam.cz>
953 * expression.cs (Probe.DoResolve): Add error CS0241 report.
955 2004-09-10 Marek Safar <marek.safar@seznam.cz>
957 * cs-parser.jay: Added error CS0241 report.
959 2004-09-10 Raja R Harinath <rharinath@novell.com>
961 * cs-parser.jay (fixed_statement): Introduce a scope for the
962 declaration in the 'fixed' statement.
964 2004-09-09 Marek Safar <marek.safar@seznam.cz>
966 * cs-parser.jay: Added CS0230 error report.
968 2004-09-09 Marek Safar <marek.safar@seznam.cz>
970 * cs-parser.jay: Added errors CS0231 and CS0257 report.
972 2004-09-09 Marek Safar <marek.safar@seznam.cz>
974 * expression.cs (Argument.Resolve): Added error CS0192 and
977 2004-09-09 Marek Safar <marek.safar@seznam.cz>
979 C# 2.0 #pragma warning feature
981 * cs-tokenizer.cs (PreProcessPragma): New method;
982 Handles #pragma directive.
984 * report.cs (WarningRegions): New class; Support
985 class for #pragma warning directive. It tests whether
986 warning is enabled for a given line.
988 2004-09-08 Miguel de Icaza <miguel@ximian.com>
990 * const.cs: Add more descriptive error report, tahnks to
993 2004-09-08 Marek Safar <marek.safar@seznam.cz>
995 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
997 2004-09-07 Miguel de Icaza <miguel@ximian.com>
999 * expression.cs: Apply patch from Ben: Remove dead code from
1000 ArrayCreation, and remove the TurnintoConstant call in const.cs,
1001 as that code just threw an exception anwyays.
1003 * const.cs: Remove the call to the turnintoconstant, for details
1006 * literal.cs: The type of the null-literal is the null type; So
1007 we use a placeholder type (literal.cs:System.Null, defined here)
1010 * expression.cs (Conditional.DoResolve): Remove some old code that
1011 is no longer needed, conversions have been fixed.
1013 (ArrayCreationExpression.DoResolve): Return false if we fail to
1014 resolve the inner expression.
1016 2004-09-07 Raja R Harinath <rharinath@novell.com>
1019 * cs-parser.jay (delegate_declaration): Record a delegate
1020 declaration as a type declaration.
1021 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
1023 2004-09-06 Miguel de Icaza <miguel@ximian.com>
1025 * parameter.cs: Do not crash if the type can not be resolved.
1027 * expression.cs: Report errors with unsafe pointers, fixes #64896
1029 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
1031 * expression.cs: Pointer arith always needs to do a conv.i
1032 if the operand is a long. fix 65320
1034 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1036 Fixed cs0619-37.cs, cs0619-38.cs
1038 * enum.cs (GetObsoleteAttribute): Removed.
1040 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
1041 on Enum member is double staged. The first is tested member
1044 2004-09-04 Marek Safar <marek.safar@seznam.cz>
1046 Fixed #56986, #63631, #65231
1048 * class.cs: (TypeContainer.AddToMemberContainer): New method,
1049 adds member to name container.
1050 (TypeContainer.AddToTypeContainer): New method, adds type to
1052 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
1053 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
1054 AddOperator): Simplified by reusing AddToMemberContainer.
1055 (TypeContainer.UserDefinedStaticConstructor): Changed to property
1057 (Method.CheckForDuplications): Fixed implementation to test all
1059 (MemberBase): Detection whether member is explicit interface
1060 implementation is now in constructor.
1061 (MemberBase.UpdateMemberName): Handles IndexerName.
1062 (Accessor): Changed to keep also location information.
1063 (AbstractPropertyEventMethod): Is derived from MemberCore.
1064 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
1065 will be emited or not.
1066 (PropertyBase.AreAccessorsDuplicateImplementation):
1067 Tests whether accessors are not in collision with some method.
1068 (Operator): Is derived from MethodCore to simplify common
1071 * decl.cs (Flags.TestMethodDuplication): Test for duplication
1073 (DeclSpace.AddToContainer): Adds the member to defined_names
1074 table. It tests for duplications and enclosing name conflicts.
1076 * enum.cs (EnumMember): Clean up to reuse the base structures
1078 2004-09-03 Martin Baulig <martin@ximian.com>
1080 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
1081 into TypeContainer, to make partial classes work again.
1083 2004-09-03 Martin Baulig <martin@ximian.com>
1085 * rootcontext.cs (RootContext.V2): Removed.
1087 2004-03-23 Martin Baulig <martin@ximian.com>
1089 * expression.cs (Invocation.OverloadResolve): Added `bool
1090 may_fail' argument and use it instead of the Location.IsNull() hack.
1092 2004-09-03 Martin Baulig <martin@ximian.com>
1094 Merged latest changes into gmcs. Please keep this comment in
1095 here, it makes it easier for me to see what changed in MCS since
1096 the last time I merged.
1098 2004-09-03 Raja R Harinath <rharinath@novell.com>
1101 * expression.cs (BetterConversion): Don't allow either conversion
1102 to be null. Remove redundant implicit conversion test when 'q ==
1103 null' -- when this function is invoked, we already know that the
1104 implicit conversion exists.
1105 (BetterFunction): Assume that 'best' is non-null. Remove
1106 redundant reimplementation of IsApplicable when 'best' is null.
1107 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
1108 number of arguments.
1109 (IsAncestralType): Extract from OverloadResolve.
1110 (OverloadResolve): Make robust to the MethodGroupExpr being
1111 unsorted. Implement all the logic of Section 14.5.5.1, and
1112 support overloading of methods from multiple applicable types.
1113 Clean up logic somewhat. Don't pass null methods to BetterFunction.
1115 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
1116 (RealError, Warning): Append type of report to related symbol.
1118 2004-09-03 Marek Safar <marek.safar@seznam.cz>
1120 * enum.cs: Fixed CLS-Compliance checks for enum members.
1121 Error tests cs3008-8.cs, cs3014-8.cs
1123 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1125 Fixed bug #62342, #63102
1126 * class.cs: ImplementIndexer uses member.IsExplicitImpl
1127 like ImplementMethod.
1129 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1131 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1134 2004-09-02 Martin Baulig <martin@ximian.com>
1136 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
1137 TypeManager.GetArgumentTypes() rather than calling GetParameters()
1140 2004-09-01 Marek Safar <marek.safar@seznam.cz>
1142 C# 2.0 Static classes implemented
1144 * class.cs (TypeContainer): instance_constructors,
1145 initialized_fields, initialized_static_fields,
1146 default_constructor, base_inteface_types are protected to be
1147 accessible from StaticClass.
1148 (TypeContainer.DefineDefaultConstructor): New virtual method
1149 for custom default constructor generating
1150 (StaticClass): New class to handle "Static classes" feature.
1152 * cs-parser.jay: Handle static keyword on class like instance
1155 * driver.cs: Added "/langversion" command line switch with two
1156 options (iso-1, default).
1158 2004-08-31 Marek Safar <marek.safar@seznam.cz>
1160 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
1162 2004-08-31 Miguel de Icaza <miguel@ximian.com>
1164 * delegate.cs: Style.
1166 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
1168 * delegate.cs: Add seperate instance expr field for miguel.
1170 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1172 * PointerArithmetic (Resolve): make sure we are not doing
1173 pointer arith on void*. Also, make sure we are resolved
1174 by not setting eclass until resolve.
1176 All callers: Make sure that PointerArithmetic gets resolved.
1178 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1180 * ArrayCreation (LookupType): If the type does not resolve
1181 to an array, give an error.
1183 2004-08-27 Marek Safar <marek.safar@seznam.cz>
1185 * statement.cs (Try.Resolve): Fixed bug #64222
1187 2004-08-27 Martin Baulig <martin@ximian.com>
1190 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
1193 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1195 * ecore.cs (Constantify): Get underlying type via
1196 System.Enum.GetUnderlyingType to avoid StackOverflow on the
1197 Windows in special cases.
1199 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1201 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
1202 for obtaining also private methods.
1203 (GetRemoveMethod): Used GetRemoveMethod (true)
1204 for obtaining also private methods.
1206 2004-08-24 Martin Baulig <martin@ximian.com>
1208 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
1209 MethodAttributes.HideBySig for operators.
1211 2004-08-23 Martin Baulig <martin@ximian.com>
1213 Back to the old error reporting system :-)
1215 * report.cs (Message): Removed.
1216 (Report.MessageData, ErrorData, WarningData): Removed.
1217 (Report.Error, Warning): Back to the old system.
1219 2004-08-23 Martin Baulig <martin@ximian.com>
1221 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
1223 * class.cs (TypeContainer.ParentContainer): New public virtual
1224 method; replaces the explicit interface implementation.
1225 (ClassPart.ParentContainer): Override.
1227 2004-08-23 Martin Baulig <martin@ximian.com>
1229 * statement.cs (Switch): Added support for constant switches; see
1230 #59428 or test-285.cs.
1232 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1235 * statement.cs (GetEnumeratorFilter): Removed useless
1236 logic because C# specs is strict. GetEnumerator must be
1239 2004-08-22 Martin Baulig <martin@ximian.com>
1241 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1242 a switch and may break, reset the barrier. Fixes #59867.
1244 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1246 CLS-Compliance speed up (~5% for corlib)
1248 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
1249 New method. Tests container for CLS-Compliant names
1251 * class.cs (TypeContainer.VerifyClsName): New method.
1252 Checks whether container name is CLS Compliant.
1253 (Constructor): Implements IMethodData.
1255 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
1256 low-case table for CLS Compliance test.
1257 (MemberCache.VerifyClsParameterConflict): New method.
1258 Checks method parameters for CS3006 error.
1260 * enum.cs (EnumMember): Is derived from MemberCore.
1261 (Enum.VerifyClsName): Optimized for better performance.
1263 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1265 * report.cs: Renamed Error_T to Error and changed all
1268 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1270 * class.cs (TypeContainer.IndexerArrayList): New inner class
1271 container for indexers.
1272 (TypeContainer.DefaultIndexerName): New constant for default
1273 indexer name. Replaced all "Item" with this constant.
1274 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
1276 * typemanager.cs (TypeManager.default_member_ctor): Cache here
1277 DefaultMemberAttribute constructor.
1279 2004-08-05 Martin Baulig <martin@ximian.com>
1281 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1284 2004-08-05 Marek Safar <marek.safar@seznam.cz>
1286 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
1287 multi platforms problem.
1289 * compiler.csproj: Included shared files.
1291 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1293 Fix bug 60333, 55971 in the more general way
1294 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1295 Added arg_type argument for constant conversion.
1296 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
1298 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1301 * class.cs (TypeContainer ): New inner classes MethodArrayList,
1302 OperatorArrayList, MethodCoreArrayList for typecontainer
1303 containers. Changed class member types to these new types.
1304 (MethodArrayList.DefineMembers): Added test for CS0659.
1306 2004-08-04 Miguel de Icaza <miguel@ximian.com>
1308 * cfold.cs: Synchronize the folding with the code in expression.cs
1309 Binary.DoNumericPromotions for uint operands.
1311 * attribute.cs: Revert patch from Raja, it introduced a regression
1312 while building Blam-1.2.1 (hard to isolate a test case).
1314 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1318 (TypeContainer.Define): Renamed to DefineContainerMembers because of
1320 (MethodCore.parent_method): New member. The method we're overriding
1321 if this is an override method.
1322 (MethodCore.CheckBase): Moved from Method class and made common.
1323 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
1325 (MethodCore.CheckForDuplications): New abstract method. For custom
1326 member duplication search in a container
1327 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
1328 method and its return type.
1329 (Event.conflict_symbol): New member. Symbol with same name in the
1333 (MemberCache.FindMemberWithSameName): New method. The method
1334 is looking for conflict with inherited symbols.
1336 2004-08-04 Martin Baulig <martin@ximian.com>
1338 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
1340 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
1342 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1344 * report.cs (Message): New enum for better error, warning reference in
1346 (MessageData): New inner abstract class. It generally handles printing of
1347 error and warning messages.
1348 Removed unused Error, Warning, Message methods.
1350 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1352 Fix for cs0592-8.cs test
1354 (Attributable.ValidAttributeTargets): Made public.
1355 (Attribute.ExplicitTarget): New member for explicit target value.
1356 (Attribute.CheckTargets): Now we translate explicit attribute
1357 target to Target here.
1359 2004-08-03 Ben Maurer <bmaurer@ximian.com>
1361 * ecore.cs (MethodGroupExpr): new IsBase property.
1363 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
1365 * delegate.cs (DelegateCreation): store a MethodGroupExpr
1366 rather than an instance expr.
1368 (DelegateCreation.Emit): Use the method group rather than
1369 the instance expression. Also, if you have base.Foo as the
1370 method for a delegate, make sure to emit ldftn, not ldftnvirt.
1372 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
1374 (NewDelegate.DoResolve): Only check for the existance of Invoke
1375 if the method is going to be needed. Use MethodGroupExpr.
1377 (NewDelegate.Emit): Remove, DelegateCreation implements this.
1379 * expression.cs: For pointer arith., make sure to use
1380 the size of the type, not the size of the pointer to
1383 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1386 * class.cs (Class): Added error CS0502 test.
1388 2004-08-03 John Luke <jluke@cfl.rr.com>
1389 Raja R Harinath <rharinath@novell.com>
1392 * attribute.cs (Attribute.complained_before): New flag.
1393 (Attribute.ResolveType, Attribute.Resolve),
1394 (Attribute.DefinePInvokeMethod): Set it.
1395 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
1397 2004-08-03 Martin Baulig <martin@ximian.com>
1399 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
1400 use a user-defined operator; we still need to do numeric
1401 promotions in case one argument is a builtin type and the other
1402 one has an implicit conversion to that type. Fixes #62322.
1404 2004-08-02 Martin Baulig <martin@ximian.com>
1406 * statement.cs (LocalInfo.Flags): Added `IsThis'.
1407 (LocalInfo.IsThis): New public property.
1408 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
1410 2004-08-01 Martin Baulig <martin@ximian.com>
1412 * class.cs (TypeContainer.GetClassBases): Don't set the default
1413 here since we may get called from GetPartialBases().
1414 (TypeContainer.DefineType): If GetClassBases() didn't return a
1415 parent, use the default one.
1417 2004-07-30 Duncan Mak <duncan@ximian.com>
1419 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
1421 2004-07-30 Martin Baulig <martin@ximian.com>
1423 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
1425 * class.cs (SourceMethod): New public class, derive from the
1426 symbol writer's ISourceMethod.
1427 (Method): Use the new symbol writer API.
1429 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
1430 as argument and use the new symbol writer.
1433 (SourceFile): Implement the symbol writer's ISourceFile.
1434 (Location.SymbolDocument): Removed.
1435 (Location.SourceFile): New public property.
1437 * symbolwriter.cs: Use the new symbol writer API.
1439 2004-07-30 Raja R Harinath <rharinath@novell.com>
1441 * Makefile (install-local): Remove. Functionality moved to
1444 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
1446 * Makefile: Install mcs.exe.config file together with mcs.exe.
1447 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
1448 correct runtime version.
1450 2004-07-25 Martin Baulig <martin@ximian.com>
1453 (TypeContainer.RegisterOrder): Removed, this was unused.
1454 (TypeContainer, interface_order): Removed.
1455 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
1456 TypeContainer as argument since we can also be called with a
1457 `PartialContainer' for a partial class/struct/interface.
1458 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
1459 of checking whether we're an `Interface' - we could be a
1461 (PartialContainer.Register): Override; call
1462 AddClass()/AddStruct()/AddInterface() on our parent.
1464 * cs-parser.jay (interface_member_declaration): Add things to the
1465 `current_container', not the `current_class'.
1467 * rootcontext.cs (RegisterOrder): The overloaded version which
1468 takes an `Interface' was unused, removed.
1470 * typemanager.cs (TypeManager.LookupInterface): Return a
1471 `TypeContainer', not an `Interface'.
1472 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
1473 contain a `PartialContainer' for an interface, so check it's
1474 `Kind' to figure out what it is.
1476 2004-07-25 Martin Baulig <martin@ximian.com>
1478 * class.cs (Class.DefaultTypeAttributes): New public constant.
1479 (Struct.DefaultTypeAttributes): Likewise.
1480 (Interface.DefaultTypeAttributes): Likewise.
1481 (PartialContainer.TypeAttr): Override this and add the
1482 DefaultTypeAttributes.
1484 2004-07-25 Martin Baulig <martin@ximian.com>
1486 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
1487 we can just use the `Parent' field instead.
1489 2004-07-25 Martin Baulig <martin@ximian.com>
1491 * class.cs (TypeContainer.Emit): Renamed to EmitType().
1493 2004-07-25 Martin Baulig <martin@ximian.com>
1495 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
1496 our parts before defining any methods.
1497 (TypeContainer.VerifyImplements): Make this virtual.
1498 (ClassPart.VerifyImplements): Override and call VerifyImplements()
1499 on our PartialContainer.
1501 2004-07-25 Martin Baulig <martin@ximian.com>
1503 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
1505 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
1506 argument, we can just use the `Parent' field instead.
1509 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
1510 (MemberBase.DoDefine): Likewise.
1512 2004-07-24 Martin Baulig <martin@ximian.com>
1514 * decl.cs (MemberCore.Parent): New public field.
1515 (DeclSpace.Parent): Moved to MemberCore.
1517 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
1518 (MemberBase.ctor): Added TypeContainer argument, pass it to our
1520 (FieldBase, Field, Operator): Likewise.
1521 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
1522 (EventField, Event): Likewise.
1524 2004-07-23 Martin Baulig <martin@ximian.com>
1526 * class.cs (PartialContainer): New public class.
1527 (ClassPart): New public class.
1528 (TypeContainer): Added support for partial classes.
1529 (TypeContainer.GetClassBases): Splitted some of the functionality
1530 out into GetNormalBases() and GetPartialBases().
1532 * cs-tokenizer.cs (Token.PARTIAL): New token.
1533 (Tokenizer.consume_identifier): Added some hacks to recognize
1534 `partial', but only if it's immediately followed by `class',
1535 `struct' or `interface'.
1537 * cs-parser.jay: Added support for partial clases.
1539 2004-07-23 Martin Baulig <martin@ximian.com>
1541 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
1542 a `DeclSpace' and also made it readonly.
1543 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
1544 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
1545 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
1547 * cs-parser.jay: Pass the `current_class', not the
1548 `current_container' (at the moment, this is still the same thing)
1549 to a new Method, Property, Event, Indexer or Constructor.
1551 2004-07-23 Martin Baulig <martin@ximian.com>
1553 * cs-parser.jay (CSharpParser): Added a new `current_class' field
1554 and removed the `current_interface' one.
1555 (struct_declaration, class_declaration, interface_declaration):
1556 Set `current_class' to the newly created class/struct/interface;
1557 set their `Bases' and call Register() before parsing their body.
1559 2004-07-23 Martin Baulig <martin@ximian.com>
1561 * class.cs (Kind): New public enum.
1562 (TypeContainer): Made this class abstract.
1563 (TypeContainer.Kind): New public readonly field.
1564 (TypeContainer.CheckDef): New public method; moved here from
1566 (TypeContainer.Register): New public abstract method.
1567 (TypeContainer.GetPendingImplementations): New public abstract
1569 (TypeContainer.GetClassBases): Removed the `is_class' and
1570 `is_iface' parameters.
1571 (TypeContainer.DefineNestedTypes): Formerly known as
1573 (ClassOrStruct): Made this class abstract.
1575 * tree.cs (RootTypes): New public type.
1577 2004-07-20 Martin Baulig <martin@ximian.com>
1579 * tree.cs (Tree.RecordNamespace): Removed.
1580 (Tree.Namespaces): Removed.
1582 * rootcontext.cs (RootContext.IsNamespace): Removed.
1584 * cs-parser.jay (namespace_declaration): Just create a new
1585 NamespaceEntry here.
1587 2004-07-20 Martin Baulig <martin@ximian.com>
1589 * statement.cs (ExceptionStatement): New abstract class. This is
1590 now used as a base class for everyone who's using `finally'.
1591 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
1592 our local variables before using them.
1594 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
1595 virtual method. This is used by Yield.Resolve() to "steal" an
1596 outer block's `finally' clauses.
1597 (FlowBranchingException): The .ctor now takes an ExceptionStatement
1600 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
1601 version which takes an ExceptionStatement. This version must be
1602 used to create exception branchings.
1605 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
1606 (Iterator.EmitMoveNext): Added exception support; protect the
1607 block with a `fault' clause, properly handle 'finally' clauses.
1608 (Iterator.EmitDispose): Run all the `finally' clauses here.
1610 2004-07-20 Martin Baulig <martin@ximian.com>
1612 * iterator.cs: This is the first of a set of changes in the
1613 iterator code. Match the spec more closely: if we're an
1614 IEnumerable, then GetEnumerator() must be called. The first time
1615 GetEnumerator() is called, it returns the current instance; all
1616 subsequent invocations (if any) must create a copy.
1618 2004-07-19 Miguel de Icaza <miguel@ximian.com>
1620 * expression.cs: Resolve the constant expression before returning
1623 2004-07-19 Martin Baulig <martin@ximian.com>
1625 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
1626 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
1627 the return type of the new EmitContext.
1629 2004-07-18 Martin Baulig <martin@ximian.com>
1631 * class.cs (Property.Define): Fix iterators.
1633 * iterators.cs (Iterator.Define): Moved the
1634 `container.AddInterator (this)' call here from the .ctor; only do
1635 it if we resolved successfully.
1637 2004-07-17 Miguel de Icaza <miguel@ximian.com>
1639 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
1640 `true' for preprocessing directives that we parse. The return
1641 value indicates whether we should return to regular tokenizing or
1642 not, not whether it was parsed successfully.
1644 In the past if we were in: #if false ... #line #endif, we would
1645 resume parsing after `#line'. See bug 61604.
1647 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
1648 building: IsEnumType should return true only for enums, not for
1649 enums or System.Enum itself. This fixes #61593.
1651 Likely what happened is that corlib was wrong: mcs depended on
1652 this bug in some places. The bug got fixed, we had to add the
1653 hack, which caused bug 61593.
1655 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
1656 that was a workaround for the older conditions.
1658 2004-07-16 Ben Maurer <bmaurer@ximian.com>
1660 * assign.cs: IAssignMethod has a new interface, as documented
1661 inline. All assignment code now uses this new api.
1663 * ecore.cs, expression.cs: All classes which implement
1664 IAssignMethod now use the new interface.
1666 * expression.cs (Invocation): add a hack to EmitCall so that
1667 IndexerAccess can be the target of a compound assignment without
1668 evaluating its arguments twice.
1670 * statement.cs: Handle changes in Invocation api.
1672 2004-07-16 Martin Baulig <martin@ximian.com>
1674 * iterators.cs: Rewrote this. We're now using one single Proxy
1675 class for both the IEnumerable and the IEnumerator interface and
1676 `Iterator' derives from Class so we can use the high-level API.
1678 * class.cs (TypeContainer.AddIterator): New method.
1679 (TypeContainer.DoDefineType): New protected virtual method, which
1680 is called from DefineType().
1681 (TypeContainer.DoDefineMembers): Call DefineType() and
1682 DefineMembers() on all our iterators.
1683 (TypeContainer.Emit): Call Emit() on all our iterators.
1684 (TypeContainer.CloseType): Call CloseType() on all our iterators.
1686 * codegen.cs (EmitContext.CurrentIterator): New public field.
1688 2004-07-15 Martin Baulig <martin@ximian.com>
1691 (TypeManager.not_supported_exception_type): New type.
1693 2004-07-14 Martin Baulig <martin@ximian.com>
1695 * iterators.cs: Use real error numbers.
1697 2004-07-14 Martin Baulig <martin@ximian.com>
1699 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
1700 requires this to be a System.Collection.IEnumerable and not a
1701 class implementing that interface.
1702 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
1704 2004-07-13 Marek Safar <marek.safar@seznam.cz>
1706 * class.cs: Fixed previous fix, it broke some error tests.
1708 2004-07-12 Martin Baulig <martin@ximian.com>
1710 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
1713 2004-07-09 Miguel de Icaza <miguel@ximian.com>
1715 * assign.cs (LocalTemporary): Add new argument: is_address,If
1716 `is_address' is true, then the value that we store is the address
1717 to the real value, and not the value itself.
1719 * ecore.cs (PropertyExpr): use the new local temporary
1720 stuff to allow us to handle X.Y += z (where X is a struct)
1722 2004-07-08 Martin Baulig <martin@ximian.com>
1724 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
1725 not always return, just like we're doing in Using.Resolve().
1727 2004-07-07 Miguel de Icaza <miguel@ximian.com>
1729 * cs-parser.jay (fixed_statement): flag this as Pinned.
1731 2004-07-06 Miguel de Icaza <miguel@ximian.com>
1733 * typemanager.cs (TypeManager): Removed MakePinned method, this
1734 mechanism is replaced with the .NET 2.x compatible mechanism of
1735 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1737 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1738 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1739 `IsFixed' property which has a different meaning.
1741 2004-07-02 Raja R Harinath <rharinath@novell.com>
1743 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1744 visible from inside a nested class, not just the names of the
1745 immediately enclosing class.
1748 2004-06-24 Raja R Harinath <rharinath@novell.com>
1750 * expression.cs (BetterConversion): Remove buggy special-case
1751 handling of "implicit constant expression conversions". At this
1752 point, we already know that the conversion is possible -- we're
1753 only checking to see which is better.
1755 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1757 * cs-parser.jay: Added error CS0210 test.
1759 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1761 * cs-parser.jay: Added error CS0134 test.
1763 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1766 * cs-parser.jay: Added error CS0145 test.
1768 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1770 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1772 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1774 * expression.cs (StackAlloc.Resolve): The argument may not
1775 be a constant; deal with this case.
1777 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1779 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1780 GetIndexerAttributeValue.
1781 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1783 * class.cs (Indexer.Define): Added error tests for CS0415,
1786 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1788 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1791 2004-06-23 Martin Baulig <martin@ximian.com>
1793 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1794 neither return nor throw, reset the barrier as well. Fixes #60457.
1796 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1798 * class.cs : EventAttributes is now set to None by default.
1799 This fixes bug #60459.
1801 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1804 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1805 Don't throw exception but return null (it's sufficient now).
1807 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1809 * typemanager.cs (GetArgumentTypes): Faster implementation.
1811 2004-06-18 Martin Baulig <martin@ximian.com>
1813 * attribute.cs (Attribute.Resolve): Check whether we're an
1814 EmptyCast which a Constant child. Fixes #60333.
1816 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1818 * statement.cs (EmitCollectionForeach): Account for the fact that
1819 not all valuetypes are in areas which we can take the address of.
1820 For these variables, we store to a temporary variable. Also, make
1821 sure that we dont emit a `callvirt' on a valuetype method.
1823 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1825 * expression.cs (StackAlloc.DoReSolve): Added test for
1826 negative parameter (CS0247).
1828 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1831 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1833 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1836 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1839 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1841 Fix bug #58254 & cs1555.cs, cs1556.cs
1842 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1844 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1846 * cs-parser.jay: Added error CS1669 test for indexers.
1848 2004-06-11 Martin Baulig <martin@ximian.com>
1850 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1851 call this twice: for params and varargs methods.
1853 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1856 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1858 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1860 * attribute.cs (Attribute.GetValidTargets): Made public.
1863 (AbstractPropertyEventMethod): New class for better code sharing.
1864 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1866 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1868 2004-06-11 Raja R Harinath <rharinath@novell.com>
1871 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
1872 that the call to Resolve is part of a MemberAccess.
1873 (Expression.Resolve): Use it for SimpleName resolution.
1874 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
1875 Add 'intermediate' boolean argument.
1876 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
1877 error message when the SimpleName can be resolved ambiguously
1878 between an expression and a type.
1879 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
1881 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
1882 call on the left-side.
1884 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1887 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
1889 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1891 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
1893 2004-06-11 Martin Baulig <martin@ximian.com>
1895 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
1896 varargs methods if applicable.
1898 2004-06-11 Martin Baulig <martin@ximian.com>
1900 * expression.cs (Invocation.EmitCall): Don't use
1901 `method.CallingConvention == CallingConventions.VarArgs' since the
1902 method could also have `CallingConventions.HasThis'.
1904 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1906 * class.cs (Event.GetSignatureForError): Implemented.
1907 Fixed crash in error test cs3010.cs
1909 2004-06-10 Miguel de Icaza <miguel@ximian.com>
1911 * cs-tokenizer.cs: Change the way we track __arglist to be
1912 consistent with the other keywords.
1914 2004-06-09 Miguel de Icaza <miguel@ximian.com>
1916 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
1919 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
1921 * codegen.cs: Check that all referenced assemblies have a strongname
1922 before strongnaming the compiled assembly. If not report error CS1577.
1923 Fix bug #56563. Patch by Jackson Harper.
1924 * typemanager.cs: Added a method to return all referenced assemblies.
1925 Fix bug #56563. Patch by Jackson Harper.
1927 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1930 (Method.ApplyAttributeBuilder): Moved and added conditional
1931 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
1934 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
1936 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1939 * class.cs: (EventField.attribute_targets): Changed default target.
1941 2004-06-08 Martin Baulig <martin@ximian.com>
1943 * expression.cs (Invocation.EmitCall): Enable varargs methods.
1945 2004-06-08 Martin Baulig <martin@ximian.com>
1947 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
1949 2004-06-07 Martin Baulig <martin@ximian.com>
1951 Added support for varargs methods.
1953 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
1956 * cs-parser.jay: Added support for `__arglist'.
1958 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
1960 * expression.cs (Argument.AType): Added `ArgList'.
1961 (Invocation): Added support for varargs methods.
1962 (ArglistAccess): New public class.
1963 (Arglist): New public class.
1965 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
1967 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
1968 a method's top-level block if the method has varargs.
1970 * support.cs (ReflectionParameters, InternalParameters): Added
1971 support for varargs methods.
1973 2004-06-07 Miguel de Icaza <miguel@ximian.com>
1975 * class.cs: Provide location in indexer error report.
1977 * driver.cs: Use standard names.
1979 * namespace.cs: Catch the use of using after a namespace has been
1980 declared also on using aliases.
1982 2004-06-03 Raja R Harinath <rharinath@novell.com>
1985 * typemanager.cs (closure_private_ok, closure_invocation_type)
1986 (closure_qualifier_type, closure_invocation_assembly)
1987 (FilterWithClosure): Move to ...
1988 (Closure): New internal nested class.
1989 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
1990 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
1991 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
1992 (MemberLookup, MemberLookupFailed): Use it.
1993 * expression.cs (New.DoResolve): Treat the lookup for the
1994 constructor as being qualified by the 'new'ed type.
1995 (Indexers.GetIndexersForTypeOrInterface): Update.
1997 2004-06-03 Marek Safar <marek.safar@seznam.cz>
2000 (GetConditionalAttributeValue): New method. Returns
2001 condition of ConditionalAttribute.
2002 (SearchMulti): New method. Returns all attributes of type 't'.
2003 Use it when attribute is AllowMultiple = true.
2004 (IsConditionalMethodExcluded): New method.
2007 (Method.IsExcluded): Implemented. Returns true if method has conditional
2008 attribute and the conditions is not defined (method is excluded).
2009 (IMethodData): Extended interface for ConditionalAttribute support.
2010 (PropertyMethod.IsExcluded): Implemented.
2013 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
2016 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
2019 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
2021 * expression.cs (ArrayCreationExpression): Make this just an
2022 `expression'. It can't be a statement, so the code here was
2025 2004-06-02 Marek Safar <marek.safar@seznam.cz>
2028 * typemanager.cs (GetFullNameSignature): New method for
2031 2004-06-02 Marek Safar <marek.safar@seznam.cz>
2034 * class.cs (MemberBase.GetSignatureForError): New virtual method.
2035 Use this method when MethodBuilder is null.
2036 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
2037 Added test for error CS0626 (MONO reports error for this situation).
2038 (IMethodData.GetSignatureForError): Extended interface.
2040 2004-06-01 Marek Safar <marek.safar@seznam.cz>
2043 (AttributeTester.GetObsoleteAttribute): Returns instance of
2044 ObsoleteAttribute when type is obsolete.
2047 (TypeContainer.VerifyObsoleteAttribute): Override.
2048 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
2049 (MethodCode.VerifyObsoleteAttribute): Override.
2050 (MemberBase.VerifyObsoleteAttribute): Override.
2053 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
2054 and report proper error.
2057 Delegate.VerifyObsoleteAttribute): Override.
2060 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
2061 and report proper error.
2062 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
2065 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
2069 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
2070 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
2071 Added test for ObsoleteAttribute.
2074 (Catch): Derived from Statement.
2076 2004-06-01 Marek Safar <marek.safar@seznam.cz>
2078 Fixed bug #59071 & cs0160.cs
2080 * statement.cs (Try.Resolve): Check here whether order of catch
2081 clauses matches their dependencies.
2083 2004-05-31 Miguel de Icaza <miguel@ximian.com>
2085 * Reverted patch to namespace.cs (Use lookuptypedirect). This
2086 caused a regression: #59343. Referencing nested classes from an
2087 assembly stopped working.
2089 2004-05-31 Martin Baulig <martin@ximian.com>
2091 MCS is now frozen for beta 2.
2093 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2095 * convert.cs: add a trivial cache for overload operator resolution.
2097 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2099 * decl.cs: If possible, use lookuptypedirect here. We can only do
2100 this if there is no `.' after the namespace. Avoids using
2101 LookupType, which does lots of slow processing.
2102 (FindNestedType) New method, does what it says :-).
2103 * namespace.cs: use LookupTypeDirect.
2104 * rootcontext.cs: use membercache, if possible.
2105 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
2107 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2110 According to the spec,
2112 In a member access of the form E.I, if E is a single identifier,
2113 and if the meaning of E as a simple-name (§7.5.2) is a constant,
2114 field, property, localvariable, or parameter with the same type as
2115 the meaning of E as a type-name (§3.8), then both possible
2116 meanings of E are permitted.
2118 We did not check that E as a simple-name had the same type as E as
2121 This trivial check gives us 5-7% on bootstrap time.
2123 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2125 * expression.cs (Invocation.OverloadResolve): Avoid the
2126 use of hashtables and boxing here by allocating on demand.
2128 2004-05-30 Martin Baulig <martin@ximian.com>
2130 * rootcontext.cs (RootContext.LookupType): Don't cache things if
2131 we're doing a silent lookup. Don't try to lookup nested types in
2132 TypeManager.object_type (thanks to Ben Maurer).
2134 2004-05-30 Martin Baulig <martin@ximian.com>
2136 Committing a patch from Ben Maurer.
2138 * rootcontext.cs (RootContext.LookupType): Cache negative results.
2140 2004-05-29 Martin Baulig <martin@ximian.com>
2142 * class.cs (IMethodData.ShouldIgnore): New method.
2144 * typemanager.cs (TypeManager.MethodFlags): Don't take a
2145 `Location' argument, we don't need it anywhere. Use
2146 `IMethodData.ShouldIgnore ()' instead of
2147 `MethodData.GetMethodFlags ()'.
2148 (TypeManager.AddMethod): Removed.
2149 (TypeManager.AddMethod2): Renamed to AddMethod.
2151 2004-05-29 Martin Baulig <martin@ximian.com>
2153 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
2155 * convert.cs (Convert.ImplicitReferenceConversion): If we're
2156 converting from a class type S to an interface type and we already
2157 have an object on the stack, don't box it again. Fixes #52578.
2159 2004-05-29 Martin Baulig <martin@ximian.com>
2161 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
2162 Added support for `params' parameters. Fixes #59267.
2164 2004-05-29 Martin Baulig <martin@ximian.com>
2166 * literal.cs (NullPointer): Provide a private .ctor which sets
2167 `type' to TypeManager.object_type. Fixes #59048.
2169 2004-05-29 Martin Baulig <martin@ximian.com>
2171 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
2172 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
2174 * ecore.cs (EventExpr.instance_expr): Make the field private.
2176 2004-05-26 Marek Safar <marek.safar@seznam.cz>
2178 Fixed bug #50080 & cs0214-2.cs
2179 * expression.cs (Cast.DoResolve): Check unsafe context here.
2181 * statement.cs (Resolve.DoResolve): Likewise.
2183 2004-05-26 Martin Baulig <martin@ximian.com>
2185 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
2187 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
2188 (RootContext.LookupType): Pass down the `silent' flag.
2190 2004-05-25 Martin Baulig <martin@ximian.com>
2193 (MethodGroupExpr.IdenticalTypeName): New public property.
2194 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
2195 expression actually refers to a type.
2197 2004-05-25 Martin Baulig <martin@ximian.com>
2199 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
2200 for #56176 and made it actually work.
2202 2004-05-25 Martin Baulig <martin@ximian.com>
2204 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
2205 (FieldExpr, PropertyExpr): Override and implement
2206 CacheTemporaries. Fixes #52279.
2208 2004-05-25 Miguel de Icaza <miguel@ximian.com>
2210 * location.cs: In the new compiler listing a file twice is a
2211 warning, not an error.
2213 2004-05-24 Martin Baulig <martin@ximian.com>
2215 * enum.cs (Enum.DefineType): For the `BaseType' to be a
2216 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
2218 2004-05-24 Martin Baulig <martin@ximian.com>
2220 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
2221 walking the `using' list. Fixes #53921.
2223 2004-05-24 Martin Baulig <martin@ximian.com>
2225 * const.cs (Const.LookupConstantValue): Added support for
2226 EmptyCast's; fixes #55251.
2228 2004-05-24 Martin Baulig <martin@ximian.com>
2230 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
2231 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
2232 which does the CS0135 check. The reason is that we first need to
2233 check whether the variable actually exists.
2235 2004-05-24 Martin Baulig <martin@ximian.com>
2237 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
2238 than RootContext.LookupType() to find the explicit interface
2241 2004-05-24 Raja R Harinath <rharinath@novell.com>
2243 * Makefile: Simplify. Use executable.make.
2244 * mcs.exe.sources: New file. List of sources of mcs.exe.
2246 2004-05-24 Anders Carlsson <andersca@gnome.org>
2250 Use the invariant culture when doing String.Compare for CLS case
2253 2004-05-23 Martin Baulig <martin@ximian.com>
2255 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
2256 don't have any dots. Fixes #52622, added cs0246-8.cs.
2258 * namespace.cs (NamespaceEntry.Lookup): Likewise.
2260 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2262 * class.cs (MemberBase.Define): Reuse MemberType member for
2263 resolved type. Other methods can use it too.
2265 2004-05-23 Martin Baulig <martin@ximian.com>
2267 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
2268 the variable also exists in the current block (otherwise, we need
2269 to report a CS0103). Fixes #58670.
2271 2004-05-23 Martin Baulig <martin@ximian.com>
2273 * flowanalysis.cs (Reachability.Reachable): Compute this
2274 on-the-fly rather than storing it as a field.
2276 2004-05-23 Martin Baulig <martin@ximian.com>
2278 * flowanalysis.cs (Reachability.And): Manually compute the
2279 resulting `barrier' from the reachability.
2281 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2284 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
2285 instance of ObsoleteAttribute when symbol is obsolete.
2288 (IMethodData): Extended interface for ObsoleteAttribute support.
2290 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2292 * attribute.cs: Fix bug #55970
2294 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2298 (GetObsoleteAttribute): New method. Creates the instance of
2300 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
2301 ObsoleteAttribute when member is obsolete.
2302 (AttributeTester.Report_ObsoleteMessage): Common method for
2303 Obsolete error/warning reporting.
2306 (TypeContainer.base_classs_type): New member for storing parent type.
2309 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
2310 for this MemberCore.
2312 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2314 * attribute.cs, const.cs: Fix bug #58590
2316 2004-05-21 Martin Baulig <martin@ximian.com>
2318 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
2319 out parameters if the end of the method is unreachable. Fixes
2322 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2324 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
2325 Hari was right, why extra method.
2327 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2329 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
2331 2004-05-20 Martin Baulig <martin@ximian.com>
2333 Merged this back from gmcs to keep the differences to a minumum.
2335 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
2336 instead of a Declspace.
2337 (Attribute.ResolveType): Likewise.
2338 (Attributes.Search): Likewise.
2339 (Attributes.Contains): Likewise.
2340 (Attributes.GetClsCompliantAttribute): Likewise.
2342 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
2344 (MethodData.ApplyAttributes): Take an EmitContext instead of a
2347 2004-05-19 Marek Safar <marek.safar@seznam.cz>
2349 Fix bug #58688 (MCS does not report error when the same attribute
2352 * attribute.cs (Attribute.Emit): Distinction between null and default.
2354 2004-05-19 Raja R Harinath <rharinath@novell.com>
2356 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
2357 of a top-level attribute without an attribute target.
2358 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
2360 (Attribute.Conditional_GetConditionName),
2361 (Attribute.Obsolete_GetObsoleteMessage): Update.
2362 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
2363 part of ScanForIndexerName.
2364 (Attribute.CanIgnoreInvalidAttribute): New function.
2365 (Attribute.ScanForIndexerName): Move to ...
2366 (Attributes.ScanForIndexerName): ... here.
2367 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
2368 (Attributes.Search): New internal variant that can choose not to
2369 complain if types aren't resolved. The original signature now
2371 (Attributes.GetClsCompliantAttribute): Use internal variant, with
2372 complaints suppressed.
2373 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
2374 only if it not useful.
2375 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
2376 top-level for attributes that are shared between the assembly
2377 and a top-level class.
2378 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
2379 * class.cs: Update to reflect changes.
2380 (DefineIndexers): Fuse loops.
2381 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
2382 a couple more variants of attribute names.
2384 2004-05-18 Marek Safar <marek.safar@seznam.cz>
2386 Fix bug #52585 (Implemented explicit attribute declaration)
2389 (Attributable.ValidAttributeTargets): New abstract method. It gets
2390 list of valid attribute targets for explicit target declaration.
2391 (Attribute.Target): It holds target itself.
2392 (AttributeSection): Removed.
2393 (Attribute.CheckTargets): New method. It checks whether attribute
2394 target is valid for the current element.
2397 (EventProperty): New class. For events that are declared like
2398 property (with add and remove accessors).
2399 (EventField): New class. For events that are declared like field.
2402 * cs-parser.jay: Implemented explicit attribute target declaration.
2404 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
2405 Override ValidAttributeTargets.
2408 (ReturnParameter): Class for applying custom attributes on
2410 (ParameterAtribute): New class. Class for applying custom
2411 attributes on the parameter type.
2413 2004-05-17 Miguel de Icaza <miguel@ximian.com>
2415 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
2418 (Method): Allow UNSAFE here.
2420 * modifiers.cs: Support unsafe reporting.
2422 2004-05-17 Marek Safar <marek.safar@seznam.cz>
2424 * decl.cs: Fix bug #58478.
2426 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2428 * statement.cs: When checking for unreachable code on an EmptyStatement,
2429 set the location. Fixes bug #58488.
2431 2004-05-13 Miguel de Icaza <miguel@ximian.com>
2433 * driver.cs: Add -pkg handling.
2435 From Gonzalo: UseShelLExecute=false
2437 2004-05-12 Marek Safar <marek.safar@seznam.cz>
2440 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
2442 (Attribute.IsClsCompliaceRequired): Moved to base for better
2444 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
2445 when attribute is AttributeUsageAttribute.
2446 (Attribute.GetValidTargets): Simplified.
2447 (Attribute.GetAttributeUsage): New method returns AttributeUsage
2448 attribute for this type.
2449 (Attribute.ApplyAttributes): Method renamed to Emit and make
2451 (GlobalAttributeSection): New class for special handling of global
2452 attributes (assembly, module).
2453 (AttributeSection.Emit): New method.
2455 * class.cs: Implemented Attributable abstract methods.
2456 (MethodCore.LabelParameters): Moved to Parameter class.
2457 (Accessor): Is back simple class.
2458 (PropertyMethod): Implemented Attributable abstract class.
2459 (DelegateMethod): Implemented Attributable abstract class.
2460 (Event): New constructor for disctintion between normal Event
2461 and Event with accessors.
2463 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
2465 * codegen.cs, const.cs, decl.cs, delegate.cs:
2466 (CommonAssemblyModulClass): Implemented Attributable abstract class
2469 * enum.cs: Implement IAttributeSupport interface.
2470 (EnumMember): New class for emum members. Implemented Attributable
2474 (ParameterBase): Is abstract.
2475 (ReturnParameter): New class for easier [return:] attribute handling.
2477 * typemanager.cs: Removed builder_to_attr.
2479 2004-05-11 Raja R Harinath <rharinath@novell.com>
2482 * attribute.cs (Attribute.GetPositionalValue): New function.
2483 * class.cs (TypeContainer.VerifyMembers): New function.
2484 (TypeContainer.Emit): Use it.
2485 (ClassOrStruct): New base class for Class and Struct.
2486 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
2487 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
2489 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
2490 then each non-static field should have a FieldOffset attribute.
2491 Otherwise, none of the fields should have a FieldOffset attribute.
2492 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
2493 and FieldOffset attributes.
2494 * typemanager.cs (TypeManager.struct_layout_attribute_type)
2495 (TypeManager.field_offset_attribute_type): New core types.
2496 (TypeManager.InitCoreTypes): Initialize them.
2498 2004-05-11 Michal Moskal <malekith@pld-linux.org>
2500 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
2501 Return correct type.
2504 2004-05-09 Miguel de Icaza <miguel@ximian.com>
2506 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
2507 be implicitly converted to ulong.
2509 * expression.cs: The logic for allowing operator &, | and ^ worked
2510 was wrong, it worked before because we did not report an error in
2511 an else branch. Fixes 57895.
2513 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
2514 allow volatile fields to be reference types.
2516 2004-05-07 Miguel de Icaza <miguel@ximian.com>
2518 * driver.cs: Add support for /debug-
2520 2004-05-07 Raja R Harinath <rharinath@novell.com>
2522 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
2523 Add a 'complain' parameter to silence errors.
2524 (Attribute.Resolve): Update to changes. Put in sanity check to catch
2525 silently overlooked type-resolutions.
2526 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
2528 (Attributes.Search): New function.
2529 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
2530 (Attributes.GetAttributeFullName): Remove hack.
2531 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
2532 Update to reflect changes.
2533 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2534 Use Attributes.Search instead of nested loops.
2536 2004-05-07 Marek Safar <marek.safar@seznam.cz>
2539 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
2540 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
2541 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
2543 * report.cs: (Report.Warning): Renamed to Warning_T because of
2544 parameter collision.
2546 2004-05-05 Raja R Harinath <rharinath@novell.com>
2548 * expression.cs (MemberAccess.ResolveMemberAccess):
2549 Exit with non-zero status after Report.Error.
2550 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
2552 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
2554 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2556 * support.cs: Don't hang when the file is empty.
2558 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2560 * support.cs: In SeekableStreamReader, compute the preamble size of the
2561 underlying stream. Position changes should take into account that initial
2564 2004-05-03 Todd Berman <tberman@sevenl.net>
2566 * driver.cs: remove unused GetSysVersion function.
2568 2004-05-03 Todd Berman <tberman@sevenl.net>
2570 * driver.cs: Remove the hack from saturday, as well as the hack
2571 from jackson (LoadAssemblyFromGac), also adds the CWD to the
2572 link_paths to get that bit proper.
2574 2004-05-01 Todd Berman <tberman@sevenl.net>
2576 * driver.cs: Try a LoadFrom before a Load, this checks the current
2577 path. This is currently a bug in mono that is be fixed, however, this
2578 provides a workaround for now. This will be removed when the bug
2581 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
2583 * CryptoConvert.cs: Updated to latest version. Fix issue with
2584 incomplete key pairs (#57941).
2586 2004-05-01 Todd Berman <tberman@sevenl.net>
2588 * driver.cs: Remove '.' from path_chars, now System.* loads properly
2591 2004-04-30 Jackson Harper <jackson@ximian.com>
2593 * codegen.cs: Open keys readonly.
2595 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2597 * typemanager.cs: don't report cyclic struct layout when a struct
2598 contains 2 or more fields of the same type. Failed for Pango.AttrShape
2599 which has 2 Pango.Rectangle fields.
2601 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
2603 * expression.cs: Handle IntPtr comparisons with IL code
2604 rather than a method call.
2606 2004-04-29 Martin Baulig <martin@ximian.com>
2608 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
2609 the list of PropertyInfo's in class hierarchy and find the
2610 accessor. Fixes #56013.
2612 2004-04-29 Martin Baulig <martin@ximian.com>
2614 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
2616 2004-04-29 Martin Baulig <martin@ximian.com>
2618 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2620 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
2622 2004-04-29 Martin Baulig <martin@ximian.com>
2624 * class.cs (ConstructorInitializer.Resolve): Check whether the
2625 parent .ctor is accessible. Fixes #52146.
2627 2004-04-29 Martin Baulig <martin@ximian.com>
2629 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2631 * statement.cs (Using.EmitLocalVariableDecls): Use
2632 TypeManager.idisposable_type, not typeof (IDisposable).
2633 (Foreach.EmitCollectionForeach): Added support for valuetypes.
2635 2004-04-29 Martin Baulig <martin@ximian.com>
2637 * class.cs (Event.Define): Don't emit the field and don't set
2638 RTSpecialName and SpecialName for events on interfaces. Fixes
2641 2004-04-29 Raja R Harinath <rharinath@novell.com>
2643 Refactor Attribute.ApplyAttributes.
2644 * attribute.cs (Attributable): New base class for objects that can
2645 have Attributes applied on them.
2646 (Attribute): Make AttributeUsage fields public.
2647 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
2648 (Attribute.IsInternalCall): New property.
2649 (Attribute.UsageAttr): Convert to a public read-only property.
2650 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
2651 (Attribute.ResolveType, Attribute.Resolve)
2652 (Attribute.ScanForIndexerName): Update to reflect changes.
2653 (Attribute.CheckAttributeTarget): Re-format.
2654 (Attribute.ApplyAttributes): Refactor, to various
2655 Attributable.ApplyAttributeBuilder methods.
2656 * decl.cs (MemberCore): Make Attributable.
2657 * class.cs (Accessor): Make Attributable.
2658 (MethodData.ApplyAttributes): Use proper attribute types, not
2660 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
2661 (TypeContainer.ApplyAttributeBuilder)
2662 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
2663 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
2664 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
2665 (Operator.ApplyAttributeBuilder): New factored-out methods.
2666 * const.cs (Const.ApplyAttributeBuilder): Likewise.
2667 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
2668 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
2669 * parameter.cs (ParameterBase): New Attributable base class
2670 that can also represent Return types.
2671 (Parameter): Update to the changes.
2673 2004-04-29 Jackson Harper <jackson@ximian.com>
2675 * driver.cs: Prefer the corlib system version when looking for
2676 assemblies in the GAC. This is still a hack, but its a better hack
2679 2004-04-29 Marek Safar <marek.safar@seznam.cz>
2681 * decl.cs, enum.cs: Improved error 3005 reporting.
2683 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
2684 (related_symbols): New private member for list of symbols
2685 related to reported error/warning.
2687 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
2689 2004-04-29 Martin Baulig <martin@ximian.com>
2691 * ecore.cs (Expression.Constantify): If we're an enum and
2692 TypeManager.TypeToCoreType() doesn't give us another type, use
2693 t.UnderlyingSystemType. Fixes #56178.
2695 2004-04-29 Martin Baulig <martin@ximian.com>
2697 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
2698 interfaces and for each interface, only add members directly
2699 declared in that interface. Fixes #53255.
2701 2004-04-28 Martin Baulig <martin@ximian.com>
2703 * expression.cs (ConditionalLogicalOperator): Use a temporary
2704 variable for `left' to avoid that we evaluate it more than once;
2707 2004-04-28 Martin Baulig <martin@ximian.com>
2709 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
2712 2004-04-28 Martin Baulig <martin@ximian.com>
2714 * statement.cs (LocalInfo.Resolve): Check whether the type is not
2717 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
2718 whether the type is not void (CS1547).
2720 2004-04-28 Martin Baulig <martin@ximian.com>
2722 * expression.cs (Unary.DoResolveLValue): Override this and report
2723 CS0131 for anything but Operator.Indirection.
2725 2004-04-28 Martin Baulig <martin@ximian.com>
2727 Committing a patch from Ben Maurer; see bug #50820.
2729 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2732 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2735 2004-04-28 Martin Baulig <martin@ximian.com>
2737 Committing a patch from Ben Maurer; see bug #50820.
2739 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2742 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2745 2004-04-28 Martin Baulig <martin@ximian.com>
2747 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
2748 (Block.AddLabel): Call DoLookupLabel() to only search in the
2751 2004-04-28 Martin Baulig <martin@ximian.com>
2753 * cfold.cs (ConstantFold.BinaryFold): Added special support for
2754 comparing StringConstants and NullLiterals in Equality and Inequality.
2756 2004-04-28 Jackson Harper <jackson@ximian.com>
2758 * driver.cs: Attempt to load referenced assemblies from the
2759 GAC. This is the quick and dirty version of this method that
2760 doesnt take into account versions and just takes the first
2761 canidate found. Will be good enough for now as we will not have more
2762 then one version installed into the GAC until I update this method.
2764 2004-04-28 Martin Baulig <martin@ximian.com>
2766 * typemanager.cs (TypeManager.CheckStructCycles): New public
2767 static method to check for cycles in the struct layout.
2769 * rootcontext.cs (RootContext.PopulateTypes): Call
2770 TypeManager.CheckStructCycles() for each TypeContainer.
2771 [Note: We only need to visit each type once.]
2773 2004-04-28 Martin Baulig <martin@ximian.com>
2775 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
2777 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
2778 success and added `out object value'. Use a `bool resolved' field
2779 to check whether we've already been called rather than
2780 `ConstantValue != null' since this breaks for NullLiterals.
2782 2004-04-28 Raja R Harinath <rharinath@novell.com>
2784 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
2785 setting of this flag, since the 'set' method may be non-public.
2787 2004-04-28 Raja R Harinath <rharinath@novell.com>
2789 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
2790 check on current_vector.Block.
2792 2004-04-27 Martin Baulig <martin@ximian.com>
2794 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
2795 a field initializer. Fixes #56459.
2797 2004-04-27 Martin Baulig <martin@ximian.com>
2799 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
2800 we're not attempting to use an indexer. Fixes #52154.
2802 2004-04-27 Martin Baulig <martin@ximian.com>
2804 * statement.cs (Return): Don't create a return label if we don't
2805 need it; reverts my change from January 20th. Thanks to Ben
2808 2004-04-27 Martin Baulig <martin@ximian.com>
2810 According to the spec, `goto' can only leave a nested scope, but
2813 * statement.cs (Block.LookupLabel): Only lookup in the current
2814 block, don't recurse into parent or child blocks.
2815 (Block.AddLabel): Check in parent and child blocks, report
2816 CS0140/CS0158 if we find a duplicate.
2817 (Block): Removed this indexer for label lookups.
2818 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2819 this already does the error reporting for us.
2822 (FlowBranching.UsageVector.Block): New public variable; may be null.
2823 (FlowBranching.CreateSibling): Added `Block' argument.
2824 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2825 label for the target of a `goto' and check whether we're not
2826 leaving a `finally'.
2828 2004-04-27 Martin Baulig <martin@ximian.com>
2830 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2831 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2834 2004-04-27 Martin Baulig <martin@ximian.com>
2836 * statement.cs (Block.AddLabel): Also check for implicit blocks
2837 and added a CS0158 check.
2839 2004-04-27 Martin Baulig <martin@ximian.com>
2841 * flowanalysis.cs (FlowBranchingLoop): New class.
2842 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2843 UsageVector's instead of an ArrayList.
2844 (FlowBranching.Label): Likewise.
2845 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2846 (FlowBranching.AddBreakVector): New method.
2848 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2850 * attribute.cs: Small regression fix: only convert the type if we
2851 the type is different, fixes System.Drawing build.
2853 2004-04-27 Martin Baulig <martin@ximian.com>
2855 * attribute.cs (Attribute.Resolve): If we have a constant value
2856 for a named field or property, implicity convert it to the correct
2859 2004-04-27 Raja R Harinath <rharinath@novell.com>
2861 * statement.cs (Block.Block): Implicit blocks share
2862 'child_variable_names' fields with parent blocks.
2863 (Block.AddChildVariableNames): Remove.
2864 (Block.AddVariable): Mark variable as "used by a child block" in
2865 every surrounding block.
2866 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2867 been used in a child block, complain about violation of "Invariant
2868 meaning in blocks" rule.
2869 * cs-parser.jay (declare_local_variables): Don't use
2870 AddChildVariableNames.
2871 (foreach_statement): Don't create an implicit block: 'foreach'
2874 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2876 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2877 converting from 0L to ulong. Fixes 57522.
2879 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2881 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2882 derived class hides via 'new' keyword field from base class (test-242.cs).
2883 TODO: Handle this in the more general way.
2885 * class.cs (CheckBase): Ditto.
2887 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2889 * decl.cs (caching_flags): New member for storing cached values
2891 (MemberCore.Flags): New enum where bit flags for caching_flags
2893 (MemberCore.cls_compliance): Moved to caching_flags.
2894 (DeclSpace.Created): Moved to caching_flags.
2896 * class.cs: Use caching_flags instead of DeclSpace.Created
2898 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2900 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2901 if we are only a derived class, not a nested class.
2903 * typemanager.cs: Same as above, but do this at the MemberLookup
2904 level (used by field and methods, properties are handled in
2905 PropertyExpr). Allow for the qualified access if we are a nested
2908 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2910 * class.cs: Refactoring.
2911 (IMethodData): New inteface; Holds links to parent members
2912 to avoid member duplication (reduced memory allocation).
2913 (Method): Implemented IMethodData interface.
2914 (PropertyBase): New inner classes for get/set methods.
2915 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2916 (Event): New inner classes for add/remove methods.
2917 (Event.DelegateMethod): Implemented IMethodData interface.
2919 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2920 EmitContext (related to class.cs refactoring).
2922 2004-04-21 Raja R Harinath <rharinath@novell.com>
2924 * delegate.cs (Delegate.VerifyApplicability): If the number of
2925 arguments are the same as the number of parameters, first try to
2926 verify applicability ignoring any 'params' modifier on the last
2930 2004-04-16 Raja R Harinath <rharinath@novell.com>
2932 * class.cs (TypeContainer.AddIndexer): Use
2933 'ExplicitInterfaceName' to determine if interface name was
2934 explicitly specified. 'InterfaceType' is not initialized at this time.
2935 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2936 Indexers array is already in the required order. Initialize
2937 'IndexerName' only if there are normal indexers.
2938 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2939 (TypeContainer.Emit): Emit DefaultMember attribute only if
2940 IndexerName is initialized.
2943 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2945 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2948 2004-04-15 Raja R Harinath <rharinath@novell.com>
2950 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2954 * attribute.cs (Attribute.Resolve): Check for duplicate named
2958 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2960 * iterators.cs (MarkYield): track whether we are in an exception,
2961 and generate code accordingly. Use a temporary value to store the
2962 result for our state.
2964 I had ignored a bit the interaction of try/catch with iterators
2965 since their behavior was not entirely obvious, but now it is
2966 possible to verify that our behavior is the same as MS .NET 2.0
2970 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2972 * iterators.cs: Avoid creating temporaries if there is no work to
2975 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2976 Enumerations, use TypeManager.EnumToUnderlying and call
2979 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
2982 (This.Emit): Use EmitContext.EmitThis to emit our
2985 (This.EmitAssign): Ditto.
2987 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
2988 codepaths, we will move all the functionality into
2991 (FieldExpr.EmitAssign): Ditto.
2993 This fixes several hidden bugs that I uncovered while doing a code
2994 review of this today.
2996 * codegen.cs (EmitThis): reworked so the semantics are more clear
2997 and also support value types "this" instances.
2999 * iterators.cs: Changed so that for iterators in value types, we
3000 do not pass the value type as a parameter.
3002 Initialization of the enumerator helpers is now done in the caller
3003 instead of passing the parameters to the constructors and having
3004 the constructor set the fields.
3006 The fields have now `assembly' visibility instead of private.
3008 2004-04-11 Miguel de Icaza <miguel@ximian.com>
3010 * expression.cs (Argument.Resolve): Check if fields passed as ref
3011 or out are contained in a MarshalByRefObject.
3013 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
3014 another compiler type.
3016 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
3018 * class.cs (Indexer.Define): use the new name checking method.
3019 Also, return false on an error.
3020 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
3021 (is_identifier_[start/part]_character): make static.
3023 2004-04-10 Miguel de Icaza <miguel@ximian.com>
3025 * expression.cs (Binary.ResolveOperator): Do no append strings
3026 twice: since we can be invoked more than once (array evaluation)
3027 on the same concatenation, take care of this here. Based on a fix
3028 from Ben (bug #56454)
3030 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
3032 * codegen.cs: Fix another case where CS1548 must be reported (when
3033 delay-sign isn't specified and no private is available #56564). Fix
3034 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
3035 error when MCS is used on the MS runtime and we need to delay-sign
3036 (which seems unsupported by AssemblyBuilder - see #56621).
3038 2004-04-08 Marek Safar <marek.safar@seznam.cz>
3040 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
3041 (TypeManager.ComputeNamespaces): Faster implementation for
3044 * compiler.csproj: Updated AssemblyName to mcs.
3046 2004-04-07 Miguel de Icaza <miguel@ximian.com>
3048 * rootcontext.cs: Add new types to the boot resolution.
3050 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
3051 MulticastDelegate is not allowed.
3053 * typemanager.cs: Add new types to lookup: System.TypedReference
3056 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
3057 check for TypedReference or ArgIterator, they are not allowed.
3059 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
3060 makes us properly catch 1510 in some conditions (see bug 56016 for
3063 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
3065 * CryptoConvert.cs: update from corlib version
3068 2004-04-05 Miguel de Icaza <miguel@ximian.com>
3070 * class.cs (Indexer.Define): Check indexername declaration
3072 2004-04-05 Marek Safar <marek.safar@seznam.cz>
3074 * attribute.cs (IsClsCompliant): Fixed problem with handling
3075 all three states (compliant, not-compliant, undetected).
3077 2004-03-30 Marek Safar <marek.safar@seznam.cz>
3079 * attribute.cs (Attribute): Location is now public.
3080 (Resolve): Store resolved arguments (pos_values) in attribute class.
3081 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
3082 (GetClsCompliantAttributeValue): New method that gets
3083 CLSCompliantAttribute value.
3084 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
3085 if exists else null.
3086 (AttributeTester): New class for CLS-Compliant verification routines.
3088 * class.cs (Emit): Add CLS-Compliant verification.
3089 (Method.GetSignatureForError): Implemented.
3090 (Constructor.GetSignatureForError): Implemented
3091 (Constructor.HasCompliantArgs): Returns if constructor has
3092 CLS-Compliant arguments.
3093 (Constructor.Emit): Override.
3094 (Construcor.IsIdentifierClsCompliant): New method; For constructors
3095 is needed to test only parameters.
3096 (FieldBase.GetSignatureForError): Implemented.
3097 (TypeContainer): New member for storing base interfaces.
3098 (TypeContainer.FindMembers): Search in base interfaces too.
3100 * codegen.cs (GetClsComplianceAttribute): New method that gets
3101 assembly or module CLSCompliantAttribute value.
3102 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
3104 (ModuleClass.Emit): Add error 3012 test.
3106 * const.cs (Emit): Override and call base for CLS-Compliant tests.
3108 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
3109 state for all decl types.
3110 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
3111 if CLS-Compliant tests are required.
3112 (IsClsCompliaceRequired): New method. Analyze whether code
3113 must be CLS-Compliant.
3114 (IsExposedFromAssembly): New method. Returns true when MemberCore
3115 is exposed from assembly.
3116 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
3117 value or gets cached value.
3118 (HasClsCompliantAttribute): New method. Returns true if MemberCore
3119 is explicitly marked with CLSCompliantAttribute.
3120 (IsIdentifierClsCompliant): New abstract method. This method is
3121 used to testing error 3005.
3122 (IsIdentifierAndParamClsCompliant): New method. Common helper method
3123 for identifier and parameters CLS-Compliant testing.
3124 (VerifyClsCompliance): New method. The main virtual method for
3125 CLS-Compliant verifications.
3126 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
3127 null. I don't know why is null (too many public members !).
3128 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
3129 and get value of first CLSCompliantAttribute that found.
3131 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
3132 (VerifyClsCompliance): Override and add extra tests.
3134 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
3135 clscheck- disable CLS-Compliant verification event if assembly is has
3136 CLSCompliantAttribute(true).
3138 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
3139 ApllyAttribute is now called in emit section as in the other cases.
3140 Possible future Emit integration.
3141 (IsIdentifierClsCompliant): New override.
3142 (VerifyClsCompliance): New override.
3143 (GetEnumeratorName): Returns full enum name.
3145 * parameter.cs (GetSignatureForError): Implemented.
3147 * report.cs (WarningData): New struct for Warning message information.
3148 (LocationOfPreviousError): New method.
3149 (Warning): New method. Reports warning based on the warning table.
3150 (Error_T): New method. Reports error based on the error table.
3152 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
3153 verifications are done here.
3155 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
3157 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
3158 CLSCompliantAttribute.
3159 (all_imported_types): New member holds all imported types from other
3161 (LoadAllImportedTypes): New method fills static table with exported types
3162 from all referenced assemblies.
3163 (Modules): New property returns all assembly modules.
3165 2004-03-30 Miguel de Icaza <miguel@ximian.com>
3167 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
3168 throwing a parser error.
3170 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
3171 which removes the hardcoded get_/set_ prefixes for properties, as
3172 IL allows for the properties to be named something else.
3176 * expression.cs: Do not override operand before we know if it is
3179 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3181 * typemanager.cs: support for pinned variables.
3183 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3185 * decl.cs, typemanager.cs: Avoid using an arraylist
3186 as a buffer if there is only one result set.
3188 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3190 * expression.cs: Make sure you cant call a static method
3191 with an instance expression, bug #56174.
3193 2004-03-29 Miguel de Icaza <miguel@ximian.com>
3195 * class.cs (IsDuplicateImplementation): Improve error reporting to
3196 flag 663 (method only differs in parameter modifier).
3198 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
3199 in preprocessor directives.
3201 * location.cs (LookupFile): Allow for the empty path.
3203 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
3204 better approach for some of that patch, but its failing with the
3205 CharSet enumeration. For now try/catch will do.
3207 * typemanager.cs: Do not crash if a struct does not have fields.
3210 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3212 * expression.cs: cs0213, cant fix a fixed expression.
3215 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3217 * cs-parser.jay: detect invalid embeded statements gracefully.
3220 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3222 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
3225 the invocation type may not be a subclass of the tye of the item/
3226 The type of the item must be a subclass of the invocation item.
3231 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
3233 * attribute.cs: Added methods to get a string and a bool from an
3234 attribute. Required to information from AssemblyKeyFileAttribute,
3235 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
3236 * codegen.cs: Modified AssemblyName creation to include support for
3237 strongnames. Catch additional exceptions to report them as CS1548.
3238 * compiler.csproj: Updated include CryptoConvert.cs.
3239 * compiler.csproj.user: Removed file - user specific configuration.
3240 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
3241 Mono.Security assembly. The original class is maintained and tested in
3242 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
3243 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
3244 like CSC 8.0 (C# v2) supports.
3245 * Makefile: Added CryptoConvert.cs to mcs sources.
3246 * rootcontext.cs: Added new options for strongnames.
3248 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
3250 * driver.cs: For --expect-error, report error code `2'
3251 if the program compiled with no errors, error code `1' if
3252 it compiled with an error other than the one expected.
3254 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
3256 * compiler.csproj: Updated for Visual Studio .NET 2003.
3257 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
3258 * compiler.sln: Updated for Visual Studio .NET 2003.
3260 2004-03-24 Ravi Pratap M <ravi@ximian.com>
3262 * expression.cs: Fix bug #47234. We basically need to apply the
3263 rule that we prefer the conversion of null to a reference type
3264 when faced with a conversion to 'object' (csc behaviour).
3266 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3268 * statement.cs: Shorter form for foreach, eliminates
3269 a local variable. r=Martin.
3271 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3273 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
3274 checks if we can use brtrue/brfalse to test for 0.
3275 * expression.cs: use the above in the test for using brtrue/brfalse.
3278 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3280 * expression.cs: Rewrite string concat stuff. Benefits:
3282 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
3283 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
3284 rather than a concat chain.
3286 * typemanager.cs: Add lookups for more concat overloads.
3288 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3290 * expression.cs: Emit shorter il code for array init.
3307 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
3309 * statement.cs: Before, two switch blocks would be merged if the
3310 total size of the blocks (end_item - begin_item + 1) was less than
3311 two times the combined sizes of the blocks.
3313 Now, it will only merge if after the merge at least half of the
3318 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
3320 * class.cs : csc build fix for GetMethods(). See bug #52503.
3322 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
3324 * expression.cs: Make sure fp comparisons work with NaN.
3325 This fixes bug #54303. Mig approved this patch a long
3326 time ago, but we were not able to test b/c the runtime
3329 2004-03-19 Miguel de Icaza <miguel@ximian.com>
3331 * ecore.cs (TypExpr.GetHashCode): implement this overload.
3333 2004-03-19 Martin Baulig <martin@ximian.com>
3335 * class.cs (MemberCore.IsDuplicateImplementation): Report the
3336 error here and not in our caller.
3338 2004-03-19 Martin Baulig <martin@ximian.com>
3340 * interface.cs: Completely killed this file.
3341 (Interface): We're now a TypeContainer and live in class.cs.
3343 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
3344 argument; we're now also called for interfaces.
3345 (TypeContainer.DefineMembers): Allow this method being called
3347 (TypeContainer.GetMethods): New public method; formerly known as
3348 Interface.GetMethod(). This is used by PendingImplementation.
3349 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
3350 it's now private and non-static.
3351 (Interface): Moved this here; it's now implemented similar to
3353 (Method, Property, Event, Indexer): Added `bool is_interface'
3354 argument to their .ctor's.
3355 (MemberBase.IsInterface): New public field.
3357 * cs-parser.jay: Create normal Method, Property, Event, Indexer
3358 instances instead of InterfaceMethod, InterfaceProperty, etc.
3359 (opt_interface_base): Removed; we now use `opt_class_base' instead.
3360 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
3362 2004-03-19 Martin Baulig <martin@ximian.com>
3364 * class.cs (MethodCore.IsDuplicateImplementation): New private
3365 method which does the CS0111 checking.
3366 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
3367 Use IsDuplicateImplementation().
3369 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
3371 * decl.cs (FindMemberToOverride): New method to find the correct
3372 method or property to override in the base class.
3374 - Make Method/Property use the above method to find the
3375 version in the base class.
3376 - Remove the InheritableMemberSignatureCompare as it is now
3379 This patch makes large code bases much faster to compile, as it is
3380 O(n) rather than O(n^2) to do this validation.
3382 Also, it fixes bug 52458 which is that nested classes are not
3383 taken into account when finding the base class member.
3385 Reviewed/Approved by Martin.
3387 2004-03-17 Marek Safar <marek.safar@seznam.cz>
3389 * interface.cs: In all interface classes removed redundant
3390 member initialization.
3392 2004-03-16 Martin Baulig <martin@ximian.com>
3394 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
3396 2004-03-15 Miguel de Icaza <miguel@ximian.com>
3398 * decl.cs (DefineTypeAndParents): New helper method to define a
3399 type's containers before the type itself is defined; This is a
3400 bug exposed by the recent changes to Windows.Forms when an
3401 implemented interface was defined inside a class that had not been
3404 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
3406 (Check): Loop correctly to report errors modifiers
3407 (UNSAFE was not in the loop, since it was the same as TOP).
3409 * interface.cs: Every interface member now takes a ModFlags,
3410 instead of a "is_new" bool, which we set on the base MemberCore.
3412 Every place where we called "UnsafeOk" in the interface, now we
3413 call the proper member (InterfaceMethod.UnsafeOK) instead to get
3414 the unsafe settings from the member declaration instead of the
3415 container interface.
3417 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
3419 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
3420 `set_indexer_name' to the pending bits (one per type).
3422 We fixed a bug today that was picking the wrong method to
3423 override, since for properties the existing InterfaceMethod code
3424 basically ignored the method name. Now we make sure that the
3425 method name is one of the valid indexer names.
3427 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
3429 * support.cs (SeekableStreamReader): Keep track of stream byte
3430 positions and don't mix them with character offsets to the buffer.
3432 Patch from Gustavo Giráldez
3434 2004-03-15 Marek Safar <marek.safar@seznam.cz>
3436 * interface.cs (InterfaceSetGetBase): Removed double member
3437 initialization, base class does it as well.
3439 2004-03-13 Martin Baulig <martin@ximian.com>
3441 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
3442 when compiling corlib.
3444 2004-03-13 Miguel de Icaza <miguel@ximian.com>
3446 * convert.cs (ExplicitConversion): We were reporting an error on
3447 certain conversions (object_type source to a value type, when the
3448 expression was `null') before we had a chance to pass it through
3449 the user defined conversions.
3451 * driver.cs: Replace / and \ in resource specifications to dots.
3454 * class.cs: Add check for duplicate operators. Fixes 52477
3456 2004-03-11 Miguel de Icaza <miguel@ximian.com>
3458 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
3459 that are in the middle of the statements, not only at the end.
3462 * class.cs (TypeContainer.AddField): No longer set the
3463 `HaveStaticConstructor' flag, now we call it
3464 `UserDefineStaticConstructor' to diferentiate the slightly
3465 semantic difference.
3467 The situation is that we were not adding BeforeFieldInit (from
3468 Modifiers.TypeAttr) to classes that could have it.
3469 BeforeFieldInit should be set to classes that have no static
3474 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
3476 And most importantly Zoltan's comment:
3478 http://bugzilla.ximian.com/show_bug.cgi?id=44229
3480 "I think beforefieldinit means 'it's ok to initialize the type sometime
3481 before its static fields are used', i.e. initialization does not need
3482 to be triggered by the first access to the type. Setting this flag
3483 helps the JIT to compile better code, since it can run the static
3484 constructor at JIT time, and does not need to generate code to call it
3485 (possibly lots of times) at runtime. Unfortunately, mcs does not set
3486 this flag for lots of classes like String.
3488 csc sets this flag if the type does not have an explicit static
3489 constructor. The reasoning seems to be that if there are only static
3490 initalizers for a type, and no static constructor, then the programmer
3491 does not care when this initialization happens, so beforefieldinit
3494 This bug prevents the AOT compiler from being usable, since it
3495 generates so many calls to mono_runtime_class_init that the AOT code
3496 is much slower than the JITted code. The JITted code is faster,
3497 because it does not generate these calls if the vtable is type is
3498 already initialized, which is true in the majority of cases. But the
3499 AOT compiler can't do this."
3501 2004-03-10 Miguel de Icaza <miguel@ximian.com>
3503 * class.cs (MethodData.Emit): Refactor the code so symbolic
3504 information is generated for destructors; For some reasons we
3505 were taking a code path that did not generate symbolic information
3508 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
3510 * class.cs: Create a Constructor.CheckBase method that
3511 takes care of all validation type code. The method
3512 contains some code that was moved from Define.
3514 It also includes new code that checks for duplicate ctors.
3515 This fixes bug #55148.
3517 2004-03-09 Joshua Tauberer <tauberer@for.net>
3519 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
3520 a { ... }-style array creation invokes EmitStaticInitializers
3521 which is not good for reference-type arrays. String, decimal
3522 and now null constants (NullCast) are not counted toward
3523 static initializers.
3525 2004-03-05 Martin Baulig <martin@ximian.com>
3527 * location.cs (SourceFile.HasLineDirective): New public field;
3528 specifies whether the file contains or is referenced by a "#line"
3530 (Location.DefineSymbolDocuments): Ignore source files which
3531 either contain or are referenced by a "#line" directive.
3533 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
3535 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
3536 direct access to our parent, so check the method inline there.
3538 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
3540 * expression.cs (Invocation.EmitCall): Miguel's last commit
3541 caused a regression. If you had:
3546 In Foo the implict this would be null.
3548 2004-02-27 Miguel de Icaza <miguel@ximian.com>
3550 * expression.cs (Invocation.EmitCall): If the method is not
3551 virtual, do not emit a CallVirt to it, use Call.
3553 * typemanager.cs (GetFullNameSignature): Improve the method to
3554 cope with ".ctor" and replace it with the type name.
3556 * class.cs (ConstructorInitializer.Resolve): Now the method takes
3557 as an argument the ConstructorBuilder where it is being defined,
3558 to catch the recursive constructor invocations.
3560 2004-02-26 Miguel de Icaza <miguel@ximian.com>
3562 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
3563 routines to check if a type is an enumerable/enumerator allow
3564 classes that implement the IEnumerable or IEnumerator interfaces.
3566 * class.cs (Property, Operator): Implement IIteratorContainer, and
3567 implement SetYields.
3569 (Property.Define): Do the block swapping for get_methods in the
3570 context of iterators. We need to check if Properties also
3571 include indexers or not.
3573 (Operator): Assign the Block before invoking the
3574 OperatorMethod.Define, so we can trigger the Iterator code
3577 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3578 Property and Operator classes are not created when we parse the
3579 declarator but until we have the block completed, so we use a
3580 singleton SimpleIteratorContainer.Simple to flag whether the
3581 SetYields has been invoked.
3583 We propagate this setting then to the Property or the Operator to
3584 allow the `yield' to function.
3586 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3588 * codegen.cs: Implemented attribute support for modules.
3589 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3590 Assembly/Module functionality.
3592 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3593 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3594 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3596 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3598 * interface.cs (FindMembers): The operation is performed on all base
3599 interfaces and not only on the first. It is required for future CLS Compliance patch.
3601 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3603 * statement.cs, codegen.cs:
3604 This patch deals with patterns such as:
3606 public class List : IEnumerable {
3608 public MyEnumerator GetEnumerator () {
3609 return new MyEnumerator(this);
3612 IEnumerator IEnumerable.GetEnumerator () {
3616 public struct MyEnumerator : IEnumerator {
3621 Before, there were a few things we did wrong:
3622 1) we would emit callvirt on a struct, which is illegal
3623 2) we emited ldarg when we needed to emit ldarga
3624 3) we would mistakenly call the interface methods on an enumerator
3625 type that derived from IEnumerator and was in another assembly. For example:
3627 public class MyEnumerator : IEnumerator
3629 Would have the interface methods called, even if there were public impls of the
3630 method. In a struct, this lead to invalid IL code.
3632 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3634 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3637 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3639 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3641 * cs-parser.jay: Fix small regression: we were not testing V2
3642 compiler features correctly.
3644 * interface.cs: If the emit context is null, then create one
3646 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3648 * decl.cs (GetSignatureForError): New virtual method to get full name
3651 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3652 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3654 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3655 Duplicated members and code in these classes has been removed.
3656 Better encapsulation in these classes.
3658 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3660 * assign.cs (Assign.DoResolve): When dealing with compound
3661 assignments, there is a new rule in ECMA C# 2.4 (might have been
3662 there before, but it is documented here) that states that in:
3666 If b is of type int, and the `op' is a shift-operator, then the
3667 above is evaluated as:
3671 * expression.cs (Binary.ResolveOperator): Instead of testing for
3672 int/uint/long/ulong, try to implicitly convert to any of those
3673 types and use that in pointer arithmetic.
3675 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3676 method to print information for from the type, not from the
3677 null-method we were given.
3679 2004-02-01 Duncan Mak <duncan@ximian.com>
3681 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3682 parsing for cmd, fixes bug #53694.
3684 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3686 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3687 in the member name duplication tests. Property and operator name duplication
3688 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3690 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3692 * interface.cs (PopulateMethod): Fixed crash when interface method
3693 returns not existing type (error test cs0246-3.cs).
3695 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3697 * cs-parser.jay (interface_accessors): Re-write actions to also
3698 store attributes attached to get and set methods. Fix spelling
3701 (inteface_property_declaration): Modify accordingly.
3703 (InterfaceAccessorInfo): New helper class to store information to pass
3704 around between rules that use interface_accessors.
3706 * interface.cs (Emit): Apply attributes on the get and set
3707 accessors of properties and indexers too.
3709 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3710 right MethodBuilder when applying attributes to the get and set accessors.
3712 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3714 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3716 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3718 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3720 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3722 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3723 changes that treat `yield' specially when present before `break'
3726 * cs-tokenizer.cs: yield is no longer a keyword.
3728 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3730 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3731 setting for default constructors.
3732 For default constructors are almost every time set wrong Modifier. The
3733 generated IL code has been alright. But inside mcs this values was
3734 wrong and this was reason why several of my CLS Compliance tests
3737 2004-01-22 Martin Baulig <martin@ximian.com>
3739 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3740 not a QualifiedIdentifier. This is what `type_name_expression'
3741 was previously doing.
3742 (type_name_expression): Removed; the code is now in
3743 `namespace_or_type_name'.
3744 (qualified_identifier): Removed, use `namespace_or_type_name'
3746 (QualifiedIdentifier): Removed this class.
3748 2004-01-22 Martin Baulig <martin@ximian.com>
3750 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3751 not a string as alias name.
3753 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3755 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3756 #52730 bug, and instead compute correctly the need to use a
3757 temporary variable when requesting an address based on the
3758 static/instace modified of the field and the constructor.
3760 2004-01-21 Martin Baulig <martin@ximian.com>
3762 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3763 class and namespace before looking up aliases. Fixes #52517.
3765 2004-01-21 Martin Baulig <martin@ximian.com>
3767 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3768 assinged in a 'try'; fixes exception4.cs.
3770 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3771 * class.cs : Implemented parameter-less constructor for TypeContainer
3773 * decl.cs: Attributes are now stored here. New property OptAttributes
3775 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3777 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3779 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3781 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3782 (CSharpSignature): New method for indexer and property signature.
3784 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3786 * pending.cs (IsVirtualFilter): Faster implementation.
3788 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3790 * typemanager.cs: Avoid inclusion of same assembly more than once.
3792 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3794 * cs-parser.jay: Fixed problem where the last assembly attribute
3795 has been applied also to following declaration (class, struct, etc.)
3797 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3799 * class.cs: Added error CS0538, CS0539 reporting.
3800 Fixed crash on Microsoft runtime when field type is void.
3802 * cs-parser.jay: Added error CS0537 reporting.
3804 * pending.cs: Added error CS0535 reporting.
3805 Improved error report for errors CS0536, CS0534.
3807 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3809 Merge a few bits from the Anonymous Method MCS tree.
3811 * statement.cs (ToplevelBlock): New class for toplevel methods,
3812 will hold anonymous methods, lifted variables.
3814 * cs-parser.jay: Create toplevel blocks for delegates and for
3815 regular blocks of code.
3817 2004-01-20 Martin Baulig <martin@ximian.com>
3819 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3820 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3821 and `NeedExplicitReturn'; added `IsLastStatement'.
3822 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3823 have a `ReturnLabel' or we're not unreachable.
3825 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3826 child's reachability; don't just override ours with it. Fixes
3827 #58058 (lluis's example).
3828 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3829 InFinally(), InLoop(), InSwitch() and
3830 BreakCrossesTryCatchBoundary() methods.
3832 * statement.cs (Return): Do all error checking in Resolve().
3833 Unless we are the last statement in a top-level block, always
3834 create a return label and jump to it.
3835 (Break, Continue): Do all error checking in Resolve(); also make
3836 sure we aren't leaving a `finally'.
3837 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3838 statement in a top-level block.
3839 (Block.Flags): Added `IsDestructor'.
3840 (Block.IsDestructor): New public property.
3842 2004-01-20 Martin Baulig <martin@ximian.com>
3844 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3846 2004-01-20 Martin Baulig <martin@ximian.com>
3848 * statement.cs (Statement.ResolveUnreachable): New public method.
3849 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3850 (Block.Resolve): Resolve unreachable statements.
3852 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3854 * expression.cs: We need to fix the case where we do
3855 not have a temp variable here.
3857 * assign.cs: Only expression compound assignments need
3858 temporary variables.
3860 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3862 * flowanalysis.cs: Reduce memory allocation in a few ways:
3863 - A block with no variables should not allocate a bit
3865 - A method with no out parameters does not need any tracking
3866 for assignment of the parameters, so we need not allocate
3869 public readonly Type[] VariableTypes;
3870 public readonly string[] VariableNames;
3871 Are redundant. The data is already stored in the variable
3872 map, so we need not allocate another array for it.
3873 - We need to add alot of checks for if (params | locals) == null
3874 due to the first two changes.
3876 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3878 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3879 implement IMemoryLocation, we store a copy on a local variable and
3880 take the address of it. Patch from Benjamin Jemlich
3882 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3883 to use a special "type_name_expression" rule which reduces the
3884 number of "QualifiedIdentifier" classes created, and instead
3885 directly creates MemberAccess expressions.
3887 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3889 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3890 that fixes #52853. Null literal assignment to ValueType
3892 * class.cs (MethodData.Emit): Instead of checking the name of the
3893 method to determine if its a destructor, create a new derived
3894 class from Method called Destructor, and test for that.
3896 * cs-parser.jay: Create a Destructor object instead of a Method.
3898 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3902 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3904 * expression.cs (Binary.ResolveOperator): Perform an implicit
3905 conversion from MethodGroups to their delegate types on the
3908 * delegate.cs: Introduce a new class DelegateCreation that is the
3909 base class for `NewDelegate' and `ImplicitDelegateCreation',
3910 factor some code in here.
3912 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3913 conversion from MethodGroups to compatible delegate types.
3915 * ecore.cs (Expression.Resolve): Do not flag error 654
3916 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3917 we allow conversions from MethodGroups to delegate types now.
3919 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3920 assignments in v2 either.
3922 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3924 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3925 static read-only fields in ctors.
3927 Applied patch from Benjamin Jemlich
3929 * expression.cs (UnaryMutator): Avoid leaking local variables.
3931 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3933 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3934 here to return true, as they can be used like this:
3938 Fixed 49836 and all the other dups
3940 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3942 * driver.cs: Implement /win32res and /win32icon.
3944 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3946 * cs-parser.jay: Add a rule to improve error handling for the
3947 common mistake of placing modifiers after the type.
3949 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3951 * cs-parser.jay (interface_event_declaration): Catch
3952 initialization of events on interfaces, and report cs0068
3954 * cs-parser.jay (interface_event_declaration): Catch
3955 initialization of events.
3957 * ecore.cs: Better report missing constructors.
3959 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3960 the error reporting done in the wrong place. Fix.
3962 * expression.cs (Binary.ResolveOperator): Catch the
3963 operator + (E x, E y) error earlier, and later allow for implicit
3964 conversions in operator +/- (E e, U x) from U to the underlying
3967 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3968 52596, if the container class is abstract, the default constructor
3969 is protected otherwise its public (before, we were always public).
3971 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3974 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3975 Jemlich that fixes bug #52597, MCS was generating invalid code for
3976 idisposable structs. Thanks to Ben for following up with this
3979 2004-01-06 Miguel de Icaza <miguel@ximian.com>
3981 * driver.cs: Allow assemblies without code to be generated, fixes
3984 2004-01-07 Nick Drochak <ndrochak@gol.com>
3986 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
3988 2004-01-05 Miguel de Icaza <miguel@ximian.com>
3990 * cs-parser.jay: Add rules to improve error reporting if fields or
3991 methods are declared at the namespace level (error 116)
3993 * Add rules to catch event add/remove
3995 2004-01-04 David Sheldon <dave-mono@earth.li>
3997 * expression.cs: Added matching ")" to error message for
4000 2004-01-03 Todd Berman <tberman@gentoo.org>
4002 * ecore.cs, attribute.cs:
4003 Applying fix from #52429.
4005 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4007 * ecore.cs, expression.cs, statement.cs:
4008 Total rewrite of how we handle branching. We
4009 now handle complex boolean expressions with fewer
4010 jumps. As well if (x == 0) no longer emits a ceq.
4012 if (x is Foo) is much faster now, because we generate
4015 Overall, we get a pretty big improvement on our benchmark
4016 tests. The code we generate is smaller and more readable.
4018 I did a full two-stage bootstrap. The patch was reviewed
4019 by Martin and Miguel.
4021 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4023 * cs-parser.jay: Make primary_expression not take a QI.
4024 we dont need this because the member_access rule covers
4025 us here. So we replace the rule with just IDENTIFIER.
4027 This has two good effects. First, we remove a s/r conflict.
4028 Second, we allocate many fewer QualifiedIdentifier objects.
4030 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4032 * attribute.cs: Handle MarshalAs attributes as pseudo, and
4033 set the correct information via SRE. This prevents
4034 hanging on the MS runtime. Fixes #29374.
4036 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
4038 * convert.cs: correctly handle conversions to value types
4039 from Enum and ValueType as unboxing conversions.
4041 Fixes bug #52569. Patch by Benjamin Jemlich.
4043 2004-01-02 Ravi Pratap <ravi@ximian.com>
4045 * expression.cs (BetterConversion): Prefer int -> uint
4046 over int -> ulong (csc's behaviour). This fixed bug #52046.
4048 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
4050 * decl.cs (MemberCache.FindMembers): now returns a
4053 * typemanager.cs: In general, go with with ^^.
4054 (CopyNewMethods): take an IList.
4055 (RealMemberLookup): Only allocate an arraylist
4056 if we copy from two sets of methods.
4058 This change basically does two things:
4059 1) Fewer array lists allocated due to CopyNewMethods.
4060 2) the explicit cast in MemberList costed ALOT.
4062 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
4064 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
4065 a hashtable to avoid needless string allocations when an identifier is
4066 used more than once (the common case).
4068 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
4070 * pending.cs: MS's TypeBuilder.GetInterfaces ()
4071 is broken, it will not return anything. So, we
4072 have to use the information we have in mcs to
4075 * typemanager.cs: Add a cache for GetInterfaces,
4076 since this will now be used more often (due to ^^)
4078 (GetExplicitInterfaces) New method that gets the
4079 declared, not effective, interfaces on a type
4080 builder (eg, if you have interface IFoo, interface
4081 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
4084 This patch makes MCS able to bootstrap itself on
4087 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
4089 * expression.cs: Remove the Nop's that Miguel put
4092 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4094 * report.cs, codegen.cs: Give the real stack trace to
4095 the error when an exception is thrown.
4097 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4099 * decl.cs: only allocate hashtables for ifaces if
4102 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4104 * expression.cs: fix the error from cs0121-2.cs
4105 (a parent interface has two child interfaces that
4106 have a function with the same name and 0 params
4107 and the function is called through the parent).
4109 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
4111 * class.cs, rootcontext.cs, typmanager.cs: do not
4114 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
4116 * codegen.cs: remove stack for the ec flow branching.
4117 It is already a linked list, so no need.
4119 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
4121 * Makefile: Allow custom profiler here.
4123 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4125 * typemanager.cs (LookupType):
4126 - Use a static char [], because split takes
4127 a param array for args, so it was allocating
4129 - Do not store true in a hashtable, it boxes.
4131 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4133 * flowanalysis.cs: bytify common enums.
4135 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4137 * modifiers.cs: Add a new set of flags for the
4138 flags allowed on explicit interface impls.
4139 * cs-parser.jay: catch the use of modifiers in
4140 interfaces correctly.
4141 * class.cs: catch private void IFoo.Blah ().
4143 All related to bug #50572.
4145 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4147 * decl.cs: Rewrite the consistant accessability checking.
4148 Accessability is not linear, it must be implemented in
4149 a tableish way. Fixes #49704.
4151 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4153 * expression.cs: Handle negation in a checked context.
4154 We must use subtraction from zero. Fixes #38674.
4156 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4158 * class.cs: Ignore static void main in DLLs.
4159 * rootcontext.cs: Handle the target type here,
4160 since we are have to access it from class.cs
4161 * driver.cs: account for the above.
4163 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4165 * report.cs: Give line numbers and files if available.
4167 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
4169 * driver.cs: Implement /addmodule.
4171 * typemanager.cs: Change 'modules' field so it now contains Modules not
4174 2003-12-20 Martin Baulig <martin@ximian.com>
4176 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
4177 (FieldBase.IsAssigned): Removed this field.
4178 (FieldBase.SetAssigned): New public method.
4179 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
4181 2003-12-20 Martin Baulig <martin@ximian.com>
4183 * expression.cs (LocalVariableReference.DoResolve): Don't set
4184 `vi.Used' if we're called from DoResolveLValue().
4186 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
4187 returns the usage vector it just merged into the current one -
4188 pass this one to UsageWarning().
4189 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
4190 of the `EmitContext', don't call this recursively on our children.
4192 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
4194 * driver.cs: Implement /target:module.
4196 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
4198 * support.cs (CharArrayHashtable): New helper class.
4200 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
4201 char arrays, not strings, so we can avoid creating a string in
4202 consume_identifier if the identifier is a keyword.
4204 2003-12-16 Martin Baulig <martin@ximian.com>
4206 * statement.cs (LocalInfo.Assigned): Removed this property.
4207 (LocalInfo.Flags): Removed `Assigned'.
4208 (LocalInfo.IsAssigned): New public method; takes the EmitContext
4209 and uses flow analysis.
4210 (Block.UsageWarning): Made this method private.
4211 (Block.Resolve): Call UsageWarning() if appropriate.
4213 * expression.cs (LocalVariableReference.DoResolve): Always set
4214 LocalInfo.Used here.
4216 2003-12-13 Martin Baulig <martin@ximian.com>
4218 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
4219 any value here; we're now using flow analysis to figure out
4220 whether a statement/block returns a value.
4222 2003-12-13 Martin Baulig <martin@ximian.com>
4224 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
4226 (FlowBranching.MergeFinally): Don't call
4227 `branching.CheckOutParameters()' here, this is called in
4229 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
4230 when adding the `finally' vector.
4232 2003-12-13 Martin Baulig <martin@ximian.com>
4235 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
4236 actually work and also fix #48962.
4238 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
4240 * decl.cs: Do not check System.Object for nested types,
4241 since we know it does not have any. Big bang for buck:
4246 corlib: 17.99 seconds
4250 corlib: 17.39 seconds
4252 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
4254 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
4255 time we are returning 0 members, so we save alot here.
4257 2003-12-11 Martin Baulig <martin@ximian.com>
4259 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
4260 `MergeChild()', also just take the `FlowBranching' as argument;
4261 call Merge() on it and return the result.
4262 (FlowBranching.Merge): We don't need to do anything if we just
4265 2003-12-11 Martin Baulig <martin@ximian.com>
4267 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
4268 them in an `ArrayList' to reduce memory usage. Thanks to Ben
4269 Maurer for this idea.
4271 2003-12-11 Martin Baulig <martin@ximian.com>
4273 * flowanalysis.cs (MergeResult): This class is now gone; we now
4274 use the `UsageVector' for this. The reason for this is that if a
4275 branching just has one sibling, we don't need to "merge" them at
4276 all - that's the next step to do.
4277 (FlowBranching.Merge): We now return a `UsageVector' instead of a
4280 2003-12-11 Martin Baulig <martin@ximian.com>
4282 Reworked flow analyis and made it more precise and bug-free. The
4283 most important change is that we're now using a special `Reachability'
4284 class instead of having "magic" meanings of `FlowReturns'. I'll
4285 do some more cleanups and optimizations and also add some more
4286 documentation this week.
4288 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
4289 largely reworked this class.
4290 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
4291 the new `Reachability' class instead of having "magic" values here.
4292 (FlowBranching): We're now using an instance of `Reachability'
4293 instead of having separate `Returns', `Breaks' etc. fields.
4295 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
4296 based on flow analysis; ignore the return value of block.Emit ().
4298 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
4300 * driver.cs typemanager.cs: Find the mono extensions to corlib even
4301 if they are private.
4303 2003-12-09 Martin Baulig <martin@ximian.com>
4305 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4306 call them directly on the UsageVector.
4308 2003-12-09 Martin Baulig <martin@ximian.com>
4310 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
4311 Changed return type from `FlowReturns' to `Reachability'.
4313 2003-12-09 Martin Baulig <martin@ximian.com>
4315 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
4316 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
4317 `Reachable' fields with a single `Reachability' one.
4319 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4321 * class.cs (FindMembers): Remove foreach's.
4334 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4339 This patch does a few things:
4340 1. EmptyStatement is now a singleton, so it is never reallocated.
4341 2. All blah is EmptyStatement constructs have been changed to
4342 blah == EmptyStatement.Value, which is much faster and valid
4343 now that EmptyStatement is a singleton.
4344 3. When resolving a block, rather than allocating a new array for
4345 the non-empty statements, empty statements are replaced with
4346 EmptyStatement.Value
4347 4. Some recursive functions have been made non-recursive.
4348 Mainly the performance impact is from (3), however (1) and (2) are needed for
4349 this to work. (4) does not make a big difference in normal situations, however
4350 it makes the profile look saner.
4355 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4356 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4357 Total memory allocated: 56397 KB
4360 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
4361 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
4362 Total memory allocated: 55666 KB
4364 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4366 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
4367 than the hashtable in a hashtable version
4369 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
4370 we always end up concating a string. This results in a huge perf
4371 loss, because many strings have to be tracked by the GC. In this
4372 patch, we first use a hashtable that works with two keys, so that
4373 the strings do not need to be concat'ed.
4384 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4386 * Makefile: Add a new target `do-time' that does a quick and simple
4387 profile, leaving easy to parse output.
4389 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
4391 * codegen.cs (Init): Create the dynamic assembly with
4392 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
4394 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
4396 * support.cs: Make the PtrHashtable use only one
4397 instance of its comparer.
4399 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
4401 * typemanager.cs: Fix lookup of GetNamespaces.
4403 2003-11-29 Miguel de Icaza <miguel@ximian.com>
4405 * expression.cs: Removed redundant line.
4407 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
4408 ArrayLists, use for loops with bounds.
4410 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
4413 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
4414 arraylists, use for loop with bounds.
4416 The above three changes give us a 0.071 second performance
4417 improvement out of 3.294 seconds down to 3.223. On my machine
4418 the above changes reduced the memory usage by 1,387 KB during
4421 * cs-parser.jay (QualifiedIdentifier): New class used to represent
4422 QualifiedIdentifiers. Before we created a new string through
4423 concatenation, and mostly later on, the result would be
4424 manipulated by DecomposeQI through string manipulation.
4426 This reduced the compiler memory usage for bootstrapping from
4427 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
4428 compile times in 0.05 seconds.
4430 2003-11-28 Dick Porter <dick@ximian.com>
4432 * support.cs: Do string compares with the Invariant culture.
4440 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
4441 the comparison is done with the Invariant culture.
4443 2003-11-27 Miguel de Icaza <miguel@ximian.com>
4445 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
4446 GetEnumerator method.
4448 (ProbeCollectionType): Iterate starting at the most specific type
4449 upwards looking for a GetEnumerator
4451 * expression.cs: Shift count can be up to 31 for int/uint and 63
4454 2003-11-26 Miguel de Icaza <miguel@ximian.com>
4456 * statement.cs (Block.LookupLabel): Also look for the label on the
4457 children blocks. Use a hash table to keep track of visited
4460 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
4461 we actually did transform the other operand, otherwise fall back
4462 to the common codepath that casts to long.
4464 * cs-tokenizer.cs: Use the same code pattern as the int case.
4465 Maybe I should do the parsing myself, and avoid depending on the
4466 Parse routines to get this done.
4468 2003-11-25 Miguel de Icaza <miguel@ximian.com>
4470 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4471 which fixes bug 51347. This time test it.
4473 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
4474 attributes for example can not tell the difference between these.
4475 The difference was only a syntax feature of the language.
4477 * attribute.cs: Apply attributes to delegates.
4479 * delegate.cs: Call the apply attributes method.
4481 2003-11-24 Miguel de Icaza <miguel@ximian.com>
4483 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
4484 comparing 0 vs Byte.MinValue, not the value
4486 (ImplicitConversionRequired): When reporting a conversion error,
4487 use error 31 to print out the constant error instead of the
4490 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4491 which fixes bug 51347.
4493 2003-11-22 Miguel de Icaza <miguel@ximian.com>
4495 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
4496 which fixes the -warnaserror command line option.
4498 2003-11-21 Miguel de Icaza <miguel@ximian.com>
4500 * cfold.cs (DoNumericPromotions): During constant folding of
4501 additions on UIntConstant, special case intconstants with
4502 IntConstants like we do on the expression binary operator.
4504 2003-11-12 Miguel de Icaza <miguel@ximian.com>
4506 * convert.cs (ImplicitReferenceConversion): We were missing a case
4507 (System.Enum are not value types or class types, so we need to
4508 classify them separatedly).
4510 * driver.cs: We do not support error 2007.
4512 2003-11-12 Jackson Harper <jackson@ximian.com>
4514 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
4515 system directory. Also use the full file name so users can
4516 libraries names mscorlib-o-tron.dll in a non system dir.
4518 2003-11-10 Martin Baulig <martin@ximian.com>
4520 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
4521 (TypeManager.InitCoreTypes): Initialize them here, but instead of
4522 calling `ResolveType()' on them, directly assign their `Type'.
4524 2003-11-08 Martin Baulig <martin@ximian.com>
4526 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
4527 return value and the `out parent' parameter.
4528 (TypeContainer.DefineType): Moved the CS0644 check into
4529 GetClassBases(). Don't pass the interface types to the
4530 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
4531 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
4533 * ecore.cs (TypeExpr.IsAttribute): New property.
4534 (TypeExpr.GetInterfaces): New method.
4536 * interface.cs (Interface.GetInterfaceTypeByName): Return a
4537 TypeExpr instead of a Type.
4538 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
4539 (Interface.DefineType): Don't pass the interface types to the
4540 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
4541 them later and then call `TypeBulider.AddInterfaceImplementation()'.
4543 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
4544 instead of a `Type[]'.
4545 (TypeManager.RegisterBuilder): Likewise.
4546 (TypeManager.AddUserInterface): Likewise.
4547 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
4548 `Type[]' and also return a `TypeExpr[]'.
4549 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
4551 2003-11-08 Martin Baulig <martin@ximian.com>
4553 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
4556 2003-11-08 Martin Baulig <martin@ximian.com>
4558 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
4559 TypeManager.ResolveExpressionTypes().
4561 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
4562 instead of an Expression.
4563 (TypeExpr): This is now an abstract base class for `TypeExpression'.
4564 (TypeExpression): New public class; formerly known as `TypeExpr'.
4566 * expression.cs (ComposedCast): Derive from TypeExpr.
4568 * typemanager.cs (TypeManager.system_*_expr): These are now
4569 TypExpr's instead of Expression's.
4570 (TypeManager.ResolveExpressionTypes): New public static function;
4571 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
4574 2003-11-06 Miguel de Icaza <miguel@ximian.com>
4576 * expression.cs (New.DoResolve): Do not dereference value that
4577 might be a null return.
4579 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4580 sure that the constant value has the right type. Fixes an
4581 unreported bug, similar to 50425.
4583 * const.cs (Const.LookupConstantValue): Call
4584 ImplicitStandardConversionExists before doing a conversion to
4585 avoid havng the TypeManager.ChangeType do conversions.
4587 Reduced the number of casts used
4589 (Const.ChangeType): New routine to enable reuse of the constant
4590 type changing code from statement.
4592 * typemanager.cs (ChangeType): Move common initialization to
4593 static global variables.
4597 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4598 every value type to go through, even if it was void. Fix that.
4600 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4601 character of the define, and the is_identifier_part_character for
4602 the rest of the string.
4604 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4606 * expression.cs (UnaryMutator.EmitCode): When I updated
4607 LocalVariableReference.DoResolve, I overdid it, and dropped an
4608 optimization done on local variable references.
4610 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4612 * ecore.cs: Convert the return from Ldlen into an int.
4614 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4616 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4617 the accessibility, this is a special case for toplevel non-public
4618 classes (internal for instance).
4620 2003-10-20 Nick Drochak <ndrochak@gol.com>
4622 * ecore.cs: Fix typo and build. Needed another right paren.
4624 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4626 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4627 `internal' case regular and protected, but not allowing protected
4628 to be evaluated later. Bug 49840
4630 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4632 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4633 to kb.Nlast, and not the kb.nFirst to isolate the switch
4636 Extract the underlying type, so enumerations of long/ulong are
4637 treated like long/ulong.
4639 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4641 * expression.cs (New): Overload the meaning of RequestedType to
4642 track the possible creation of the NewDelegate type, since
4643 DoResolve is invoked more than once for new constructors on field
4646 See bugs: #48800 and #37014
4648 * cs-parser.jay (declare_local_constants): Take an arraylist
4649 instead of a single constant.
4651 (local_constant_declaration): It should take a
4652 constant_declarators, not a constant_declarator. Fixes 49487
4654 * convert.cs: Fix error report.
4656 2003-10-13 Jackson Harper <jackson@ximian.com>
4658 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4661 2003-10-09 Martin Baulig <martin@ximian.com>
4663 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4665 (MethodCore.DoDefineParameters): Removed the TypeContainer
4666 argument; use the DeclSpace which was passed to the .ctor instead.
4667 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4668 TypeContainer; we only need a DeclSpace here.
4670 2003-10-09 Martin Baulig <martin@ximian.com>
4672 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4674 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4675 EmitContext's .ctor.
4677 2003-10-09 Martin Baulig <martin@ximian.com>
4679 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4680 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4681 AsAccessible(), moved them as well.
4683 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4685 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4687 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4689 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4691 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4692 generation for >=, as spotted by Paolo, bug 48679.
4693 Patch from David Waite.
4695 * cs-tokenizer.cs: Add handling for #pragma.
4697 * cs-parser.jay: Allow for both yield and yield return in the
4698 syntax. The anti-cobolization of C# fight will go on!
4700 * class.cs (TypeBuilder.DefineType): Catch error condition here
4701 (Parent.DefineType erroring out and returning null).
4703 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4704 coping with enumerations variables, we were mistakenly processing
4705 them as a regular value type instead of built-in types. Fixes the
4708 * typemanager.cs (IsBuiltinOrEnum): New method.
4710 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4712 * cs-parser.jay: Upgrade: yield now needs the return clause.
4714 2003-09-19 Martin Baulig <martin@ximian.com>
4716 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4717 `MemberCache parent' argument. Normally, an interface doesn't
4718 have a parent type except System.Object, but we use this in gmcs
4719 for generic type parameters.
4721 2003-09-18 Martin Baulig <martin@ximian.com>
4723 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4724 on `type.IsInterface'; don't check whether the type has a parent
4725 to determine whether it's an interface.
4727 2003-09-15 Martin Baulig <martin@ximian.com>
4729 * class.cs (TypeContainer.DefineType): Added an error flag to
4730 avoid reporting duplicate CS0146's ("class definition is
4733 * driver.cs (Driver.MainDriver): Abort if
4734 RootContext.ResolveTree() reported any errors.
4736 2003-09-07 Martin Baulig <martin@ximian.com>
4738 * report.cs (Error, Warning): Added overloaded versions which take
4739 a `params object[] args' and call String.Format().
4741 2003-09-07 Martin Baulig <martin@ximian.com>
4743 * decl.cs (DeclSpace..ctor): Don't call
4744 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4745 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4746 (DeclSpace.RecordDecl): New method.
4748 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4750 2003-09-02 Ravi Pratap <ravi@ximian.com>
4752 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4753 value attributes to be applied to ParameterBuilders.
4755 * class.cs (MethodCore.LabelParameters): Make static and more
4756 generic so that it can be used from other places - like interface
4757 methods, for instance.
4759 * interface.cs (Interface.Emit): Call LabelParameters before
4760 emitting attributes on the InterfaceMethod.
4762 2003-08-26 Martin Baulig <martin@ximian.com>
4764 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4765 resolving aliases; fixes #47927.
4767 2003-08-26 Martin Baulig <martin@ximian.com>
4769 * statement.cs (Using.DoResolve): This is internally emitting a
4770 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4771 do not always return. Fixes #47681.
4773 2003-08-26 Martin Baulig <martin@ximian.com>
4775 * decl.cs (MemberCore): Moved WarningNotHiding(),
4776 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4778 (AdditionResult): Make this nested in DeclSpace.
4779 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4780 argument; call NamespaceEntry.Define() unless we're nested in a
4783 * namespace.cs (Namespace.DefineName): New public function. This
4784 is called from DeclSpace's .ctor to add
4785 (Namespace.Lookup): Include DeclSpaces in the lookup.
4787 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4789 * const.cs (Const): Derive from MemberBase, not MemberCore.
4791 2003-08-25 Martin Baulig <martin@ximian.com>
4793 * convert.cs (Convert.ExplicitReferenceConversion): When
4794 converting from an interface type to a class, unbox if the target
4795 type is a struct type. Fixes #47822.
4797 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4799 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
4802 2003-08-22 Martin Baulig <martin@ximian.com>
4804 * class.cs (TypeManager.DefineType): When defining a nested type,
4805 call DefineType() on our parent; fixes #47801.
4807 2003-08-22 Martin Baulig <martin@ximian.com>
4809 * class.cs (MethodData.Define): While checking if a method is an
4810 interface implementation, improve the test a bit more to fix #47654.
4812 2003-08-22 Martin Baulig <martin@ximian.com>
4814 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4815 correctly; fixes #47722.
4817 2003-08-22 Martin Baulig <martin@ximian.com>
4819 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
4820 LocalVariableReference, ensure it's not read-only. Fixes #47536.
4822 * statement.cs (Fixed.DoResolve): Make all variables read-only.
4824 2003-08-22 Martin Baulig <martin@ximian.com>
4826 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
4827 can only be assigned in static constructors. Fixes #47161.
4829 2003-08-22 Martin Baulig <martin@ximian.com>
4831 Rewrote and improved the flow analysis code.
4833 * flowbranching.cs (FlowBranching): Make this class abstract.
4834 (FlowBranching.CreateBranching): New static function to create a
4836 (FlowBranchingBlock, FlowBranchingException): New classes.
4837 (FlowBranching.UsageVector.Type): New public readonly field.
4838 (FlowBranching.UsageVector.Breaks): Removed the setter.
4839 (FlowBranching.UsageVector.Returns): Removed the setter.
4840 (FlowBranching.UsageVector): Added Break(), Return(),
4841 NeverReachable() and Throw() methods to modify the reachability.
4842 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
4843 done by FlowBranching.Merge().
4844 (FlowBranching.UsageVector.MergeChild): New method; merges the
4845 merge result into the current vector.
4846 (FlowBranching.Merge): New abstract method to merge a branching.
4848 2003-08-12 Martin Baulig <martin@ximian.com>
4850 * expression.cs (Indirection.CacheTemporaries): Create the
4851 LocalTemporary with the pointer type, not its element type.
4853 2003-08-10 Miguel de Icaza <miguel@ximian.com>
4855 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
4856 token was a keyword or not.
4858 Add `error' options where an IDENTIFIER was expected; Provide
4859 CheckToken and CheckIdentifierToken convenience error reporting
4862 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
4864 * decl.cs: Rename `NamespaceEntry Namespace' public field into
4865 NameSpaceEntry NameSpaceEntry.
4867 (LookupInterfaceOrClass): Avoid creating a full qualified name
4868 from namespace and name: avoid doing lookups when we know the
4869 namespace is non-existant. Use new Tree.LookupByNamespace which
4870 looks up DeclSpaces based on their namespace, name pair.
4872 * driver.cs: Provide a new `parser verbose' to display the
4873 exception thrown during parsing. This is turned off by default
4874 now, so the output of a failure from mcs is more graceful.
4876 * namespace.cs: Track all the namespaces defined in a hashtable
4879 (IsNamespace): New method
4881 2003-08-09 Miguel de Icaza <miguel@ximian.com>
4883 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
4884 we know that we need to concatenate (full typename can never be
4889 * statement.cs: Use a bitfield; Do not initialize to null things
4890 which are done by the constructor by default.
4892 * cs-parser.jay: bug fix, parameter was 4, not 3.
4894 * expression.cs: Just use the property;
4896 * statement.cs: No need for GetVariableInfo method.
4898 2003-08-08 Martin Baulig <martin@ximian.com>
4900 * flowanalysis.cs (FlowReturns): This is now nested in the
4901 `FlowBranching' class.
4902 (MyBitVector): Moved this here from statement.cs.
4903 (FlowBranching.SiblingType): New enum type.
4904 (FlowBranching.CreateSibling): Added `SiblingType' argument.
4906 2003-08-07 Martin Baulig <martin@ximian.com>
4908 * flowanalysis.cs (FlowBranchingType): This is now nested in the
4909 `FlowBranching' class and called `BranchingType'.
4911 2003-08-07 Martin Baulig <martin@ximian.com>
4913 * flowanalysis.cs: Moved all the control flow analysis code into
4916 2003-08-07 Martin Baulig <martin@ximian.com>
4918 * assign.cs (Assign.DoResolve): `target' must either be an
4919 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
4922 2003-08-07 Miguel de Icaza <miguel@ximian.com>
4924 * expression.cs (BinaryMethod): This kind of expression is created by the
4925 Binary class if it determines that the operator has to be handled
4928 (BinaryDelegate): This kind of expression is created if we are
4929 dealing with a + or - operator on delegates.
4931 (Binary): remove method, argumetns, and DelegateOperator: when
4932 dealing with methods,
4934 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
4936 * statement.cs (Block): use bitfields for the three extra booleans
4937 we had in use. Remove unused topblock parameter.
4939 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
4941 * assign.cs: Drop extra unneeded tests.
4943 2003-08-06 Miguel de Icaza <miguel@ximian.com>
4945 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
4947 * statement.cs (Foreach): Use VariableStorage instead of
4950 * codegen.cs (VariableStorage): New class used by clients that
4951 require a variable stored: locals or fields for variables that
4952 need to live across yield.
4954 Maybe provide a convenience api for EmitThis+EmitLoad?
4956 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
4959 2003-08-05 Miguel de Icaza <miguel@ximian.com>
4961 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4962 RemapParameterLValue): New methods that are used to turn a
4963 precomputed FieldInfo into an expression like this:
4967 The idea is to use this instead of making LocalVariableReference
4968 have more than one meaning.
4970 * cs-parser.jay: Add error production to BASE.
4972 * ecore.cs: Deal with TypeManager.GetField returning null, which
4973 is now a valid return value.
4975 (FieldExprNoAddress): New expression for Fields whose address can
4978 * expression.cs (LocalVariableReference): During the resolve
4979 phases, create new expressions if we are in a remapping context.
4980 Remove code that dealt with remapping here.
4982 (ParameterReference): same.
4984 (ProxyInstance): New expression, like the `This' expression, but
4985 it is born fully resolved. We know what we are doing, so remove
4986 the errors that are targeted to user-provided uses of `this'.
4988 * statement.cs (Foreach): our variable is now stored as an
4989 Expression; During resolution, follow the protocol, dont just
4990 assume it will return this.
4992 2003-08-06 Martin Baulig <martin@ximian.com>
4994 * support.cs (SeekableStreamReader.cs): New public class.
4996 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4997 SeekableStreamReader instead of the normal StreamReader.
4999 2003-08-04 Martin Baulig <martin@ximian.com>
5001 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
5002 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
5003 deambiguate casts and delegate invocations.
5004 (parenthesized_expression): Use the new tokens to ensure this is
5005 not a cast of method invocation.
5007 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
5008 when reading a `)' and Deambiguate_CloseParens () was previously
5011 * expression.cs (ParenthesizedExpression): New class. This is
5012 just used for the CS0075 test.
5013 (Binary.DoResolve): Check for CS0075.
5015 2003-07-29 Ravi Pratap <ravi@ximian.com>
5017 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
5018 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
5019 reference comparison.
5021 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
5022 examine the ReturnType for equality - this is necessary in the
5023 cases of implicit and explicit operators whose signature also
5024 includes the return type.
5026 2003-07-26 Miguel de Icaza <miguel@ximian.com>
5028 * namespace.cs: Cache the result of the namespace computation,
5029 instead of computing it every time.
5031 2003-07-24 Miguel de Icaza <miguel@ximian.com>
5033 * decl.cs: Use a global arraylist that we reuse over invocations
5034 to avoid excesive memory consumption. Reduces memory usage on an
5035 mcs compile by one meg (45 average).
5037 * typemanager.cs (LookupTypeReflection): In .NET pointers are
5038 private, work around that.
5040 2003-07-23 Miguel de Icaza <miguel@ximian.com>
5042 * literal.cs (IntLiteral): Define Zero and One static literals.
5044 * cs-parser.jay (integer_literal): use static literals to reduce
5045 memory usage for the most used literals (0, 1 and -1). 211kb
5046 reduced in memory usage.
5048 Replace all calls to `new ArrayList' with `new
5049 ArrayList(4)' which is a good average number for most allocations,
5050 and also requires only 16 bytes of memory for its buffer by
5053 This reduced MCS memory usage in seven megabytes for the RSS after
5056 2003-07-28 Ravi Pratap <ravi@ximian.com>
5058 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
5059 handle params methods the correct way by forming only one
5060 applicable set with params and normal methods in them. Earlier we
5061 were looking at params methods only if we found no normal methods
5062 which was not the correct thing to do.
5064 (Invocation.BetterFunction): Take separate arguments indicating
5065 when candidate and the best method are params methods in their
5068 This fixes bugs #43367 and #46199.
5070 * attribute.cs: Documentation updates.
5072 (CheckAttribute): Rename to CheckAttributeTarget.
5073 (GetValidPlaces): Rename to GetValidTargets.
5075 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
5076 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
5080 2003-07-28 Martin Baulig <martin@ximian.com>
5082 * class.cs (TypeContainer.DefineMembers): Use the base type's full
5083 name when looking up the base class of a nested class. Fixes #46977.
5085 2003-07-26 Martin Baulig <martin@ximian.com>
5087 * expression.cs (Indexers.Indexer): New nested struct; contains
5088 getter, setter and the indexer's type.
5089 (Indexers.Properties): This is now an ArrayList of
5091 (IndexerAccess.DoResolveLValue): Correctly set the type if the
5092 indexer doesn't have any getters.
5094 * assign.cs (Assign.DoResolve): Also do the implicit conversions
5095 for embedded property and indexer assignments.
5097 2003-07-26 Martin Baulig <martin@ximian.com>
5099 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
5100 preprocessor directive is not the first non-whitespace character
5103 2003-07-26 Martin Baulig <martin@ximian.com>
5105 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
5106 namespace parsing, follow the spec more closely.
5108 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
5109 NamespaceEntry.Lookup().
5111 2003-07-25 Martin Baulig <martin@ximian.com>
5113 * MethodCore.cs (OverridesSomething): New public field; it's set
5114 from TypeContainer.DefineMembers if this method overrides
5115 something (which doesn't need to be a method). Fix #39462.
5117 2003-07-25 Ravi Pratap <ravi@ximian.com>
5119 * typemanager.cs (GetMembers): Ensure that the list of members is
5120 reversed. This keeps things in sync.
5122 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
5123 find an AttributeUsage attribute.
5125 * expression.cs (Invocation.OverloadResolve): Perform the check
5126 which disallows Invoke to be directly called on a Delegate.
5128 (Error_InvokeOnDelegate): Report error cs1533.
5130 2003-07-25 Martin Baulig <martin@ximian.com>
5132 * expression.cs (Indexers.GetIndexersForType): Only look in the
5133 interface hierarchy if the requested type is already an
5134 interface. Fixes #46788 while keeping #46502 fixed.
5136 2003-07-25 Martin Baulig <martin@ximian.com>
5138 * class.cs (TypeContainer.DefineMembers): Check whether all
5139 readonly fields have been assigned and report warning CS0649 if
5142 * statement.cs (LocalInfo.IsFixed): Always return true if this is
5145 2003-07-24 Ravi Pratap <ravi@ximian.com>
5147 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
5148 returned from GetMethods to make things consistent with the
5149 assumptions MCS makes about ordering of methods.
5151 This should comprehensively fix bug #45127 and it does :-)
5153 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
5154 ordering is actually reverse.
5156 * Clean up some debug messages I left lying around.
5158 * interface.cs (Populate*): Get rid of code which emits attributes
5159 since the stage in which we emit attributes is the 'Emit' stage,
5160 not the define stage.
5162 (Emit): Move attribute emission for interface members here.
5164 2003-07-22 Ravi Pratap <ravi@ximian.com>
5166 * expression.cs (Invocation.OverloadResolve): Follow the spec more
5167 closely: we eliminate methods in base types when we have an
5168 applicable method in a top-level type.
5170 Please see section 14.5.5.1 for an exact description of what goes
5173 This fixes bug #45127 and a host of other related to corlib compilation.
5175 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
5176 array is the method corresponding to the top-level type (this is
5177 because of the changes made to icall.c) so we change this
5180 (MethodGroupExpr.Name): This too.
5182 * typemanager.cs (GetElementType): New method which does the right
5183 thing when compiling corlib.
5185 * everywhere: Make use of the above in the relevant places.
5187 2003-07-22 Martin Baulig <martin@ximian.com>
5189 * cs-parser.jay (invocation_expression): Moved
5190 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
5191 `cast_expression', but create a InvocationOrCast which later
5192 resolves to either an Invocation or a Cast.
5194 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
5195 method; call this before EmitStatement() to make sure that this
5196 expression can be used as a statement.
5198 * expression.cs (InvocationOrCast): New class; resolves to either
5199 an Invocation or a Cast.
5201 * statement.cs (StatementExpression): Call ResolveStatement() on
5202 the ExpressionStatement before emitting it.
5204 2003-07-21 Martin Baulig <martin@ximian.com>
5206 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
5207 `ref' and `out' attributes match; fixes #46220.
5208 (MemberAccess.ResolveMemberAccess): You can't reference a type
5209 through an expression; fixes #33180.
5210 (Indexers.GetIndexersForType): Don't return the indexers from
5211 interfaces the class implements; fixes #46502.
5213 2003-07-21 Martin Baulig <martin@ximian.com>
5215 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
5216 CS0661 checks; fixes bug #30442.
5218 2003-07-21 Martin Baulig <martin@ximian.com>
5220 * decl.cs (AdditionResult): Added `Error'.
5222 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
5224 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
5225 makes cs0031.cs actually work.
5227 2003-07-20 Martin Baulig <martin@ximian.com>
5229 * namespace.cs: Fixed that bug which caused a crash when compiling
5232 2003-07-20 Miguel de Icaza <miguel@ximian.com>
5234 * typemanager.cs (LookupTypeReflection): Never expose types which
5235 are NotPublic, NestedPrivate, NestedAssembly, or
5236 NestedFamANDAssem. We used to return these, and later do a check
5237 that would report a meaningful error, but the problem is that we
5238 would not get the real match, if there was a name override.
5240 2003-07-18 Miguel de Icaza <miguel@ximian.com>
5242 * namespace.cs (Namespace, Name): Do not compute the namespace
5243 name dynamically, compute it in the constructor. This reduced
5244 memory usage by 1697 KB.
5246 * driver.cs: Use --pause to pause at the end.
5248 2003-07-17 Peter Williams <peter@newton.cx>
5250 * Makefile: Change the name of the test target so that it doesn't
5251 conflict with the recursive test target.
5253 2003-07-17 Miguel de Icaza <miguel@ximian.com>
5255 * expression.cs (LocalVariableReference.Emit, EmitAssign,
5256 AddressOf): Do not use EmitThis, that was wrong, use the actual
5259 2003-07-15 Miguel de Icaza <miguel@ximian.com>
5261 * class.cs (MethodData.Define): While checking if a method is an
5262 interface implementation, improve the test: If we are not public
5263 (use new test here: use the computed MethodAttributes directly,
5264 instead of the parsed modifier flags) check if the `implementing'
5265 method comes from an interface or not.
5267 * pending.cs (VerifyPendingMethods): Slightly better error
5270 * makefile: add test target that does the mcs bootstrap.
5272 2003-07-16 Ravi Pratap <ravi@ximian.com>
5274 * interface.cs (Define): Do nothing here since there are no
5275 members to populate etc. Move the attribute emission out of here
5276 since this was just totally the wrong place to put it. Attribute
5277 application happens during the 'Emit' phase, not in the 'Define'
5280 (Emit): Add this method and move the attribute emission here
5282 * rootcontext.cs (EmitCode): Call the Emit method on interface
5285 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5287 * expression.cs (OverloadResolve): Report error only if Location
5288 is not 'Null' which means that there was a probe going on.
5290 2003-07-14 Martin Baulig <martin@ximian.com>
5292 * expression.cs (ConditionalLogicalOperator): New public class to
5293 implement user defined conditional logical operators.
5294 This is section 14.11.2 in the spec and bug #40505.
5296 2003-07-14 Martin Baulig <martin@ximian.com>
5298 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
5300 2003-07-14 Martin Baulig <martin@ximian.com>
5302 * codegen.cs (EmitContext.InFixedInitializer): New public field.
5304 * ecore.cs (IVariable.VerifyFixed): New interface method.
5306 * expression.cs (Unary.ResolveOperator): When resolving the `&'
5307 operator, check whether the variable is actually fixed. Fixes bug
5308 #36055. Set a variable definitely assigned when taking its
5309 address as required by the spec.
5311 * statement.cs (LocalInfo.IsFixed): New field.
5312 (LocalInfo.MakePinned): Set `IsFixed' to true.
5314 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5316 * attribute.cs (Attribute.Resolve): While doing a Member lookup
5317 for .ctors, ensure that we only ask for members declared in the
5318 attribute type (BindingFlags.DeclaredOnly).
5322 * expression.cs (Error_WrongNumArguments): Report error 1501
5323 correctly the way CSC does.
5325 2003-07-13 Martin Baulig <martin@ximian.com>
5327 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
5328 lookup on the fully qualified name, to make things like "X.X" work
5329 where "X.X" is a fully qualified type name, but we also have a
5330 namespace "X" in the using list. Fixes #41975.
5332 2003-07-13 Martin Baulig <martin@ximian.com>
5334 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
5335 function. If we're a CompoundAssign, we need to create an embedded
5336 CompoundAssign, not an embedded Assign.
5337 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
5340 2003-07-13 Martin Baulig <martin@ximian.com>
5342 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
5343 work to fix bug #46088.
5345 2003-07-13 Ravi Pratap <ravi@ximian.com>
5347 * class.cs (Operator.Emit): Do not emit attributes here - it is
5348 taken care of by the Method class that we delegate too. This takes
5351 2003-07-10 Martin Baulig <martin@ximian.com>
5353 * expression.cs (TypeOfVoid): New class.
5354 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
5356 2003-07-10 Martin Baulig <martin@ximian.com>
5358 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
5361 2003-07-10 Martin Baulig <martin@ximian.com>
5363 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
5364 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
5366 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
5368 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
5370 2003-07-10 Martin Baulig <martin@ximian.com>
5372 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
5373 of decimal. Fixes #42850.
5375 NOTE: I also fixed the created byte blob, but this doesn't work on
5376 the MS runtime and csc never produces any byte blobs for decimal
5379 2003-07-10 Martin Baulig <martin@ximian.com>
5381 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
5382 structs; fixes #32068.
5383 (Block.AddChildVariableNames): Fixed #44302.
5385 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5387 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
5389 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5391 * attribute.cs: And this test is onger needed.
5393 2003-07-08 Martin Baulig <martin@ximian.com>
5395 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
5396 inaccessible types. Fixes #36313.
5398 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
5400 * namespace.cs (NamespaceEntry): Create implicit entries for all
5401 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
5402 implicit entries for N1.N2 and N1.
5404 2003-07-08 Martin Baulig <martin@ximian.com>
5406 Rewrote the handling of namespaces to fix a lot of the issues
5407 wrt. `using' aliases etc.
5409 * namespace.cs (Namespace): Splitted this class into a
5410 per-assembly `Namespace' and a per-file `NamespaceEntry'.
5412 * typemanager.cs (TypeManager.IsNamespace): Removed.
5413 (TypeManager.ComputeNamespaces): Only compute namespaces from
5414 loaded assemblies here, not the namespaces from the assembly we're
5415 currently compiling.
5417 2003-07-08 Martin Baulig <martin@ximian.com>
5419 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
5421 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5423 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
5426 I thought about the memory savings here, but LookupTypeReflection
5427 is used under already very constrained scenarios. Compiling
5428 corlib or mcs only exposes one hit, so it would not really reduce
5429 any memory consumption.
5431 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5433 * typemanager.cs: fixes bug #45889 by only adding public types from
5434 other assemblies to the list of known types.
5436 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5438 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
5439 on the type we resolved.
5441 2003-07-05 Martin Baulig <martin@ximian.com>
5443 * pending.cs (PendingImplementation.ParentImplements): Don't
5444 create the proxy if the parent is abstract.
5446 * class.cs (TypeContainer.DefineIndexers): Process explicit
5447 interface implementations first. Fixes #37714.
5449 2003-07-04 Miguel de Icaza <miguel@ximian.com>
5451 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
5452 defined recursively; but since we modify the input parameters
5453 (left is set to `this' temporarily), we reset this value if the
5454 left_is_explicit is false, which gives the original semantics to
5457 * literal.cs (NullPointer): new class used to represent a null
5458 literal in a pointer context.
5460 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
5461 type is a pointer, use a NullPointer object instead of a
5462 NullLiteral. Closes 43687
5464 (ExplicitConversion): Convert pointer values using
5465 the conv opcode to the proper type.
5467 * ecore.cs (New): change ValueTypeVariable property into a method,
5468 that returns whether the valuetype is suitable for being used.
5470 * expression.cs (Binary.DoNumericPromotions): Only return if we
5471 the int constant was a valid uint, and we can return both left and
5472 right as uints. If not, we continue processing, to trigger the
5473 type conversion. This fixes 39018.
5475 * statement.cs (Block.EmitMeta): During constant resolution, set
5476 the CurrentBlock property on the emitcontext, so that we resolve
5477 constants propertly.
5479 2003-07-02 Martin Baulig <martin@ximian.com>
5481 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
5482 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
5484 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
5485 than emitting it here.
5487 * statement.cs: Fixed some more flow analysis bugs.
5489 2003-07-02 Martin Baulig <martin@ximian.com>
5491 * class.cs (MethodData.Define): When implementing interface
5492 methods, set Final unless we're Virtual.
5494 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
5495 check work for interface methods.
5497 2003-07-01 Martin Baulig <martin@ximian.com>
5499 * ecore.cs (EmitContext.This): Replaced this property with a
5500 GetThis() method which takes a Location argument. This ensures
5501 that we get the correct error location for a CS0188.
5503 2003-07-01 Miguel de Icaza <miguel@ximian.com>
5505 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
5506 ImplicitStandardConversion.
5508 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
5510 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
5512 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
5515 2003-06-30 Miguel de Icaza <miguel@ximian.com>
5517 * class.cs (Constructor.Define): Turn off initlocals for unsafe
5520 (MethodData.Define): Turn off initlocals for unsafe methods.
5522 2003-06-29 Miguel de Icaza <miguel@ximian.com>
5524 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
5525 complete; Fixes #37521.
5527 * delegate.cs: Use Modifiers.TypeAttr to compute the
5528 TypeAttributes, instead of rolling our own. This makes the flags
5529 correct for the delegates.
5531 2003-06-28 Miguel de Icaza <miguel@ximian.com>
5533 * class.cs (Constructor.Define): Set the private flag for static
5534 constructors as well.
5536 * cs-parser.jay (statement_expression): Set the return value to
5537 null, to avoid a crash when we catch an error.
5539 2003-06-24 Miguel de Icaza <miguel@ximian.com>
5541 * cs-parser.jay: Applied patch from Jackson that adds support for
5542 extern and unsafe modifiers to destructor declarations.
5544 * expression.cs: Report error 21 if the user is trying to index a
5547 * driver.cs: Add an error message, suggested by the bug report.
5549 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
5550 if we do not have a ": this ()" constructor initializer. Fixes 45149
5552 2003-06-14 Miguel de Icaza <miguel@ximian.com>
5554 * namespace.cs: Add some information to reduce FAQs.
5556 2003-06-13 Miguel de Icaza <miguel@ximian.com>
5558 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
5559 underlying enumeration types. Fixes #43915.
5561 * expression.cs: Treat ushort/short as legal values to be used in
5564 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
5566 * delegate.cs: transfer custom attributes for paramenters from
5567 the delegate declaration to Invoke and BeginInvoke.
5569 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
5571 * attribute.cs: handle custom marshalers and emit marshal info
5574 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
5576 * makefile.gnu: Added anonymous.cs to the compiler sources.
5578 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5580 * iterators.cs: Change the name of the proxy class to include two
5583 * cs-parser.jay: Update grammar to include anonymous methods.
5585 * anonymous.cs: new file.
5587 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5589 * class.cs (Field.Define): Add missing test for pointers and
5592 2003-05-27 Ravi Pratap <ravi@ximian.com>
5594 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5595 we use the stobj opcode.
5597 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5598 since it wasn't the correct fix.
5600 It still is puzzling that we are required to use stobj for IntPtr
5601 which seems to be a ValueType.
5603 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5605 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5606 during regular simple name resolution. Now, the trick is that
5607 instead of returning for processing the simplename, we do a
5608 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5609 contextual lookup type). If a match is found, return that, if
5610 not, return for further composition.
5612 This fixes long-standing 30485.
5614 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5615 using the address to initialize an object, do an Stobj instead of
5616 using the regular Stelem.
5618 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5619 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5620 Because if we are a BaseIndexerAccess that value will be true.
5623 * statement.cs (GotoCase.Resolve): Return after reporting an
5624 error, do not attempt to continue.
5626 * expression.cs (PointerArithmetic.Emit): If our operand is a
5627 long, convert our constants to match the operand before
5628 multiplying. Convert to I type before adding. Fixes 43670.
5630 2003-05-14 Ravi Pratap <ravi@ximian.com>
5632 * enum.cs (ImplicitConversionExists) : Rename to
5633 ImplicitEnumConversionExists to remove ambiguity.
5635 * ecore.cs (NullCast): New type of cast expression class which
5636 basically is very similar to EmptyCast with the difference being
5637 it still is a constant since it is used only to cast a null to
5641 * convert.cs (ImplicitReferenceConversion): When casting a null
5642 literal, we return a NullCast.
5644 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5645 should be around anymore.
5647 The renaming (reported was slightly wrong). Corrections:
5649 ConvertImplicitStandard -> ImplicitConversionStandard
5650 ConvertExplicitStandard -> ExplicitConversionStandard
5652 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5653 before passing them in !
5655 * convert.cs (ImplicitConversionStandard): When comparing for
5656 equal expr and target types, ensure that expr is not a
5659 In general, we must not be checking (expr_type ==
5660 target_type) in the top level conversion methods
5661 (ImplicitConversion, ExplicitConversion etc). This checking is
5662 done in the methods that they delegate to.
5664 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5666 * convert.cs: Move Error_CannotConvertType,
5667 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5668 ImplicitNumericConversion, ImplicitConversionExists,
5669 ImplicitUserConversionExists, StandardConversionExists,
5670 FindMostEncompassedType, FindMostSpecificSource,
5671 FindMostSpecificTarget, ImplicitUserConversion,
5672 ExplicitUserConversion, GetConversionOperators,
5673 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5674 TryImplicitIntConversion, Error_CannotConvertImplicit,
5675 ConvertImplicitRequired, ConvertNumericExplicit,
5676 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5677 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5680 Perform the following renames:
5682 StandardConversionExists -> ImplicitStandardConversionExists
5683 ConvertImplicit -> ImplicitConversion
5684 ConvertImplicitStandard -> ImplicitStandardConversion
5685 TryImplicitIntConversion -> ImplicitIntConversion
5686 ConvertImplicitRequired -> ImplicitConversionRequired
5687 ConvertNumericExplicit -> ExplicitNumericConversion
5688 ConvertReferenceExplicit -> ExplicitReferenceConversion
5689 ConvertExplicit -> ExplicitConversion
5690 ConvertExplicitStandard -> ExplicitStandardConversion
5692 2003-05-19 Martin Baulig <martin@ximian.com>
5694 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5695 (TypeInfo): Added support for structs having structs as fields.
5697 * ecore.cs (FieldExpr): Implement IVariable.
5698 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5699 VariableInfo for the field.
5701 2003-05-18 Martin Baulig <martin@ximian.com>
5703 * expression.cs (This.DoResolve): Report a CS0027 if we're
5704 emitting a field initializer.
5706 2003-05-18 Martin Baulig <martin@ximian.com>
5708 * expression.cs (This.ResolveBase): New public function.
5709 (This.DoResolve): Check for CS0188.
5711 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5714 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5715 `instance_expression' to null if we don't have any non-static
5718 2003-05-18 Martin Baulig <martin@ximian.com>
5720 Reworked the way how local variables and parameters are handled by
5721 the flow analysis code.
5723 * statement.cs (TypeInfo, VariableMap): New public classes.
5724 (VariableInfo): New public class. This is now responsible for
5725 checking whether a variable has been assigned. It is used for
5726 parameters and local variables.
5727 (Block.EmitMeta): Take the InternalParameters as argument; compute
5728 the layout of the flow vectors here.
5729 (Block.LocalMap, Block.ParameterMap): New public properties.
5730 (FlowBranching): The .ctor doesn't get the InternalParameters
5731 anymore since Block.EmitMeta() now computes the layout of the flow
5733 (MyStructInfo): This class is now known as `StructInfo' and nested
5734 in `TypeInfo'; we don't access this directly anymore.
5736 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5737 property and removed IsAssigned(), IsFieldAssigned(),
5738 SetAssigned() and SetFieldAssigned(); we now call them on the
5739 VariableInfo so we don't need to duplicate this code everywhere.
5741 * expression.cs (ParameterReference): Added `Block block' argument
5743 (LocalVariableReference, ParameterReference, This): The new
5744 VariableInfo class is now responsible for all the definite
5747 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5748 IsParameterAssigned, SetParameterAssigned): Removed.
5750 2003-05-18 Martin Baulig <martin@ximian.com>
5752 * typemanager.cs (InitCoreTypes): Try calling
5753 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5754 the 3-args-version. Corlib now also needs our `void_type'.
5755 (GetMethod): Added overloaded version which takes an optional
5756 `bool report_errors' to allow lookups of optional methods.
5758 2003-05-12 Martin Baulig <martin@ximian.com>
5760 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5761 only used for locals and not for parameters.
5763 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5765 * support.cs (InternalParameters.ParameterType): Return the
5766 ExternalType of the parameter.
5768 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5771 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5773 * class.cs (MethodData.Define): Do not set the `newslot' on
5774 interface members, if they are also flagged as "override".
5776 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5777 better code for ++i and i++. This only works for static fields
5778 and local variables.
5780 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5781 want to pull the DeclSpace out of the builder_to_declspace instead
5782 of the TypeBuilder (like in TypeContainer.FindMembers).
5784 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
5785 instead of LookupTypeContainer. Fixes the crash on .NET for
5786 looking up interface members.
5788 * const.cs: Create our own emit context during the Definition
5789 stage, so that constants are evaluated in the proper context, when
5790 a recursive definition happens.
5792 2003-05-11 Martin Baulig <martin@ximian.com>
5794 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
5795 new block for a switch section.
5796 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
5797 the adding/lookup in the switch block. Fixes #39828.
5799 2003-05-09 Miguel de Icaza <miguel@ximian.com>
5801 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
5802 functionality: I needed to convert the data after I had performed
5803 the add/sub operation into the operands type size.
5805 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
5806 pass the type for the box operation, otherwise the resulting
5807 object would have been of type object.
5809 (BoxedCast): Add constructor to specify the type to box as.
5811 2003-05-07 Miguel de Icaza <miguel@ximian.com>
5813 * iterators.cs: I was reusing the `count' variable inadvertently,
5814 take steps to not allow this to happen.
5816 2003-05-06 Miguel de Icaza <miguel@ximian.com>
5818 * attribute.cs (Attribute.Resolve): Params attributes are encoded
5819 by creating an array at the point where the params starts and
5820 putting all those arguments there, then adjusting the size of the
5823 2003-05-05 Miguel de Icaza <miguel@ximian.com>
5825 * expression.cs (New.AddressOf): Implement interface
5826 IMemoryLocation. This is used when the `new' operator is used in
5827 the context of an invocation to a method on a value type.
5829 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
5832 * namespace.cs: Also check the using aliases here.
5834 * driver.cs: Move the test for using validity after the types have
5835 been entered, so we do a single pass that also includes the using
5838 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
5839 in the regular case. CreateSiblingForFinally is doing extra
5842 * attribute.cs (GetAttributeArgumentExpression): Store the result
5843 on an out value, and use the return value to indicate failure
5844 instead of using null (which is a valid return for Constant.GetValue).
5846 * statement.cs: Perform the analysis flow for the increment
5847 portion after the statement, because this will be the real flow of
5848 execution. Fixes #42385
5850 * codegen.cs (EmitContext.EmitArgument,
5851 EmitContext.EmitStoreArgument): New helper functions when the
5852 RemapToProxy flag is set.
5854 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
5857 Add support for remapping parameters.
5859 * iterators.cs: Propagate parameter values; Store parameter
5860 values in the proxy classes.
5862 2003-05-04 Miguel de Icaza <miguel@ximian.com>
5864 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
5865 need a proxy reference; I do not know what I was thinking
5867 * cs-parser.jay (constructor_initializer): catch another error,
5868 and display nice message.
5870 (field_declaration): catch void field declaration
5871 to flag a better error.
5873 * class.cs (MemberBase.CheckBase): Report an error instead of a
5874 warning if a new protected member is declared in a struct.
5875 (Field.Define): catch the error of readonly/volatile.
5877 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
5879 (FieldExpr.AddressOf): ditto. Catch error where the address of a
5880 volatile variable is taken
5882 2003-05-02 Miguel de Icaza <miguel@ximian.com>
5884 * statement.cs (Fixed.Resolve): Report an error if we are not in
5887 2003-05-01 Miguel de Icaza <miguel@ximian.com>
5889 * typemanager.cs: reuse the code that handles type clashes for
5890 delegates and enumerations.
5892 * class.cs (Report28): Always report.
5894 * expression.cs (EncodeAsAttribute): Allow nulls here.
5896 2003-04-28 Miguel de Icaza <miguel@ximian.com>
5898 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
5899 the functionality for testing whether an expression is valid for
5900 an attribute here. Also handle the case of arrays of elements
5903 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
5904 encoding a linear array into an array of objects that are suitable
5905 to be passed to an CustomAttributeBuilder.
5907 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
5909 * ecore.cs: (FieldExpr): Handle field remapping here.
5911 * iteratators.cs: Pass the instance variable (if the method is an
5912 instance method) to the constructors, so we can access the field
5913 variables on the class.
5915 TODO: Test this with structs. I think the THIS variable on
5916 structs might have to be a pointer, and not a refenrece
5918 2003-04-27 Miguel de Icaza <miguel@ximian.com>
5920 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
5921 local variables to fields in a proxy class.
5923 * iterators.cs (PopulateProxy): Rename our internal fields to
5925 Create a <THIS> field if we are an instance method, so we can
5926 reference our parent container variables.
5927 (MapVariable): Called back from the EmitContext code to enter a
5928 new variable to field mapping into the proxy class (we just create
5932 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
5933 for using the remapped locals to fields.
5935 I placed the code here, because that gives the same semantics to
5936 local variables, and only changes the Emit code.
5938 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
5939 statements inside iterators.
5940 (VariableInfo): Add a FieldBuilder for the cases when we are
5941 remapping local variables to fields in a proxy class
5943 * ecore.cs (SimpleNameResolve): Avoid testing two times for
5944 current_block != null.
5946 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
5947 not cope with strings, as it has been moved to the
5948 TableSwitchEmit. Fixed bug in switch generation.
5950 * expression.cs (New.DoResolve): Provide more context for the user
5951 when reporting an error.
5953 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5956 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5957 check the permissions for it. Note than in a type-resolution
5958 context the check was already present in DeclSpace.ResolveType,
5959 but was missing from the MemberAccess.
5961 (ArrayCreation.CheckIndices): warn if the user has
5962 more nested levels of expressions, but there are no more
5963 dimensions specified. Avoids crash on bug 41906.
5965 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5967 * statement.cs (Block): replace Implicit bool, for a generic
5969 New flag: `Unchecked'. This is used during the EmitMeta phase
5970 (which is out-of-line with the regular Resolve/Emit process for a
5971 statement, as this is done ahead of time, but still gets a chance
5972 to call constant resolve).
5974 (Block.Flags): new enum for adding a new flag.
5976 (Block.EmitMeta): track the state of unchecked.
5978 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5979 to enable constant resolution to work there as well.
5981 2003-04-22 Miguel de Icaza <miguel@ximian.com>
5983 * typemanager.cs (ienumerable_type): Also look up
5984 System.Collections.IEnumerable.
5986 2003-04-21 Miguel de Icaza <miguel@ximian.com>
5988 TODO: Test more than one conditional per method.
5990 * class.cs (Indexer.Define): Report the location where the user is
5991 referencing the unsupported feature.
5993 (MethodData): Overload the use of `conditionals' to
5994 minimize the creation of needless ArrayLists. This saves roughly
5995 212kb on my machine.
5997 (Method): Implement the new IIteratorContainer interface.
5998 (Method.SetYields): Implement the method by setting the ModFlags
5999 to contain METHOD_YIELDS.
6001 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
6002 which just got set to null.
6004 * iterators.cs: New file.
6006 (Yield, YieldBreak): New statements.
6008 * statement.cs (Return.Resolve): Flag an error if we are used in
6011 * codegen.cs (InIterator): New flag set if the code is being
6012 compiled in an iterator method.
6014 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
6015 internal modifier, and we just use it to avoid adding extra
6016 fields, as this is seldom used.
6018 * cs-parser.jay: Add yield_statement (yield and yield break).
6020 * driver.cs: New flag -v2 to turn on version 2 features.
6022 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
6023 hashtable when v2 is enabled.
6025 2003-04-20 Miguel de Icaza <miguel@ximian.com>
6027 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
6028 there is already a namespace defined with this name.
6030 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
6031 people upgraded their corlibs.
6033 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
6034 always use fully qualified types, no need to use the compiler
6037 (TypeManager.IsNamespace): Use binarysearch.
6039 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
6040 AddDelegate): I did not quite use the new IsValid API properly: I
6041 have to pass the short-name and the fullname. I was passing only
6042 the basename instead of the fullname sometimes.
6044 (TypeContainer.DefineType): call NamespaceClash.
6046 * interface.cs (Interface.DefineType): use NamespaceClash before
6049 * delegate.cs (Delegate.DefineType): use NamespaceClash before
6052 * enum.cs: (Enum.DefineType): use NamespaceClash before
6055 * typemanager.cs (: 3-line patch that gives us some tasty 11%
6056 speed increase. First, use the negative_hits cache when we get a
6057 negative. Second, add the type with its full original name
6058 instead of the new . and + encoded name (reflection uses + to
6059 separate type from a nested type). Use LookupTypeReflection
6060 directly which bypasses the type->name hashtable (that we already
6061 know does not contain the type.
6063 * decl.cs (DeclSpace.ResolveTypeExpr): track the
6064 location/container type.
6066 * driver.cs: When passing utf8, use directly the UTF8Encoding.
6068 2003-04-19 Miguel de Icaza <miguel@ximian.com>
6070 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
6072 * delegate.cs (NewDelegate.Resolve): Test whether an instance
6073 method is being referenced in the method group from a static
6074 context, and report error 120 if so.
6076 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
6079 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
6080 is created, we create the A namespace).
6082 * cs-parser.jay: A namespace also introduces a DeclarationFound.
6085 2003-04-18 Miguel de Icaza <miguel@ximian.com>
6087 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
6088 invocation to ModuleBuilder.GetType with the same values will
6089 return a new type instance, so we need to cache its return
6092 * expression.cs (Binary.ResolveOperator): Only allow the compare
6093 operators on enums if they are of the same type.
6095 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
6096 types of ValueType on their own case. Before we were giving them
6097 the same treatment as objects.
6099 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
6100 fullname. Short name is used to compare against container name.
6101 Fullname is used to check against defined namespace names.
6103 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
6104 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
6106 (Method.CheckBase): Call parent.
6107 (MemberBase.CheckBase): Check for protected members on sealed
6109 (PropertyBase.CheckBase): Call parent.
6110 (Field.Define): Call parent.
6112 * report.cs: Negative error codes are now mapped to 8000 - code,
6113 so that the display is render more nicely.
6115 * typemanager.cs: Do not use try/catch, instead report a regular
6118 (GetPointerType, GetReferenceType): These methods provide
6119 mechanisms to obtain the T* and T& from a T. We had the code
6120 previously scattered around the code base, and it also used
6121 TypeManager.LookupType that would go through plenty of caches.
6122 This one goes directly to the type source.
6124 In some places we did the Type.GetType followed by
6125 ModuleBuilder.GetType, but not in others, so this unifies the
6128 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
6129 statements now that we have namespace information.
6131 * typemanager.cs (IsNamespace): New method, returns whether the
6132 string presented is a namespace or not.
6134 (ComputeNamespaces): New public entry point, computes the list of
6135 available namespaces, using the GetNamespaces API call in Mono, or
6136 the slower version in MS.NET.
6138 Now before we start the semantic analysis phase, we have a
6139 complete list of namespaces including everything that the user has
6142 Deleted old code to cache namespaces in .nsc files.
6144 2003-04-17 Miguel de Icaza <miguel@ximian.com>
6146 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
6147 class/struct location definition Location for the implicit
6148 constructor location.
6150 (Operator.Define): Use the location of the operator for the
6151 implicit Method definition.
6153 (Constructor.Emit): use the constructor location for the implicit
6154 base initializer constructor.
6156 * ecore.cs: Remove ITypeExpression. This interface is now gone,
6157 and the Expression class now contains two new methods:
6159 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
6160 isolate type lookup from the rest of the resolution process.
6162 Since we use Expressions to hold type definitions due to the way
6163 we parse the input we have historically overloaded Resolve to
6164 perform the Type lookups if a special flag is passed. Now this is
6165 eliminated and two methods take their place.
6167 The differences in the two methods between xStep and xTerminal is
6168 that xStep is involved in our current lookup system that uses
6169 SimpleNames to compose a name, while xTerminal is used just to
6170 catch the case where the simplename lookup failed.
6172 2003-04-16 Miguel de Icaza <miguel@ximian.com>
6174 * expression.cs (ResolveMemberAccess): Remove redundant code.
6175 TypeExpr expressions are always born fully resolved.
6177 * interface.cs (PopulateMethod): Do not lookup the types twice.
6178 We were doing it once during SemanticAnalysis and once during
6181 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
6182 in local variable type definitions, were being returned as a
6183 SimpleName (we decomposed everything into a string), that is
6184 because primary_expression was being used instead of a type in the
6185 grammar (reduce/reduce conflicts).
6187 The part that was wrong is that we converted the expression into a
6188 string (an oversimplification in one hand, compounded with primary
6189 expressions doing string concatenation).
6195 Would return "A.B.C[]" as a SimpleName. This stopped things like
6196 using clauses from working on this particular context. And a type
6197 was being matched directly against "A.B.C[]".
6199 We now use the correct approach, and allow for ComposedCast to be
6200 part of the unary expression. So the "A.B.C []" become a composed
6201 cast of "A.B.C" (as a nested group of MemberAccess with a
6202 SimpleName at the end) plus the rank composition "[]".
6206 2003-04-10 Miguel de Icaza <miguel@ximian.com>
6208 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
6209 for the access level checking.
6211 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
6212 `TypeContainer container', because I kept getting confused when I
6213 was debugging this code.
6215 * expression.cs (Indexers): Instead of tracking getters/setters,
6216 we now track them in parallel. We create one arraylist less, but
6217 most importantly it is possible now for the LValue code to find a
6218 matching get for a set.
6220 (IndexerAccess.DoResolveLValue): Update the code.
6221 GetIndexersForType has been modified already to extract all the
6222 indexers from a type. The code assumed it did not.
6224 Also make the code set the correct return type for the indexer.
6225 This was fixed a long time ago for properties, but was missing for
6226 indexers. It used to be void_type.
6228 (Binary.Emit): Test first for doubles instead of
6229 floats, as they are more common.
6231 (Binary.EmitBranchable): Use the .un version of the branch opcodes
6232 when dealing with floats and the <=, >= operators. This fixes bug
6235 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
6236 to load the array value by emitting a load on the foreach variable
6237 type. This was incorrect.
6239 We now emit the code to load an element using the the array
6240 variable type, and then we emit the conversion operator.
6244 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
6246 * attribute.cs: Avoid allocation of ArrayLists in the common case.
6248 2003-04-09 Miguel de Icaza <miguel@ximian.com>
6250 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
6251 test for protection before we test for signatures.
6253 (MethodSignature.ToString): implement.
6255 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
6256 to the case where we reduced into a LongConstant.
6258 * decl.cs (CheckAccessLevel): If the type is an array, we can not
6259 depend on whether the information is acurrate, because the
6260 Microsoft runtime will always claim that the array type is public,
6261 regardless of the real state.
6263 If the type is a pointer, another problem happens: the type is
6264 reported as non-public in Microsoft.
6266 In both cases we have to call CheckAccessLevel recursively with
6267 the underlying type as the argument to be tested.
6269 2003-04-08 Miguel de Icaza <miguel@ximian.com>
6271 * assign.cs (Assign.Emit): If we are dealing with a compound
6272 assignment expression, we should use the code path that stores the
6273 intermediate result in a temporary value. This fixes #40903.
6275 *expression.cs (Indirection.ToString): Provide ToString method for
6278 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
6280 * class.cs: Null out fields holding references to Block objects so
6281 they can be garbage collected.
6283 * expression.cs (OverloadResolve): Remove unused local.
6285 2003-04-07 Martin Baulig <martin@ximian.com>
6287 * codegen.cs (EmitContext.CurrentFile): New public field.
6288 (EmitContext.Mark): Use the CurrentFile to check whether the
6289 location is in the correct file.
6290 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
6292 2003-04-07 Martin Baulig <martin@ximian.com>
6294 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
6296 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
6297 location. [FIXME: The location argument which gets passed to this
6298 method is sometimes wrong!]
6300 2003-04-07 Nick Drochak <ndrochak@gol.com>
6302 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
6304 2003-04-07 Miguel de Icaza <miguel@ximian.com>
6306 * expression.cs (Indirection.EmitAssign): We were using the
6307 temporary, but returning immediately instead of continuing the
6310 2003-04-06 Martin Baulig <martin@ximian.com>
6312 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
6313 if it's a nested child, but also deriving from the outer class.
6316 * typemanager.cs (IsNestedChildOf): Make this work if it's a
6317 nested child, but also deriving from the outer class. See
6319 (FilterWithClosure): We may access private members of the outer
6320 class if we're a nested child and deriving from the outer class.
6321 (RealMemberLookup): Only set `closure_private_ok' if the
6322 `original_bf' contained BindingFlags.NonPublic.
6324 2003-04-05 Martin Baulig <martin@ximian.com>
6326 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
6328 2003-04-02 Miguel de Icaza <miguel@ximian.com>
6330 * class.cs (Event.Define): Do not allow abstract events to have
6333 2003-04-01 Miguel de Icaza <miguel@ximian.com>
6335 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
6336 block in event declarations.
6338 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
6339 value type, get its address.
6341 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
6342 leaving a class on the stack instead of a boolean value (int
6343 0/1). Change the code so we compare against null, and then the
6344 result against zero.
6346 * class.cs (TypeContainer.GetClassBases): We were checking for the
6347 parent class being sealed too late.
6349 * expression.cs (Binary.Emit): For <= and >= when dealing with
6350 floating point values, use cgt.un and clt.un instead of cgt and
6353 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
6355 * statement.cs: Apply the same optimization as MS: skip the
6356 GetEnumerator returning an IEnumerator, and use the one returning a
6357 CharEnumerator instead. This allows us to avoid the try-finally block
6360 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
6362 * cs-parser.jay: Attributes cannot be applied to
6363 namespaces. Fixes #40473
6365 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6368 (Add*): check if the name is valid using the full name for constants,
6369 fields, properties and events.
6371 2003-03-28 Miguel de Icaza <miguel@ximian.com>
6373 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
6374 char constants to be part of the enumeration.
6376 * expression.cs (Conditional.DoResolve): Add support for operator
6377 true. Implements the missing functionality from 14.12
6379 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
6380 operator true/false as required by the spec.
6382 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
6383 implicit conversion to boolean.
6385 * statement.cs (Statement.ResolveBoolean): A boolean expression is
6386 also one where the type implements `operator true'.
6388 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
6389 get an expression that will invoke operator true based on an
6392 (GetConversionOperators): Removed the hack that called op_True
6395 (Expression.ResolveBoolean): Move this from Statement.
6397 2003-03-17 Miguel de Icaza <miguel@ximian.com>
6399 * ecore.cs (FieldExpr): do not allow initialization of initonly
6400 fields on derived classes
6402 2003-03-13 Martin Baulig <martin@ximian.com>
6404 * statement.cs (Block.Emit): Call ig.BeginScope() and
6405 ig.EndScope() when compiling with debugging info; call
6406 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
6408 2003-03-08 Miguel de Icaza <miguel@ximian.com>
6410 * expression.cs (Indexers): Do not construct immediately, allow
6411 for new members to be appended as we go. Fixes 38143
6413 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6415 * expression.cs: save/restore context when resolving an unchecked
6418 2003-03-05 Miguel de Icaza <miguel@ximian.com>
6420 * cfold.cs: Catch division by zero in modulus operator during
6423 2003-03-03 Miguel de Icaza <miguel@ximian.com>
6425 * interface.cs (Interface.DefineMembers): Avoid defining members
6428 2003-02-27 Miguel de Icaza <miguel@ximian.com>
6430 * driver.cs: handle the +/- options for -noconfig
6432 * statement.cs (Unckeched.Resolve): Also track the state of
6433 unchecked in the Resolve phase.
6435 2003-02-27 Martin Baulig <martin@ximian.com>
6437 * ecore.cs (Expression.MemberLookup): Don't create a
6438 MethodGroupExpr for something which is not a method. Fixes #38291.
6440 2003-02-25 Miguel de Icaza <miguel@ximian.com>
6442 * class.cs (MemberBase.CheckParameters): Also check that the type
6443 is unmanaged if it is a pointer.
6445 * expression.cs (SizeOf.Resolve): Add location information.
6447 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
6448 a managed type is declared.
6450 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
6451 parameter modifiers as well. Fixes bug 38606
6453 * class.cs: Very sad. Am backing out the speed up changes
6454 introduced by the ArrayList -> Array in the TypeContainer, as they
6455 were not actually that much faster, and introduced a bug (no error
6456 reports on duplicated methods).
6458 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
6459 source first, this will guarantee that we have a valid expression
6460 before calling in lower levels functions that will require a
6461 resolved object. Then use this original_source in the
6462 target.ResolveLValue instead of the original source that was
6465 Another change. Use target.Resolve instead of LValueResolve.
6466 Although we are resolving for LValues, we will let the Assign code
6467 take care of that (it will be called again from Resolve). This
6468 basically allows code like this:
6470 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
6471 class Y { void A (X x) { x [0] += o; }
6473 The problem was that the indexer was trying to resolve for
6474 set_Item (idx, object o) and never finding one. The real set_Item
6475 was set_Item (idx, X). By delaying the process we get the right
6480 2003-02-23 Martin Baulig <martin@ximian.com>
6482 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
6483 while calling DoEmit ().
6485 * codegen.cs (EmitContext.Mark): Don't mark locations in other
6486 source files; if you use the #line directive inside a method, the
6487 compiler stops emitting line numbers for the debugger until it
6488 reaches the end of the method or another #line directive which
6489 restores the original file.
6491 2003-02-23 Martin Baulig <martin@ximian.com>
6493 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
6495 2003-02-23 Martin Baulig <martin@ximian.com>
6497 * statement.cs (Block.AddChildVariableNames): We need to call this
6498 recursively, not just for our immediate children.
6500 2003-02-23 Martin Baulig <martin@ximian.com>
6502 * class.cs (Event.Define): Always make the field private, like csc does.
6504 * typemanager.cs (TypeManager.RealMemberLookup): Make events
6505 actually work, fixes bug #37521.
6507 2003-02-23 Miguel de Icaza <miguel@ximian.com>
6509 * delegate.cs: When creating the various temporary "Parameters"
6510 classes, make sure that we call the ComputeAndDefineParameterTypes
6511 on those new parameters (just like we do with the formal ones), to
6512 allow them to be resolved in the context of the DeclSpace.
6514 This fixes the bug that Dick observed in Bugzilla #38530.
6516 2003-02-22 Miguel de Icaza <miguel@ximian.com>
6518 * expression.cs (ResolveMemberAccess): When resolving a constant,
6519 do not attempt to pull a constant if the value was not able to
6520 generate a valid constant.
6522 * const.cs (LookupConstantValue): Do not report more errors than required.
6524 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6526 * expression.cs: fixes bug #38328.
6528 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6530 * class.cs: Changed all the various members that can be part of a
6531 class from being an ArrayList to be an Array of the right type.
6532 During the DefineType type_list, interface_list, delegate_list and
6533 enum_list are turned into types, interfaces, delegates and enums
6536 And during the member population, indexer_list, event_list,
6537 constant_list, field_list, instance_constructor_list, method_list,
6538 operator_list and property_list are turned into their real arrays.
6540 Although we could probably perform this operation earlier, for
6541 good error reporting we need to keep the lists and remove the
6542 lists for longer than required.
6544 This optimization was triggered by Paolo profiling the compiler
6545 speed on the output of `gen-sample-program.pl' perl script.
6547 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
6548 not crash in methods like MemberLookupFailed that use this field.
6550 This problem arises when the compiler fails to resolve a type
6551 during interface type definition for example.
6553 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6555 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
6556 inherit from System.Object, so we have to stop at null, not only
6557 when reaching System.Object.
6559 2003-02-17 Miguel de Icaza <miguel@ximian.com>
6561 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
6562 DeclaredOnly because the parent indexer might have had a different
6563 name, but did not loop until the top of the hierarchy was reached.
6565 The problem this one fixes is 35492: when a class implemented an
6566 indexer from an interface, we were getting the interface method
6567 (which was abstract) and we were flagging an error (can not invoke
6570 This also keeps bug 33089 functioning, and test-148 functioning.
6572 * typemanager.cs (IsSpecialMethod): The correct way of figuring
6573 out if a method is special is to see if it is declared in a
6574 property or event, or whether it is one of the predefined operator
6575 names. This should fix correctly #36804.
6577 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6579 The goal here is to remove the dependency on EmptyCast.Peel ().
6580 Killing it completely.
6582 The problem is that currently in a number of places where
6583 constants are expected, we have to "probe" for an EmptyCast, and
6584 Peel, which is not the correct thing to do, as this will be
6585 repetitive and will likely lead to errors.
6587 The idea is to remove any EmptyCasts that are used in casts that
6588 can be reduced to constants, so we only have to cope with
6591 This bug hunt was triggered by Bug 37363 and the desire to remove
6592 the duplicate pattern where we were "peeling" emptycasts to check
6593 whether they were constants. Now constants will always be
6596 * ecore.cs: Use an enumconstant here instead of wrapping with
6599 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6600 throwing me off. By handling this we can get rid of a few hacks.
6602 * statement.cs (Switch): Removed Peel() code.
6604 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6606 * class.cs: Location information for error 508
6608 * expression.cs (New.DoResolve): Add a guard against double
6609 resolution of an expression.
6611 The New DoResolve might be called twice when initializing field
6612 expressions (see EmitFieldInitializers, the call to
6613 GetInitializerExpression will perform a resolve on the expression,
6614 and later the assign will trigger another resolution
6616 This leads to bugs (#37014)
6618 * delegate.cs: The signature for EndInvoke should contain any ref
6619 or out parameters as well. We were not doing this in the past.
6621 * class.cs (Field.Define): Do not overwrite the type definition
6622 inside the `volatile' group. Turns out that volatile enumerations
6623 were changing the type here to perform a validity test, which
6626 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6628 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6629 and structs, we do not want to load the instance variable
6631 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6632 enum_type has to be handled like an object reference (implicit
6633 conversions exists from this to object), but the regular IsClass
6634 and IsValueType tests will never return true for this one.
6636 Also we use TypeManager.IsValueType instead of type.IsValueType,
6637 just for consistency with the rest of the code (this is only
6638 needed if we ever use the construct exposed by test-180.cs inside
6639 corlib, which we dont today).
6641 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6643 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6646 2003-02-09 Martin Baulig <martin@ximian.com>
6648 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6649 (Namespace.DefineNamespaces): New static public method; this is
6650 called when we're compiling with debugging to add all namespaces
6653 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6654 pass it to the Namespace's .ctor.
6656 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6657 and MethodBase arguments; pass the namespace ID to the symwriter;
6658 pass the MethodBase instead of the token to the symwriter.
6659 (SymbolWriter.DefineNamespace): New method to add a namespace to
6662 2003-02-09 Martin Baulig <martin@ximian.com>
6664 * symbolwriter.cs: New file. This is a wrapper around
6665 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6666 methods here in near future.
6668 2003-02-09 Martin Baulig <martin@ximian.com>
6670 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6671 ILGenerator.MarkSequencePoint() which are actually used by the
6674 2003-02-09 Martin Baulig <martin@ximian.com>
6676 * location.cs (SourceFile): New public sealed class. This
6677 contains the name and an index which is used in the location's token.
6678 (Location): Reserve an appropriate number of bits in the token for
6679 the source file instead of walking over that list, this gives us a
6680 really huge performance improvement when compiling with debugging.
6682 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6683 `SourceFile' argument instead of a string.
6684 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6685 but don't parse/tokenize here, we need to generate the list of all
6686 source files before we do that.
6687 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6690 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6691 instead of a string.
6693 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6696 2003-02-09 Martin Baulig <martin@ximian.com>
6698 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6699 filename on `#line default'.
6701 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6703 * statement.cs: don't clear the pinned var when the fixed statement
6704 returns from the method (fixes bug#37752).
6706 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6708 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6711 2003-02-07 Martin Baulig <martin@ximian.com>
6713 * driver.cs: Removed the `--debug-args' command line argument.
6715 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6716 automatically by the AsssemblyBuilder.
6717 (CodeGen.InitializeSymbolWriter): We don't need to call any
6718 initialization function on the symbol writer anymore. This method
6719 doesn't take any arguments.
6721 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6723 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6724 from referenced assemblies as well.
6726 2003-02-02 Martin Baulig <martin@ximian.com>
6728 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6730 2003-02-02 Martin Baulig <martin@ximian.com>
6732 * class.cs (Constructor.Emit): Open the symbol writer before
6733 emitting the constructor initializer.
6734 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6735 single-stepping through constructor initializers.
6737 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6739 * class.cs: Handle error 549: do not allow virtual methods in
6742 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6744 * decl.cs: Check access levels when resolving types
6746 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6748 * statement.cs: Add parameters and locals set in catch blocks that might
6749 return to set vector
6751 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6753 * class.cs (Operator): Set the SpecialName flags for operators.
6755 * expression.cs (Invocation.DoResolve): Only block calls to
6756 accessors and operators on SpecialName methods.
6758 (Cast.TryReduce): Handle conversions from char constants.
6761 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
6763 * statement.cs: small memory and time optimization in FlowBranching.
6765 2003-01-28 Pedro Mart <yoros@wanadoo.es>
6767 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
6768 problem that the last fix but in the other sid (Set).
6770 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
6771 access when there is no indexer in the hierarchy.
6773 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
6775 * class.cs: Combine some if statements.
6777 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6779 * driver.cs: fixed bug #37187.
6781 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
6783 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
6784 any indexer, it's needed to build a list with all the indexers in the
6785 hierarchy (AllGetters), else we have problems. Fixes #35653.
6787 2003-01-23 Miguel de Icaza <miguel@ximian.com>
6789 * class.cs (MethodData.Define): It is wrong for an interface
6790 implementation to be static in both cases: explicit and implicit.
6791 We were only handling this in one case.
6793 Improve the if situation there to not have negations.
6795 * class.cs (Field.Define): Turns out that we do not need to check
6796 the unsafe bit on field definition, only on usage. Remove the test.
6798 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6800 * driver.cs: use assembly.Location instead of Codebase (the latest
6801 patch made mcs fail when using MS assemblies).
6803 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
6805 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
6806 get the path to *corlib.dll.
6808 2003-01-21 Nick Drochak <ndrochak@gol.com>
6812 * typemanager.cs: Remove compiler warnings
6814 2003-01-20 Duncan Mak <duncan@ximian.com>
6816 * AssemblyInfo.cs: Bump the version number to 0.19.
6818 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6820 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
6822 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
6824 * class.cs (Constructor::Emit): Emit debugging info for constructors.
6826 2003-01-17 Miguel de Icaza <miguel@ximian.com>
6828 * cs-parser.jay: Small fix: we were not comparing the constructor
6829 name correctly. Thanks to Zoltan for the initial pointer.
6831 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
6833 * cs-tokenizer.cs: Set file name when specified with #line
6835 2003-01-15 Miguel de Icaza <miguel@ximian.com>
6837 * cs-parser.jay: Only perform the constructor checks here if we
6838 are named like the class; This will help provider a better
6839 error. The constructor path is taken when a type definition is
6840 not found, but most likely the user forgot to add the type, so
6841 report that rather than the constructor error.
6843 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
6845 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
6848 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6850 * cs-parser.jay: Add cleanup call.
6852 2003-01-13 Duncan Mak <duncan@ximian.com>
6854 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
6855 consistent with other methods.
6857 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6859 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
6861 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
6863 * attribute.cs: only set GuidAttr to true when we have a
6866 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6870 * typemanager.cs: fixes to allow mcs compile corlib with the new
6871 Type.IsSubclassOf fix.
6873 2003-01-08 Miguel de Icaza <miguel@ximian.com>
6875 * expression.cs (LocalVariableReference.DoResolve): Classify a
6876 constant as a value, not as a variable. Also, set the type for
6879 * cs-parser.jay (fixed_statement): take a type instead of a
6880 pointer_type, so we can produce a better error message later.
6882 * statement.cs (Fixed.Resolve): Flag types that are not pointers
6885 (For.DoEmit): Make inifinite loops have a
6886 non-conditional branch back.
6888 (Fixed.DoEmit): First populate the pinned variables, then emit the
6889 statement, then clear the variables. Before I was emitting the
6890 code once for each fixed piece.
6893 2003-01-08 Martin Baulig <martin@ximian.com>
6895 * statement.cs (FlowBranching.MergeChild): A break in a
6896 SWITCH_SECTION does not leave a loop. Fixes #36155.
6898 2003-01-08 Martin Baulig <martin@ximian.com>
6900 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
6901 lives in the same number space than `param_map'. Fixes #36154.
6903 2003-01-07 Miguel de Icaza <miguel@ximian.com>
6905 * cs-parser.jay (constructor_declaration): Set the
6906 Constructor.ModFlags before probing for it. This makes the
6907 compiler report 514, 515 and 132 (the code was there, but got
6910 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
6911 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
6912 (GotoCase.Resolve): Set `Returns' to ALWAYS.
6914 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
6916 * enum.cs: create the enum static fields using the enum type.
6918 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
6920 * class.cs: don't try to create the ParamBuilder for the return
6921 type if it's not needed (and handle it breaking for the ms runtime
6924 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
6926 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
6928 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6930 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6931 the command. This showed up while compiling the JANET source
6932 code, which used \r as its only newline separator.
6934 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6936 * class.cs (Method.Define): If we are an operator (because it
6937 reuses our code), then set the SpecialName and HideBySig. #36128
6939 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6941 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6942 exception, report error 120 `object reference required'.
6944 * driver.cs: Add --pause option, used during to measure the size
6945 of the process as it goes with --timestamp.
6947 * expression.cs (Invocation.DoResolve): Do not allow methods with
6948 SpecialName to be invoked.
6950 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6952 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6953 number before adding it.
6955 2002-12-21 Ravi Pratap <ravi@ximian.com>
6957 * ecore.cs (StandardImplicitConversion): When in an unsafe
6958 context, we allow conversion between void * to any other pointer
6959 type. This fixes bug #35973.
6961 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6963 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6964 is not thrown when extensionless outputs are used
6966 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6968 * rootcontext.cs: fixed compilation of corlib.
6970 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6972 * attribute.cs (Attributes.Contains): Add new method.
6974 * class.cs (MethodCore.LabelParameters): if the parameter is an
6975 `out' parameter, check that no attribute `[In]' has been passed.
6977 * enum.cs: Handle the `value__' name in an enumeration.
6979 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
6981 * decl.cs: Added special case to allow overrides on "protected
6984 2002-12-18 Ravi Pratap <ravi@ximian.com>
6986 * attribute.cs (Attributes.AddAttributeSection): Rename to this
6987 since it makes much more sense.
6989 (Attributes.ctor): Don't require a Location parameter.
6991 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6993 * attribute.cs (ApplyAttributes): Remove extra Location parameters
6994 since we already have that information per attribute.
6996 * everywhere : make appropriate changes.
6998 * class.cs (LabelParameters): Write the code which actually
6999 applies attributes to the return type. We can't do this on the MS
7000 .NET runtime so we flag a warning in the case an exception is
7003 2002-12-18 Miguel de Icaza <miguel@ximian.com>
7005 * const.cs: Handle implicit null conversions here too.
7007 2002-12-17 Ravi Pratap <ravi@ximian.com>
7009 * class.cs (MethodCore.LabelParameters): Remove the extra
7010 Type [] parameter since it is completely unnecessary. Instead
7011 pass in the method's attributes so that we can extract
7012 the "return" attribute.
7014 2002-12-17 Miguel de Icaza <miguel@ximian.com>
7016 * cs-parser.jay (parse): Use Report.Error to flag errors instead
7017 of ignoring it and letting the compile continue.
7019 * typemanager.cs (ChangeType): use an extra argument to return an
7020 error condition instead of throwing an exception.
7022 2002-12-15 Miguel de Icaza <miguel@ximian.com>
7024 * expression.cs (Unary.TryReduce): mimic the code for the regular
7025 code path. Perform an implicit cast in the cases where we can
7026 implicitly convert to one of the integral types, and then reduce
7027 based on that constant. This fixes bug #35483.
7029 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7031 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
7033 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7035 * namespace.cs: fixed bug #35489.
7037 2002-12-12 Miguel de Icaza <miguel@ximian.com>
7039 * class.cs: Remove some dead code.
7041 * cs-parser.jay: Estimate the number of methods needed
7042 (RootContext.MethodCount);
7044 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
7045 numbers instead of StringBuilders.
7047 * support.cs (PtrHashtable): Add constructor with initial size;
7048 We can now reduce reallocations of the method table.
7050 2002-12-10 Ravi Pratap <ravi@ximian.com>
7052 * attribute.cs (ApplyAttributes): Keep track of the emitted
7053 attributes on a per-target basis. This fixes bug #35413.
7055 2002-12-10 Miguel de Icaza <miguel@ximian.com>
7057 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
7058 default to the Windows 1252 encoding.
7060 (UnixParseOption): Support version, thanks to Alp for the missing
7063 * AssemblyInfo.cs: Add nice assembly information.
7065 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
7068 * cs-parser.jay: Allow a trailing comma before the close bracked
7069 in the attribute_section production.
7071 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
7072 address of the instance was being taken, I will take this out,
7073 because we take the address of the object immediately here.
7075 2002-12-09 Ravi Pratap <ravi@ximian.com>
7077 * typemanager.cs (AreMultipleAllowed): Take care of the most
7078 obvious case where attribute type is not in the current assembly -
7081 2002-12-08 Miguel de Icaza <miguel@ximian.com>
7083 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
7084 definitions, instead of doing that afterwards.
7086 Also we use a nice little hack, depending on the constructor, we
7087 know if we are a "composed" name or a simple name. Hence, we
7088 avoid the IndexOf test, and we avoid
7090 * codegen.cs: Add code to assist in a bug reporter to track down
7091 the source of a compiler crash.
7093 2002-12-07 Ravi Pratap <ravi@ximian.com>
7095 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
7096 types have been emitted for a given element and flag an error
7097 if something which does not have AllowMultiple set is used more
7100 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
7101 attribute types and their corresponding AllowMultiple properties
7103 (AreMultipleAllowed): Check the property for a given type.
7105 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
7106 property in the case we have a TypeContainer.
7108 (Attributes.AddAttribute): Detect duplicates and just skip on
7109 adding them. This trivial fix catches a pretty gross error in our
7110 attribute emission - global attributes were being emitted twice!
7112 Bugzilla bug #33187 is now fixed.
7114 2002-12-06 Miguel de Icaza <miguel@ximian.com>
7116 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
7119 * expression.cs (Binary.ResolveOperator): I can only use the
7120 Concat (string, string, string) and Concat (string, string,
7121 string, string) if the child is actually a concatenation of
7124 2002-12-04 Miguel de Icaza <miguel@ximian.com>
7126 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
7127 context where we need a 2-character lookahead.
7129 * pending.cs (PendingImplementation): Rework so we can keep track
7130 of interface types all the time, and flag those which were
7131 implemented by parents as optional.
7133 2002-12-03 Miguel de Icaza <miguel@ximian.com>
7135 * expression.cs (Binary.ResolveOperator): Use
7136 String.Concat(string,string,string) or
7137 String.Concat(string,string,string,string) when possible.
7139 * typemanager: More helper methods.
7142 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
7144 * pending.cs: remove the bogus return from GetMissingInterfaces()
7145 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
7147 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7149 * namespace.cs: avoid duplicated 'using xxx' being added to
7150 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
7151 when we get more than one 'using' statement for the same namespace.
7152 Report a CS0105 warning for it.
7154 2002-11-30 Miguel de Icaza <miguel@ximian.com>
7156 * cs-tokenizer.cs (consume_identifier): use read directly, instead
7157 of calling getChar/putback, uses internal knowledge of it.
7159 (xtoken): Reorder tokenizer so most common patterns are checked
7160 first. This reduces the compilation time in another 5% (from 8.11s
7161 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
7163 The parsing time is 22% of the compilation in mcs, and from that
7164 64% is spent on the tokenization process.
7166 I tried using a binary search for keywords, but this is slower
7167 than the hashtable. Another option would be to do a couple of
7170 * Not use a StringBuilder, instead use an array of chars,
7171 with a set value. Notice that this way we could catch
7172 the 645 error without having to do it *afterwards*.
7174 * We could write a hand-parser to avoid the hashtable
7175 compares altogether.
7177 The identifier consumption process takes 37% of the tokenization
7178 time. Another 15% is spent on is_number. 56% of the time spent
7179 on is_number is spent on Int64.Parse:
7181 * We could probably choose based on the string length to
7182 use Int32.Parse or Int64.Parse and avoid all the 64-bit
7185 Another 3% is spend on wrapping `xtoken' in the `token' function.
7187 Handle 0xa0 as whitespace (#34752)
7189 2002-11-26 Miguel de Icaza <miguel@ximian.com>
7191 * typemanager.cs (IsCLRType): New routine to tell whether a type
7192 is one of the builtin types.
7194 Maybe it needs to use TypeCodes to be faster. Maybe we could use
7195 typecode in more places instead of doing pointer comparissions.
7196 We could leverage some knowledge about the way the typecodes are
7199 New code to cache namespaces in assemblies, it is currently not
7200 invoked, to be used soon.
7202 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
7204 * expression.cs (Binary.ResolveOperator): specially handle
7205 strings, and do not perform user-defined operator overloading for
7208 2002-11-24 Miguel de Icaza <miguel@ximian.com>
7210 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
7211 internalcall as it is a pretty simple operation; Avoid whenever
7212 possible to call Char.IsLetter.
7214 (consume_identifier): Cut by half the number of
7215 hashtable calls by merging the is_keyword and GetKeyword behavior.
7217 Do not short-circuit, because if we do, we
7218 report errors (ie, #if false && true would produce an invalid
7222 2002-11-24 Martin Baulig <martin@ximian.com>
7224 * expression.cs (Cast.TryReduce): If we're in checked syntax,
7225 check constant ranges and report a CS0221. Fixes #33186.
7227 2002-11-24 Martin Baulig <martin@ximian.com>
7229 * cs-parser.jay: Make this work for uninitialized variable
7230 declarations in the `for' initializer. Fixes #32416.
7232 2002-11-24 Martin Baulig <martin@ximian.com>
7234 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
7235 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
7237 2002-11-24 Martin Baulig <martin@ximian.com>
7239 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
7240 argument; if true, we also check for user-defined conversions.
7241 This is only needed if both arguments are of a user-defined type.
7242 Fixes #30443, added test-175.cs.
7243 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
7245 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
7247 2002-11-24 Martin Baulig <martin@ximian.com>
7249 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
7250 function to get the store opcode.
7251 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
7252 only emit the Ldelema if the store opcode is Stobj. You must run
7253 both test-34 and test-167 to test this. Fixes #34529.
7255 2002-11-23 Martin Baulig <martin@ximian.com>
7257 * ecore.cs (Expression.MemberLookup): Added additional
7258 `qualifier_type' argument which is used when we're being called
7259 from MemberAccess.DoResolve() and null if we're called from a
7261 (Expression.MemberLookupFailed): New method to report errors; this
7262 does the CS1540 check and reports the correct error message.
7264 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
7265 argument for the CS1540 check and redone the way how we're dealing
7266 with private members. See the comment in the source code for details.
7267 (FilterWithClosure): Reverted this back to revision 1.197; renamed
7268 `closure_start_type' to `closure_qualifier_type' and check whether
7269 it's not null. It was not this filter being broken, it was just
7270 being called with the wrong arguments.
7272 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
7273 and pass it the correct `qualifier_type'; this also does the error
7276 2002-11-22 Miguel de Icaza <miguel@ximian.com>
7278 * expression.cs (Invocation.EmitParams): If the we are dealing
7279 with a non-built-in value type, load its address as well.
7281 (ArrayCreation): Use a a pretty constant instead
7282 of the hardcoded value 2. Use 6 instead of 2 for the number of
7283 static initializers.
7285 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
7286 because they are not really value types, just glorified integers.
7288 * driver.cs: Do not append .exe, the CSC compiler does not do it.
7290 * ecore.cs: Remove redundant code for enumerations, make them use
7291 the same code path as everything else, fixes the casting issue
7292 with enumerations in Windows.Forms.
7294 * attribute.cs: Do only cast to string if it is a string, the
7295 validation happens later.
7297 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
7298 people upgrade their corlibs.
7300 * ecore.cs: Oops, enumerations were not following the entire code path
7302 2002-11-21 Miguel de Icaza <miguel@ximian.com>
7304 * typemanager.cs (FilterWithClosure): Commented out the test for
7305 1540 in typemanager.cs, as it has problems when accessing
7306 protected methods from a parent class (see test-174.cs).
7308 * attribute.cs (Attribute.ValidateGuid): new method.
7309 (Attribute.Resolve): Use above.
7311 2002-11-19 Miguel de Icaza <miguel@ximian.com>
7313 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
7315 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
7316 handling for enumerations, as we only needed the TypeContainer
7317 functionality to begin with (this is required for the fix below to
7318 work for enums that reference constants in a container class for
7321 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
7323 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
7324 a valid TypeBuilder to perform lookups on.o
7326 * class.cs (InheritableMemberSignatureCompare): Use true in the
7327 call to GetGetMethod and GetSetMethod, because we are comparing
7328 the signature, and we need to get the methods *even* if they are
7331 (PropertyBase.CheckBase): ditto.
7333 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
7334 GotoCase.Resolve): Use Peel on EmpytCasts.
7336 * ecore.cs (EmptyCast): drop child, add Peel method.
7338 2002-11-17 Martin Baulig <martin@ximian.com>
7340 * ecore.cs (EmptyCast.Child): New public property.
7342 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
7343 label resolved to an EmptyCast. Fixes #34162.
7344 (GotoCase.Resolve): Likewise.
7345 (Block.EmitMeta): Likewise.
7347 2002-11-17 Martin Baulig <martin@ximian.com>
7349 * expression.cs (Invocation.BetterConversion): Prefer int over
7350 uint; short over ushort; long over ulong for integer literals.
7351 Use ImplicitConversionExists instead of StandardConversionExists
7352 since we also need to check for user-defined implicit conversions.
7353 Fixes #34165. Added test-173.cs.
7355 2002-11-16 Martin Baulig <martin@ximian.com>
7357 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
7358 with the `true' and `false' literals. Fixes #33151.
7360 2002-11-16 Martin Baulig <martin@ximian.com>
7362 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
7363 October 22nd; don't do the cs1540 check for static members.
7365 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
7366 now using our own filter here and doing the cs1540 check again.
7368 2002-11-16 Martin Baulig <martin@ximian.com>
7370 * support.cs (InternalParameters): Don't crash if we don't have
7371 any fixed parameters. Fixes #33532.
7373 2002-11-16 Martin Baulig <martin@ximian.com>
7375 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
7376 when looking up static methods to make this work on Windows.
7379 2002-11-16 Martin Baulig <martin@ximian.com>
7381 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
7382 a setter rather than using PropertyInfo.CanWrite.
7384 2002-11-15 Nick Drochak <ndrochak@gol.com>
7386 * class.cs: Allow acces to block member by subclasses. Fixes build
7389 2002-11-14 Martin Baulig <martin@ximian.com>
7391 * class.cs (Constructor.Emit): Added the extern/block check.
7394 2002-11-14 Martin Baulig <martin@ximian.com>
7396 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
7397 iteration while looking for indexers, this is needed because the
7398 indexer may have a different name in our base classes. Fixed the
7399 error reporting (no indexers at all, not get accessor, no
7400 overloaded match). Fixes bug #33089.
7401 (IndexerAccess.DoResolveLValue): Likewise.
7403 2002-11-14 Martin Baulig <martin@ximian.com>
7405 * class.cs (PropertyBase.CheckBase): Make this work for multiple
7406 indexers. Fixes the first part of bug #33089.
7407 (MethodSignature.InheritableMemberSignatureCompare): Added support
7410 2002-11-13 Ravi Pratap <ravi@ximian.com>
7412 * attribute.cs (Attribute.Resolve): Catch the
7413 NullReferenceException and report it since it isn't supposed to
7416 2002-11-12 Miguel de Icaza <miguel@ximian.com>
7418 * expression.cs (Binary.EmitBranchable): Also handle the cases for
7419 LogicalOr and LogicalAnd that can benefit from recursively
7420 handling EmitBranchable. The code now should be nice for Paolo.
7422 2002-11-08 Miguel de Icaza <miguel@ximian.com>
7424 * typemanager.cs (LookupType): Added a negative-hit hashtable for
7425 the Type lookups, as we perform quite a number of lookups on
7426 non-Types. This can be removed once we can deterministically tell
7427 whether we have a type or a namespace in advance.
7429 But this might require special hacks from our corlib.
7433 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
7434 and double which avoids a conversion from an integer to a double.
7436 * expression.cs: tiny optimization, avoid calling IsConstant,
7437 because it effectively performs the lookup twice.
7439 2002-11-06 Miguel de Icaza <miguel@ximian.com>
7441 But a bogus return here to keep the semantics of the old code
7442 until the Mono runtime is fixed.
7444 * pending.cs (GetMissingInterfaces): New method used to remove all
7445 the interfaces that are already implemented by our parent
7446 classes from the list of pending methods.
7448 * interface.cs: Add checks for calls after ResolveTypeExpr.
7450 2002-11-05 Miguel de Icaza <miguel@ximian.com>
7452 * class.cs (Class.Emit): Report warning 67: event not used if the
7453 warning level is beyond 3.
7455 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
7456 being a NullLiteral.
7458 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
7461 * class.cs (TypeContainer.GetClassBases): Cover a missing code
7462 path that might fail if a type can not be resolved.
7464 * expression.cs (Binary.Emit): Emit unsigned versions of the
7467 * driver.cs: use error 5.
7469 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
7471 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
7473 2002-11-01 Miguel de Icaza <miguel@ximian.com>
7475 * cs-parser.jay (switch_section): A beautiful patch from Martin
7476 Baulig that fixed 33094.
7478 2002-10-31 Miguel de Icaza <miguel@ximian.com>
7480 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
7481 Check whether the base is abstract and report an error if so.
7483 * expression.cs (IndexerAccess.DoResolveLValue,
7484 IndexerAccess.DoResolve): ditto.
7486 (Invocation.DoResolve): ditto.
7488 (Invocation.FullMethodDesc): Improve the report string.
7490 * statement.cs (Block): Eliminate IsVariableDefined as it is
7491 basically just a wrapper for GetVariableInfo.
7493 * ecore.cs (SimpleName): Use new
7495 * support.cs (ReflectionParamter.ParameterType): We unwrap the
7496 type, as we return the actual parameter ref/unref state on a
7499 2002-10-30 Miguel de Icaza <miguel@ximian.com>
7501 * support.cs: Return proper flags REF/OUT fixing the previous
7504 * expression.cs: Reverted last patch, that was wrong. Is_ref is
7505 not used to mean `ref' but `ref or out' in ParameterReference
7507 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
7508 full type signature instead of calling TypeManger.CSharpName
7511 * support.cs (InternalParameters.ParameterDesc): Do not compare
7512 directly to the modflags, because REF/OUT will actually be bitsets
7515 * delegate.cs (VerifyMethod): Check also the modifiers.
7517 * cs-tokenizer.cs: Fix bug where floating point values with an
7518 exponent where a sign was missing was ignored.
7520 * driver.cs: Allow multiple assemblies to be specified in a single
7523 2002-10-28 Miguel de Icaza <miguel@ximian.com>
7525 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
7526 because identifiers after a parenthesis would end up in this kind
7527 of production, and we needed to desamiguate it for having casts
7530 (UserDefinedType *) xxx
7532 2002-10-24 Miguel de Icaza <miguel@ximian.com>
7534 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
7535 we should set on the Bindingflags.NonPublic, but not turn on
7536 private_ok. private_ok controls whether a Private member is
7537 returned (this is chekced on the filter routine), while the
7538 BindingFlags.NonPublic just controls whether private/protected
7539 will be allowed. This fixes the problem part of the problem of
7540 private properties being allowed to be used in derived classes.
7542 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
7543 so we can call the children DoResolveLValue method (this will
7544 properly signal errors on lvalue assignments to base properties)
7546 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
7547 getter are null, and we have a property info, we know that this
7548 happened because the lookup failed, so we report an error 122 for
7549 protection level violation.
7551 We also silently return if setter and getter are null in the
7552 resolve functions, this condition only happens if we have flagged
7553 the error before. This is the other half of the problem.
7555 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
7556 not have accessibility information, that is why we were returning
7557 true in the filter function in typemanager.cs.
7559 To properly report 122 (property is inaccessible because of its
7560 protection level) correctly, we report this error in ResolveAccess
7561 by failing if both the setter and the getter are lacking (ie, the
7564 DoResolve and DoLResolve have been modified to check for both
7565 setter/getter being null and returning silently, the reason being
7566 that I did not want to put the knowledge about this error in upper
7569 int old = Report.Errors;
7570 x = new PropertyExpr (...);
7571 if (old != Report.Errors)
7576 So the property expr is returned, but it is invalid, so the error
7577 will be flagged during the resolve process.
7579 * class.cs: Remove InheritablePropertySignatureCompare from the
7580 class, as we no longer depend on the property signature to compute
7581 whether it is possible to implement a method or not.
7583 The reason is that calling PropertyInfo.GetGetMethod will return
7584 null (in .NET, in Mono it works, and we should change this), in
7585 cases where the Get Method does not exist in that particular
7590 class X { public virtual int A { get { return 1; } } }
7592 class Z : Y { public override int A { get { return 2; } } }
7594 Would fail in Z because the parent (Y) would not have the property
7595 defined. So we avoid this completely now (because the alternative
7596 fix was ugly and slow), and we now depend exclusively on the
7599 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7600 reference method, instead of using the property.
7602 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7603 routines are gone now.
7605 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7606 names, they were incorrectly named.
7608 * cs-tokenizer.cs: Return are more gentle token on failure.
7610 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7611 had an out-of-sync index variable, which caused it to remove from
7612 the list of pending methods the wrong method sometimes.
7614 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7616 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7617 CanWrite, because those refer to this particular instance of the
7618 property, and do not take into account the fact that we can
7619 override single members of a property.
7621 Constructor requires an EmitContext. The resolution process does
7622 not happen here, but we need to compute the accessors before,
7623 because the resolution does not always happen for properties.
7625 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7626 subclass, before we did not update this flag, but we did update
7629 (GetAccessors): Drop this routine, as it did not work in the
7630 presence of partially overwritten set/get methods.
7632 Notice that this broke the cs1540 detection, but that will require
7635 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7639 * driver.cs: issue a warning instead of an error if we don't support
7640 debugging for the platform. Also ignore a couple of errors that may
7641 arise when trying to write the symbols. Undo my previous patch.
7643 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7645 * driver.cs: ignore /debug switch except for Unix platforms.
7647 2002-10-23 Nick Drochak <ndrochak@gol.com>
7649 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7651 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7653 * driver.cs: Do not make mcs-debug conditional, so we do not break
7656 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7657 review this patch. But basically after all the children variables
7658 have been merged, the value of "Breaks" was not being set to
7659 new_breaks for Switch blocks. I think that it should be set after
7660 it has executed. Currently I set this to the value of new_breaks,
7661 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7662 conservative, but I do not understand this code very well.
7664 I did not break anything in the build, so that is good ;-)
7666 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7668 2002-10-20 Mark Crichton <crichton@gimp.org>
7670 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7672 2002-10-20 Nick Drochak <ndrochak@gol.com>
7674 * cfold.cs: Fixed compile blocker.
7676 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7678 * driver.cs: I was chekcing the key, not the file.
7680 2002-10-19 Ravi Pratap <ravi@ximian.com>
7682 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7683 message that we were generating - we just need to silently return
7686 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7688 * class.cs (Event.Define): Change my previous commit, as this
7689 breaks the debugger. This is a temporary hack, as it seems like
7690 the compiler is generating events incorrectly to begin with.
7692 * expression.cs (Binary.ResolveOperator): Added support for
7693 "U operator - (E x, E y)"
7695 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7698 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7699 init-only variables, but this path did not take into account that
7700 there might be also instance readonly variables. Correct this
7703 This fixes bug 32253
7705 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7708 * driver.cs: Change the extension for modules to `netmodule'
7710 * cs-parser.jay: Improved slightly the location tracking for
7711 the debugger symbols.
7713 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7714 modifiers that were specified instead of the hardcoded value
7715 (FamAndAssem). This was basically ignoring the static modifier,
7716 and others. Fixes 32429.
7718 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7719 fixed a bug in the process (32476)
7721 * expression.cs (ArrayAccess.EmitAssign): Patch from
7722 hwang_rob@yahoo.ca that fixes bug 31834.3
7724 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7726 * driver.cs: Make the module extension .netmodule.
7728 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7730 * driver.cs: Report an error if the resource file is not found
7731 instead of crashing.
7733 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7734 false, like Emit does.
7736 2002-10-16 Nick Drochak <ndrochak@gol.com>
7738 * typemanager.cs: Remove unused private member. Also reported mcs
7739 bug to report this as a warning like csc.
7741 2002-10-15 Martin Baulig <martin@gnome.org>
7743 * statement.cs (Statement.Emit): Made this a virtual method; emits
7744 the line number info and calls DoEmit().
7745 (Statement.DoEmit): New protected abstract method, formerly knows
7746 as Statement.Emit().
7748 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7750 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7752 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7753 have fixed a remaining problem: not every AddXXXX was adding a
7754 fully qualified name.
7756 Now everyone registers a fully qualified name in the DeclSpace as
7757 being defined instead of the partial name.
7759 Downsides: we are slower than we need to be due to the excess
7760 copies and the names being registered this way.
7762 The reason for this is that we currently depend (on the corlib
7763 bootstrap for instance) that types are fully qualified, because
7764 we dump all the types in the namespace, and we should really have
7765 types inserted into the proper namespace, so we can only store the
7766 basenames in the defined_names array.
7768 2002-10-10 Martin Baulig <martin@gnome.org>
7770 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
7771 from bug #31834, see the bug report for a testcase which is
7774 2002-10-10 Martin Baulig <martin@gnome.org>
7776 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
7777 flow analysis code for this.
7779 * statement.cs (Do, While, For): Tell the flow analysis code about
7781 (FlowBranching.UsageVector): Added support for infinite loops.
7782 (Block.Resolve): Moved the dead code elimination here and use flow
7785 2002-10-09 Miguel de Icaza <miguel@ximian.com>
7787 * class.cs (Field.Define): Catch cycles on struct type
7790 * typemanager.cs (IsUnmanagedtype): Do not recursively check
7791 fields if the fields are static. We only need to check instance
7794 * expression.cs (As.DoResolve): Test for reference type.
7796 * statement.cs (Using.ResolveExpression): Use
7797 ConvertImplicitRequired, not ConvertImplicit which reports an
7799 (Using.ResolveLocalVariableDecls): ditto.
7801 * expression.cs (Binary.ResolveOperator): Report errors in a few
7802 places where we had to.
7804 * typemanager.cs (IsUnmanagedtype): Finish implementation.
7806 2002-10-08 Miguel de Icaza <miguel@ximian.com>
7808 * expression.cs: Use StoreFromPtr instead of extracting the type
7809 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
7811 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
7812 an enumeration value to a System.Enum, but System.Enum is not a
7813 value type, but an class type, so we need to box.
7815 (Expression.ConvertExplicit): One codepath could return
7816 errors but not flag them. Fix this. Fixes #31853
7818 * parameter.cs (Resolve): Do not allow void as a parameter type.
7820 2002-10-06 Martin Baulig <martin@gnome.org>
7822 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
7823 if it's a class type and not a struct. Fixes #31815.
7825 2002-10-06 Martin Baulig <martin@gnome.org>
7827 * statement.cs: Reworked the flow analysis code a bit to make it
7828 usable for dead code elimination.
7830 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7832 * cs-parser.jay: allow empty source files. Fixes bug #31781.
7834 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7836 * expression.cs (ComposedCast.DoResolveType): A quick workaround
7837 to fix the test 165, will investigate deeper.
7839 2002-10-04 Martin Baulig <martin@gnome.org>
7841 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
7842 finally blocks actually work.
7843 (Try.Resolve): We don't need to create a sibling for `finally' if
7844 there is no finally block.
7846 2002-10-04 Martin Baulig <martin@gnome.org>
7848 * class.cs (Constructor.Define): The default accessibility for a
7849 non-default constructor is private, not public.
7851 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7853 * class.cs (Constructor): Make AllowedModifiers public, add
7856 * cs-parser.jay: Perform the modifiers test here, as the
7857 constructor for the Constructor class usually receives a zero
7858 because of the way we create it (first we create, later we
7859 customize, and we were never checking the modifiers).
7861 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
7862 is a version of LookupTypeReflection that includes the type-name
7863 cache. This can be used as a fast path for functions that know
7864 the fully qualified name and are only calling into *.GetType() to
7865 obtain a composed type.
7867 This is also used by TypeManager.LookupType during its type
7870 (LookupType): We now also track the real type name, as sometimes
7871 we can get a quey for the real type name from things like
7872 ComposedCast. This fixes bug 31422.
7874 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
7875 complete type fullname, it does not have to go through the type
7876 resolution system to obtain the composed version of the type (for
7877 obtaining arrays or pointers).
7879 (Conditional.Emit): Use the EmitBoolExpression to
7880 generate nicer code, as requested by Paolo.
7882 (ArrayCreation.CheckIndices): Use the patch from
7883 hwang_rob@yahoo.ca to validate the array initializers.
7885 2002-10-03 Miguel de Icaza <miguel@ximian.com>
7887 * class.cs (ConstructorInitializer.Emit): simplify code by using
7888 Invocation.EmitCall, and at the same time, fix the bugs in calling
7889 parent constructors that took variable arguments.
7891 * ecore.cs (Expression.ConvertNumericExplicit,
7892 Expression.ImplicitNumericConversion): Remove the code that
7893 manually wrapped decimal (InternalTypeConstructor call is now gone
7896 * expression.cs (Cast.TryReduce): Also handle decimal types when
7897 trying to perform a constant fold on the type.
7899 * typemanager.cs (IsUnmanagedtype): Partially implemented.
7901 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
7902 that only turned off an error report, and did nothing else.
7904 2002-10-02 Miguel de Icaza <miguel@ximian.com>
7906 * driver.cs: Handle and ignore /fullpaths
7908 2002-10-01 Miguel de Icaza <miguel@ximian.com>
7910 * expression.cs (Binary.ResolveOperator): Catch the case where
7911 DoNumericPromotions returns true,
7913 (Binary.DoNumericPromotions): Simplify the code, and the tests.
7915 2002-09-27 Miguel de Icaza <miguel@ximian.com>
7917 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
7920 2002-09-26 Miguel de Icaza <miguel@ximian.com>
7922 * ecore.cs (ConvertNumericExplicit): It is not enough that the
7923 conversion exists, but it is also required that the conversion be
7924 performed. This manifested in "(Type64Enum) 2".
7926 * class.cs (TypeManager.AddMethod): The fix is not to change
7927 AddEnum, because that one was using a fully qualified name (every
7928 DeclSpace derivative does), but to change the AddMethod routine
7929 that was using an un-namespaced name. This now correctly reports
7930 the duplicated name.
7932 Revert patch until I can properly fix it. The issue
7933 is that we have a shared Type space across all namespaces
7934 currently, which is wrong.
7936 Options include making the Namespace a DeclSpace, and merge
7937 current_namespace/current_container in the parser.
7939 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7941 * cs-parser.jay: Improve error reporting when we get a different
7942 kind of expression in local_variable_type and
7943 local_variable_pointer_type.
7945 Propagate this to avoid missleading errors being reported.
7947 * ecore.cs (ImplicitReferenceConversion): treat
7948 TypeManager.value_type as a target just like object_type. As
7953 Is valid, and needs to result in the int 1 being boxed before it
7954 is assigned to the value type v.
7956 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7957 to validate the enumeration name.
7959 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7960 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7961 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7963 * ecore.cs (TryImplicitIntConversion): When doing an
7964 implicit-enumeration-conversion, check if the type is 64-bits and
7965 perform a conversion before passing to EnumConstant.
7967 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7969 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7970 report ambiguous type references. Unlike the MS version, we
7971 report what the ambiguity is. Innovation at work ;-)
7973 (DeclSpace.FindType): Require a location argument to
7974 display when we display an ambiguous error.
7976 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7978 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7980 * expression.cs (EmitDynamicInitializers): Apply patch from
7981 hwang_rob@yahoo.ca that fixes the order in which we emit our
7984 2002-09-21 Martin Baulig <martin@gnome.org>
7986 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7987 delegate takes no arguments.
7989 2002-09-20 Miguel de Icaza <miguel@ximian.com>
7991 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7994 * expression.cs: Extract the underlying type.
7996 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7998 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
8000 2002-09-19 Miguel de Icaza <miguel@ximian.com>
8002 * class.cs (TypeContainer.DefineType): We can not use the nice
8003 PackingSize with the size set to 1 DefineType method, because it
8004 will not allow us to define the interfaces that the struct
8007 This completes the fixing of bug 27287
8009 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
8010 means also structs. This fixes part of the problem.
8011 (Expresion.ImplicitReferenceConversionExists): ditto.
8013 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
8014 error if there were no errors reported during the type lookup
8015 process, to avoid duplicates or redundant errors. Without this
8016 you would get an ambiguous errors plus a type not found. We have
8017 beaten the user enough with the first error.
8019 (DeclSparce.FindType): Emit a warning if we have an ambiguous
8022 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
8023 during the resolution process, stop the lookup, this avoids
8024 repeated error reports (same error twice).
8026 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
8028 * typemanager.cs (LookupType): Redo the type lookup code to match
8029 the needs of System.Reflection.
8031 The issue is that System.Reflection requires references to nested
8032 types to begin with a "+" sign instead of a dot. So toplevel
8033 types look like: "NameSpace.TopLevelClass", and nested ones look
8034 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
8037 2002-09-19 Martin Baulig <martin@gnome.org>
8039 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
8040 says that a method always returns or always throws an exception,
8041 don't report the CS0161.
8043 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
8044 set `Returns = new_returns'.
8046 2002-09-19 Martin Baulig <martin@gnome.org>
8048 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
8049 to an enum constant, check for a CS0176.
8051 2002-09-18 Miguel de Icaza <miguel@ximian.com>
8053 * class.cs (TypeContainer.CheckPairedOperators): Now we check
8054 for operators that must be in pairs and report errors.
8056 * ecore.cs (SimpleName.DoResolveType): During the initial type
8057 resolution process, when we define types recursively, we must
8058 check first for types in our current scope before we perform
8059 lookups in the enclosing scopes.
8061 * expression.cs (MakeByteBlob): Handle Decimal blobs.
8063 (Invocation.VerifyArgumentsCompat): Call
8064 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
8065 I thought we were supposed to always call this, but there are a
8066 few places in the code where we dont do it.
8068 2002-09-17 Miguel de Icaza <miguel@ximian.com>
8070 * driver.cs: Add support in -linkres and -resource to specify the
8071 name of the identifier.
8073 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8075 * ecore.cs (StandardConversionExists): Sync with the conversion
8076 code: allow anything-* to void* conversions.
8078 (FindMostSpecificSource): Use an Expression argument
8079 instead of a Type, because we might be handed over a Literal which
8080 gets a few more implicit conversions that plain types do not. So
8081 this information was being lost.
8083 Also, we drop the temporary type-holder expression when not
8086 2002-09-17 Martin Baulig <martin@gnome.org>
8088 * class.cs (PropertyBase.CheckBase): Don't check the base class if
8089 this is an explicit interface implementation.
8091 2002-09-17 Martin Baulig <martin@gnome.org>
8093 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
8094 different `IndexerName' attributes.
8096 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
8097 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
8098 virtual CommonResolve().
8100 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8102 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
8103 and convert that to the UnderlyingType.
8105 * statement.cs (Foreach.Resolve): Indexers are just like variables
8106 or PropertyAccesses.
8108 * cs-tokenizer.cs (consume_string): Track line numbers and columns
8109 inside quoted strings, we were not doing this before.
8111 2002-09-16 Martin Baulig <martin@gnome.org>
8113 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
8114 resolve it. This is needed for the definite assignment check of the
8115 instance expression, fixes bug #29846.
8116 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
8118 2002-09-16 Nick Drochak <ndrochak@gol.com>
8120 * parameter.cs: Fix compile error. Cannot reference static member
8121 from an instance object. Is this an mcs bug?
8123 2002-09-14 Martin Baulig <martin@gnome.org>
8125 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
8126 multiple times. Fixes bug #30295, added test-166.cs.
8128 2002-09-14 Martin Baulig <martin@gnome.org>
8130 * statement.cs (Block.Emit): Don't emit unreachable code.
8131 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
8133 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
8135 2002-09-14 Martin Baulig <martin@gnome.org>
8137 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
8140 2002-09-14 Martin Baulig <martin@gnome.org>
8142 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
8143 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
8144 be false on the ms runtime.
8146 2002-09-13 Martin Baulig <martin@gnome.org>
8148 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
8149 the CS0038 error message.
8151 2002-09-12 Miguel de Icaza <miguel@ximian.com>
8153 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
8154 constant inside, return it.
8156 2002-09-12 Martin Baulig <martin@gnome.org>
8158 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
8159 implicit conversion can be done between enum types.
8161 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
8162 check whether an implicit conversion to the current enum's UnderlyingType
8163 exists and report an error if not.
8165 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
8166 without debugging support.
8168 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
8169 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
8171 2002-09-12 Martin Baulig <martin@gnome.org>
8173 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
8175 * ecore.cs (IMemberExpr.DeclaringType): New property.
8176 (SimpleName.SimpleNameResolve): Check whether we're accessing a
8177 nonstatic member of an outer type (CS0038).
8179 2002-09-11 Miguel de Icaza <miguel@ximian.com>
8181 * driver.cs: Activate the using-error detector at warning level
8182 4 (at least for MS-compatible APIs).
8184 * namespace.cs (VerifyUsing): Small buglett fix.
8186 * pending.cs (PendingImplementation): pass the container pointer.
8188 * interface.cs (GetMethods): Allow for recursive definition. Long
8189 term, I would like to move every type to support recursive
8190 definitions, not the current ordering mechanism that we have right
8193 The situation is this: Attributes are handled before interfaces,
8194 so we can apply attributes to interfaces. But some attributes
8195 implement interfaces, we will now handle the simple cases
8196 (recursive definitions will just get an error).
8198 * parameter.cs: Only invalidate types at the end if we fail to
8201 2002-09-09 Martin Baulig <martin@gnome.org>
8203 * ecore.cs (PropertyExpr.Emit): Also check for
8204 TypeManager.system_int_array_get_length so this'll also work when
8205 compiling corlib. Fixes #30003.
8207 2002-09-09 Martin Baulig <martin@gnome.org>
8209 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
8210 and throw an exception if we can't get the type's size. Fixed #30040,
8213 2002-09-09 Martin Baulig <martin@gnome.org>
8215 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
8217 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
8218 context. Fixes bug #30027.
8220 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
8221 virtual functions. Fixes bug #30043, added test-164.cs.
8223 2002-09-08 Ravi Pratap <ravi@ximian.com>
8225 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
8227 2002-09-08 Nick Drochak <ndrochak@gol.com>
8229 * driver.cs: Use an object to get the windows codepage since it's not a
8232 2002-09-08 Miguel de Icaza <miguel@ximian.com>
8234 * statement.cs (For.Emit): for infinite loops (test == null)
8235 return whether there is a break inside, not always "true".
8237 * namespace.cs (UsingEntry): New struct to hold the name of the
8238 using definition, the location where it is defined, and whether it
8239 has been used in a successful type lookup.
8241 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
8246 2002-09-06 Ravi Pratap <ravi@ximian.com>
8248 * attribute.cs : Fix incorrect code which relied on catching
8249 a NullReferenceException to detect a null being passed in
8250 where an object was expected.
8252 2002-09-06 Miguel de Icaza <miguel@ximian.com>
8254 * statement.cs (Try): flag the catch variable as assigned
8256 * expression.cs (Cast): Simplified by using ResolveType instead of
8259 * statement.cs (Catch): Fix bug by using ResolveType.
8261 2002-09-06 Ravi Pratap <ravi@ximian.com>
8263 * expression.cs (BetterConversion): Special case for when we have
8264 a NullLiteral as the argument and we have to choose between string
8265 and object types - we choose string the way csc does.
8267 * attribute.cs (Attribute.Resolve): Catch the
8268 NullReferenceException and report error #182 since the Mono
8269 runtime no more has the bug and having this exception raised means
8270 we tried to select a constructor which takes an object and is
8273 2002-09-05 Ravi Pratap <ravi@ximian.com>
8275 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
8276 message (1502, 1503) when we can't locate a method after overload
8277 resolution. This is much more informative and closes the bug
8280 * interface.cs (PopulateMethod): Return if there are no argument
8281 types. Fixes a NullReferenceException bug.
8283 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
8284 expressions too. Previously we were checking only in one place for
8285 positional arguments leaving out named arguments.
8287 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
8288 type to the enum type is not allowed. Remove code corresponding to
8291 (ConvertNumericExplicit): Allow explicit conversions from
8292 the underlying type to enum type. This precisely follows the spec
8293 and closes a bug filed by Gonzalo.
8295 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8298 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
8300 2002-09-03 Miguel de Icaza <miguel@ximian.com>
8302 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
8303 it was important that we stored the right value after the
8304 reduction in `converted'.
8306 2002-09-04 Martin Baulig <martin@gnome.org>
8308 * location.cs (Location.SymbolDocument): Use full pathnames for the
8311 2002-08-30 Miguel de Icaza <miguel@ximian.com>
8313 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
8314 of the expression resolve mechanism, because that will catch the
8315 SimpleName error failures.
8317 (Conditional): If we can not resolve the
8318 expression, return, do not crash.
8320 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8323 (location): display token name instead of its number.
8325 2002-08-28 Martin Baulig <martin@gnome.org>
8327 * expression.cs (Binary.ResolveOperator): Don't silently return
8328 but return an error if an operator cannot be applied between two
8331 2002-08-28 Martin Baulig <martin@gnome.org>
8333 * class.cs (Constructor.Define): Set the permission attributes
8334 correctly instead of making all constructors public.
8336 2002-08-28 Martin Baulig <martin@gnome.org>
8338 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
8339 for private members before reporting a CS0103; if we find anything,
8342 2002-08-28 Martin Baulig <martin@gnome.org>
8344 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
8345 to check whether `closure_start_type == closure_invocation_type',
8346 we also need to check whether `m.DeclaringType == closure_invocation_type'
8347 before bypassing the permission checks. We might be accessing
8348 protected/private members from the base class.
8349 (TypeManager.RealMemberLookup): Only set private_ok if private
8350 members were requested via BindingFlags.NonPublic.
8352 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
8354 * expression.cs (MemberAccess.ResolveMemberAccess): Set
8355 MethodGroupExpr.IsExplicitImpl if appropriate.
8356 (Invocation.DoResolve): Don't report the CS0120 for explicit
8357 interface implementations.
8359 2002-08-27 Martin Baulig <martin@gnome.org>
8361 * expression.cs (Invocation.DoResolve): If this is a static
8362 method and we don't have an InstanceExpression, we must report
8365 2002-08-25 Martin Baulig <martin@gnome.org>
8367 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
8368 `==' between a valuetype and an object.
8370 2002-08-25 Miguel de Icaza <miguel@ximian.com>
8372 * ecore.cs (TypeExpr): Provide a ToString method.
8374 2002-08-24 Martin Baulig <martin@gnome.org>
8376 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
8377 now called proggie.dbg and it's a binary file.
8379 2002-08-23 Martin Baulig <martin@gnome.org>
8381 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
8383 2002-08-23 Martin Baulig <martin@gnome.org>
8385 * struct.cs (MyStructInfo.ctor): Make this work with empty
8386 structs; it's not allowed to use foreach() on null.
8388 2002-08-23 Martin Baulig <martin@gnome.org>
8390 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
8391 writer the full pathname of the generated assembly.
8393 2002-08-23 Martin Baulig <martin@gnome.org>
8395 * statements.cs (FlowBranching.UsageVector.MergeChildren):
8396 A `finally' block never returns or breaks; improved handling of
8399 2002-08-23 Martin Baulig <martin@gnome.org>
8401 * statement.cs (Throw.Resolve): Allow `throw null'.
8403 2002-08-23 Martin Baulig <martin@gnome.org>
8405 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
8406 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
8407 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
8408 MemberLookup would return a wrong event if this is an explicit
8409 interface implementation and the class has an event with the same
8412 2002-08-23 Martin Baulig <martin@gnome.org>
8414 * statement.cs (Block.AddChildVariableNames): New public method.
8415 (Block.AddChildVariableName): Likewise.
8416 (Block.IsVariableNameUsedInChildBlock): Likewise.
8417 (Block.AddVariable): Check whether a variable name has already
8418 been used in a child block.
8420 * cs-parser.jay (declare_local_variables): Mark all variable names
8421 from the current block as being used in a child block in the
8424 2002-08-23 Martin Baulig <martin@gnome.org>
8426 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
8427 find the symbol writer.
8429 * driver.cs: csc also allows the arguments to /define being
8430 separated by commas, not only by semicolons.
8432 2002-08-23 Martin Baulig <martin@gnome.org>
8434 * interface.cs (Interface.GetMembers): Added static check for events.
8436 2002-08-15 Martin Baulig <martin@gnome.org>
8438 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
8439 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
8441 * ecore.cs (Expression.MemberLookup): Added documentation and explained
8442 why the MethodData.EmitDestructor() change was necessary.
8444 2002-08-20 Martin Baulig <martin@gnome.org>
8446 * class.cs (TypeContainer.FindMembers): Added static check for events.
8448 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
8450 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
8451 use Type.GetEvents(), not Type.FindMembers().
8453 2002-08-20 Martin Baulig <martin@gnome.org>
8455 * decl.cs (MemberCache): Added a special method cache which will
8456 be used for method-only searched. This ensures that a method
8457 search will return a MethodInfo with the correct ReflectedType for
8460 2002-08-20 Martin Baulig <martin@gnome.org>
8462 * decl.cs (DeclSpace.FindMembers): Made this public.
8464 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8466 * delegate.cs: fixed build on windows.
8467 [FIXME: Filed as bug #29150: MCS must report these errors.]
8469 2002-08-19 Ravi Pratap <ravi@ximian.com>
8471 * ecore.cs (StandardConversionExists): Return a false
8472 if we are trying to convert the void type to anything else
8473 since that is not allowed.
8475 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
8476 we flag error 70 in the event an event is trying to be accessed
8477 directly from outside the declaring type.
8479 2002-08-20 Martin Baulig <martin@gnome.org>
8481 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
8482 MemberCache from typemanager.cs to decl.cs.
8484 2002-08-19 Martin Baulig <martin@gnome.org>
8486 * class.cs (TypeContainer): Implement IMemberContainer.
8487 (TypeContainer.DefineMembers): Create the MemberCache.
8488 (TypeContainer.FindMembers): Do better BindingFlags checking; only
8489 return public members if BindingFlags.Public was given, check
8490 whether members are static.
8492 2002-08-16 Martin Baulig <martin@gnome.org>
8494 * decl.cs (DeclSpace.Define): Splitted this in Define and
8495 DefineMembers. DefineMembers is called first and initializes the
8498 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
8499 DefineMembers() on all our DeclSpaces.
8501 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
8502 but call DefineMembers() on all nested interfaces. We call their
8503 Define() in our new Define() function.
8505 * interface.cs (Interface): Implement IMemberContainer.
8506 (Interface.Define): Moved all code except the attribute stuf to
8508 (Interface.DefineMembers): Initialize the member cache.
8510 * typemanager.cs (IMemberFinder): Removed this interface, we don't
8511 need this anymore since we can use MemberCache.FindMembers directly.
8513 2002-08-19 Martin Baulig <martin@gnome.org>
8515 * typemanager.cs (MemberCache): When creating the cache for an
8516 interface type, add all inherited members.
8517 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
8518 to `out bool used_cache' and documented it.
8519 (TypeManager.MemberLookup): If we already used the cache in the first
8520 iteration, we don't need to do the interfaces check.
8522 2002-08-19 Martin Baulig <martin@gnome.org>
8524 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
8525 here from IMemberFinder and don't implement this interface anymore.
8526 (DeclSpace.MemberCache): Moved here from IMemberFinder.
8528 * typemanager.cs (IMemberFinder): This interface is now only used by
8529 classes which actually support the member cache.
8530 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
8531 since we only put DeclSpaces into this Hashtable.
8532 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
8533 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
8535 2002-08-16 Martin Baulig <martin@gnome.org>
8537 * typemanager.cs (ICachingMemberFinder): Removed.
8538 (IMemberFinder.MemberCache): New property.
8539 (TypeManager.FindMembers): Merged this with RealFindMembers().
8540 This function will never be called from TypeManager.MemberLookup()
8541 so we can't use the cache here, just the IMemberFinder.
8542 (TypeManager.MemberLookup_FindMembers): Check whether the
8543 IMemberFinder has a MemberCache and call the cache's FindMembers
8545 (MemberCache): Rewrote larger parts of this yet another time and
8546 cleaned it up a bit.
8548 2002-08-15 Miguel de Icaza <miguel@ximian.com>
8550 * driver.cs (LoadArgs): Support quoting.
8552 (Usage): Show the CSC-like command line arguments.
8554 Improved a few error messages.
8556 2002-08-15 Martin Baulig <martin@gnome.org>
8558 * typemanager.cs (IMemberContainer.Type): New property.
8559 (IMemberContainer.IsInterface): New property.
8561 The following changes are conditional to BROKEN_RUNTIME, which is
8562 defined at the top of the file.
8564 * typemanager.cs (MemberCache.MemberCache): Don't add the base
8565 class'es members, but add all members from TypeHandle.ObjectType
8566 if we're an interface.
8567 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
8568 is the current type.
8569 (MemberCache.CacheEntry.Container): Removed this field.
8570 (TypeHandle.GetMembers): Include inherited members.
8572 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8574 * typemanager.cs: fixed compilation and added a comment on a field that
8577 2002-08-15 Martin Baulig <martin@gnome.org>
8579 * class.cs (ConstructorInitializer.Resolve): In the
8580 Expression.MemberLookup call, use the queried_type as
8583 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8584 declared' attribute, it's always true.
8585 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8586 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8587 temporary wrapper for FindMembers which tells MemberLookup whether
8588 members from the base classes are included in the return value.
8589 This will go away soon.
8590 (TypeManager.MemberLookup): Use this temporary hack here; once the
8591 new MemberCache is completed, we don't need to do the DeclaredOnly
8592 looping here anymore since the MemberCache will take care of this.
8593 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8594 (MemberCache): When creating the MemberCache for a class, get
8595 members from the current class and all its base classes.
8596 (MemberCache.CacheEntry.Container): New field. This is a
8597 temporary hack until the Mono runtime is fixed to distinguish
8598 between ReflectedType and DeclaringType. It allows us to use MCS
8599 with both the MS runtime and the unfixed Mono runtime without
8600 problems and without accecting performance.
8601 (MemberCache.SearchMembers): The DeclaredOnly looping from
8602 TypeManager.MemberLookup is now done here.
8604 2002-08-14 Martin Baulig <martin@gnome.org>
8606 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8607 Type.GetFields on dynamic types but get the fields from the
8608 corresponding TypeContainer.
8609 (MyStructInfo.GetStructInfo): Added check for enum types.
8611 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8612 (MemberList.SyncRoot): Implemented.
8613 (TypeManager.FilterWithClosure): No need to check permissions if
8614 closure_start_type == closure_invocation_type, don't crash if
8615 closure_invocation_type is null.
8617 2002-08-13 Martin Baulig <martin@gnome.org>
8619 Rewrote TypeContainer.FindMembers to use a member cache. This
8620 gives us a speed increase of about 35% for the self-hosting MCS
8621 build and of about 15-20% for the class libs (both on GNU/Linux).
8623 * report.cs (Timer): New class to get enhanced profiling. This
8624 whole class is "TIMER" conditional since it remarkably slows down
8627 * class.cs (MemberList): New class. This is an IList wrapper
8628 which we're now using instead of passing MemberInfo[]'s around to
8629 avoid copying this array unnecessarily.
8630 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8631 (ICachingMemberFinder, IMemberContainer): New interface.
8632 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8633 has already been checked, otherwise use it for the name comparision.
8634 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8635 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8636 if possible. Returns a MemberList, not a MemberInfo [].
8637 (TypeHandle): New class, implements IMemberContainer. We create
8638 one instance of this class per type, it contains a MemberCache
8639 which is used to do the member lookups.
8640 (MemberCache): New class. Each instance of this class contains
8641 all members of a type and a name-based hash table.
8642 (MemberCache.FindMembers): This is our new member lookup
8643 function. First, it looks up all members of the requested name in
8644 the hash table. Then, it walks this list and sorts out all
8645 applicable members and returns them.
8647 2002-08-13 Martin Baulig <martin@gnome.org>
8649 In addition to a nice code cleanup, this gives us a performance
8650 increase of about 1.4% on GNU/Linux - not much, but it's already
8651 half a second for the self-hosting MCS compilation.
8653 * typemanager.cs (IMemberFinder): New interface. It is used by
8654 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8655 Enum, Delegate or Interface.
8656 (TypeManager.finder_to_member_finder): New PtrHashtable.
8657 (TypeManager.finder_to_container): Removed.
8658 (TypeManager.finder_to_delegate): Removed.
8659 (TypeManager.finder_to_interface): Removed.
8660 (TypeManager.finder_to_enum): Removed.
8662 * interface.cs (Interface): Implement IMemberFinder.
8664 * delegate.cs (Delegate): Implement IMemberFinder.
8666 * enum.cs (Enum): Implement IMemberFinder.
8668 * class.cs (TypeContainer): Implement IMemberFinder.
8670 2002-08-12 Martin Baulig <martin@gnome.org>
8672 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8674 2002-08-12 Martin Baulig <martin@gnome.org>
8676 * ecore.cs (ITypeExpression): New interface for expressions which
8678 (TypeExpression): Renamed to TypeLookupExpression.
8679 (Expression.DoResolve): If we're doing a types-only lookup, the
8680 expression must implement the ITypeExpression interface and we
8681 call DoResolveType() on it.
8682 (SimpleName): Implement the new ITypeExpression interface.
8683 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8684 hack, the situation that we're only looking up types can't happen
8685 anymore when this method is called. Moved the type lookup code to
8686 DoResolveType() and call it.
8687 (SimpleName.DoResolveType): This ITypeExpression interface method
8688 is now doing the types-only lookup.
8689 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8690 (ResolveFlags): Added MaskExprClass.
8692 * expression.cs (MemberAccess): Implement the ITypeExpression
8694 (MemberAccess.DoResolve): Added support for a types-only lookup
8695 when we're called via ITypeExpression.DoResolveType().
8696 (ComposedCast): Implement the ITypeExpression interface.
8698 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8699 Expression.Resolve() with ResolveFlags.Type instead.
8701 2002-08-12 Martin Baulig <martin@gnome.org>
8703 * interface.cs (Interface.Define): Apply attributes.
8705 * attribute.cs (Attribute.ApplyAttributes): Added support for
8706 interface attributes.
8708 2002-08-11 Martin Baulig <martin@gnome.org>
8710 * statement.cs (Block.Emit): Only check the "this" variable if we
8711 do not always throw an exception.
8713 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8714 whether the property has a set accessor.
8716 2002-08-11 Martin Baulig <martin@gnome.org>
8718 Added control flow analysis support for structs.
8720 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8721 with control flow analysis turned off.
8722 (IVariable): New interface.
8723 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8724 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8725 (FieldExpr.DoResolve): Resolve the instance expression with flow
8726 analysis turned off and do the definite assignment check after the
8727 resolving when we know what the expression will resolve to.
8729 * expression.cs (LocalVariableReference, ParameterReference):
8730 Implement the new IVariable interface, only call the flow analysis
8731 code if ec.DoFlowAnalysis is true.
8732 (This): Added constructor which takes a Block argument. Implement
8733 the new IVariable interface.
8734 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8735 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8736 This does the definite assignment checks for struct members.
8738 * class.cs (Constructor.Emit): If this is a non-static `struct'
8739 constructor which doesn't have any initializer, call
8740 Block.AddThisVariable() to tell the flow analysis code that all
8741 struct elements must be initialized before control returns from
8744 * statement.cs (MyStructInfo): New public class.
8745 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8746 argument to this indexer. If non-zero, check an individual struct
8747 member, not the whole struct.
8748 (FlowBranching.CheckOutParameters): Check struct members.
8749 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8750 overloaded versions of these methods which take an additional
8751 `int field_idx' argument to check struct members.
8752 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8753 overloaded versions of these methods which take an additional
8754 `string field_name' argument to check struct member.s
8755 (VariableInfo): Implement the IVariable interface.
8756 (VariableInfo.StructInfo): New public property. Returns the
8757 MyStructInfo instance of the variable if it's a struct or null.
8758 (Block.AddThisVariable): New public method. This is called from
8759 Constructor.Emit() for non-static `struct' constructor which do
8760 not have any initializer. It creates a special variable for the
8761 "this" instance variable which will be checked by the flow
8762 analysis code to ensure that all of the struct's fields are
8763 initialized before control returns from the constructor.
8764 (UsageVector): Added support for struct members. If a
8765 variable/parameter is a struct with N members, we reserve a slot
8766 in the usage vector for each member. A struct is considered fully
8767 initialized if either the struct itself (slot 0) or all its
8768 members are initialized.
8770 2002-08-08 Martin Baulig <martin@gnome.org>
8772 * driver.cs (Driver.MainDriver): Only report an error CS5001
8773 if there were no compilation errors.
8775 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
8776 `UnsafeContext' property to determine whether the parent is in
8777 unsafe context rather than checking the parent's ModFlags:
8778 classes nested in an unsafe class are unsafe as well.
8780 2002-08-08 Martin Baulig <martin@gnome.org>
8782 * statement.cs (UsageVector.MergeChildren): Distinguish between
8783 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
8784 we return. Added test17() and test18() to test-154.cs.
8786 2002-08-08 Martin Baulig <martin@gnome.org>
8788 * typemanager.cs (TypeManager.FilterWithClosure): If we have
8789 Family access, make sure the invoking type isn't a subclass of the
8790 queried type (that'd be a CS1540).
8792 * ecore.cs (Expression.MemberLookup): Added overloaded version of
8793 this method which takes an additional `Type invocation_type'.
8795 * expression.cs (BaseAccess.DoResolve): Use the base type as
8796 invocation and query type.
8797 (MemberAccess.DoResolve): If the lookup failed and we're about to
8798 report a CS0122, try a lookup with the ec.ContainerType - if this
8799 succeeds, we must report a CS1540.
8801 2002-08-08 Martin Baulig <martin@gnome.org>
8803 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
8804 (MethodGroupExpr): Implement the IMemberExpr interface.
8806 * expression (MemberAccess.ResolveMemberAccess): No need to have
8807 any special code for MethodGroupExprs anymore, they're now
8810 2002-08-08 Martin Baulig <martin@gnome.org>
8812 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
8813 Family, FamANDAssem and FamORAssem permissions.
8814 (TypeManager.IsSubclassOrNestedChildOf): New public method.
8816 2002-08-08 Martin Baulig <martin@gnome.org>
8818 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
8819 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
8822 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
8824 * driver.cs: implemented /resource option to embed managed resources.
8826 2002-08-07 Martin Baulig <martin@gnome.org>
8828 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
8829 (FieldBase.HasFieldInitializer): New public property.
8830 (FieldBase.GetInitializerExpression): New public method. Resolves and
8831 returns the field initializer and makes sure it is only resolved once.
8832 (TypeContainer.EmitFieldInitializers): Call
8833 FieldBase.GetInitializerExpression to get the initializer, this ensures
8834 that it isn't resolved multiple times.
8836 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
8837 the resolving process (SimpleName/MemberLookup) that we're currently
8838 emitting a field initializer (which must not access any instance members,
8839 this is an error CS0236).
8841 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
8842 argument, if the `IsFieldInitializer' flag is set, we must report and
8843 error CS0236 and not an error CS0120.
8845 2002-08-07 Martin Baulig <martin@gnome.org>
8847 * ecore.cs (IMemberExpr): New public interface.
8848 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
8849 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
8850 if the expression is an IMemberExpr.
8852 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
8853 to be null, implicitly default to `this' if we're non-static in
8854 this case. Simplified the code a lot by using the new IMemberExpr
8855 interface. Also fixed bug #28176 here.
8857 2002-08-06 Martin Baulig <martin@gnome.org>
8859 * cs-parser.jay (SimpleLookup): Removed. We need to create
8860 ParameterReferences during semantic analysis so that we can do a
8861 type-only search when resolving Cast, TypeOf and SizeOf.
8862 (block): Pass the `current_local_parameters' to the Block's
8865 * class.cs (ConstructorInitializer): Added `Parameters parameters'
8866 argument to the constructor.
8867 (ConstructorInitializer.Resolve): Create a temporary implicit
8868 block with the parameters.
8870 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
8871 references here if we aren't doing a type-only search.
8873 * statement.cs (Block): Added constructor which takes a
8874 `Parameters parameters' argument.
8875 (Block.Parameters): New public property.
8877 * support.cs (InternalParameters.Parameters): Renamed `parameters'
8878 to `Parameters' and made it public readonly.
8880 2002-08-06 Martin Baulig <martin@gnome.org>
8882 * ecore.cs (Expression.Warning): Made this public as well.
8884 * report.cs (Report.Debug): Print the contents of collections.
8886 2002-08-06 Martin Baulig <martin@gnome.org>
8888 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
8889 used to tell Resolve() which kinds of expressions it may return.
8890 (Expression.Resolve): Added overloaded version of this method which
8891 takes a `ResolveFlags flags' argument. This can be used to tell
8892 Resolve() which kinds of expressions it may return. Reports a
8894 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
8895 ResolveFlags.SimpleName.
8896 (Expression.Error118): Added overloaded version of this method which
8897 takes a `ResolveFlags flags' argument. It uses the flags to determine
8898 which kinds of expressions are allowed.
8900 * expression.cs (Argument.ResolveMethodGroup): New public method.
8901 Resolves an argument, but allows a MethodGroup to be returned.
8902 This is used when invoking a delegate.
8904 * TODO: Updated a bit.
8906 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8908 Fixed compilation with csc.
8910 * ecore.cs: Expression.Error made public. Is this correct? Should
8911 Warning be made public too?
8913 * expression.cs: use ea.Location instead of ea.loc.
8914 [FIXME: Filed as bug #28607: MCS must report these errors.]
8916 2002-08-06 Martin Baulig <martin@gnome.org>
8918 * ecore.cs (Expression.loc): Moved the location here instead of
8919 duplicating it in all derived classes.
8920 (Expression.Location): New public property.
8921 (Expression.Error, Expression.Warning): Made them non-static and
8922 removed the location argument.
8923 (Expression.Warning): Added overloaded version which takes an
8924 `int level' argument.
8925 (Expression.Error118): Make this non-static and removed the
8926 expression and location arguments.
8927 (TypeExpr): Added location argument to the constructor.
8929 * expression.cs (StaticCallExpr): Added location argument to
8931 (Indirection, PointerArithmetic): Likewise.
8932 (CheckedExpr, UnCheckedExpr): Likewise.
8933 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8934 (StringPtr): Likewise.
8937 2002-08-05 Martin Baulig <martin@gnome.org>
8939 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8941 * assign.cs (Assign.DoResolve): Check whether the source
8942 expression is a value or variable.
8944 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8945 while resolving the corresponding blocks.
8947 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8948 an error, don't silently return null.
8950 * statement.cs (Block.AddVariable): Do the error reporting here
8951 and distinguish between CS0128 and CS0136.
8952 (Block.DoResolve): Report all unused labels (warning CS0164).
8953 (LabeledStatement): Pass the location to the constructor.
8954 (LabeledStatement.HasBeenReferenced): New property.
8955 (LabeledStatement.Resolve): Set it to true here.
8957 * statement.cs (Return.Emit): Return success even after reporting
8958 a type mismatch error (CS0126 or CS0127), this is what csc does and
8959 it avoids confusing the users with any consecutive errors.
8961 2002-08-05 Martin Baulig <martin@gnome.org>
8963 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8965 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8967 * expression.cs (MemberAccess.DoResolve): Silently return if an
8968 error has already been reported.
8970 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8971 error has already been reported.
8973 2002-08-05 Martin Baulig <martin@gnome.org>
8975 * statement.cs (UsageVector): Only initialize the `parameters'
8976 vector if we actually have any "out" parameters.
8978 2002-08-05 Martin Baulig <martin@gnome.org>
8980 * expression.cs (Binary.ResolveOperator): When combining delegates,
8981 they must have the same type.
8983 2002-08-05 Martin Baulig <martin@gnome.org>
8985 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8986 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8987 work with the ms runtime and we also don't need it: if we're a
8988 PropertyBuilder and not in the `indexer_arguments' hash, then we
8989 are a property and not an indexer.
8991 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8992 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8993 since the latter one doesn't work with the ms runtime.
8995 2002-08-03 Martin Baulig <martin@gnome.org>
8997 Fixed bugs #27998 and #22735.
8999 * class.cs (Method.IsOperator): New public field.
9000 (Method.CheckBase): Report CS0111 if there's already a method
9001 with the same parameters in the current class. Report CS0508 when
9002 attempting to change the return type of an inherited method.
9003 (MethodData.Emit): Report CS0179 if a method doesn't have a body
9004 and it's not marked abstract or extern.
9005 (PropertyBase): New abstract base class for Property and Indexer.
9006 (PropertyBase.CheckBase): Moved here from Property and made it work
9008 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
9009 the same so we can reuse it there.
9010 (Property, Indexer): Derive from PropertyBase.
9011 (MethodSignature.inheritable_property_signature_filter): New delegate
9012 to find properties and indexers.
9014 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
9015 argument and improved error reporting.
9017 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
9018 EmptyReadOnlyParameters and made it a property.
9020 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
9021 version of this method which takes a `PropertyInfo indexer'.
9022 (TypeManager.RegisterIndexer): New method.
9024 * class.cs: Added myself as author of this file :-)
9026 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9028 * class.cs: fixed compilation on windoze.
9030 2002-08-03 Martin Baulig <martin@gnome.org>
9032 * interface.cs (Interface.GetInterfaceBases): Check whether all
9033 base interfaces are at least as accessible than the current one.
9035 * class.cs (TypeContainer.GetClassBases): Check whether base types
9036 are at least as accessible than the current type.
9037 (TypeContainer.AsAccessible): Implemented and made non-static.
9038 (MemberBase.CheckParameters): Report errors if the accessibility
9041 * delegate.cs (Delegate.Delegate): The default visibility is
9042 internal for top-level types and private for nested types.
9043 (Delegate.Define): Report errors if the accessibility checks fail.
9045 * enum.cs (Enum.Enum): The default visibility is internal for
9046 top-level types and private for nested types.
9047 (Enum.DefineType): Compute the correct visibility.
9049 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
9050 function which takes a `bool is_toplevel' instead of a TypeContainer.
9052 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
9055 2002-08-02 Martin Baulig <martin@gnome.org>
9057 * expression.cs (LocalVariableReferenc): Added constructor which
9058 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
9059 (LocalVariableReference.IsReadOnly): New property.
9060 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
9061 variable is readonly, use our own readonly flag to do this; you can
9062 use the new constructor to get a writable reference to a read-only
9065 * cs-parser.jay (foreach_statement, using_statement): Get a writable
9066 reference to the local variable.
9068 2002-08-01 Miguel de Icaza <miguel@ximian.com>
9070 * rootcontext.cs (ResolveCore): Also include System.Exception
9072 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
9073 we reach an EmptyStatement.
9075 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
9078 * expression.cs (Binary.ResolveOperator): Check error result in
9081 use brtrue/brfalse directly and avoid compares to null.
9083 2002-08-02 Martin Baulig <martin@gnome.org>
9085 * class.cs (TypeContainer.Define): Define all nested interfaces here.
9086 Fixes bug #28407, added test-155.cs.
9088 2002-08-01 Martin Baulig <martin@gnome.org>
9090 * class.cs (Event.EmitDefaultMethod): Make this work with static
9091 events. Fixes #28311, added verify-3.cs.
9093 2002-08-01 Martin Baulig <martin@gnome.org>
9095 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
9096 `is_disposable' fields.
9097 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
9098 `hm.is_disposable' if we're using the collection pattern.
9099 (Foreach.EmitCollectionForeach): Use the correct type for the
9100 enumerator's local variable, only emit the try/finally block if
9101 necessary (fixes #27713).
9103 2002-08-01 Martin Baulig <martin@gnome.org>
9105 * ecore.cs (Expression.report118): Renamed to Error118 and made
9108 * statement.cs (Throw.Resolve): Check whether the expression is of
9109 the correct type (CS0118) and whether the type derives from
9110 System.Exception (CS0155).
9111 (Catch.Resolve): New method. Do the type lookup here and check
9112 whether it derives from System.Exception (CS0155).
9113 (Catch.CatchType, Catch.IsGeneral): New public properties.
9115 * typemanager.cs (TypeManager.exception_type): Added.
9117 2002-07-31 Miguel de Icaza <miguel@ximian.com>
9119 * driver.cs: Updated About function.
9121 2002-07-31 Martin Baulig <martin@gnome.org>
9123 Implemented Control Flow Analysis.
9125 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
9126 (EmitContext.CurrentBranching): Added.
9127 (EmitContext.StartFlowBranching): Added.
9128 (EmitContext.EndFlowBranching): Added.
9129 (EmitContext.KillFlowBranching): Added.
9130 (EmitContext.IsVariableAssigned): Added.
9131 (EmitContext.SetVariableAssigned): Added.
9132 (EmitContext.IsParameterAssigned): Added.
9133 (EmitContext.SetParameterAssigned): Added.
9134 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
9135 Added control flow analysis stuff here.
9137 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
9138 resolve the expression as lvalue.
9139 (LocalVariableReference.DoResolve): Check whether the variable has
9140 already been assigned.
9141 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
9142 the parameter as assigned here.
9143 (ParameterReference.DoResolve): Check whether the parameter has already
9145 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
9146 expression as lvalue.
9148 * statement.cs (FlowBranching): New class for the flow analysis code.
9149 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
9150 (LabeledStatement.IsDefined): New public property.
9151 (LabeledStatement.AddUsageVector): New public method to tell flow
9152 analyis that the label may be reached via a forward jump.
9153 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
9155 (VariableInfo.Number): New public field. This is used by flow analysis
9156 to number all locals of a block.
9157 (Block.CountVariables): New public property. This is the number of
9158 local variables in this block (including the locals from all parent
9160 (Block.EmitMeta): Number all the variables.
9162 * statement.cs: Added flow analysis support to all classes.
9164 2002-07-31 Martin Baulig <martin@gnome.org>
9166 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
9167 To get debugging messages, compile mcs with /define:MCS_DEBUG and
9168 then use this argument.
9170 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
9172 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
9173 use this to specify /define options.
9175 2002-07-29 Martin Baulig <martin@gnome.org>
9177 * statement.cs (Fixed): Moved all code that does variable lookups
9178 and resolvings from Emit to Resolve.
9180 * statement.cs (For): Moved all code that does variable lookups
9181 and resolvings from Emit to Resolve.
9183 * statement.cs (Using): Moved all code that does variable lookups
9184 and resolvings from Emit to Resolve.
9186 2002-07-29 Martin Baulig <martin@gnome.org>
9188 * attribute.cs (Attribute.Resolve): Explicitly catch a
9189 System.NullReferenceException when creating the
9190 CustromAttributeBuilder and report a different warning message.
9192 2002-07-29 Martin Baulig <martin@gnome.org>
9194 * support.cs (ParameterData.ParameterName): Added method to
9195 get the name of a parameter.
9197 * typemanager.cs (TypeManager.IsValueType): New public method.
9199 2002-07-29 Martin Baulig <martin@gnome.org>
9201 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
9202 is a flag which specifies that it's either ref or out.
9203 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
9204 the out parameter to `out Parameter.Modifier mod', also set the
9205 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
9207 * support.cs (InternalParameters.ParameterModifier): Distinguish
9208 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9209 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9211 * expression.cs (Argument.GetParameterModifier): Distinguish
9212 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9213 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9215 2002-07-29 Martin Baulig <martin@gnome.org>
9217 * expression.cs (ParameterReference.ParameterReference): Added
9218 `Location loc' argument to the constructor.
9220 * cs-parser.jay: Pass location to ParameterReference.
9222 2002-07-28 Miguel de Icaza <miguel@ximian.com>
9224 * statement.cs (Try): Initialize the location.
9226 * cs-parser.jay: pass location to Try.
9228 * expression.cs (Unary.Reduce): Change the prototype to return
9229 whether a constant fold could be performed or not. The result is
9230 returned in an out parameters. In the case of Indirection and
9231 AddressOf, we want to perform the full tests.
9233 2002-07-26 Miguel de Icaza <miguel@ximian.com>
9235 * statement.cs (Statement.Emit): Flag dead code.
9237 2002-07-27 Andrew Birkett <andy@nobugs.org>
9239 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
9241 2002-07-27 Martin Baulig <martin@gnome.org>
9243 * class.cs (MethodData.Define): Put back call to
9244 TypeManager.AddMethod(), accidentally commented this out.
9246 * report.cs (Debug): New public method to print debugging information,
9247 this is `[Conditional ("DEBUG")]'.
9249 2002-07-26 Martin Baulig <martin@gnome.org>
9251 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
9252 (switch_statement): Push the current_block to the switch_stack and
9253 pop it again when we're done with the switch.
9254 (switch_section): The new block is a child of the current_block.
9255 Fixes bug #24007, added test-152.cs.
9257 2002-07-27 Martin Baulig <martin@gnome.org>
9259 * expression.cs (Invocation.EmitArguments): When calling a varargs
9260 function with only its fixed arguments, we need to pass an empty
9263 2002-07-27 Martin Baulig <martin@gnome.org>
9265 Mono 0.13 has been released.
9267 2002-07-25 Miguel de Icaza <miguel@ximian.com>
9269 * driver.cs: Rename --resource to --linkres, because that is what
9270 we do currently, we dont support --resource yet.
9272 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
9274 2002-07-25 Martin Baulig <martin@gnome.org>
9276 * class.cs (MethodData): New public class. This is a `method builder'
9277 class for a method or one accessor of a Property/Indexer/Event.
9278 (MethodData.GetMethodFlags): Moved here from MemberBase.
9279 (MethodData.ApplyAttributes): Likewise.
9280 (MethodData.ApplyObsoleteAttribute): Likewise.
9281 (MethodData.ApplyConditionalAttribute): Likewise.
9282 (MethodData.ApplyDllImportAttribute): Likewise.
9283 (MethodData.CheckAbstractAndExternal): Likewise.
9284 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
9285 (MethodData.Emit): Formerly known as Method.Emit().
9286 (MemberBase): Moved everything which was specific to a single
9287 accessor/method to MethodData.
9288 (Method): Create a new MethodData and call Define() and Emit() on it.
9289 (Property, Indexer, Event): Create a new MethodData objects for each
9290 accessor and call Define() and Emit() on them.
9292 2002-07-25 Martin Baulig <martin@gnome.org>
9294 Made MethodCore derive from MemberBase to reuse the code from there.
9295 MemberBase now also checks for attributes.
9297 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
9298 (MemberBase.GetMethodFlags): Moved here from class Method and marked
9300 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
9301 `CallingConventions cc' and `Attributes opt_attrs' arguments.
9302 (MemberBase.ApplyAttributes): New virtual method; applies the
9303 attributes to a method or accessor.
9304 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
9305 (MemberBase.ApplyConditionalAttribute): Likewise.
9306 (MemberBase.ApplyDllImportAttribute): Likewise.
9307 (MemberBase.CheckAbstractAndExternal): Likewise.
9308 (MethodCore.ParameterTypes): This is now a property instead of a
9309 method, it's initialized from DoDefineParameters().
9310 (MethodCore.ParameterInfo): Removed the set accessor.
9311 (MethodCore.DoDefineParameters): New protected virtual method to
9312 initialize ParameterTypes and ParameterInfo.
9313 (Method.GetReturnType): We can now simply return the MemberType.
9314 (Method.GetMethodFlags): Override the MemberBase version and add
9315 the conditional flags.
9316 (Method.CheckBase): Moved some code from Define() here, call
9317 DoDefineParameters() here.
9318 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
9319 here to avoid some larger code duplication.
9320 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
9321 ensure that abstract and external accessors don't declare a body.
9323 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
9324 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
9325 lookup in the attribute's parent classes, so we need to abort as soon
9326 as we found the first match.
9327 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
9328 the attribute has no arguments.
9330 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
9333 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9335 * cs-parser.jay: reverted previous patch.
9337 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9339 * cs-parser.jay: fixed bug #22119.
9341 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9343 * attribute.cs: fixed compilation. The error was:
9344 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
9345 be assigned to before control leaves the current method."
9346 [FIXME: Filed as bug #28186: MCS must report this error.]
9348 2002-07-25 Martin Baulig <martin@gnome.org>
9350 * attribute.cs (Attribute.Conditional_GetConditionName): New static
9351 method to pull the condition name ouf of a Conditional attribute.
9352 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
9353 the obsolete message and error flag out of an Obsolete attribute.
9355 * class.cs (Method.GetMethodFlags): New public method to get the
9356 TypeManager.MethodFlags for this method.
9357 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
9359 (Method.Define): Get and apply the Obsolete and Conditional attributes;
9360 if we're overriding a virtual function, set the new private variable
9361 `parent_method'; call the new TypeManager.AddMethod().
9363 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
9364 the MethodBuilder and the Method in a PtrHashtable.
9365 (TypeManager.builder_to_method): Added for this purpose.
9366 (TypeManager.MethodFlags): Added IsObsoleteError.
9367 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
9368 Obsolete and Conditional arguments in MethodBuilders. If we discover
9369 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
9370 the message from the attribute.
9372 2002-07-24 Martin Baulig <martin@gnome.org>
9374 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
9375 preprocessor directives, ensure that the argument to #define/#undef is
9376 exactly one identifier and that it's actually an identifier.
9378 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
9381 2002-07-24 Martin Baulig <martin@gnome.org>
9383 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
9384 initialize it to TypeManager.object_type in the constructor.
9385 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
9386 of the `hm.get_current' method if we're using the collection pattern.
9387 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
9388 for the explicit conversion to make it work when we're using the collection
9389 pattern and the `Current' property has a different return type than `object'.
9392 2002-07-24 Martin Baulig <martin@gnome.org>
9394 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
9395 does not match, but don't report any errors. This method is called in
9396 order for all methods in a MethodGroupExpr until a matching method is
9397 found, so we don't want to bail out if the first method doesn't match.
9398 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
9399 matches, report the 123. Fixes #28070.
9401 2002-07-24 Martin Baulig <martin@gnome.org>
9403 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
9404 TypeManager.TypeToCoreType() to the top of the method so the
9405 following equality checks will work. Fixes #28107.
9407 2002-07-24 Martin Baulig <martin@gnome.org>
9409 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
9410 operand is of type uint, and the other operand is of type sbyte,
9411 short or int, the operands are converted to type long." -
9412 Actually do what this comment already told us. Fixes bug #28106,
9415 2002-07-24 Martin Baulig <martin@gnome.org>
9417 * class.cs (MethodBase): New abstract class. This is now a base
9418 class for Property, Indexer and Event to avoid some code duplication
9419 in their Define() and DefineMethods() methods.
9420 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
9421 generic methods for Define() and DefineMethods().
9422 (FieldBase): Derive from MemberBase, not MemberCore.
9423 (Property): Derive from MemberBase, not MemberCore.
9424 (Property.DefineMethod): Moved all the code from this method to the
9425 new MethodBase.DefineAccessor(), just call it with appropriate
9427 (Property.Define): Call the new Property.DoDefine(), this does some
9428 sanity checks and we don't need to duplicate the code everywhere.
9429 (Event): Derive from MemberBase, not MemberCore.
9430 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
9431 accessors, this will also make them work with interface events.
9432 (Indexer): Derive from MemberBase, not MemberCore.
9433 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
9434 (Indexer.Define): Use the new MethodBase functions.
9436 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
9437 argument to the constructor.
9438 (Interface.FindMembers): Added support for interface events.
9439 (Interface.PopluateEvent): Implemented.
9441 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
9443 2002-07-22 Miguel de Icaza <miguel@ximian.com>
9445 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
9446 but this is required to check for a method name being the same as
9447 the containing class.
9451 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9453 * interface.cs: initialize variable.
9455 2002-07-23 Martin Baulig <martin@gnome.org>
9457 Implemented the IndexerName attribute in interfaces.
9459 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
9460 name if this is an explicit interface implementation.
9461 (Indexer.InterfaceIndexerName): New public variable. If we're
9462 implementing an interface indexer, this is the IndexerName in that
9463 interface. Otherwise, it's the IndexerName.
9464 (Indexer.DefineMethod): If we're implementing interface indexer,
9465 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
9466 and Pending.ImplementIndexer methods.
9467 (Indexer.Define): Also define the PropertyBuilder if we're
9468 implementing an interface indexer and this is neither an explicit
9469 interface implementation nor do the IndexerName match the one in
9472 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
9473 If a method is defined here, then we always need to create a proxy
9474 for it. This is used when implementing interface indexers.
9475 (Pending.IsInterfaceIndexer): New public method.
9476 (Pending.ImplementIndexer): New public method.
9477 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
9478 This is used when implementing interface indexers to define a proxy
9480 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
9481 define a proxy if necessary.
9483 * interface.cs (Interface.IndexerName): New public variable.
9484 (Interface.PopulateIndexer): Set the IndexerName.
9485 (Interface.DefineIndexers): New private method. Populate all the
9486 indexers and make sure their IndexerNames match.
9488 * typemanager.cs (IndexerPropertyName): Added support for interface
9491 2002-07-22 Martin Baulig <martin@gnome.org>
9493 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
9494 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
9495 ret if HasReturnLabel.
9496 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
9499 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
9500 and set the ec.LoopBeginTryCatchLevel.
9501 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
9502 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
9503 the current ec.TryCatchLevel, the branch goes out of an exception
9504 block. In this case, we need to use Leave and not Br.
9506 2002-07-22 Martin Baulig <martin@gnome.org>
9508 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
9509 block unless the block does not always return or it is contained in
9510 another try { ... } catch { ... } block. Fixes bug #26506.
9511 Added verify-1.cs to the test suite.
9513 2002-07-22 Martin Baulig <martin@gnome.org>
9515 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
9516 then we do not always return. Fixes bug #24985.
9518 2002-07-22 Martin Baulig <martin@gnome.org>
9520 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
9521 lookup on a per-class level; ie. walk up the class hierarchy until we
9522 found at least one applicable method, then choose the best among them.
9523 Fixes bug #24463 and test-29.cs.
9525 2002-07-22 Martin Baulig <martin@gnome.org>
9527 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
9528 return types of the methods. The return type is not part of the
9529 signature and we must not check it to make the `new' modifier work.
9530 Fixes bug #27999, also added test-147.cs.
9531 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
9533 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
9534 on the method's return type.
9536 2002-07-21 Martin Baulig <martin@gnome.org>
9538 * assign.cs: Make this work if the rightmost source is a constant and
9539 we need to do an implicit type conversion. Also adding a few more tests
9540 to test-38.cs which should have caught this.
9542 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
9543 target in the makefile for this. The makefile.gnu is primarily intended
9544 for end-users who don't want to debug the compiler.
9546 2002-07-21 Martin Baulig <martin@gnome.org>
9548 * assign.cs: Improved the Assign class so it can now handle embedded
9549 assignments (X = Y = Z = something). As a side-effect this'll now also
9550 consume less local variables. test-38.cs now passes with MCS, added
9551 a few new test cases to that test.
9553 2002-07-20 Martin Baulig <martin@gnome.org>
9555 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
9556 instructions. Fixes bug #27977, also added test-146.cs.
9558 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9560 * cs-tokenizer.cs: fixed getHex ().
9562 2002-07-19 Martin Baulig <martin@gnome.org>
9564 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
9565 not Type.GetType() to lookup the array type. This is needed when
9566 we're constructing an array of a user-defined type.
9567 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
9568 single-dimensional arrays, but also for single-dimensial arrays of
9571 2002-07-19 Martin Baulig <martin@gnome.org>
9573 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
9574 this function is called, it's not allowed to share LocalBuilders
9577 2002-07-19 Martin Baulig <martin@gnome.org>
9579 * expression.cs (Argument.Resolve): Report an error 118 when trying
9580 to pass a type as argument.
9582 2002-07-18 Martin Baulig <martin@gnome.org>
9584 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9585 Conv_R_Un for the signed `long' type.
9587 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9589 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9590 `expr' for the temporary result, as that will fail if we do
9591 multiple resolves on the same expression.
9593 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9595 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9596 ec.TypeContainer for looking up aliases.
9598 * class.cs (TypeContainer): Remove LookupAlias from here.
9600 * decl.cs (DeclSpace); Move here.
9602 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9604 * class.cs (FindMembers): Only call filter if the constructor
9605 bulider is not null.
9607 Also handle delegates in `NestedTypes' now. Now we will perform
9608 type lookups using the standard resolution process. This also
9611 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9612 This uses Expressions (the limited kind that can be parsed by the
9613 tree) instead of strings.
9615 * expression.cs (ComposedCast.ToString): Implement, used to flag
9616 errors since now we have to render expressions.
9618 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9621 * ecore.cs (SimpleName.ToString): ditto.
9623 * cs-parser.jay: Instead of using strings to assemble types, use
9624 Expressions to assemble the type (using SimpleName, ComposedCast,
9625 MemberAccess). This should fix the type lookups in declarations,
9626 because we were using a different code path for this.
9628 * statement.cs (Block.Resolve): Continue processing statements
9629 even when there is an error.
9631 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9633 * class.cs (Event.Define): Also remove the `remove' method from
9634 the list of pending items.
9636 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9637 generate more compact code.
9639 2002-07-17 Martin Baulig <martin@gnome.org>
9641 * const.cs (Const.LookupConstantValue): Add support for constant
9642 `unchecked' and `checked' expressions.
9643 Also adding test case test-140.cs for this.
9645 2002-07-17 Martin Baulig <martin@gnome.org>
9647 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9648 check whether mi.ReturnType implements the IEnumerator interface; the
9649 `==' and the IsAssignableFrom() will fail in this situation.
9651 2002-07-16 Ravi Pratap <ravi@ximian.com>
9653 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9656 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9658 * expression.cs: fixed bug #27811.
9660 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9662 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9663 Molaro: when we are a ref, the value already contains a pointer
9664 value, do not take the address of it.
9666 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9667 * removed mb-parser.jay and mb-tokenizer.cs
9669 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9671 * expression.cs: check against the building corlib void type.
9673 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9675 * ecore.cs: fix for valuetype static readonly fields: when
9676 initializing them, we need their address, not the address of a copy.
9678 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9680 * typemanager.cs: register also enum_type in corlib.
9682 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9684 * class.cs: allow calling this (but not base) initializers in structs.
9686 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9688 * ecore.cs: make sure we compare against the building base types
9691 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9693 * typemanager.cs: fix TypeToCoreType() to handle void and object
9694 (corlib gets no more typerefs after this change).
9696 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9698 * expression.cs (ArrayCreation.EmitArrayArguments): use
9699 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9701 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9702 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9703 array indexes, the runtime actually forbids them.
9705 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9706 for array arguments here.
9708 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9709 instead of the default for ValueTypes.
9711 (New.DoEmit): Use IsValueType instead of
9712 IsSubclassOf (value_type)
9713 (New.DoResolve): ditto.
9714 (Invocation.EmitCall): ditto.
9716 * assign.cs (Assign): ditto.
9718 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9719 Statements *are* currently doing part of their resolution during
9722 Expressions do always resolve during resolve, but statements are
9723 only required to propagate resolution to their children.
9725 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9727 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9729 (LoadAssembly): Do not add the dll if it is already specified
9731 (MainDriver): Add the System directory to the link path at the end,
9732 after all the other -L arguments.
9734 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9735 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9736 ldelem.u1) and using the opposite for sbytes.
9738 This fixes Digger, and we can finally run it.
9740 * driver.cs (UnixParseOption): Move the option parsing here.
9741 (CSCParseOption): Implement CSC-like parsing of options.
9743 We now support both modes of operation, the old Unix way, and the
9744 new CSC-like way. This should help those who wanted to make cross
9747 The only thing broken is that /r:, /reference: and /lib: are not
9748 implemented, because I want to make those have the same semantics
9749 as the CSC compiler has, and kill once and for all the confussion
9750 around this. Will be doing this tomorrow.
9752 * statement.cs (Unsafe.Resolve): The state is checked during
9753 resolve, not emit, so we have to set the flags for IsUnsfe here.
9755 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9757 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9758 not catch the Error_ObjectRefRequired in SimpleName (as it is
9759 possible to have a class/instance variable name that later gets
9760 deambiguated), we have to check this here.
9762 2002-07-10 Ravi Pratap <ravi@ximian.com>
9764 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
9765 make static and put into Expression.
9767 (Event.Define): Register the private field of the event with the
9768 TypeManager so that GetFieldFromEvent can get at it.
9770 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
9771 keep track of the private field associated with an event which
9774 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
9777 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
9779 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9781 * expression.cs (Binary.EmitBranchable): this routine emits the
9782 Binary expression in a branchable context. This basically means:
9783 we need to branch somewhere, not just get the value on the stack.
9785 This works together with Statement.EmitBoolExpression.
9787 * statement.cs (Statement.EmitBoolExpression): Use
9790 2002-07-09 Miguel de Icaza <miguel@ximian.com>
9792 * statement.cs (For): Reduce the number of jumps in loops.
9794 (For): Implement loop inversion for the For statement.
9796 (Break): We can be breaking out of a Try/Catch controlled section
9797 (foreach might have an implicit try/catch clause), so we need to
9798 use Leave instead of Br.
9800 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
9801 now). If the instace expression supports IMemoryLocation, we use
9802 the AddressOf method from the IMemoryLocation to extract the
9803 address instead of emitting the instance.
9805 This showed up with `This', as we were emitting the instance
9806 always (Emit) instead of the Address of This. Particularly
9807 interesting when This is a value type, as we dont want the Emit
9808 effect (which was to load the object).
9810 2002-07-08 Miguel de Icaza <miguel@ximian.com>
9812 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
9814 * statement.cs (Checked): Set the CheckedState during the resolve
9815 process too, as the ConvCast operations track the checked state on
9816 the resolve process, and not emit.
9818 * cs-parser.jay (namespace_member_declaration): Flag that we have
9819 found a declaration when we do. This is used to flag error 1529
9821 * driver.cs: Report ok when we display the help only.
9823 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
9825 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
9827 2002-07-04 Miguel de Icaza <miguel@ximian.com>
9829 * cs-tokenizer.cs (define): We also have to track locally the
9830 defines. AllDefines is just used for the Conditional Attribute,
9831 but we also need the local defines for the current source code.
9833 2002-07-03 Miguel de Icaza <miguel@ximian.com>
9835 * statement.cs (While, For, Do): These loops can exit through a
9836 Break statement, use this information to tell whether the
9837 statement is the last piece of code.
9839 (Break): Flag that we break.
9841 * codegen.cs (EmitContexts): New `Breaks' state variable.
9843 2002-07-03 Martin Baulig <martin@gnome.org>
9845 * class.cs (TypeContainer.MethodModifiersValid): Allow override
9846 modifiers in method declarations in structs. Otherwise, you won't
9847 be able to override things like Object.Equals().
9849 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9851 * class.cs (Method, Property, Indexer): Do not allow the public
9852 modifier to be used in explicit interface implementations.
9854 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
9855 override modifiers in method declarations in structs
9857 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
9859 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
9860 integer or real overflow, report an error
9862 2002-07-02 Martin Baulig <martin@gnome.org>
9864 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
9865 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
9866 to tell the runtime about our newly created System.Object and
9867 System.ValueType types.
9869 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9871 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
9872 struct instead of Ldarg/Starg.
9874 2002-07-02 Martin Baulig <martin@gnome.org>
9876 * expression.cs (Indirection.Indirection): Call
9877 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
9879 2002-07-02 Martin Baulig <martin@gnome.org>
9881 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
9882 ValueType, call TypeManager.TypeToCoreType() on it.
9883 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
9884 the OpCodes.Newarr argument.
9886 2002-07-02 Martin Baulig <martin@gnome.org>
9888 * expression.cs (Invocation.EmitCall): When compiling corlib,
9889 replace all calls to the system's System.Array type to calls to
9890 the newly created one.
9892 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
9893 System.Array methods.
9894 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
9895 from the system's System.Array type which must be replaced.
9897 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
9899 * typemanager.cs: load unverifiable_code_ctor so we can build
9900 corlib using the correct type. Avoid using GetTypeCode() with
9902 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
9903 TypeManager.object_type to allow building corlib.
9905 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
9907 * ecore.cs: handle System.Enum separately in LoadFromPtr().
9909 2002-07-01 Martin Baulig <martin@gnome.org>
9911 * class.cs: Make the last change actually work, we need to check
9912 whether `ifaces != null' to avoid a crash.
9914 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9916 * class.cs: when we build structs without fields that implement
9917 interfaces, we need to add the interfaces separately, since there is
9918 no API to both set the size and add the interfaces at type creation
9921 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9923 * expression.cs: the dimension arguments to the array constructors
9924 need to be converted if they are a long.
9926 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
9928 * class.cs: don't emit ldarg.0 if there is no parent constructor
9929 (fixes showstopper for corlib).
9931 2002-06-29 Martin Baulig <martin@gnome.org>
9933 MCS now compiles corlib on GNU/Linux :-)
9935 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9936 ie. check for MethodImplOptions.InternalCall.
9938 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9939 and TypeManager.attribute_type are null, so we must explicitly check
9940 whether parent is not null to find out whether it's an attribute type.
9941 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9942 and SetBuilder, not only if the property is neither abstract nor external.
9943 This is necessary to set the MethodImplOptions on the accessor methods.
9944 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9945 SetBuilder, see Property.Emit().
9947 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9948 populate "System.Object", "System.ValueType" and "System.Attribute" since
9949 they've already been populated from BootCorlib_PopulateCoreTypes().
9951 2002-06-29 Martin Baulig <martin@gnome.org>
9953 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9954 is the NullLiteral, we also need to make sure that target_type is not
9957 2002-06-29 Martin Baulig <martin@gnome.org>
9959 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9960 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9961 before calling BootstrapCorlib_ResolveDelegate ().
9963 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9965 * statement.cs: fixed build-breaker. All tests passed ok.
9967 2002-06-27 Martin Baulig <martin@gnome.org>
9969 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9970 for System.Decimal when compiling corlib.
9972 2002-06-27 Martin Baulig <martin@gnome.org>
9974 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9975 switch blocks which contain nothing but a default clause.
9977 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9979 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9981 2002-06-27 Martin Baulig <martin@gnome.org>
9983 * ecore.cs (PropertyExpr.PropertyExpr): Call
9984 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9986 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9987 is already a TypeBuilder.
9989 2002-06-27 Martin Baulig <martin@gnome.org>
9991 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9992 `target_type == TypeManager.array_type', not IsAssignableFrom() in
9993 the "from an array-type to System.Array" case. This makes it work
9994 when compiling corlib.
9996 2002-06-27 Martin Baulig <martin@gnome.org>
9998 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9999 non-static PropertyExpr, set its InstanceExpression. This makes
10000 the `ICollection.Count' property work in System/Array.cs.
10002 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
10004 * driver.cs: Made error handling more consistent. Errors now
10005 tracked by Report class, so many methods which used to return int
10006 now return void. Main() now prints success/failure and
10007 errors/warnings message.
10009 Renamed '--probe' compiler argument to '--expect-error'. Removed
10010 the magic number return values (123 and 124). Now, if the
10011 expected error occurs, the compiler exits with success (exit value
10012 0). If the compilation completes without seeing that particular
10013 error, the compiler exits with failure (exit value 1). The
10014 makefile in mcs/errors has been changed to handle the new behaviour.
10016 * report.cs: Made 'expected error' number a property and renamed
10017 it from 'Probe' to 'ExpectedError'.
10019 * genericparser.cs: Removed error handling support, since it is
10020 now all done by Report class.
10022 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
10023 class, so parse() no longer returns an int.
10025 * namespace.cs: Use Report.Error instead of GenericParser.error
10027 2002-06-22 Miguel de Icaza <miguel@ximian.com>
10029 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
10030 TypeContainer.AddOperator): At the front of the list put the
10031 explicit implementations, so they get resolved/defined first.
10033 2002-06-21 Miguel de Icaza <miguel@ximian.com>
10035 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
10036 interface type is implemented by this TypeContainer. Used during
10037 explicit interface implementation.
10039 (Property.Define, Indexer.Define, Method.Define): Validate that
10040 the given interface in the explicit implementation is one of the
10041 base classes for the containing type.
10043 Also if we are explicitly implementing an interface, but there is
10044 no match in the pending implementation table, report an error.
10046 (Property.Define): Only define the property if we are
10047 not explicitly implementing a property from an interface. Use the
10048 correct name also for those properties (the same CSC uses,
10049 although that is really not needed).
10051 (Property.Emit): Do not emit attributes for explicitly implemented
10052 properties, as there is no TypeBuilder.
10054 (Indexer.Emit): ditto.
10056 Hiding then means that we do not really *implement* a pending
10057 implementation, which makes code fail.
10059 2002-06-22 Martin Baulig <martin@gnome.org>
10061 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
10062 the return value of Object.GetType(). [FIXME: we need to do this whenever
10063 we get a type back from the reflection library].
10065 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
10067 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
10069 2002-06-20 Miguel de Icaza <miguel@ximian.com>
10071 * attribute.cs: Return null if we can not look up the type.
10073 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
10074 the interface types found.
10076 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
10077 interface types found.
10079 * typemanager.cs (GetInterfaces): Make this routine returns alll
10080 the interfaces and work around the lame differences between
10081 System.Type and System.Reflection.Emit.TypeBuilder in the results
10082 result for GetInterfaces.
10084 (ExpandInterfaces): Given an array of interface types, expand and
10085 eliminate repeated ocurrences of an interface. This expands in
10086 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
10089 2002-06-21 Martin Baulig <martin@gnome.org>
10091 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
10094 2002-06-21 Martin Baulig <martin@gnome.org>
10096 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
10097 and called with one of the core types, return the corresponding typebuilder for
10100 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
10103 2002-06-21 Martin Baulig <martin@gnome.org>
10105 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
10106 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
10107 (Expression.ConvertReferenceExplicit): Likewise.
10109 * expression.cs (ElementAccess.DoResolve): Likewise.
10110 (ElementAccess.DoResolveLValue): Likewise.
10112 2002-06-10 Martin Baulig <martin@gnome.org>
10114 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
10115 add the "value" parameter to the parameter list.
10117 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
10120 2002-06-19 Miguel de Icaza <miguel@ximian.com>
10122 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
10123 the argument to an int, uint, long or ulong, per the spec. Also
10124 catch negative constants in array creation.
10126 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
10128 * class.cs: do not allow the same interface to appear twice in
10129 the definition list.
10131 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
10133 * ecore.cs: don't use ldlen with System.Array.
10135 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
10137 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
10139 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
10141 * modifiers.cs: produce correct field attributes for protected
10142 internal. Easy fix so miguel can work on ther harder stuff:-)
10144 2002-06-18 Miguel de Icaza <miguel@ximian.com>
10146 * pending.cs: New file. Move the code from class.cs here.
10147 Support clearning the pending flag for all methods (when not doing
10148 explicit interface implementation).
10150 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
10152 * rootcontext.cs: added a couple more types needed to bootstrap.
10154 2002-06-17 Miguel de Icaza <miguel@ximian.com>
10156 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
10157 constructor in the type, instead of any constructor in the type
10158 hierarchy. Thanks to Paolo for finding this bug (it showed up as
10159 a bug in the Mono runtime when applying the params attribute).
10161 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
10162 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
10164 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
10166 * expression.cs (Unary.ResolveOperator): Use TypeManager
10167 to resolve the type.
10169 2002-06-13 Ravi Pratap <ravi@ximian.com>
10171 * cs-parser.jay (enum_member_declaration): Pass in the attributes
10174 * enum.cs (AddEnumMember): Add support to store the attributes associated
10175 with each member too.
10177 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
10178 field builders too - this takes care of the enum member case.
10180 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
10182 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
10183 address-of operator on both value types and pointers.
10185 2002-06-10 Martin Baulig <martin@gnome.org>
10187 * interface.cs (Interface.PopulateIndexer): Add the indexer's
10188 PropertyBuilder to the `property_builders' list.
10190 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
10191 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
10192 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
10193 find any indexers which are inherited from an interface.
10195 2002-06-09 Martin Baulig <martin@gnome.org>
10197 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
10198 the same type as the constant if necessary. There's also a test-130.cs
10201 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
10203 * typemanager.cs (TypeManager.ChangeType): Previously known as
10204 Enum.ChangeEnumType().
10206 2002-06-09 Martin Baulig <martin@gnome.org>
10208 * expression.cs (Cast.TryReduce): Added support for consts.
10210 2002-06-08 Ravi Pratap <ravi@ximian.com>
10212 * class.cs (Accessor): Hold attributes information so we can pass
10215 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
10216 Modify to pass in attributes attached to the methods.
10218 (add_accessor_declaration, remove_accessor_declaration): Ditto.
10220 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
10221 to handle the Accessor kind :-)
10223 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
10225 2002-06-08 Martin Baulig <martin@gnome.org>
10227 * expression.cs (Unary.TryReduceNegative): Added support for
10230 2002-06-08 Martin Baulig <martin@gnome.org>
10232 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
10233 name can't be found in the `defined_names' - the caller will do a
10234 MemberLookup in this case and thus find methods in System.Enum
10235 such as Enum.IsDefined().
10237 2002-06-08 Martin Baulig <martin@gnome.org>
10239 * enum.cs (Enum.ChangeEnumType): This is a custom version of
10240 Convert.ChangeType() which works with TypeBuilder created types.
10241 (Enum.LookupEnumValue, Enum.Define): Use it here.
10243 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
10244 `TypeBuilder.BaseType != null' check.
10245 (TypeContainer.FindMembers): Only lookup parent members if we
10246 actually have a parent.
10247 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
10248 (ConstructorInitializer.Resolve): Likewise.
10250 * interface.cs (Interface.FindMembers): Added
10251 `TypeBuilder.BaseType != null' check.
10253 * rootcontext.cs (RootContext.ResolveCore): Added
10254 "System.Runtime.CompilerServices.IndexerNameAttribute" to
10255 classes_second_stage.
10257 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
10258 debug_type and trace_type when compiling with --nostdlib.
10260 2002-06-07 Martin Baulig <martin@gnome.org>
10262 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
10263 (AddField): Set it to true when adding a non-static field.
10264 (DefineType): Use `have_nonstatic_fields' to find out whether we
10265 have non-static fields, not `Fields != null'.
10267 2002-06-02 Miguel de Icaza <miguel@ximian.com>
10269 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
10270 dereferencing a null on the static-field code path)
10272 2002-05-30 Martin Baulig <martin@gnome.org>
10274 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
10275 to take command line arguments. Use reflection to call the new
10276 custom `Initialize' function on the symbol writer and pass it the
10277 command line arguments.
10279 * driver.cs (--debug-args): New command line argument to pass command
10280 line arguments to the symbol writer.
10282 2002-05-28 Miguel de Icaza <miguel@ximian.com>
10284 * assign.cs (DoResolve): Forgot to do the implicit conversion to
10285 the target type for indexers and properties. Thanks to Joe for
10288 2002-05-27 Miguel de Icaza <miguel@ximian.com>
10290 * typemanager.cs (MethodFlags): returns the method flags
10291 (Obsolete/ShouldIgnore) that control warning emission and whether
10292 the invocation should be made, or ignored.
10294 * expression.cs (Invocation.Emit): Remove previous hack, we should
10295 not do this on matching a base type, we should do this based on an attribute
10297 Only emit calls to System.Diagnostics.Debug and
10298 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
10299 on the command line.
10301 * rootcontext.cs: Global settings for tracing and debugging.
10303 * cs-tokenizer.cs (define): New utility function to track
10304 defines. Set the global settings for TRACE and DEBUG if found.
10306 2002-05-25 Ravi Pratap <ravi@ximian.com>
10308 * interface.cs (Populate*): Pass in the TypeContainer as well as
10309 the DeclSpace as parameters so that we can create EmitContexts and
10310 then use that to apply attributes etc.
10312 (PopulateMethod, PopulateEvent, PopulateProperty)
10313 (PopulateIndexer): Apply attributes everywhere.
10315 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
10318 (ApplyAttributes): Update accordingly.
10320 We now apply interface attributes for all members too.
10322 2002-05-26 Miguel de Icaza <miguel@ximian.com>
10324 * class.cs (Indexer.Define); Correctly check if we are explicit
10325 implementation (instead of checking the Name for a ".", we
10326 directly look up if the InterfaceType was specified).
10328 Delay the creation of the PropertyBuilder.
10330 Only create the PropertyBuilder if we are not an explicit
10331 interface implementation. This means that explicit interface
10332 implementation members do not participate in regular function
10333 lookups, and hence fixes another major ambiguity problem in
10334 overload resolution (that was the visible effect).
10336 (DefineMethod): Return whether we are doing an interface
10339 * typemanager.cs: Temporary hack until we get attributes in
10340 interfaces (Ravi is working on that) and we get IndexerName
10341 support in interfaces.
10343 * interface.cs: Register the indexers as properties.
10345 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
10346 warning, I have verified that this is a bug in the .NET runtime
10347 (JavaScript suffers of the same problem).
10349 * typemanager.cs (MemberLookup): When looking up members for
10350 interfaces, the parent of an interface is the implicit
10351 System.Object (so we succeed in searches of Object methods in an
10352 interface method invocation. Example: IEnumerable x; x.ToString
10355 2002-05-25 Miguel de Icaza <miguel@ximian.com>
10357 * class.cs (Event): Events should also register if they do
10358 implement the methods that an interface requires.
10360 * typemanager.cs (MemberLookup); use the new GetInterfaces
10363 (GetInterfaces): The code used to lookup interfaces for a type is
10364 used in more than one place, factor it here.
10366 * driver.cs: Track the errors at the bottom of the file, we kept
10369 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
10370 instance if the method we are calling is static!
10372 2002-05-24 Miguel de Icaza <miguel@ximian.com>
10374 * attribute.cs (ApplyAttributes): Make this function filter out
10375 the IndexerName attribute (as that attribute in reality is never
10376 applied) and return the string constant for the IndexerName
10379 * class.cs (TypeContainer.Emit): Validate that all the indexers
10380 have the same IndexerName attribute, and if so, set the
10381 DefaultName attribute on the class.
10383 * typemanager.cs: The return value might contain other stuff (not
10384 only methods). For instance, consider a method with an "Item"
10385 property and an Item method.
10387 * class.cs: If there is a problem with the parameter types,
10390 2002-05-24 Ravi Pratap <ravi@ximian.com>
10392 * ecore.cs (ImplicitConversionExists): Wrapper function which also
10393 looks at user defined conversion after making a call to
10394 StandardConversionExists - we need this for overload resolution.
10396 * expression.cs : Update accordingly the various method calls.
10398 This fixes 2 bugs filed against implicit user defined conversions
10400 2002-05-22 Miguel de Icaza <miguel@ximian.com>
10402 * statement.cs: Track the result of the assignment.
10404 2002-05-21 Miguel de Icaza <miguel@ximian.com>
10406 * expression.cs (MemberAccess): Improved error reporting for
10407 inaccessible members.
10409 2002-05-22 Martin Baulig <martin@gnome.org>
10411 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
10412 itself with debugging support.
10414 2002-05-22 Martin Baulig <martin@gnome.org>
10416 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
10417 Removed, this isn't needed anymore.
10419 2002-05-20 Martin Baulig <martin@gnome.org>
10421 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
10422 be underlying type for an enum.
10424 2002-05-20 Miguel de Icaza <miguel@ximian.com>
10426 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
10427 that splits out the loading of just the core types.
10429 * rootcontext.cs (ResolveCore): Split the struct resolution in
10430 two, so we can load the enumeration underlying types before any
10433 * expression.cs (Is): Bandaid until we fix properly Switch (see
10434 bug #24985 for details).
10436 * typemanager.cs (ImplementsInterface): The hashtable will contain
10437 a null if there are no interfaces implemented.
10439 2002-05-18 Miguel de Icaza <miguel@ximian.com>
10441 * cs-parser.jay (indexer_declarator): It is fine to have array
10444 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10446 * typemanager.cs: (RegisterBuilder): New function used to register
10447 TypeBuilders that implement interfaces. Since
10448 TypeBuilder.GetInterfaces (as usual) does not work with lame
10450 (AddUserType): register interfaces.
10452 (ImplementsInterface): Use the builder_to_ifaces hash if we are
10453 dealing with TypeBuilder. Also, arrays are showing up as
10454 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
10455 methods can not be invoked on them!
10457 * ecore.cs (ExplicitReferenceConversionExists): Made public.
10458 (ImplicitReferenceConversionExists): Split out from
10459 StandardConversionExists.
10461 * expression.cs (As): We were only implementing one of the three
10462 cases for the as operator. We now implement them all.
10463 (Is): Implement the various other cases for Is as well.
10465 * typemanager.cs (CACHE): New define used to control if we want or
10466 not the FindMembers cache. Seems to have a negative impact on
10467 performance currently
10469 (MemberLookup): Nested types have full acess to
10470 enclosing type members
10472 Remove code that coped with instance/static returns for events, we
10473 now catch this in RealFindMembers.
10475 (RealFindMembers): only perform static lookup if the instance
10476 lookup did not return a type or an event.
10478 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10480 * assign.cs (CompoundAssign): We pass more semantic information
10481 now to Compound Assignments than we did before: now we have all
10482 the information at hand, and now we resolve the target *before* we
10483 do the expression expansion, which allows the "CacheValue" method
10484 to have the effect we intended (before, a [x] += 1 would generate
10485 two differen ArrayAccess expressions from the ElementAccess,
10486 during the resolution process).
10488 (CompoundAssign.DoResolve): Resolve target and original_source here.
10490 2002-05-16 Miguel de Icaza <miguel@ximian.com>
10492 * expression.cs (ArrayAccess): dropped debugging information.
10494 * typemanager.cs: Small bug fix: I was always returning i_members,
10495 instead of one of i_members or s_members (depending on which had
10498 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
10499 method is invoked before any code generation takes place, and it
10500 is a mechanism to inform that the expression will be invoked more
10501 than once, and that the method should use temporary values to
10502 avoid having side effects
10504 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
10506 * ecore.cs (Expression.CacheTemporaries): Provide empty default
10509 * expression.cs (Indirection, ArrayAccess): Add support for
10510 CacheTemporaries in these two bad boys.
10512 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
10513 ldobj or ldind_ref.
10514 (StoreFromPtr): Handle stobj as well.
10516 * expression.cs (UnaryMutator): Share more code.
10518 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
10519 down: I was not tracking the Filter function as well, which
10520 was affecting the results of the cache.
10522 2002-05-15 Miguel de Icaza <miguel@ximian.com>
10524 * attribute.cs: Remove the hack to handle the CharSet property on
10527 2002-05-14 Miguel de Icaza <miguel@ximian.com>
10529 * attribute.cs (DoResolve): More uglyness, we now only try to
10530 resolve the attribute partially, to extract the CharSet
10531 information (only if we are a StructLayout attribute). Otherwise
10533 (GetExtraTypeInfo): Add some code to conditionally kill in the
10534 future this. I am more and more convinced that the .NET
10535 framework has special code to handle the attribute setting on
10538 * expression.cs (IsParamsMethodApplicable): Revert my previous
10539 foreach change here, it was wrong.
10541 2002-05-13 Miguel de Icaza <miguel@ximian.com>
10543 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
10544 (pp_expr): do not abort on unknown input, just return.
10545 (eval): abort if there are pending chars.
10547 * attribute.cs (Attribute.Resolve): Positional parameters are
10548 optional. Deal with that case.
10550 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
10551 the Ansi/Unicode/Auto information for the type.
10553 (TypeContainer.DefineType): instantiate the EmitContext here, as
10554 we will be using it during the type definition (to resolve
10555 attributes) and during the emit phase.
10557 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
10558 to pull type information out of the attributes
10560 (Attribute.Resolve): track the constructor builder, and allow for
10561 multiple invocations (structs and classes will use this).
10563 * ecore.cs (MemberLookupFinal): new version with all the
10564 parameters customizable.
10566 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
10567 constructors. Return if the result value is null (as the error
10568 would have been flagged already by MemberLookupFinal)
10570 Do not allow instances of abstract classes or interfaces to be
10573 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
10574 We have to compare the assembly property here when dealing with
10575 FamANDAssem and Assembly access modifiers, because we might be
10576 creating an assembly from *modules* (that means that we are not
10577 getting TypeBuilders for types defined in other modules that are
10578 part of this assembly).
10580 (Method.Emit): If the method is marked abstract and has a body,
10583 (TypeContainer.DefineMembers): If both the defined member and the
10584 parent name match are methods, then do not emit any warnings: let
10585 the Method.Define routine take care of flagging warnings. But if
10586 there is a mismatch (method overrides something else, or method is
10587 overriwritten by something, then emit warning).
10589 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10590 set to null, this means `do not check for the return type on the
10593 (Method.Define): set the return type for the method signature to
10594 null, so that we get methods with the same name and parameters and
10595 different return types. This is used to flag warning 114 (you are
10596 hiding a method, and you probably want to use the new/override
10599 * typemanager.cs (MemberLookup): Implemented proper access
10600 control, closing a long standing set of bug reports. The problem
10601 was that the Framework only has two bits: Public and NonPublic,
10602 and NonPublic includes private and protected methods, but we need
10603 to enforce the FamANDAssem, FamOrAssem and Family.
10605 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10607 * statement.cs (GotoCase): Return true: Ammounts to giving up
10608 knowledge on whether we return or not, and letting the other case
10609 be responsible for it.
10611 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10613 * driver.cs: Do not load directories for each file processed, only
10614 do it if there is a pattern.
10616 * ecore.cs: Report readonly assigns here as well, as we might have
10617 been resolved only by MemberAccess.
10619 (SimpleName.SimpleNameResolve): Also be useful for LValue
10620 resolution. We need this to propagate assign to local readonly variables
10622 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10623 do not want to reuse potential criteria memory.
10625 * class.cs (MyEventBuilder): Set reflected_type;
10627 * ecore.cs (Constantify): Added support for constifying bools.
10629 (RootContext.LookupType): Added a cache for values looked up in
10630 the declaration space.
10632 * typemanager.cs (FindMembers): Now is a front-end to
10633 RealFindMembers, and provides a two-level hashtable-based cache to
10636 15% performance improvement: from 22.5 to 19.2 seconds.
10638 * expression.cs (IsParamsMethodApplicable): use foreach.
10639 (Invocation.DoResolve): ditto.
10640 (New.DoResolve): ditto.
10641 (ArrayCreation.DoResolve): ditto.
10643 * ecore.cs (FindMostEncompassingType): use foreach.
10645 * delegate.cs (NewDelegate.DoResolve): Use foreach
10647 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10648 (RemoveMethods): use foreach.
10650 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10651 nested foreach statements instead of for, and also break out of
10652 the inner loop once a match is found.
10654 (Invocation.OverloadResolve): Use foreach, simplify the code.
10656 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10658 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10659 we actually unwrap the expression to allow for extra information
10662 * expression.cs: Use Shr_Un on unsigned operations.
10664 2002-05-08 Ravi Pratap <ravi@ximian.com>
10666 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10667 applicable operators was not being considered correctly. This closes
10668 the bug Miguel reported.
10670 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10672 * attribute.cs: check that the type derives from System.Attribute
10673 and report the correct error in that case (moved the duplicate code to
10674 its own method, too).
10676 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10678 * attribute.cs: lookup attribute type name as the spec says: first the
10679 bare attribute name and then name + "Attribute" (nant compiles with
10680 mcs after this fix).
10682 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10684 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10685 Because of the way we parse things, we should try to see if a
10686 UIntConstant can fit in an integer.
10688 2002-05-07 Ravi Pratap <ravi@ximian.com>
10690 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10691 when we are in an explicit context.
10693 (ConvertReferenceExplicit): When converting from Iface type S to Class
10694 T make sure the rules are implemented as an OR.
10696 * parameter.cs (ParameterType): Make it a property for now although the
10697 purpose really isn't anything immediate.
10699 * expression.cs (Is*Applicable): Do better checking on the parameter type
10700 of a ref/out parameter. The ones from the system assemblies are already
10701 marked with the correct type so we don't need to do any correction.
10703 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10704 the object type is standard too so include that.
10706 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10708 * ecore.cs (StandardConversionExists): Augment with missing code:
10709 deal with IntConstant, LongConstants and Enumerations.
10711 * assign.cs: Report the error, instead of failing silently
10713 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10714 typecontainer that they are declared, because the
10715 typecontainer/namespace will have the list of using clauses that
10716 need to be applied.
10718 Assembly Attributes were escaping the normal registration
10721 (EmitCode): Apply attributes within an EmitContext that represents
10722 the container they were declared on.
10724 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10726 2002-05-06 Ravi Pratap <ravi@ximian.com>
10728 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10729 Revamp completely - make much cleaner as we now operate only
10732 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10733 to implement the logic detailed in the spec more correctly.
10735 (UserDefinedConversion): Update accordingly.
10737 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10739 * statement.cs: Return flow analysis information up.
10741 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10744 (token): Do not consume an extra character before calling
10747 2002-05-06 Piers Haken <piersh@friskit.com>
10749 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10751 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10753 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10754 EmitContext during the instance constructor initializer
10755 resolution, to stop access to instance variables.
10757 This is mandated by the spec, last paragraph of the `constructor
10758 initializers' section.
10760 2002-05-05 Miguel de Icaza <miguel@ximian.com>
10762 * cs-parser.jay, class.cs (Accessor): new class used to represent
10763 an accessor (get or set). In the past we used `null' to represent
10764 a missing accessor. But this is ambiguous because there was no
10765 way to tell in abstract indexers/properties if one of them was
10768 Now there is a way of addressing that.
10770 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
10771 instead of FindMembers.
10773 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
10774 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
10776 * attribute.cs: Treat indexers and properties as the same in terms
10777 of applying attributes
10779 * ecore.cs (FindMostEncompassedType): Use statically initialized
10780 EmptyExpressions()s like we do elsewhere to avoid creating useless
10781 objects (and we take this out of the tight loop).
10783 (GetConversionOperators): Move the code to extract the actual
10784 operators to a separate routine to clean things up.
10786 2002-05-04 Miguel de Icaza <miguel@ximian.com>
10788 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
10789 events are always registered FieldBuilders.
10791 * class.cs (FieldBase): New class shared by Fields
10793 * delegate.cs: If we are a toplevel delegate, use our full name.
10794 If we are a nested delegate, then only use our tail name.
10796 2002-05-02 Ravi Pratap <ravi@ximian.com>
10798 * expression.cs (IsApplicable): Ensure that we add the "&" to
10799 ref/out types before comparing it with the type of the argument.
10801 (IsParamsMethodApplicable): Ditto.
10803 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
10806 * delegate.cs : Handle the case when we have more than one applicable
10807 method. Flag an error only when we finish checking all.
10809 2002-05-02 Miguel de Icaza <miguel@ximian.com>
10811 * expression.cs: Add support for boolean static initializers.
10813 2002-05-01 Miguel de Icaza <miguel@ximian.com>
10815 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
10817 * parameter.cs (ComputeParameterTypes,
10818 ComputeAndDefineParameterTypes): Better error handling: now we
10819 clear the `types' cache if we fail during any of the type lookups.
10820 We also return the status code correctly to our caller
10822 * delegate.cs: If we fail to define a delegate, abort the extra
10825 * expression.cs (Binary.ResolveOperator): for
10826 operator==(object,object) and operator !=(object, object) we also
10827 have to verify that there is an implicit conversion from one to
10830 (ArrayAccess.DoResolve): Array Access can operate on
10833 2002-04-30 Miguel de Icaza <miguel@ximian.com>
10835 * assign.cs (CompoundAssign): A new class used as a "flag" that
10836 the assignment actually is happening as part of a compound
10837 assignment operator.
10839 During compound assignment, a few new rules exist to enable things
10846 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
10847 to the type of x) if y is implicitly convertible to the type of x,
10848 and the operator is a builtin operator and the return type of the
10849 operator is explicitly convertible to the type of x.
10851 * rootcontext.cs: Reset warning level to 2. 4 catches various
10852 "interesting" features in mcs, we must clean this up at some
10853 point, but currently am trying to kill other bugs ;-)
10855 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
10856 in container classes as well.
10858 * expression.cs (Binary.ResolveOperator): Handle string case
10859 before anything else (as operator overloading does emit an error
10860 before doing anything else).
10862 This code could go away when we move to a table driven model, but
10863 i could not come up with a good plan last night.
10865 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
10867 * typemanager.cs (CSharpName): reimplementation using regex.
10868 * class.cs: added null check for fields in Emit
10869 * rootcontext.cs: set warninglevel to 4
10871 2002-04-29 Miguel de Icaza <miguel@ximian.com>
10873 * typemanager.cs (CSharpName): reimplemented with Lupus
10876 2002-04-28 Miguel de Icaza <miguel@ximian.com>
10878 * statement.cs (If): correclty implement Resolve, because we were
10879 not catching sem errors in there. The same process is needed
10881 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
10884 (Statement.Warning_DeadCodeFound): Factorize code.
10885 (While): Report dead code here too.
10887 (Statement): Added Resolve virtual method to allow
10888 for resolution split from the emit code.
10890 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10892 * statement.cs (EmitBoolExpression): No longer try to resolve the
10894 (MakeBoolean): New utility function that resolve, implicitly
10895 converts to boolean and tags the expression.
10898 (If, Do): Implement dead code elimination.
10899 (While): Implement loop inversion
10901 (Do, While, For, If): Resolve the expression prior to calling our
10904 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
10907 - added method Report28 (warning: program has more than one entry point)
10908 - added method IsEntryPoint, implements paragraph 10.1 of the spec
10909 - modified method Method.Define, the part at the end of the method
10911 * rootcontext.cs: added static public Location EntryPointLocation;
10913 * ../errors/cs0028.cs : Add test case for the above warning.
10916 - modified method CSharpName to allow arrays of primitive type to
10917 be printed nicely (e.g. instead of System.Int32[][] it now prints
10919 - added method CSharpSignature: returns the signature of a method
10920 in string format to be used in reporting errors, warnings, etc.
10922 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
10925 2002-04-26 Ravi Pratap <ravi@ximian.com>
10927 * delegate.cs (Define): Fix extremely silly bug where I was
10928 setting the type of the 'object' parameter of the BeginInvoke
10929 method to System.IAsyncResult instead of System.Object ;-)
10931 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10933 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10936 (Constructor.Emit): return if we fail to initialize the
10937 constructor. Another door closed!
10939 * expression.cs (New.DoResolve): Improve error message (from -6 to
10940 1501). Use DeclaredOnly lookup to find the exact constructor.
10942 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10943 loop. This is useful.
10945 * cs-parser.jay: Adjust the default parameters so that destructors
10946 have the proper signature.
10948 2002-04-26 Martin Baulig <martin@gnome.org>
10950 * driver.cs (LoadAssembly): If `assembly' contains any characters
10951 which are only valid in path names and not in assembly names
10952 (currently slash, backslash and point), use Assembly.LoadFrom ()
10953 instead of Assembly.Load () on the `assembly' (before iteration
10954 over the link_paths).
10956 2002-04-26 Martin Baulig <martin@gnome.org>
10958 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10960 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10962 * class.cs (Property): use the new typemanager.MemberLookup
10964 (TypeContainer.MemberLookup): Implement using the
10965 TypeManager.MemberLookup now.
10967 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10968 and return MemberInfos, so that these can be used without an
10969 EmitContext (what we had before).
10971 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10973 * expression.cs: Fix the case where the argument to params if the
10974 type of the params. I omitted handling this before. Fixed
10976 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10978 * driver.cs: Call BootCorlib_PopulateCoreType
10980 * class.cs (Property.CheckBase): Check for properties only, not
10983 * interface.cs: Temporary hack: try/catch around the
10984 CustomAttributeBuilder, because I am getting an exception that I
10987 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10988 types whose definitions are required to be there (attributes are
10989 defined before standard types).
10991 Compute definitions as we boot the various types, as they are used
10992 immediately (value_type class will need object_type, but if we do
10993 not initialize object_type, we will pass a null, which will let
10994 the runtime pick the System.Object from the existing corlib, which
10995 is not what we want).
10997 2002-04-22 Patrik Torstensson <totte@labs2.com>
10999 * cs-tokenizer.cs: fixed a number of trim() issues.
11001 2002-04-22 Ravi Pratap <ravi@ximian.com>
11003 * expression.cs (Argument.Type): Ensure that we return the correct
11004 type when we have out or ref parameters [in which case we
11007 2002-04-22 Miguel de Icaza <miguel@ximian.com>
11009 * class.cs (Property, Indexer): Allow extern modifier in there.
11011 * typemanager.cs (InitBaseTypes): Initializes object_type and
11012 value_type, since those will be used early on during the bootstrap
11013 process to compile corlib.
11015 (InitCoreTypes): Move code from here to InitBaseTypes.
11017 2002-04-21 Miguel de Icaza <miguel@ximian.com>
11019 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
11020 single-dimension arrays as using the ldlen opcode.
11022 Daniel Lewis discovered this optimization.
11024 * typemanager.cs: Add signature for System.Array::get_Length
11026 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11028 * statement.cs: report the error when the foreach does not apply to an
11029 array nor a collection.
11031 2002-04-19 Miguel de Icaza <miguel@ximian.com>
11033 * expression.cs: Add implicit conversions to the operator ~.
11035 * constant.cs (DecimalConstant.Emit): Emit decimal value.
11037 * typemanager.cs: Locate the decimal constructor.
11039 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11041 * attribute.cs: use the new property of TypeOf.
11042 * expression.cs: added 'get' property around typearg.
11044 These changes fix a build breaker reported by NickD. Is this the
11045 correct way to fix? If not, please, revert my changes and make it
11048 2002-04-17 Miguel de Icaza <miguel@ximian.com>
11050 * attribute.cs: Add support for typeof in attribute invocations.
11051 I am not sure that this is right though.
11053 2002-04-14 Duncan Mak <duncan@ximian.com>
11055 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
11056 Binary.Operator.Division case.
11058 2002-04-13 Ravi Pratap <ravi@ximian.com>
11060 * class.cs (DefineType): Ensure that we do a proper check on
11061 attribute types and also register it with the TypeManager.
11063 (TypeContainer.Targets): The default for attribute types is
11064 AttributeTargets.All.
11066 * attribute.cs (ApplyAttributes): Registering the attribute type
11067 is done elsewhere, not when we discover we have a Usage attribute.
11069 2002-04-12 Ravi Pratap <ravi@ximian.com>
11071 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
11072 and get rid of is_delegate parameter.
11074 * everywhere : update.
11076 2002-04-12 Ravi Pratap <ravi@ximian.com>
11078 * cs-parser.jay (compilation_unit): Revamp completely to use
11079 some new ideas that I got from Rhys' grammar to solve the problems
11080 with assembly level attributes.
11082 (outer_declaration): New grammar production.
11084 (attribute_sections): Add.
11086 (opt_attributes): Base on attribute_sections
11088 (namespace_declaration): Allow opt_attributes to tackle the case
11089 when we have assembly level attributes - we are clever in this
11092 * attribute.cs (ApplyAttributes): Do not worry about assembly
11093 attributes in the non-global context.
11095 * rootcontext.cs (AddGlobalAttributes): Go back to using this
11096 instead of SetGlobalAttributes.
11098 * class.cs, rootcontext.cs : Ensure we define and generate
11099 attribute types before anything else.
11101 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
11102 and flag the new error -20 for the case when the attribute type
11103 does not have valid targets specified. csc does not catch this.
11105 * ../errors/errors.txt : update for error # -20
11107 2002-04-11 Ravi Pratap <ravi@ximian.com>
11109 * support.cs (InternalParameters.ParameterModifier): Do some null
11110 checking and return sane values.
11112 * class.cs (Method.Define): If we are a PInvoke method, ensure
11113 that we are static and extern. Report error # 601
11115 * ../errors/cs0601.cs : Add test case for the above error.
11117 2002-04-07 Ravi Pratap <ravi@ximian.com>
11119 * rootcontext.cs (attribute_types): We need to keep type of
11120 all attribute types separately and emit code for them first.
11122 (RegisterAttribute) : Implement.
11124 * class.cs (DefineType): Check if the current Type is a custom
11125 attribute type and register it accordingly.
11127 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
11128 adding the first attribute twice and rename to
11130 (SetGlobalAttributes): this.
11132 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
11135 * attribute.cs (ApplyAttributes): Take an additional argument telling us
11136 if we are processing global arguments. Hmm, I am unsure of this.
11138 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11140 * expression.cs: added static array of strings to avoid calling
11141 Enum.ToString () for Operator in Binary. Significant recover of
11144 2002-04-10 Miguel de Icaza <miguel@ximian.com>
11146 * class.cs (FindMembers): Allow the Builders of the various
11147 members to be null. If they are skip them. This only happens
11148 during the PInvoke declaration.
11150 2002-04-09 Miguel de Icaza <miguel@ximian.com>
11152 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
11153 failure, so we do not keep going afterwards.
11155 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
11156 wanted to pass `false' as the `is_delegate' argument. If this is
11157 the case, why not use delegate_type == null to mean `is_delegate =
11158 false' and anything else as is_delegate = true.
11160 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
11162 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
11163 code for the section, not the beginning of the tests.
11165 2002-04-08 Miguel de Icaza <miguel@ximian.com>
11167 * cfold.cs: Handle operator + (Enum x, Underlying x)
11169 * expression.cs (Binary): same. Warn about errors where we have
11170 Enum/Enum in operator + as well.
11172 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
11175 - added support for switch(bool)
11176 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
11177 - add TableSwitchEmit() to handle table-based switch statements
11179 2002-04-05 Ravi Pratap <ravi@ximian.com>
11181 * expression.cs (Invocation.OverloadResolve): Factor out code which
11182 does parameter compatibility checking with arguments so that we can
11183 re-use the code even from Delegate.VerifyApplicability
11185 (VerifyArgumentsCompat): Move above code here.
11187 * delegate.cs (VerifyApplicability): Get rid of duplicate code
11188 and instead make a call to the above method.
11190 2002-03-31 Ravi Pratap <ravi@ximian.com>
11192 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
11193 We use it to keep track of classes which are attribute types.
11195 2002-04-02 Miguel de Icaza <miguel@ximian.com>
11197 * delegate.cs (Delegate.Define): Correctly define the types in the
11198 presence of fixed and array parameters.
11200 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
11203 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
11204 include NonPublic after the first iteration.
11206 * class.cs (Indexer.CheckBase): Only check if both parents are
11209 * cs-parser.jay (accessor_body): If empty, set to null.
11211 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
11212 same code path here to resolve constants names that we did have in
11213 MemberAccess.DoResolve. There is too much code duplicated here.
11215 2002-04-01 Miguel de Icaza <miguel@ximian.com>
11217 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
11219 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
11222 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
11223 tokens, numbers and strings.
11225 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
11228 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
11229 asyncronous parameters and the regular parameters.
11231 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
11232 specify the target directory.
11234 * expression.cs: (This.DoResolve): Simplify
11235 (As.Emit): Optimize, do not generate IsInst if the expression is
11236 always of the given type.
11238 (Is.DoResolve): Bug fix, we were reporting both always/never for
11241 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
11242 creating too many unnecessary arrays.
11244 2002-03-31 Miguel de Icaza <miguel@ximian.com>
11246 * class.cs (EmitFieldInitializer): Use Assign expression to assign
11247 fields instead of rolling our own initializer. Takes care of all
11248 implicit conversions, and drops unnecessary static checks/argument.
11250 2002-03-31 Dick Porter <dick@ximian.com>
11252 * driver.cs: use the GetDirectories() return values properly, and
11253 use "/" as path separator.
11255 2002-03-30 Miguel de Icaza <miguel@ximian.com>
11257 * expression.cs (Unary): Optimize - - expr into expr.
11258 (Binary): Optimize a + (-b) into a -b.
11260 * codegen.cs (CodeGen): Made all methods static.
11262 2002-03-29 Miguel de Icaza <miguel@ximian.com>
11266 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
11267 TypeBuilder property.
11269 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
11272 * tree.cs: Removed the various RecordXXXX, and replaced with a
11273 single RecordDecl. Removed all the accessor methods, and just
11274 left a single access point Type
11276 * enum.cs: Rename DefineEnum to DefineType.
11278 * decl.cs: New abstract method `DefineType' used to unify the
11279 Defines for Enumerations, Interfaces, TypeContainers and
11282 (FindType): Moved LookupInterfaceOrClass here. Moved the
11283 LookupBaseClasses method that used to live in class.cs and
11284 interface.cs here, and renamed to FindType.
11286 * delegate.cs: Implement DefineType. Take advantage of the
11287 refactored pattern for locating the parent builder without taking
11288 the parent_builder argument (which we know does not work if we are
11289 nested, and triggering a toplevel definition).
11291 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11293 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
11294 accessibility of a member has changed during override and report
11297 * class.cs (Method.Define, Property.Define): Only complain on
11298 overrides if the method is private, any other accessibility is
11299 fine (and since we just checked the permission is the same, we are
11302 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
11303 and elif are processed always. The other pre-processing
11304 directives are only processed if we are "taking" the path
11306 2002-03-29 Martin Baulig <martin@gnome.org>
11308 * class.cs (Method.Emit): Only emit symbolic debugging info if the
11309 current location is not Null.
11311 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
11312 a separate method so we can profile it.
11314 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
11315 `span.Seconds' are just seconds, but no minutes or hours.
11316 (MainDriver): Profile the CodeGen.SaveSymbols calls.
11318 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11320 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
11321 Remove the gratuitous set of Final:
11323 // If an interface implementation, then we can set Final.
11324 if (((flags & MethodAttributes.Abstract) == 0) &&
11325 implementing.DeclaringType.IsInterface)
11326 flags |= MethodAttributes.Final;
11328 I do not know what I was smoking when I used that.
11331 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
11332 step into fixing the name resolution issues for delegates and
11333 unifying the toplevel name resolution.
11335 2002-03-28 Martin Baulig <martin@gnome.org>
11337 * class.cs (Method.Emit): If we have a symbol writer, call its
11338 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
11339 tell it about the current method.
11341 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
11342 writer that we're going to emit the first byte of IL code for a new
11343 statement (a new source line).
11344 (EmitContext.EmitTopBlock): If we have a symbol writer, call
11345 EmitContext.Mark() before emitting any code.
11347 * location.cs (SymbolDocument): Return null when we're Null.
11349 * statement.cs (Statement): Moved the `Location loc' variable here.
11350 (Statement.EmitBoolExpression): If we have a symbol writer, call
11351 ec.Mark() before emitting any code to tell it that we're at the
11352 beginning of a new statement.
11353 (StatementExpression): Added `Location' argument to the constructor.
11354 (Block): Added public readonly variable `StartLocation' and public
11355 variable `EndLocation'. The latter is to be set using SetEndLocation().
11356 (Block): Added constructor which takes a start and end location.
11357 (Block.SetEndLocation): New method. This sets the end location.
11358 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
11359 local variables we create.
11360 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
11361 each statement and do also mark the begin and end of the block.
11363 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
11364 tell it the current lexer.Location, use Location.Null for the end of the
11366 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
11367 current block, set its end location using SetEndLocation().
11368 (statement_expression): StatementExpression constructor now takes the
11369 lexer.Location as additional argument.
11370 (for_statement, declare_local_variables): Likewise.
11371 (declare_local_variables): When creating a new implicit block, use the
11372 new Block constructor and pass it the lexer.Location.
11374 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11376 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
11377 members also on the parent interfaces recursively.
11379 2002-03-27 Miguel de Icaza <miguel@ximian.com>
11381 * report.cs: Use new formats, since Gonzalo finished the missing
11384 * expression.cs (Binary.ResolveOperator): added missing operator|
11385 operator& and operator^ for bool/bool.
11387 * cs-parser.jay: CheckDef now takes a Location argument that is
11388 used to report errors more precisly (instead of reporting the end
11389 of a definition, we try to track something which is a lot closer
11390 to the source of the problem).
11392 * cs-tokenizer.cs: Track global token use, so we can properly flag
11393 the use of #define/#undef after the first token has been seen.
11395 Also, rename the reportXXXX to Error_DescriptiveName
11397 * decl.cs (DeclSpace.IsTopLevel): Move property here from
11398 TypeContainer, so that Enum and Interface can use this too.
11400 * class.cs (TypeContainer.LookupInterfaceOrClass,
11401 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
11402 `builder' argument. Typically this was used to pass the parent
11403 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
11406 The problem is that a nested class could trigger the definition of
11407 a toplevel class, and the builder would be obviously wrong in that
11410 So we drop this argument, and we compute dynamically the
11411 TypeBuilder/ModuleBuilder (the correct information was available
11412 to us anyways from DeclSpace.Parent)
11414 * interface.cs (Interface.DefineInterface): Drop builder
11415 parameter cleanup like class.cs
11417 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
11420 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
11423 (Try.Emit): Propagate the returns value from the statement.
11425 (Return.Emit): Even if we are leavning
11427 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
11429 * modifiers.cs: Fix the computation of MethodAttributes flags.
11431 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
11433 * driver.cs: allow compilation of files that start with '/'.
11434 Add a default case when checking the argument of --target.
11436 2002-03-25 Miguel de Icaza <miguel@ximian.com>
11438 * interface.cs: Implement the same search algorithm for types in
11439 the interface code.
11441 * delegate.cs: Do not allow multiple definition.
11443 * Recovered ChangeLog that got accidentally amputated
11445 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
11447 * rootcontext.cs: Load manually enum to allow core classes to
11448 contain enumerations.
11450 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
11451 Update to new static methods in TypeManager.
11453 * typemanager.cs (GetMethod, GetConstructor): Use our
11454 implementation of FindMembers to find the members, since during
11455 corlib compilation, the types are TypeBuilders and GetMethod and
11456 GetConstructor do not work.
11458 Make all methods in TypeManager static.
11460 (InitCodeHelpers): Split the functionality from
11461 the InitCodeTypes function.
11463 * driver.cs: Call InitCodeHelpers after we have populated the
11466 * cs-parser.jay (delegate_declaration): we did not used to compute
11467 the delegate name correctly for void delegates.
11469 2002-03-24 Miguel de Icaza <miguel@ximian.com>
11471 * rootcontext.cs (RootContext): Init the interface_resolve_order
11472 and type_container_resolve_order always.
11474 (ResolveCore, BootstrapCorlib_ResolveClass,
11475 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
11476 compiler when compiling with --nostdlib
11478 * class.cs (TypeContainer.DefineType): Check that our parent is
11479 not null. This test is most important when we are bootstraping
11482 * codegen.cs: Split out the symbol writing code.
11484 2002-03-25 Martin Baulig <martin@gnome.org>
11486 * driver.cs (-g): Made -g an alias for --debug.
11488 2002-03-24 Martin Baulig <martin@gnome.org>
11490 * codegen.cs (SymbolWriter): New public variable. Returns the
11491 current symbol writer.
11492 (CodeGen): Added `bool want_debugging_support' argument to the
11493 constructor. If true, tell the ModuleBuild that we want debugging
11494 support and ask it for the ISymbolWriter.
11495 (Save): If we have a symbol writer, call it's Close() method after
11496 saving the assembly.
11498 * driver.c (--debug): New command line argument to create a
11499 debugger information file.
11501 * location.cs (SymbolDocument): New public property. Returns an
11502 ISymbolDocumentWriter object for the current source file or null
11503 if we don't have a symbol writer.
11505 2002-03-21 Miguel de Icaza <miguel@ximian.com>
11507 * driver.cs (LoadAssembly): Correctly return when all the paths
11508 have been tried and not before.
11510 * statement.cs (Switch.Emit): return the actual coverage for this
11511 statement (returns/not-returns)
11513 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
11514 switch of the statement if we are the last switch section. That
11515 kills two problems: try/catch problems (we used to emit an empty
11516 nop at the end) and switch statements where all branches would
11519 2002-03-19 Miguel de Icaza <miguel@ximian.com>
11521 * driver.cs: Add default assemblies (the equivalent to the
11522 Microsoft CSC.RSP file)
11524 * cs-tokenizer.cs: When updating `cols and setting it to zero,
11525 also update tokens_seen and set it to false.
11527 * driver.cs: Implement --recurse for Mike.
11529 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
11530 correctly splitting out the paths.
11532 2002-03-18 Miguel de Icaza <miguel@ximian.com>
11534 * interface.cs (Interface.PopulateProperty): Instead of using
11535 `parent' as the declaration space for the set parameters, use
11538 * support.cs (InternalParameters): InternalParameters constructor
11539 takes a DeclSpace instead of a TypeContainer.
11541 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
11542 types are being initialized, load the address of it before calling
11545 (New): Provide a mechanism to disable the generation of local
11546 value type temporaries when the caller will be providing us with
11547 an address to store it.
11549 (ArrayCreation.EmitDynamicInitializers): Use it.
11551 2002-03-17 Miguel de Icaza <miguel@ximian.com>
11553 * expression.cs (Invocation.EmitArguments): Only probe for array
11554 property if there is more than one argument. Sorry about that.
11556 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
11557 empty param arrays.
11559 * class.cs (Method.LabelParameters): Fix incorrect code path that
11560 prevented the `ParamArrayAttribute' from being applied to the
11563 2002-03-16 Miguel de Icaza <miguel@ximian.com>
11565 * support.cs (ReflectionParameters): Correctly compute whether the
11566 last argument is a params array. Fixes the problem with
11569 * typemanager.cs: Make the assemblies array always be non-null
11570 (empty, but non-null)
11572 * tree.cs (RecordDecl): New function that abstracts the recording
11573 of names. This reports error 101, and provides a pointer to the
11574 previous declaration. Fixes a crash in the compiler.
11576 * cs-parser.jay (constructor_declaration): Update to new grammar,
11577 and provide a constructor_body that can be empty.
11579 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11581 * driver.cs: Add support for --resources.
11583 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11584 Make all types for the various array helper methods be integer.
11586 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11587 CheckState to ConvCast.
11589 (ConvCast): Now it takes a `checked' state argument, to avoid
11590 depending on the emit context for the conversion, and just using
11591 the resolve time setting.
11593 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11594 instead of Invocation.EmitArguments. We do not emit the original
11595 arguments, instead we emit those which have been converted to
11596 unsigned int expressions.
11598 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11600 * codegen.cs: ditto.
11602 * expression.cs (LocalVariableReference): Drop the use of the
11603 Store function that depended on the variable index.
11605 * statement.cs (VariableInfo): Drop the `Idx' property from this
11606 class, as this is not taking into account the indexes for
11607 temporaries tat we generate during the execution, getting the
11610 * class.cs: First emit class initializers, then call the parent
11613 * expression.cs (Binary): Fix opcode emision.
11614 (UnaryMutator.EmitCode): Support checked code generation
11616 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11617 matches for events for both the Static and Instance scans,
11618 pointing to the same element. Fix that.
11620 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11622 * rootcontext.cs (ResolveTree): Always set the
11623 interface_resolve_order, because nested interfaces will be calling
11626 * class.cs (GetInterfaceOrClass): Track the same resolution
11627 process used by TypeManager.LookupType. This fixes the nested
11628 type lookups in class declarations (separate path from
11631 (TypeContainer.DefineType): Also define nested interfaces.
11632 (TypeContainer.RegisterOrder): New public function used to
11633 register the order in which child interfaces need to be closed.
11635 Nested interfaces need to be closed after their parents have been
11638 * interface.cs (InterfaceAttr): Put all the logic for computing
11639 the interface attribute here.
11641 (DefineInterface): Register our interface order with the
11642 RootContext or with the TypeContainer depending on the case.
11644 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11646 * cs-parser.jay: rework foreach statement to work with the new
11647 changes to the policy on SimpleNames.
11649 * report.cs: support Stacktrace on warnings as well.
11651 * makefile: drop --unsafe and /unsafe from the compile.
11653 2002-03-13 Ravi Pratap <ravi@ximian.com>
11655 * ecore.cs (StandardConversionExists): Modify to take an Expression
11656 as the first parameter. Ensure we do null -> reference type conversion
11659 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11660 temporary Expression objects.
11662 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11664 * interface.cs: workaround bug in method overloading resolution
11665 (there is already a bugzilla bug for it).
11667 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11669 We could also solve this problem by having a separate path for
11670 performing type lookups, instead of DoResolve, we could have a
11671 ResolveType entry point, and only participating pieces of the
11672 production (simplename, deref, array) would implement this.
11674 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11675 signal SimpleName to only resolve type names and not attempt to
11676 resolve anything else.
11678 * expression.cs (Cast): Set the flag.
11680 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11682 * class.cs: Only report 108 if there is no `new' modifier.
11684 * cs-parser.jay: rework foreach statement to work with the new
11685 changes to the policy on SimpleNames.
11687 * report.cs: support Stacktrace on warnings as well.
11689 * makefile: drop --unsafe and /unsafe from the compile.
11691 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11693 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11694 lookups here, instead of doing that at parse time. This means
11695 that our grammar will not introduce `LocalVariableReferences' as
11696 expressions at this point. That solves the problem of code like
11700 static void Main ()
11704 This is only half the fix. The full fix requires parameters to
11705 also be handled in this way.
11707 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11708 makes the use more obvious of the DeclSpace. The
11709 ec.TypeContainer.TypeBuilder is now only used to pull the
11710 TypeBuilder for it.
11712 My theory is that I can get rid of the TypeBuilder completely from
11713 the EmitContext, and have typecasts where it is used (from
11714 DeclSpace to where it matters).
11716 The only pending problem is that the code that implements Aliases
11717 is on TypeContainer, and probably should go in DeclSpace.
11719 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11720 lookups here, instead of doing that at parse time. This means
11721 that our grammar will not introduce `LocalVariableReferences' as
11722 expressions at this point. That solves the problem of code like
11726 static void Main ()
11730 This is only half the fix. The full fix requires parameters to
11731 also be handled in this way.
11733 * class.cs (Property.DefineMethod): When implementing an interface
11734 method, set newslot, when implementing an abstract method, do not
11735 set the flag (before we tried never setting it, or always setting
11736 it, which is the difference).
11737 (Indexer.DefineMethod): same.
11738 (Method.DefineMethod): same.
11740 * ecore.cs: Only set the status used flag if we get back a Field.
11742 * attribute.cs: Temporary hack, so Paolo can keep working.
11744 2002-03-08 Ravi Pratap <ravi@ximian.com>
11746 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11747 the unmanaged type in the case we have a MarshalAs attribute.
11749 (Resolve): Handle the case when we are parsing the special MarshalAs
11750 attribute [we need to store the unmanaged type to use later]
11752 * typemanager.cs (marshal_as_attr_type): Built in type for the
11753 MarshalAs Attribute.
11755 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11756 on parameters and accordingly set the marshalling info.
11758 2002-03-09 Miguel de Icaza <miguel@ximian.com>
11760 * class.cs: Optimizing slightly by removing redundant code after
11761 we switched to the `NoTypes' return value.
11762 (Property.DefineMethod): use NoTypes here too.
11764 This fixes the bug I introduced in my last batch of changes.
11766 2002-03-05 Ravi Pratap <ravi@ximian.com>
11768 * tree.cs (RecordEnum): Add. We now keep track of enums too.
11770 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
11771 Enums since those are types too.
11773 * cs-parser.jay (enum_declaration): Record enums as we parse them.
11775 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
11776 thanks to a call during the lookup process.
11778 2002-03-07 Miguel de Icaza <miguel@ximian.com>
11780 * statement.cs (Foreach): Lots of work to accomodate a particular
11781 kind of foreach statement that I had not kept in mind. It is
11782 possible to have foreachs on classes that provide a GetEnumerator
11783 method that return objects that implement the "pattern" for using
11784 a foreach, there is no need to support GetEnumerator
11787 This is needed to compile nant.
11789 * decl.cs: Only report 114 if the member is not `Finalize' and if
11790 the warning level is at least 2.
11792 * class.cs: Moved the compare function from Method to
11795 (MethodSignature.InheritableMemberSignatureCompare): Add new
11796 filter function that is used to extract inheritable methods from a
11799 (Method.Define): Use the new `inheritable_method_signature_filter'
11802 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
11805 2002-03-06 Miguel de Icaza <miguel@ximian.com>
11807 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
11809 * cs-parser.jay: Add opt_semicolon to the interface declaration.
11811 * expression.cs: Pass location information to
11812 ConvertImplicitStandard.
11814 * class.cs: Added debugging code to track return values from
11817 2002-03-05 Miguel de Icaza <miguel@ximian.com>
11819 * expression.cs (Is.DoResolve): If either side of the `is' is an
11820 interface, do not flag the warning.
11822 * ecore.cs (ImplicitReferenceConversion): We need a separate test
11825 * report.cs: Allow for --fatal to be used with --probe.
11827 * typemanager.cs (NoTypes): Move the definition for the empty Type
11830 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
11832 (TypeContainer.DefineProxy): New function used to proxy to parent
11833 implementations when implementing interfaces.
11834 (TypeContainer.ParentImplements): used to lookup if our parent
11835 implements a public function that is required by an interface.
11836 (TypeContainer.VerifyPendingMethods): Hook this up.
11838 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
11839 `modules' and `assemblies' arraylists into arrays. We only grow
11840 these are the very early start up of the program, so this improves
11841 the speedof LookupType (nicely measured).
11843 * expression.cs (MakeByteBlob): Replaced unsafe code with
11844 BitConverter, as suggested by Paolo.
11846 * cfold.cs (ConstantFold.Binary): Special case: perform constant
11847 folding of string concatenation, but if either side is a string,
11848 and the other is not, then return null, and let the runtime use
11849 the concatenation on the string plus the object (using
11850 `Object.ToString').
11852 2002-03-04 Miguel de Icaza <miguel@ximian.com>
11854 Constant Folding has been implemented now.
11856 * expression.cs (Unary.Reduce): Do not throw an exception, catch
11857 the error instead on types that are not supported in one's
11860 * constant.cs (Constant and all children): New set of functions to
11861 perform implict and explicit conversions.
11863 * ecore.cs (EnumConstant): Implement the new functions to perform
11864 conversion by proxying to the child expression.
11866 * codegen.cs: (ConstantCheckState): Constant evaluation has its
11867 own separate setting that can not be turned off from the command
11868 line using --unchecked or --checked and is only controlled using
11869 the checked/unchecked statements and expressions. This setting is
11870 used by the constant folder to flag errors.
11872 * expression.cs (CheckedExpr, UncheckedExpr): Set the
11873 ConstantCheckState as well.
11875 During Resolve, they also have to flag the state, because the
11876 constant folder runs completely in the Resolve phase.
11878 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
11881 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11883 * cfold.cs: New file, this file contains the constant folder.
11885 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
11886 argument to track whether we are using the resulting address to
11887 load or store a value and provide better error messages.
11889 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
11890 new AddressOf arguments.
11892 * statement.cs (Foreach.EmitCollectionForeach): Update
11894 * expression.cs (Argument.Emit): Call AddressOf with proper
11895 arguments to track usage.
11897 (New.DoEmit): Call AddressOf with new arguments.
11899 (Unary.Emit): Adjust AddressOf call.
11901 2002-03-01 Ravi Pratap <ravi@ximian.com>
11903 * cs-parser.jay (member_access): Change the case for pre-defined types
11904 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
11907 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
11910 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
11911 essentially like methods and apply attributes like MethodImplOptions to them too.
11913 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
11916 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
11917 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
11920 * Update code everywhere accordingly.
11922 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
11924 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
11926 2002-02-28 Ravi Pratap <ravi@ximian.com>
11928 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11929 try performing lookups against those instead of jumping straight into using
11930 the 'using' clauses.
11932 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11934 (LookupType): Perform lookups in implicit parents too.
11936 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11937 sequence as RootContext.LookupType.
11939 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11940 the various cases of namespace lookups into this method.
11942 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11944 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11945 in positional arguments)
11947 * class.cs (Operator): Update the AllowedModifiers to contain
11950 * cs-parser.jay: Update operator declaration to allow for the
11951 operator body to be empty.
11953 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11956 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11958 * class.cs (Method.Emit): Label parameters.
11960 * driver.cs: Return 1 or 0 as the program exit code.
11962 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11964 * expression.cs: Special case the `null' object when trying to
11965 auto-compute the type, as anything can be explicitly converted to
11968 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11969 spotting this Paolo.
11971 (Expression.ImplicitNumericConversion): Perform comparissions of
11972 the type using the underlying type in the case of an enumeration
11973 rather than using the enumeration type for the compare.
11975 Cope with the underlying == type case, which is not possible to
11978 (Expression.ConvertNumericExplicit): Perform comparissions of
11979 the type using the underlying type in the case of an enumeration
11980 rather than using the enumeration type for the compare.
11982 * driver.cs: If the user does not supply an extension, assume .exe
11984 * cs-parser.jay (if_statement): Rewrote so that we can track the
11985 location for the if statement.
11987 * expression.cs (Binary.ConstantFold): Only concat strings when
11988 the operation is "+", not everything ;-)
11990 * statement.cs (Statement.EmitBoolExpression): Take a location
11992 (If, While, Do): Track location.
11994 * expression.cs (Binary.ResolveOperator): In the object + string
11995 case, I was missing a call to ConvertImplicit
11997 2002-02-25 Ravi Pratap <ravi@ximian.com>
11999 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
12000 Location arguments. Ensure we use RootContext.LookupType to do our work
12001 and not try to do a direct Type.GetType and ModuleBuilder.GetType
12003 * interface.cs (PopulateMethod): Handle the type of the parameter being
12006 * expression.cs (Invocation.BetterFunction): Handle the case when we
12007 have a params method with no fixed arguments and a call is made with no
12010 2002-02-25 Miguel de Icaza <miguel@ximian.com>
12012 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
12013 the verbatim-string-literal
12015 * support.cs (InternalParameters.ParameterModifier): handle null
12017 (InternalParameters.ParameterType): ditto.
12019 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
12020 duplicating the name of the variable parameter.
12021 (GetParameterByName): Fix bug where we were not looking up array
12022 paramters if they were the only present (thanks Paolo!).
12023 (GetParameterInfo): We only have an empty set of types if both
12024 fixed and array are set to null.
12025 (GetParameterInfo-idx): Handle FixedParameter == null
12027 * cs-parser.jay: Handle the case where there is no catch
12028 statements (missing null test).
12030 2002-02-22 Miguel de Icaza <miguel@ximian.com>
12032 * driver.cs (MainDriver): Be conservative on our command line
12035 Catch DirectoryNotFoundException when calling GetFiles.
12037 (SplitPathAndPattern): Used to split the input specification into
12038 a path and a pattern that we can feed to Directory.GetFiles.
12040 2002-02-21 Miguel de Icaza <miguel@ximian.com>
12042 * statement.cs (Fixed): Implement the last case of the Fixed
12043 statement (string handling).
12045 * expression.cs (StringPtr): New class used to return a char * to
12046 a string; Used by the Fixed statement.
12048 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
12050 * expression.cs (Binary.ResolveOperator): Remove redundant
12051 MemberLookup pn parent type.
12052 Optimize union call, we do not need a union if the types are the same.
12053 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
12056 Specialize the use of MemberLookup everywhere, instead of using
12057 the default settings.
12059 (StackAlloc): Implement stackalloc keyword.
12061 * cs-parser.jay: Add rule to parse stackalloc.
12063 * driver.cs: Handle /h, /help, /?
12065 * expression.cs (MakeByteBlob): Removed the hacks we had in place
12066 before we supported unsafe code.
12068 * makefile: add --unsafe to the self compilation of mcs.
12070 2002-02-20 Miguel de Icaza <miguel@ximian.com>
12072 * expression.cs (PointerArithmetic): New class that is used to
12073 perform pointer arithmetic.
12074 (Binary.Resolve): Handle pointer arithmetic
12075 Handle pointer comparission.
12076 (ArrayPtr): Utility expression class that is used to take the
12077 address of an array.
12079 (ElementAccess): Implement array access for pointers
12081 * statement.cs (Fixed): Implement fixed statement for arrays, we
12082 are missing one more case before we are done.
12084 * expression.cs (Indirection): Implement EmitAssign and set the
12085 ExprClass to Variable. This allows pointer dereferences to be
12086 treated as variables, and to have values assigned to them.
12088 * ecore.cs (Expression.StoreFromPtr): New utility function to
12089 store values dereferencing.
12091 2002-02-20 Ravi Pratap <ravi@ximian.com>
12093 * expression.cs (Binary.ResolveOperator): Ensure that we are
12094 not trying to operate on a void type - this fixes the reported
12097 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
12098 the parent implementation is sealed.
12100 * ../errors/cs0239.cs : Add.
12102 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
12104 * typemanager.cs (unverifiable_code_type): Corresponds to
12105 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
12106 which have unsafe code in them.
12108 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
12111 2002-02-19 Miguel de Icaza <miguel@ximian.com>
12113 * cs-tokenizer.cs: Add support for @"litreal strings"
12115 Make tokenizer accept pre-processor directives
12116 on any column (remove the old C-like limitation).
12118 * rootcontext.cs (EmitCode): Emit any global attributes.
12119 (AddGlobalAttributes): Used to keep track of assembly attributes.
12121 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
12123 * cs-parser.jay: Add support for global attributes.
12125 2002-02-17 Miguel de Icaza <miguel@ximian.com>
12127 * expression.cs (Indirection): New helper class. Unary will
12128 create Indirection classes to be able to implement the
12129 IMemoryLocation interface on it.
12131 2002-02-16 Miguel de Icaza <miguel@ximian.com>
12133 * cs-parser.jay (fixed_statement): reference the right statement.
12135 * statement.cs (Fixed.Emit): Finish implementing the fixed
12136 statement for the &x case.
12138 2002-02-14 Miguel de Icaza <miguel@ximian.com>
12140 * class.cs (Property.Define, Method.Define): Remove newslot when
12143 * modifiers.cs: My use of NewSlot when `Abstract' was set was
12144 wrong. NewSlot should only be used if the `new' keyword is present.
12146 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
12147 locating our system dir. Sorry about this.
12149 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12151 * driver.cs (GetSystemDir): Compute correctly the location of our
12152 system assemblies. I was using the compiler directory instead of
12153 the library directory.
12155 2002-02-13 Ravi Pratap <ravi@ximian.com>
12157 * expression.cs (BetterFunction): Put back in what Miguel commented out
12158 since it is the correct fix. The problem is elsewhere ;-)
12160 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
12161 parameters of the parms method are themselves compatible or not !
12163 (StandardConversionExists): Fix very dangerous bug where we were forgetting
12164 to check that a class implements an interface before saying that an implicit
12165 conversion was allowed. Use ImplementsInterface to do the checking.
12167 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12169 * class.cs (Method.Define): Track whether we are an explicit
12170 implementation or not. And only call DefineMethodOverride if we
12171 are an explicit implementation.
12173 (Property.DefineMethod): Ditto.
12175 2002-02-11 Ravi Pratap <ravi@ximian.com>
12177 * expression.cs (BetterFunction): Catch hideous bug which was
12178 preventing us from detecting ambiguous calls due to implicit casts i.e
12181 2002-01-29 Miguel de Icaza <miguel@ximian.com>
12183 * support.cs (Pair): Remove un-needed method. I figured why I was
12184 getting the error in cs-parser.jay, the variable in a foreach loop
12185 is readonly, and the compiler does not really treat this as a variable.
12187 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
12188 instead of EQUALS in grammar.
12190 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
12192 * expression.cs (Unary.DoResolve): Check whether the argument is
12195 2002-01-28 Miguel de Icaza <miguel@ximian.com>
12197 * support.cs: Api for Pair to set a value. Despite the fact that
12198 the variables are public the MS C# compiler refuses to compile
12199 code that accesses the field if the variable is part of a foreach
12202 * statement.cs (Fixed): Begin implementation of the fixed
12205 (Block.AddVariable): Return the VariableInfo on success and null
12206 on failure instead of true/false.
12208 * cs-parser.jay (foreach): Catch errors on variables already
12209 defined (we were ignoring this value before) and properly unwind
12210 the block hierarchy
12212 (fixed_statement): grammar for the fixed statement.
12214 2002-01-25 Miguel de Icaza <miguel@ximian.com>
12216 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
12217 pointer types to be incretemented.
12219 (SizeOf): Implement.
12221 * cs-parser.jay (pointer_member_access): Implement
12222 expr->IDENTIFIER production.
12224 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
12225 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
12228 (Unary): Implement indirection.
12230 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
12231 use in non-unsafe context).
12233 (SimpleName.DoResolve): Check for pointers in field access on safe
12236 (Expression.LoadFromPtr): Factor the load-indirect code in this
12237 function. This was duplicated in UnboxCast and ParameterReference
12239 2002-01-24 Miguel de Icaza <miguel@ximian.com>
12241 * expression.cs (ComposedCast): report an error if a pointer cast
12242 is used in a safe region.
12244 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
12245 pointer type casts in unsafe context.
12247 * codegen.cs (EmitContext): Set up IsUnsafe.
12249 * cs-parser.jay (non_expression_type): Add productions for pointer
12252 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
12253 code. We should not use force into static mode if the method is
12254 not virtual. Fixes bug in MIS
12256 * statement.cs (Do.Emit, While.Emit, For.Emit,
12257 Statement.EmitBoolExpression): Add support to Do and While to
12258 propagate infinite loop as `I do return' semantics.
12260 Improve the For case to also test for boolean constants.
12262 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
12263 to the list of attributes we can add.
12265 Remove `EmitContext' argument.
12267 * class.cs (Method.Define): Apply parameter attributes.
12268 (Constructor.Define): Apply parameter attributes.
12269 (MethodCore.LabelParameters): Move here the core of labeling
12272 * support.cs (ReflectionParameters.ParameterModifier,
12273 InternalParameters.ParameterModifier): Use IsByRef on the type and
12274 only return the OUT bit for these parameters instead of in/out/ref
12277 This is because I miss-understood things. The ParameterInfo.IsIn
12278 and IsOut represent whether the parameter has the [In] and [Out]
12281 2002-01-22 Miguel de Icaza <miguel@ximian.com>
12283 * ecore.cs (FieldExpr.Emit): Release temporaries.
12285 * assign.cs (LocalTemporary.Release): new function.
12287 * codegen.cs (EmitContext.GetTemporaryStorage,
12288 EmitContext.FreeTemporaryStorage): Rework the way we deal with
12289 temporary storage. Now we can "put back" localbuilders when we
12292 2002-01-21 Miguel de Icaza <miguel@ximian.com>
12294 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
12295 need to make a copy of the variable to generate verifiable code.
12297 2002-01-19 Miguel de Icaza <miguel@ximian.com>
12299 * driver.cs: Compute dynamically the system directory.
12301 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
12302 Slower, but more generally useful. Used by the abstract
12303 registering implementation.
12305 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
12306 the rules for the special rule on Type/instances. First check if
12307 we have the same name, and if so, try that special static path
12308 rather than the instance path.
12310 2002-01-18 Miguel de Icaza <miguel@ximian.com>
12312 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
12315 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
12316 Enum, ValueType, Delegate or Array for non-corlib compiles.
12318 * cs-tokenizer.cs: Catch long identifiers (645)
12320 * typemanager.cs (IndexerPropetyName): Ravi never tested this
12323 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
12324 fix, we were returning too early, so we were not registering
12325 pending methods from abstract classes.
12327 Do not register pending methods if the class is abstract.
12329 * expression.cs (Conditional.DoResolve): Report circular implicit
12330 conversions when we neecd to compute it for conditional
12333 (Is.DoResolve): If the expression is always of the provided type,
12334 flag warning 183. If the expression can not ever be of the
12335 provided type flag warning 184.
12337 * class.cs: Catch 169 as well.
12339 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
12342 2002-01-18 Nick Drochak <ndrochak@gol.com>
12344 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
12346 2002-01-17 Miguel de Icaza <miguel@ximian.com>
12348 * interface.cs: (PopulateMethod): Check for pointers being defined
12349 only if the unsafe context is active.
12350 (PopulateProperty): ditto.
12351 (PopulateIndexer): ditto.
12353 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
12354 specified. If pointers are present, make sure that they are
12355 present in an unsafe context.
12356 (Constructor, Constructor.Define): ditto.
12357 (Field, Field.Define): ditto.
12358 (Property, Property.Define): ditto.
12359 (Event, Event.Define): ditto.
12361 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
12362 hashtable if there are classes or structs defined.
12364 * expression.cs (LocalVariableReference.DoResolve): Simplify this
12365 code, as the constant resolution moved.
12367 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
12368 the metadata, so we can flag error 133.
12370 * decl.cs (MemberCore.UnsafeOK): New function to test that a
12371 pointer is being declared in an unsafe context.
12373 2002-01-16 Miguel de Icaza <miguel@ximian.com>
12375 * modifiers.cs (Modifiers.Check): Require a Location argument.
12376 Report error 227 for Unsafe use.
12378 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
12380 * statement.cs (For.Emit): If the test is null, then report that
12381 we do `return', as we wont reach anything afterwards.
12383 (Switch.SwitchGoverningType): Track the expression that matched
12386 * driver.cs: Allow negative numbers as an error code to flag.
12388 * cs-parser.jay: Handle 1551.
12390 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
12392 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12394 * cs-parser.jay: Report 1518 (type declaration can only contain
12395 class, struct, interface, enum or delegate)
12397 (switch_label): Report 1523 (keywords `case' or `default' must
12400 (opt_switch_sections): Report 1522 (empty switch)
12402 * driver.cs: Report 1515 (response file specified multiple times)
12403 Report 1516 (Source file specified multiple times).
12405 * expression.cs (Argument.Resolve): Signal 1510
12407 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
12408 access not allowed in static code)
12410 2002-01-11 Ravi Pratap <ravi@ximian.com>
12412 * typemanager.cs (IsPointerType): Utility method which we are going
12415 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
12416 the object type, so we take care of that.
12418 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
12420 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
12421 added to non-params parameters :-)
12423 * typemanager.cs (CSharpName): Include 'void' type too.
12425 (void_ptr_type): Include in the set of core types.
12427 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
12430 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
12433 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
12434 completely forgotten about it.
12436 2002-01-10 Ravi Pratap <ravi@ximian.com>
12438 * cs-parser.jay (pointer_type): Add. This begins our implementation
12439 of parsing rules for unsafe code.
12441 (unsafe_statement): Implement.
12443 (embedded_statement): Modify to include the above.
12445 * statement.cs (Unsafe): Implement new class for unsafe blocks.
12447 * codegen.cs (EmitContext.InUnsafe): Add. This determines
12448 if the current context is an unsafe one.
12450 * cs-parser.jay (local_variable_pointer_type): Since local variable types
12451 are handled differently, we need separate rules for them.
12453 (local_variable_declaration): Update to use local_variable_pointer_type
12454 to allow variable declarations of unmanaged pointer types.
12456 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
12457 in unsafe contexts.
12459 * ../errors/cs0214.cs : Add.
12461 2002-01-16 Nick Drochak <ndrochak@gol.com>
12463 * makefile: remove 'response' file when cleaning.
12465 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12467 * cs-parser.jay: Report 1524.
12469 2002-01-14 Miguel de Icaza <miguel@ximian.com>
12471 * typemanager.cs (RegisterMethod): drop checking if we have
12472 registered this from here
12474 2002-01-12 Miguel de Icaza <miguel@ximian.com>
12476 * class.cs (Method.EmitDestructor): Implement calling our base
12479 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
12480 value of InFinally.
12482 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
12483 this routine and will wrap the call in a try/catch block. Deal
12486 2002-01-11 Miguel de Icaza <miguel@ximian.com>
12488 * ecore.cs (Expression.MemberLookup): instead of taking a
12489 parameter `same_type' that was used to tell whether we could
12490 access private members we compute our containing type from the
12493 (FieldExpr): Added partial support for volatile fields. This does
12494 not work for volatile fields exposed from assemblies, as I can not
12495 figure out how to extract the modreq from it.
12497 Updated all the source files to use this.
12499 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
12500 because it is referenced by MemberLookup very often.
12502 2002-01-09 Ravi Pratap <ravi@ximian.com>
12504 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
12505 TypeBuilder.GetCustomAttributes to retrieve what we need.
12507 Get rid of redundant default_member_attr_type as this is the same as
12508 default_member_type which already exists.
12510 * interface.cs, attribute.cs : Update accordingly.
12512 2002-01-08 Miguel de Icaza <miguel@ximian.com>
12514 * typemanager.cs: Enable IndexerPropertyName again. It does not
12515 work for TYpeBuilders though. Ravi, can you please fix this?
12517 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
12519 * expression.cs (Argument.Emit): Handle the case of ref objects
12520 being passed to ref functions;
12522 (ParameterReference.EmitLoad): Loads the content of the pointer
12523 without dereferencing.
12525 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12527 * cs-tokenizer.cs: Implemented the pre-processing expressions.
12529 2002-01-08 Ravi Pratap <ravi@ximian.com>
12531 * class.cs (Indexer.DefineMethod): Incorporate the interface
12532 type in the name of the method if we are doing explicit interface
12535 * expression.cs (ConversionExists): Remove as it is completely obsolete.
12537 (BetterConversion): Fix extremely trivial bug where we were referring to
12538 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
12541 * ../errors/bug16.cs : Add although we have fixed it.
12543 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12545 * expression.cs (BaseIndexer): Begin implementation.
12547 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
12549 * cs-parser.jay (indexer_declarator): Use qualified_identifier
12550 production directly to remove a shift/reduce, and implement
12551 explicit interface implementation.
12553 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
12554 after a floating point suffix.
12556 * expression.cs (DoNumericPromotions): Improved the conversion for
12557 uint/uint. If we have a constant, we avoid doing a typecast to a
12560 * class.cs (Indexer): Implement explicit interface implementation
12563 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
12565 * class.cs: make the default instance constructor public and hidebysig.
12567 2001-01-03 Ravi Pratap <ravi@ximian.com>
12569 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
12570 so we can call it from elsewhere.
12572 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
12573 we emit it internally if the class has a defined indexer; otherwise the user
12574 emits it by decorating the class definition with the DefaultMemberAttribute.
12576 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
12577 attribute is not used on a type which defines an indexer.
12579 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12580 character when we skip whitespace.
12582 * ../errors/cs0646.cs : Add.
12584 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12586 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12589 * makefile: Add practical target `mcs3.exe' which builds the third
12590 generation compiler.
12592 * expression.cs (New): Fix structures constructor calling.
12594 * class.cs (Property, Method, Indexer): Emit Final flag on the
12595 method if we are an interface implementation and we are not
12598 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12599 whether this property is referencing a `base' method.
12601 * expression.cs (Invocation.EmitCall): take an extra argument:
12602 is_base, this is used to determine whether the `call' or
12603 `callvirt' opcode should be used.
12606 * delegate.cs: update EmitCall.
12608 * class.cs (Method.Define): Set NewSlot for the cases where we are
12609 not implementing an interface method.
12611 (Property.Define): ditto.
12613 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12615 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12616 'r'. Allows mcs to parse itself fully.
12618 2002-01-02 Ravi Pratap <ravi@ximian.com>
12620 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12621 of the number of initializers that require the InitializeArray method.
12623 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12624 update the above field where necessary.
12626 (MakeByteBlob): Update accordingly.
12628 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12631 (EmitDynamicInitializers): Update in accordance with the new optimization.
12633 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12634 same OpCode applies.
12636 * cs-parser.jay : Fix some glaring errors I introduced.
12638 2002-01-01 Ravi Pratap <ravi@ximian.com>
12640 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12641 so that we can check for name clashes there too.
12643 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12644 for interface indexers.
12646 * interfaces.cs (Define): Emit the default member attribute.
12648 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12649 variable was being referred to while setting the value ;-)
12651 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12653 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12654 byte-by-byte information when we know the data is zero.
12656 Make the block always a multiple of 4, because
12657 DefineInitializedData has a bug.
12659 * assign.cs: Fix, we should assign from the temporary, not from
12662 * expression.cs (MakeByteBlob): Fix my incorrect code.
12664 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12666 * typemanager.cs (EnumToUnderlying): This function is used to get
12667 the underlying type from an enumeration, because it does not
12670 * constant.cs: Use the I4_S form for values between -128 and 127.
12672 * statement.cs (Block.LookupLabel): Looks up a label.
12673 (Block): Drop support for labeled blocks.
12675 (LabeledStatement): New kind of statement that represents a label
12678 (Goto): Finally implement this bad boy.
12680 * cs-parser.jay: Update to reflect new mechanism to implement
12683 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12685 * codegen.cs (EmitContext.This): a codegen property that keeps the
12686 a single instance of this instead of creating many different this
12689 * delegate.cs (Delegate.DoResolve): Update to use the property;
12691 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12693 * expression.cs (BaseAccess.DoResolve): Ditto.
12695 2001-12-29 Ravi Pratap <ravi@ximian.com>
12697 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12698 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12700 (InitCoreTypes): Update accordingly.
12702 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12703 so we can quickly store the state.
12705 (ApplyAttributes): Set the correct implementation flags
12706 for InternalCall methods.
12708 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12710 * expression.cs (EmitCall): if a method is not virtual, then do
12711 not use callvirt on it.
12713 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12714 user defined stuff) requires the use of stobj, which takes an
12715 address on the stack instead of an array and an index. So emit
12716 the Ldelema operation for it.
12718 (EmitStoreOpcode): Use stobj for valuetypes.
12720 (UnaryMutator.EmitCode): Use the right 1 value depending on
12721 whether we are dealing with int64/uint64, float or doubles.
12723 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12724 constructors that I implemented last night.
12726 (Constructor.IsDefault): Fix to work properly for static
12729 * cs-parser.jay (CheckDef): report method signature errors.
12730 Update error number 103 to be 132.
12732 * decl.cs: New AdditionResult enumeration value: MethodExists.
12733 Although we do this check for methods later on in the semantic
12734 analysis, catching repeated default constructors is so easy that
12735 we catch these here.
12737 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12740 (ParameterReference.EmitAssign, Emit): handle
12743 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12744 (ArrayAccess.EmitStoreOpcode): ditto.
12746 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12748 * expression.cs (MakeByteBlob): Complete all the missing types
12749 (uint, short, ushort, byte, sbyte)
12751 * class.cs: Only init instance field initializers on instance
12754 Rename `constructors' to instance_constructors.
12756 (TypeContainer.AddConstructor): Only add constructors to the list
12757 if it is not static.
12759 Make sure that we handle default_static_constructor independently
12760 everywhere where we handle instance_constructors
12762 2001-12-28 Miguel de Icaza <miguel@ximian.com>
12764 * class.cs: Do not lookup or create a base initializer for a
12765 static constructor.
12767 (ConstructorInitializer.Resolve): use the proper type to lookup
12770 * cs-parser.jay: Report error 1585 (modifiers between type and name).
12772 * enum.cs, interface.cs: Remove CloseType, this is taken care by
12775 * decl.cs: CloseType is now an virtual method, the default
12776 implementation just closes this type.
12778 2001-12-28 Ravi Pratap <ravi@ximian.com>
12780 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
12781 to PreserveSig by default. Also emit HideBySig on such methods.
12783 Basically, set the defaults to standard values.
12785 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
12786 argument, if candidate is better, it can't be worse than the best !
12788 (Invocation): Re-write bits to differentiate between methods being
12789 applicable in their expanded form and their normal form - for params
12792 Get rid of use_standard everywhere as only standard conversions are allowed
12793 in overload resolution.
12795 More spec conformance.
12797 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12799 * driver.cs: Add --timestamp, to see where the compiler spends
12802 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
12803 `this' in static code.
12805 (SimpleName.DoResolve): Implement in terms of a helper function
12806 that allows static-references to be passed upstream to
12809 (Expression.ResolveWithSimpleName): Resolve specially simple
12810 names when called by MemberAccess to implement the special
12813 (Expression.ImplicitReferenceConversion): Handle conversions from
12814 Null to reference types before others, as Null's type is
12817 * expression.cs (Invocation.EmitCall): Handle the special case of
12818 calling methods declared on a reference type from a ValueType
12819 (Base classes System.Object and System.Enum)
12821 (MemberAccess.Resolve): Only perform lookups on Enumerations if
12822 the left hand side is a TypeExpr, not on every enumeration.
12824 (Binary.Resolve): If types are reference types, then do a cast to
12825 object on operators != and == of both arguments.
12827 * typemanager.cs (FindMembers): Extract instance and static
12828 members if requested.
12830 * interface.cs (PopulateProperty): Use void_type instead of null
12831 as the return type for the setter method.
12833 (PopulateIndexer): ditto.
12835 2001-12-27 Ravi Pratap <ravi@ximian.com>
12837 * support.cs (ReflectionParameters): Fix minor bug where we
12838 were examining the wrong parameter for the ParamArray attribute.
12840 Cope with requests for the type of the parameter at position
12841 greater than the params parameter's. We now return the element
12842 type of the params array as that makes more sense.
12844 * expression.cs (Invocation.IsParamsMethodApplicable): Update
12845 accordingly as we no longer have to extract the element type
12848 (Invocation.OverloadResolve): Update.
12850 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12852 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
12853 against IEnumerator, test whether the return value is a descendant
12854 of the IEnumerator interface.
12856 * class.cs (Indexer.Define): Use an auxiliary method to implement
12857 the other bits of the method definition. Begin support for
12858 explicit interface implementation.
12860 (Property.DefineMethod): Use TypeManager.void_type instead of null
12861 for an empty return value.
12863 2001-12-26 Miguel de Icaza <miguel@ximian.com>
12865 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
12866 dealing with a FieldExpr which is composed of a FieldBuilder, in
12867 the code path we did extract the constant, but we should have
12868 obtained the underlying value to be able to cast it (otherwise we
12869 end up in an infinite loop, this is what Ravi was running into).
12871 (ArrayCreation.UpdateIndices): Arrays might be empty.
12873 (MemberAccess.ResolveMemberAccess): Add support for section
12874 14.5.4.1 that deals with the special case of E.I when E is a type
12875 and something else, that I can be a reference to a static member.
12877 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
12878 handle a particular array type to create byte blobs, it is just
12879 something we dont generate byteblobs for.
12881 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
12884 * location.cs (Push): remove the key from the hashtable that we
12885 are about to add. This happens for empty files.
12887 * driver.cs: Dispose files after we have parsed them.
12889 (tokenize): new function that only runs the tokenizer on its
12890 input, for speed testing.
12892 2001-12-26 Ravi Pratap <ravi@ximian.com>
12894 * class.cs (Event.Define): Define the private field only if there
12895 are no accessors defined.
12897 * expression.cs (ResolveMemberAccess): If there is no associated
12898 field with the event, that means we have an event defined with its
12899 own accessors and we should flag error cs0070 since transforming
12900 ourselves into a field is not valid in that case.
12902 * ecore.cs (SimpleName.DoResolve): Same as above.
12904 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
12905 and charset to sane values.
12907 2001-12-25 Ravi Pratap <ravi@ximian.com>
12909 * assign.cs (DoResolve): Perform check on events only if they
12910 are being accessed outside the declaring type.
12912 * cs-parser.jay (event_declarations): Update rules to correctly
12913 set the type of the implicit parameter etc.
12915 (add_accessor, remove_accessor): Set current local parameters.
12917 * expression.cs (Binary): For delegate addition and subtraction,
12918 cast the return value from the method into the appropriate delegate
12921 2001-12-24 Ravi Pratap <ravi@ximian.com>
12923 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
12924 of these as the workaround is unnecessary.
12926 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
12927 delegate data - none of that is needed at all.
12929 Re-write bits to extract the instance expression and the delegate method
12932 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12935 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12936 of attaching attributes instead of duplicating code everywhere.
12938 * everywhere : Update code to do attribute emission using the above method.
12940 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12942 * expression.cs (IsParamsMethodApplicable): if there are not
12943 parameters, return immediately.
12945 * ecore.cs: The 0 literal can be implicity converted to an enum
12948 (SimpleName.DoResolve): First lookup the type, then lookup the
12951 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12952 want to get its address. If the InstanceExpression is not
12953 addressable, store the result in a temporary variable, then get
12956 * codegen.cs: Only display 219 errors on warning level or above.
12958 * expression.cs (ArrayAccess): Make it implement the
12959 IMemoryLocation interface.
12961 (Binary.DoResolve): handle the operator == (object a, object b)
12962 and operator != (object a, object b) without incurring into a
12963 BoxedCast (because 5 != o should never be performed).
12965 Handle binary enumerator operators.
12967 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12968 value type, otherwise use Ldelem_ref.
12970 Use precomputed names;
12972 (AddressOf): Implement address of
12974 * cs-parser.jay (labeled_statement): Fix recursive block
12975 addition by reworking the production.
12977 * expression.cs (New.DoEmit): New has a special case:
12979 If we are dealing with a ValueType, we have a few
12980 situations to deal with:
12982 * The target of New is a ValueType variable, that is
12983 easy, we just pass this as the variable reference
12985 * The target of New is being passed as an argument,
12986 to a boxing operation or a function that takes a
12989 In this case, we need to create a temporary variable
12990 that is the argument of New.
12993 2001-12-23 Ravi Pratap <ravi@ximian.com>
12995 * rootcontext.cs (LookupType): Check that current_type is not null before
12996 going about looking at nested types.
12998 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12999 not implement the IAssignMethod interface any more.
13001 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
13002 where we tranform them into FieldExprs if they are being resolved from within
13003 the declaring type.
13005 * ecore.cs (SimpleName.DoResolve): Do the same here.
13007 * assign.cs (DoResolve, Emit): Clean up code considerably.
13009 * ../errors/bug10.cs : Add.
13011 * ../errors/cs0070.cs : Add.
13013 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
13015 * assign.cs : Get rid of EventIsLocal everywhere.
13017 2001-12-23 Miguel de Icaza <miguel@ximian.com>
13019 * ecore.cs (ConvertIntLiteral): finished the implementation.
13021 * statement.cs (SwitchLabel): Convert the value we are using as a
13022 key before looking up the table.
13024 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13026 * codegen.cs (EmitTopBlock): Require a Location argument now.
13028 * cs-parser.jay (constructor_declarator): We need to setup
13029 current_local_parameters before we parse the
13030 opt_constructor_initializer, to allow the variables to be bound
13031 to the constructor arguments.
13033 * rootcontext.cs (LookupType): First lookup nested classes in our
13034 class and our parents before we go looking outside our class.
13036 * expression.cs (ConstantFold): Extract/debox the values at the
13039 * rootcontext.cs (EmitCode): Resolve the constants first before we
13040 resolve the types. This is not really needed, but it helps debugging.
13042 * statement.cs: report location.
13044 * cs-parser.jay: pass location to throw statement.
13046 * driver.cs: Small bug fix.
13048 * report.cs: Updated format to be 4-zero filled digits.
13050 2001-12-22 Ravi Pratap <ravi@ximian.com>
13052 * expression.cs (CheckIndices): Fix minor bug where the wrong
13053 variable was being referred to ;-)
13055 (DoEmit): Do not call EmitStaticInitializers when the
13056 underlying type is System.Object.
13058 2001-12-21 Ravi Pratap <ravi@ximian.com>
13060 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
13061 and do the usual workaround for SRE.
13063 * class.cs (MyEventBuilder.EventType): New member to get at the type
13064 of the event, quickly.
13066 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
13068 * assign.cs (Assign.DoResolve): Handle the case when the target
13069 is an EventExpr and perform the necessary checks.
13071 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
13074 (SimpleName.MemberStaticCheck): Include check for EventExpr.
13076 (EventExpr): Set the type in the constructor itself since we
13077 are meant to be born fully resolved.
13079 (EventExpr.Define): Revert code I wrote earlier.
13081 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
13082 instance expression is null. The instance expression is a This in that case
13083 or a null, depending on whether it is a static method or not.
13085 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
13086 refers to more than one method.
13088 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
13089 and accordingly flag errors.
13091 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13093 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
13095 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13097 * location.cs (ToString): Provide useful rutine.
13099 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13101 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
13102 objects, return the actual integral boxed.
13104 * statement.cs (SwitchLabel): define an ILLabel for each
13107 (Switch.CheckSwitch): If the value is a Literal, extract
13108 the underlying literal.
13110 Also in the unused hashtable we had, add the SwitchLabel so we can
13111 quickly look this value up.
13113 * constant.cs: Implement a bunch of new constants. Rewrite
13114 Literal based on this. Made changes everywhere to adapt to this.
13116 * expression.cs (Expression.MakeByteBlob): Optimize routine by
13117 dereferencing array only once, and also copes with enumrations.
13119 bytes are two bytes wide, not one.
13121 (Cast): Perform constant conversions.
13123 * ecore.cs (TryImplicitIntConversion): Return literals instead of
13124 wrappers to the literals here.
13126 * expression.cs (DoNumericPromotions): long literals can converted
13127 to ulong implicity (this is taken care of elsewhere, but I was
13128 missing this spot).
13130 * ecore.cs (Expression.Literalize): Make the return type Literal,
13131 to improve type checking.
13133 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
13135 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13137 * literal.cs: Revert code from ravi that checked the bounds. The
13138 bounds are sane by the definition of the type itself.
13140 * typemanager.cs: Fix implementation of ImplementsInterface. We
13141 need to actually look up in our parent hierarchy for interfaces
13144 * const.cs: Use the underlying type for enumerations
13146 * delegate.cs: Compute the basename for the delegate creation,
13147 that should fix the delegate test case, and restore the correct
13148 Type Lookup semantics in rootcontext
13150 * rootcontext.cs: Revert Ravi's last patch. The correct way of
13151 referencing a nested type with the Reflection API is using the "+"
13154 * cs-parser.jay: Do not require EOF token at the end.
13156 2001-12-20 Ravi Pratap <ravi@ximian.com>
13158 * rootcontext.cs (LookupType): Concatenate type names with
13159 a '.' instead of a '+' The test suite passes again.
13161 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
13162 field of the enumeration.
13164 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
13165 the case when the member is an EventExpr.
13167 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
13168 static has an associated instance expression.
13170 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
13172 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
13174 * class.cs (Event.Define): Register event and perform appropriate checks
13177 We define the Add and Remove methods even if the use provides none because
13178 in that case, we provide default implementations ourselves.
13180 Define a private field of the type of the event. This is done by the CSC compiler
13181 and we should be doing it too ;-)
13183 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
13184 More methods we use in code we generate.
13186 (multicast_delegate_type, delegate_type): Two separate types since the distinction
13189 (InitCoreTypes): Update accordingly for the above.
13191 * class.cs (Event.Emit): Generate code for default accessors that we provide
13193 (EmitDefaultMethod): Do the job in the above.
13195 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
13198 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13200 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
13201 builders even if we were missing one.
13203 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
13204 pass the Basename as our class name instead of the Name. The
13205 basename will be correctly composed for us.
13207 * parameter.cs (Paramters): Now takes a Location argument.
13209 * decl.cs (DeclSpace.LookupType): Removed convenience function and
13210 make all the code call directly LookupType in RootContext and take
13211 this chance to pass the Location information everywhere.
13213 * Everywhere: pass Location information.
13215 2001-12-19 Miguel de Icaza <miguel@ximian.com>
13217 * class.cs (Constructor.Define): Updated way of detecting the
13218 length of the parameters.
13220 (TypeContainer.DefineType): Use basename as the type name for
13223 (TypeContainer.Define): Do not recursively define types here, as
13224 definition is taken care in order by the RootContext.
13226 * tree.cs: Keep track of namespaces in a per-file basis.
13228 * parameter.cs (Parameter.ComputeSignature): Update to use
13231 (Parameters.GetSignature): ditto.
13233 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
13234 instead of a TypeContainer.
13236 (Interface.SemanticAnalysis): Use `this' instead of our parent to
13237 resolve names. Because we need to be resolve in our context, not
13240 * driver.cs: Implement response files.
13242 * class.cs (TypeContainer.DefineType): If we are defined, do not
13243 redefine ourselves.
13245 (Event.Emit): Emit the code for add/remove handlers.
13246 (Event.Define): Save the MethodBuilders for add/remove.
13248 * typemanager.cs: Use pair here too.
13250 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
13251 DictionaryEntry requires the first argument to be non-null.
13253 (enum_declaration): Compute full name for registering the
13256 (delegate_declaration): Instead of using
13257 formal_parameter_list, use opt_formal_parameter_list as the list
13260 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
13261 (EventParsing): New property that controls whether `add' and
13262 `remove' are returned as tokens or identifiers (for events);
13264 2001-12-19 Ravi Pratap <ravi@ximian.com>
13266 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
13267 use MyEventBuilder only and let it wrap the real builder for us.
13269 (MyEventBuilder): Revamp constructor etc.
13271 Implement all operations that we perform on EventBuilder in precisely the same
13274 (FindMembers): Update to use the EventBuilder member.
13276 (Event.Emit): Update accordingly.
13278 2001-12-18 Ravi Pratap <ravi@ximian.com>
13280 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
13281 by calling the appropriate methods.
13283 (GetCustomAttributes): Make stubs as they cannot possibly do anything
13286 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
13288 2001-12-17 Ravi Pratap <ravi@ximian.com>
13290 * delegate.cs (Delegate.Populate): Check that the return type
13291 and various parameters types are indeed accessible.
13293 * class.cs (Constructor.Define): Same here.
13295 (Field.Define): Ditto.
13297 (Event.Define): Ditto.
13299 (Operator.Define): Check that the underlying Method defined itself
13300 correctly - so it's MethodBuilder should not be null.
13302 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
13303 expression happens to be null.
13305 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
13306 members but as of now we don't seem to be able to do anything really useful with it.
13308 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
13309 not the EventBuilder.
13311 2001-12-18 Miguel de Icaza <miguel@ximian.com>
13313 * cs-tokenizer.cs: Add support for defines.
13314 Add support for #if, #elif, #else, #endif
13316 (eval_var): evaluates a variable.
13317 (eval): stubbed for evaluating functions.
13319 * cs-parser.jay: Pass the defines information
13321 * driver.cs: Add --define command line option.
13323 * decl.cs: Move MemberCore here.
13325 Make it the base class for DeclSpace. This allows us to catch and
13326 report 108 and 109 for everything now.
13328 * class.cs (TypeContainer.Define): Extract all the members
13329 before populating and emit the warning 108 (new keyword required
13330 to override) instead of having each member implement this.
13332 (MemberCore.Define): New abstract method, we will be using this in
13333 the warning reporting engine in Populate.
13335 (Operator.Define): Adjust to new MemberCore protocol.
13337 * const.cs (Const): This does not derive from Expression, it is a
13338 temporary object we use to create fields, it is a MemberCore.
13340 * class.cs (Method.Define): Allow the entry point to be in a
13343 * driver.cs: Rewrite the argument handler to clean it up a bit.
13345 * rootcontext.cs: Made it just an auxiliary namespace feature by
13346 making everything static.
13348 * driver.cs: Adapt code to use RootContext type name instead of
13351 * delegate.cs: Remove RootContext argument.
13353 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
13356 * class.cs (Event.Define): The lookup can fail.
13358 * cs-tokenizer.cs: Begin implementation of pre-procesor.
13360 * expression.cs: Resolve the this instance before invoking the code.
13362 2001-12-17 Miguel de Icaza <miguel@ximian.com>
13364 * cs-parser.jay: Add a production in element_access that allows
13365 the thing to become a "type" reference. This way we can parse
13366 things like "(string [])" as a type.
13368 Note that this still does not handle the more complex rules of
13372 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
13374 * ecore.cs: (CopyNewMethods): new utility function used to
13375 assemble the list of methods from running FindMembers.
13377 (MemberLookup): Rework FindMembers so that
13379 2001-12-16 Miguel de Icaza <miguel@ximian.com>
13381 * class.cs (TypeContainer): Remove Delegates who fail to be
13384 * delegate.cs (Populate): Verify that we dont get null return
13385 values. TODO: Check for AsAccessible.
13387 * cs-parser.jay: Use basename to emit error 574 (destructor should
13388 have the same name as container class), not the full name.
13390 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
13391 possible representation.
13393 Also implements integer type suffixes U and L.
13395 2001-12-15 Miguel de Icaza <miguel@ximian.com>
13397 * expression.cs (ArrayCreation.DoResolve): We need to do the
13398 argument resolution *always*.
13400 * decl.cs: Make this hold the namespace. Hold the root context as
13402 (LookupType): Move here.
13404 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
13406 * location.cs (Row, Name): Fixed the code, it was always returning
13407 references to the first file.
13409 * interface.cs: Register properties defined through interfaces.
13411 * driver.cs: Add support for globbing on the command line
13413 * class.cs (Field): Make it derive from MemberCore as well.
13416 2001-12-15 Ravi Pratap <ravi@ximian.com>
13418 * class.cs (Event::Define): Check that the type of the event is a delegate
13419 type else flag error #66.
13421 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
13424 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
13425 values of EntryPoint, CharSet etc etc.
13427 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
13429 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
13430 be null and we should ignore this. I am not sure if this is really clean. Apparently,
13431 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
13432 which needs this to do its work.
13434 * ../errors/cs0066.cs : Add.
13436 2001-12-14 Miguel de Icaza <miguel@ximian.com>
13438 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
13441 * class.cs: (MethodSignature.MethodSignature): Removed hack that
13442 clears out the parameters field.
13443 (MemberSignatureCompare): Cleanup
13445 (MemberCore): New base class used to share code between MethodCore
13448 (RegisterRequiredImplementations) BindingFlags.Public requires
13449 either BindingFlags.Instace or Static. Use instance here.
13451 (Property): Refactored code to cope better with the full spec.
13453 * parameter.cs (GetParameterInfo): Return an empty array instead
13456 * class.cs (Property): Abstract or extern properties have no bodies.
13458 * parameter.cs (GetParameterInfo): return a zero-sized array.
13460 * class.cs (TypeContainer.MethodModifiersValid): Move all the
13461 method modifier validation to the typecontainer so we can reuse
13462 this on properties.
13464 (MethodCore.ParameterTypes): return an empty sized array of types.
13466 (Property.Define): Test property modifier validity.
13468 Add tests for sealed/override too.
13470 (Method.Emit): abstract or extern methods have no bodies.
13472 2001-12-14 Ravi Pratap <ravi@ximian.com>
13474 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
13477 (Method::Define, ::Emit): Modify accordingly.
13479 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
13481 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
13483 * makefile: Pass in /unsafe.
13485 2001-12-13 Miguel de Icaza <miguel@ximian.com>
13487 * class.cs (MakeKey): Kill routine.
13489 * class.cs (TypeContainer.Define): Correctly define explicit
13490 method implementations (they require the full interface name plus
13493 * typemanager.cs: Deply the PtrHashtable here and stop using the
13494 lame keys. Things work so much better.
13496 This of course broke everyone who depended on `RegisterMethod' to
13497 do the `test for existance' test. This has to be done elsewhere.
13499 * support.cs (PtrHashtable): A hashtable that avoid comparing with
13500 the object stupid Equals method (because, that like fails all over
13501 the place). We still do not use it.
13503 * class.cs (TypeContainer.SetRequiredInterface,
13504 TypeContainer.RequireMethods): Killed these two routines and moved
13505 all the functionality to RegisterRequiredImplementations.
13507 (TypeContainer.RegisterRequiredImplementations): This routine now
13508 registers all the implementations required in an array for the
13509 interfaces and abstract methods. We use an array of structures
13510 which can be computed ahead of time to reduce memory usage and we
13511 also assume that lookups are cheap as most classes will not
13512 implement too many interfaces.
13514 We also avoid creating too many MethodSignatures.
13516 (TypeContainer.IsInterfaceMethod): Update and optionally does not
13517 clear the "pending" bit if we find that there are problems with
13520 (TypeContainer.VerifyPendingMethods): Update to report errors of
13521 methods that look like implementations but are not.
13523 (TypeContainer.Define): Add support for explicit interface method
13526 2001-12-12 Miguel de Icaza <miguel@ximian.com>
13528 * typemanager.cs: Keep track of the parameters here instead of
13529 being a feature of the TypeContainer.
13531 * class.cs: Drop the registration of parameters here, as
13532 InterfaceMethods are also interface declarations.
13534 * delegate.cs: Register methods with the TypeManager not only with
13535 the TypeContainer. This code was buggy.
13537 * interface.cs: Full registation here.
13539 2001-12-11 Miguel de Icaza <miguel@ximian.com>
13541 * expression.cs: Remove reducer for binary expressions, it can not
13544 * const.cs: Put here the code that used to go into constant.cs
13546 * constant.cs: Put here the code for constants, this is a new base
13547 class for Literals.
13549 * literal.cs: Make Literal derive from Constant.
13551 2001-12-09 Miguel de Icaza <miguel@ximian.com>
13553 * statement.cs (Return.Emit): Report error 157 if the user
13554 attempts to return from a finally block.
13556 (Return.Emit): Instead of emitting a return, jump to the end of
13559 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
13560 LocalBuilder to store the result of the function. ReturnLabel is
13561 the target where we jump.
13564 2001-12-09 Radek Doulik <rodo@ximian.com>
13566 * cs-parser.jay: remember alias in current namespace
13568 * ecore.cs (SimpleName::DoResolve): use aliases for types or
13571 * class.cs (LookupAlias): lookup alias in my_namespace
13573 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
13575 (LookupAlias): lookup alias in this and if needed in parent
13578 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13582 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13583 making things static. I need this to avoid passing the
13584 TypeContainer when calling ParameterType.
13586 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13587 that did string manipulation to compute the type and then call
13588 GetType. Use Parameter.ParameterType instead.
13590 * cs-tokenizer.cs: Consume the suffix for floating values.
13592 * expression.cs (ParameterReference): figure out whether this is a
13593 reference parameter or not. Kill an extra variable by computing
13594 the arg_idx during emission.
13596 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13597 function that returns whether a parameter is an out/ref value or not.
13599 (Parameter.ParameterType): The type of the parameter (base,
13600 without ref/out applied).
13602 (Parameter.Resolve): Perform resolution here.
13603 (Parameter.ExternalType): The full type (with ref/out applied).
13605 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13606 support for expressions on the using statement.
13608 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13610 * statement.cs (Using.EmitLocalVariableDecls): Split the
13611 localvariable handling of the using statement.
13613 (Block.EmitMeta): Keep track of variable count across blocks. We
13614 were reusing slots on separate branches of blocks.
13616 (Try.Emit): Emit the general code block, we were not emitting it.
13618 Check the type of the declaration to be an IDisposable or
13619 something that can be implicity converted to it.
13621 Emit conversions if required.
13623 * ecore.cs (EmptyExpression): New utility class.
13624 (Expression.ImplicitConversionExists): New utility function.
13626 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13628 * statement.cs (Using): Implement.
13630 * expression.cs (LocalVariableReference): Support read only variables.
13632 * statement.cs: Remove the explicit emit for the Leave opcode.
13633 (VariableInfo): Add a readonly field.
13635 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13637 * ecore.cs (ConvCast): new class used to encapsulate the various
13638 explicit integer conversions that works in both checked and
13639 unchecked contexts.
13641 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13642 properly generate the overflow opcodes.
13644 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13646 * statement.cs: The correct type for the EmptyExpression is the
13647 element_type, not the variable type. Ravi pointed this out.
13649 2001-12-04 Ravi Pratap <ravi@ximian.com>
13651 * class.cs (Method::Define): Handle PInvoke methods specially
13652 by using DefinePInvokeMethod instead of the usual one.
13654 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13655 above to do the task of extracting information and defining the method.
13657 2001-12-04 Ravi Pratap <ravi@ximian.com>
13659 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13660 of the condition for string type.
13662 (Emit): Move that here.
13664 (ArrayCreation::CheckIndices): Keep string literals in their expression
13667 (EmitDynamicInitializers): Handle strings appropriately.
13669 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13671 * codegen.cs (EmitContext): Replace multiple variables with a
13672 single pointer to the current Switch statement.
13674 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13677 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13681 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13684 (Foreach.Emit): Foreach on arrays was not setting
13685 up the loop variables (for break/continue).
13687 (GotoCase): Semi-implented.
13689 2001-12-03 Ravi Pratap <ravi@ximian.com>
13691 * attribute.cs (CheckAttribute): Handle system attributes by using
13692 Attribute.GetAttributes to examine information we need.
13694 (GetValidPlaces): Same here.
13696 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13698 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13700 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13702 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13704 (Method::Emit): Handle the case when we are a PInvoke method.
13706 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13708 * expression.cs: Use ResolveWithSimpleName on compound names.
13710 2001-12-02 Ravi Pratap <ravi@ximian.com>
13712 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13713 before trying to reduce it.
13715 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13717 * constant.cs (LookupConstantValue): Implement.
13719 (EmitConstant): Use the above in emitting the constant.
13721 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13722 that are user-defined by doing a LookupConstantValue on them.
13724 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13727 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13729 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13731 (BaseAccess.DoResolve): Implement.
13733 (MemberAccess.DoResolve): Split this routine into a
13734 ResolveMemberAccess routine that can be used independently
13736 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13738 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13739 As that share bits of the implementation. Is returns a boolean,
13740 while As returns the Type that is being probed.
13742 2001-12-01 Ravi Pratap <ravi@ximian.com>
13744 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13745 instead of a Literal - much easier.
13747 (EnumInTransit): Remove - utterly useless :-)
13749 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13751 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13753 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13754 chain when we have no associated expression.
13756 2001-11-30 Ravi Pratap <ravi@ximian.com>
13758 * constant.cs (Define): Use Location while reporting the errror.
13760 Also emit a warning when 'new' is used and there is no inherited
13763 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
13766 (LookupEnumValue): Implement to lookup an enum member's value and define it
13769 (Populate): Re-write accordingly to use the above routine.
13771 2001-11-27 Miguel de Icaza <miguel@ximian.com>
13773 * expression.cs (This): Fix prototype for DoResolveLValue to
13774 override the base class DoResolveLValue.
13776 * cs-parser.cs: Report errors cs574 and cs575 (destructor
13779 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
13780 (we need to load the address of the field here). This fixes
13783 (FieldExpr.DoResolveLValue): Call the DoResolve
13784 function to initialize the Instance expression.
13786 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
13787 correctly the GetEnumerator operation on a value type.
13789 * cs-parser.jay: Add more simple parsing error catches.
13791 * statement.cs (Switch): Add support for string switches.
13792 Handle null specially.
13794 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
13796 2001-11-28 Ravi Pratap <ravi@ximian.com>
13798 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
13800 (declare_local_constant): New helper function.
13802 * statement.cs (AddConstant): Keep a separate record of constants
13804 (IsConstant): Implement to determine if a variable is a constant.
13806 (GetConstantExpression): Implement.
13808 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
13810 * statement.cs (IsVariableDefined): Re-write.
13812 2001-11-27 Ravi Pratap <ravi@ximian.com>
13814 * class.cs (TypeContainer::FindMembers): Look for constants
13815 in the case when we are looking for MemberTypes.Field
13817 * expression.cs (MemberAccess::DoResolve): Check that in the
13818 case we are a FieldExpr and a Literal, we are not being accessed
13819 by an instance reference.
13821 * cs-parser.jay (local_constant_declaration): Implement.
13823 (declaration_statement): Implement for constant declarations.
13825 2001-11-26 Miguel de Icaza <miguel@ximian.com>
13827 * statement.cs (Switch): Catch double defaults.
13829 (Switch): More work on the switch() statement
13830 implementation. It works for integral values now, need to finish
13834 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13836 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
13837 integer literals into other integer literals. To be used by
13840 2001-11-24 Ravi Pratap <ravi@ximian.com>
13842 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
13845 (EmitDynamicInitializers): Cope with the above since we extract data
13846 directly from ArrayData now.
13848 (ExpectInitializers): Keep track of whether initializers are mandatory
13851 (Bounds): Make it a hashtable to prevent the same dimension being
13852 recorded for every element in that dimension.
13854 (EmitDynamicInitializers): Fix bug which prevented the Set array method
13857 Also fix bug which was causing the indices to be emitted in the reverse
13860 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13862 * expression.cs (ArrayCreation): Implement the bits that Ravi left
13863 unfinished. They do not work, because the underlying code is
13866 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13868 * cs-parser.jay: Remove bogus fixme.
13870 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
13871 on Switch statement.
13873 2001-11-23 Ravi Pratap <ravi@ximian.com>
13875 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
13878 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
13879 parameter. Apparently, any expression is allowed.
13881 (ValidateInitializers): Update accordingly.
13883 (CheckIndices): Fix some tricky bugs thanks to recursion.
13885 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
13886 I was being completely brain-dead.
13888 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
13889 and re-write acordingly.
13891 (DelegateInvocation): Re-write accordingly.
13893 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
13895 (MakeByteBlob): Handle types more correctly.
13897 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
13898 initialization from expressions but it is incomplete because I am a complete
13901 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13903 * statement.cs (If.Emit): Fix a bug that generated incorrect code
13904 on If. Basically, we have to return `true' (ie, we do return to
13905 our caller) only if both branches of the if return.
13907 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
13908 short-circuit operators, handle them as short circuit operators.
13910 (Cast.DoResolve): Resolve type.
13911 (Cast.Cast): Take an expression as the target type.
13913 * cs-parser.jay (cast_expression): Remove old hack that only
13914 allowed a limited set of types to be handled. Now we take a
13915 unary_expression and we resolve to a type during semantic
13918 Use the grammar productions from Rhys to handle casts (this is
13919 not complete like Rhys syntax yet, we fail to handle that corner
13920 case that C# has regarding (-x), but we will get there.
13922 2001-11-22 Ravi Pratap <ravi@ximian.com>
13924 * class.cs (EmitFieldInitializer): Take care of the case when we have a
13925 field which is an array type.
13927 * cs-parser.jay (declare_local_variables): Support array initialization too.
13929 * typemanager.cs (MakeKey): Implement.
13931 (everywhere): Use the above appropriately.
13933 * cs-parser.jay (for_statement): Update for array initialization while
13934 declaring variables.
13936 * ecore.cs : The error message was correct, it's the variable's names that
13937 were misleading ;-) Make the code more readable.
13939 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13940 the correct type etc.
13942 (ConvertExplicit): Handle Enum types by examining the underlying type.
13944 2001-11-21 Ravi Pratap <ravi@ximian.com>
13946 * parameter.cs (GetCallingConvention): Always return
13947 CallingConventions.Standard for now.
13949 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13951 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13952 and `r' after calling DoNumericPromotions.
13954 * ecore.cs: Fix error message (the types were in the wrong order).
13956 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13957 BindingFlags.Instance as well
13959 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13960 implicit int literal conversion in an empty cast so that we
13961 propagate the right type upstream.
13963 (UnboxCast): new class used to unbox value types.
13964 (Expression.ConvertExplicit): Add explicit type conversions done
13967 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13968 the target type before applying the implicit LongLiterals to ULong
13971 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13973 * cs-parser.jay (for_statement): Reworked the way For works: now
13974 we declare manually any variables that are introduced in
13975 for_initializer to solve the problem of having out-of-band code
13976 emition (that is what got for broken).
13978 (declaration_statement): Perform the actual variable declaration
13979 that used to be done in local_variable_declaration here.
13981 (local_variable_declaration): Do not declare anything, just pass
13982 the information on a DictionaryEntry
13984 2001-11-20 Ravi Pratap <ravi@ximian.com>
13986 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13987 re-write of the logic to now make it recursive.
13989 (UpdateIndices): Re-write accordingly.
13991 Store element data in a separate ArrayData list in the above methods.
13993 (MakeByteBlob): Implement to dump the array data into a byte array.
13995 2001-11-19 Ravi Pratap <ravi@ximian.com>
13997 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
14000 * constant.cs (Define): Implement.
14002 (EmitConstant): Re-write fully.
14004 Pass in location info.
14006 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
14009 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
14010 DictionaryEntry since we need location info too.
14012 (constant_declaration): Update accordingly.
14014 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
14015 code into another method : UpdateIndices.
14017 2001-11-18 Ravi Pratap <ravi@ximian.com>
14019 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
14020 some type checking etc.
14022 2001-11-17 Ravi Pratap <ravi@ximian.com>
14024 * expression.cs (ArrayCreation::ValidateInitializers): Implement
14025 bits to provide dimension info if the user skips doing that.
14027 Update second constructor to store the rank correctly.
14029 2001-11-16 Ravi Pratap <ravi@ximian.com>
14031 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
14032 and try to implement.
14034 * ../errors/cs0150.cs : Add.
14036 * ../errors/cs0178.cs : Add.
14038 2001-11-16 Miguel de Icaza <miguel@ximian.com>
14040 * statement.cs: Implement foreach on multi-dimensional arrays.
14042 * parameter.cs (Parameters.GetParameterByName): Also lookup the
14043 name of the params argument.
14045 * expression.cs: Use EmitStoreOpcode to get the right opcode while
14046 initializing the array.
14048 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
14049 we can use this elsewhere.
14051 * statement.cs: Finish implementation of foreach for single
14054 * cs-parser.jay: Use an out-of-band stack to pass information
14055 around, I wonder why I need this.
14057 foreach_block: Make the new foreach_block the current_block.
14059 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
14060 function used to return a static Parameters structure. Used for
14061 empty parameters, as those are created very frequently.
14063 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
14065 2001-11-15 Ravi Pratap <ravi@ximian.com>
14067 * interface.cs : Default modifier is private, not public. The
14068 make verify test passes again.
14070 2001-11-15 Ravi Pratap <ravi@ximian.com>
14072 * support.cs (ReflectionParameters): Fix logic to determine
14073 whether the last parameter is a params one. Test 9 passes again.
14075 * delegate.cs (Populate): Register the builders we define with
14076 RegisterParameterForBuilder. Test 19 passes again.
14078 * cs-parser.jay (property_declaration): Reference $6 instead
14079 of $$ to get at the location.
14081 (indexer_declaration): Similar stuff.
14083 (attribute): Ditto.
14085 * class.cs (Property): Register parameters for the Get and Set methods
14086 if they exist. Test 23 passes again.
14088 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
14089 call to EmitArguments as we are sure there aren't any params arguments.
14090 Test 32 passes again.
14092 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
14093 IndexOutOfRangeException.
14095 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
14096 Test 33 now passes again.
14098 2001-11-15 Miguel de Icaza <miguel@ximian.com>
14100 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
14101 broke a bunch of things. Will have to come up with a better way
14102 of tracking locations.
14104 * statement.cs: Implemented foreach for single dimension arrays.
14106 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14108 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
14109 an error. This removes the lookup from the critical path.
14111 * cs-parser.jay: Removed use of temporary_loc, which is completely
14114 2001-11-14 Miguel de Icaza <miguel@ximian.com>
14116 * support.cs (ReflectionParameters.ParameterModifier): Report
14117 whether the argument is a PARAMS argument or not.
14119 * class.cs: Set the attribute `ParamArrayAttribute' on the
14120 parameter argument.
14122 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
14123 and cons_param_array_attribute (ConstructorInfo for
14124 ParamArrayAttribute).,
14126 * codegen.cs: Emit the return using the `Return' statement, that
14127 way we can report the error correctly for missing return values.
14129 * class.cs (Method.Emit): Clean up.
14131 * expression.cs (Argument.Resolve): Take another argument: the
14132 location where this argument is used. Notice that this is not
14133 part of the "Argument" class as to reduce the size of the
14134 structure (we know the approximate location anyways).
14136 Test if the argument is a variable-reference, if not, then
14137 complain with a 206.
14139 (Argument.Emit): Emit addresses of variables.
14141 (Argument.FullDesc): Simplify.
14143 (Invocation.DoResolve): Update for Argument.Resolve.
14145 (ElementAccess.DoResolve): ditto.
14147 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
14148 method should be virtual, as this method is always virtual.
14150 (NewDelegate.DoResolve): Update for Argument.Resolve.
14152 * class.cs (ConstructorInitializer.DoResolve): ditto.
14154 * attribute.cs (Attribute.Resolve): ditto.
14156 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14158 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
14160 * expression.cs (ParameterReference): Drop IStackStorage and implement
14161 IAssignMethod instead.
14163 (LocalVariableReference): ditto.
14165 * ecore.cs (FieldExpr): Drop IStackStorage and implement
14166 IAssignMethod instead.
14168 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14170 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
14171 enumerations that are used in heavily used structures derive from
14172 byte in a laughable and pathetic attempt to reduce memory usage.
14173 This is the kind of pre-optimzations that you should not do at
14174 home without adult supervision.
14176 * expression.cs (UnaryMutator): New class, used to handle ++ and
14177 -- separatedly from the other unary operators. Cleans up the
14178 code, and kills the ExpressionStatement dependency in Unary.
14180 (Unary): Removed `method' and `Arguments' from this class, making
14181 it smaller, and moving it all to SimpleCall, so I can reuse this
14182 code in other locations and avoid creating a lot of transient data
14183 strucutres when not required.
14185 * cs-parser.jay: Adjust for new changes.
14187 2001-11-11 Miguel de Icaza <miguel@ximian.com>
14189 * enum.cs (Enum.Populate): If there is a failure during
14192 * cs-parser.jay (opt_enum_base): we used to catch type errors
14193 here, but this is really incorrect. The type error should be
14194 catched during semantic analysis.
14196 2001-12-11 Ravi Pratap <ravi@ximian.com>
14198 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
14199 current_local_parameters as expected since I, in my stupidity, had forgotten
14202 * attribute.cs (GetValidPlaces): Fix stupid bug.
14204 * class.cs (Method::Emit): Perform check on applicability of attributes.
14206 (Constructor::Emit): Ditto.
14208 (Field::Emit): Ditto.
14210 (Field.Location): Store location information.
14212 (Property, Event, Indexer, Operator): Ditto.
14214 * cs-parser.jay (field_declaration): Pass in location for each field.
14216 * ../errors/cs0592.cs : Add.
14218 2001-11-12 Ravi Pratap <ravi@ximian.com>
14220 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
14222 (InitCoreTypes): Update accordingly.
14224 (RegisterAttrType, LookupAttr): Implement.
14226 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
14227 info about the same.
14229 (Resolve): Update to populate the above as necessary.
14231 (Error592): Helper.
14233 (GetValidPlaces): Helper to the above.
14235 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
14237 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
14239 2001-11-12 Ravi Pratap <ravi@ximian.com>
14241 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
14243 * ../errors/cs0617.cs : Add.
14245 2001-11-11 Ravi Pratap <ravi@ximian.com>
14247 * enum.cs (Emit): Rename to Populate to be more consistent with what
14248 we expect it to do and when exactly it is called.
14250 * class.cs, rootcontext.cs : Update accordingly.
14252 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
14253 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
14255 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
14257 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
14258 of a fieldinfo using the above, when dealing with a FieldBuilder.
14260 2001-11-10 Ravi Pratap <ravi@ximian.com>
14262 * ../errors/cs0031.cs : Add.
14264 * ../errors/cs1008.cs : Add.
14266 * ../errrors/cs0543.cs : Add.
14268 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
14271 (FindMembers): Implement.
14273 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
14274 enums and delegates too.
14276 (enum_types): Rename to builder_to_enum.
14278 (delegate_types): Rename to builder_to_delegate.
14280 * delegate.cs (FindMembers): Implement.
14282 2001-11-09 Ravi Pratap <ravi@ximian.com>
14284 * typemanager.cs (IsEnumType): Implement.
14286 * enum.cs (Emit): Re-write parts to account for the underlying type
14287 better and perform checking etc.
14289 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
14290 of the underlying type.
14292 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
14295 * enum.cs (error31): Helper to report error #31.
14297 * cs-parser.jay (enum_declaration): Store location of each member too.
14299 * enum.cs (member_to_location): New hashtable.
14301 (AddEnumMember): Update location hashtable.
14303 (Emit): Use the location of each member while reporting errors.
14305 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14307 * cs-parser.jay: A for_initializer if is a
14308 local_variable_declaration really ammount to have an implicit
14309 block with the variable declaration and no initializer for for.
14311 * statement.cs (For.Emit): Cope with null initializers.
14313 This fixes the infinite loop on for initializers.
14315 2001-11-08 Miguel de Icaza <miguel@ximian.com>
14317 * enum.cs: More cleanup.
14319 * ecore.cs: Remove dead code.
14321 * class.cs (Property.Emit): More simplification.
14322 (Event.Emit): ditto.
14324 Reworked to have less levels of indentation.
14326 2001-11-08 Ravi Pratap <ravi@ximian.com>
14328 * class.cs (Property): Emit attributes.
14338 * enum.cs (Emit): Ditto.
14340 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
14343 * class.cs (Field, Event, etc.): Move attribute generation into the
14344 Emit method everywhere.
14346 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
14347 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
14348 as we had no way of defining nested enums !
14350 * rootcontext.cs : Adjust code accordingly.
14352 * typemanager.cs (AddEnumType): To keep track of enum types separately.
14354 2001-11-07 Ravi Pratap <ravi@ximian.com>
14356 * expression.cs (EvalConstantExpression): Move into ecore.cs
14358 * enum.cs (Enum): Rename some members and make them public and readonly
14359 according to our convention.
14361 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
14364 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
14366 (Enum::Emit): Write a simple version for now which doesn't try to compute
14367 expressions. I shall modify this to be more robust in just a while.
14369 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
14371 (TypeContainer::CloseType): Create the Enum types too.
14373 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
14375 * expression.cs (EvalConstantExpression): Get rid of completely.
14377 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
14378 user-defined values and other cases.
14380 (IsValidEnumLiteral): Helper function.
14382 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
14383 out there in the case we had a literal FieldExpr.
14385 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
14387 (Literalize): Revamp a bit to take two arguments.
14389 (EnumLiteral): New class which derives from Literal to wrap enum literals.
14391 2001-11-06 Ravi Pratap <ravi@ximian.com>
14393 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
14395 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
14397 (Resolve): Use the above to ensure we have proper initializers.
14399 2001-11-05 Ravi Pratap <ravi@ximian.com>
14401 * expression.cs (Expression::EvalConstantExpression): New method to
14402 evaluate constant expressions.
14404 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
14406 2001-11-07 Miguel de Icaza <miguel@ximian.com>
14408 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
14411 (Binary.ResolveOperator): Handle operator != (object a, object b)
14412 and operator == (object a, object b);
14414 (Binary.DoNumericPromotions): Indicate whether the numeric
14415 promotion was possible.
14417 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
14420 Made the ArrayAccess implement interface IAssignMethod instead of
14421 IStackStore as the order in which arguments are passed reflects
14424 * assign.cs: Instead of using expr.ExprClass to select the way of
14425 assinging, probe for the IStackStore/IAssignMethod interfaces.
14427 * typemanager.cs: Load InitializeArray definition.
14429 * rootcontext.cs (RootContext.MakeStaticData): Used to define
14430 static data that can be used to initialize arrays.
14432 2001-11-05 Miguel de Icaza <miguel@ximian.com>
14434 * expression.cs: Handle operator== and operator!= for booleans.
14436 (Conditioal.Reduce): Implement reducer for the ?: operator.
14438 (Conditional.Resolve): Implement dead code elimination.
14440 (Binary.Resolve): Catch string literals and return a new
14441 concatenated string.
14443 (Unary.Reduce): Implement reduction of unary expressions.
14445 * ecore.cs: Split out the expression core handling here.
14447 (Expression.Reduce): New method used to perform constant folding
14448 and CSE. This is needed to support constant-expressions.
14450 * statement.cs (Statement.EmitBoolExpression): Pass true and false
14451 targets, and optimize for !x.
14453 2001-11-04 Ravi Pratap <ravi@ximian.com>
14455 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
14456 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
14457 set custom atttributes.
14459 * literal.cs (Literal::GetValue): New abstract method to return the actual
14460 value of the literal, cast as an object.
14462 (*Literal): Implement GetValue method.
14464 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
14465 expressions to the arraylist but objects of type Argument.
14467 * class.cs (TypeContainer::Emit): Emit our attributes too.
14469 (Method::Emit, Constructor::Emit): Ditto.
14471 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
14472 to be ignoring earlier.
14474 2001-11-03 Ravi Pratap <ravi@ximian.com>
14476 * attribute.cs (AttributeSection::Define): Implement to do the business
14477 of constructing a CustomAttributeBuilder.
14479 (Attribute): New trivial class. Increases readability of code.
14481 * cs-parser.jay : Update accordingly.
14483 (positional_argument_list, named_argument_list, named_argument): New rules
14485 (attribute_arguments): Use the above so that we are more correct.
14487 2001-11-02 Ravi Pratap <ravi@ximian.com>
14489 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
14490 to perform all checks for a method with a params parameter.
14492 (Invocation::OverloadResolve): Update to use the above method and therefore
14493 cope correctly with params method invocations.
14495 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
14498 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
14499 constructors in our parent too because we can't afford to miss out on
14502 * attribute.cs (AttributeSection): New name for the class Attribute
14504 Other trivial changes to improve readability.
14506 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
14507 use the new class names.
14509 2001-11-01 Ravi Pratap <ravi@ximian.com>
14511 * class.cs (Method::Define): Complete definition for params types too
14513 (Indexer::Define): Ditto.
14515 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
14516 Cope everywhere with a request for info about the array parameter.
14518 2001-11-01 Ravi Pratap <ravi@ximian.com>
14520 * tree.cs (RecordNamespace): Fix up to check for the correct key.
14522 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
14523 local_variable_type to extract the string corresponding to the type.
14525 (local_variable_type): Fixup the action to use the new helper method.
14527 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
14530 * expression.cs : Clean out code which uses the above.
14532 2001-10-31 Ravi Pratap <ravi@ximian.com>
14534 * typemanager.cs (RegisterMethod): Check if we already have an existing key
14535 and bale out if necessary by returning a false.
14537 (RegisterProperty): Ditto.
14539 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
14540 and print out appropriate error messages.
14542 * interface.cs (everywhere): Ditto.
14544 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
14545 location to constructor.
14547 * class.cs (Property, Event, Indexer): Update accordingly.
14549 * ../errors/cs111.cs : Added.
14551 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
14552 of a method, as laid down by the spec.
14554 (Invocation::OverloadResolve): Use the above method.
14556 2001-10-31 Ravi Pratap <ravi@ximian.com>
14558 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
14559 now take a TypeContainer and a Parameters object.
14561 (ParameterData): Modify return type of ParameterModifier method to be
14562 Parameter.Modifier and not a string.
14564 (ReflectionParameters, InternalParameters): Update accordingly.
14566 * expression.cs (Argument::GetParameterModifier): Same here.
14568 * support.cs (InternalParameters::ParameterType): Find a better way of determining
14569 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
14570 symbol in it at all so maybe this is only for now.
14572 2001-10-30 Ravi Pratap <ravi@ximian.com>
14574 * support.cs (InternalParameters): Constructor now takes an extra argument
14575 which is the actual Parameters class.
14577 (ParameterDesc): Update to provide info on ref/out modifiers.
14579 * class.cs (everywhere): Update call to InternalParameters to pass in
14580 the second argument too.
14582 * support.cs (ParameterData): Add ParameterModifier, which is a method
14583 to return the modifier info [ref/out etc]
14585 (InternalParameters, ReflectionParameters): Implement the above.
14587 * expression.cs (Argument::ParameterModifier): Similar function to return
14588 info about the argument's modifiers.
14590 (Invocation::OverloadResolve): Update to take into account matching modifiers
14593 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14594 a new SetFormalParameters object which we pass to InternalParameters.
14596 2001-10-30 Ravi Pratap <ravi@ximian.com>
14598 * expression.cs (NewArray): Merge into the ArrayCreation class.
14600 2001-10-29 Ravi Pratap <ravi@ximian.com>
14602 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14603 NewUserdefinedArray into one as there wasn't much of a use in having
14606 * expression.cs (Argument): Change field's name to ArgType from Type.
14608 (Type): New readonly property which returns the proper type, taking into
14609 account ref/out modifiers.
14611 (everywhere): Adjust code accordingly for the above.
14613 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14614 whether we are emitting for a ref or out parameter.
14616 * expression.cs (Argument::Emit): Use the above field to set the state.
14618 (LocalVariableReference::Emit): Update to honour the flag and emit the
14621 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14623 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14625 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14627 (ReflectionParameters, InternalParameters): Implement the above method.
14629 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14632 (Invocation::FullMethodDesc): Ditto.
14634 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14636 * cs-parser.jay: Add extra production for the second form of array
14639 * expression.cs (ArrayCreation): Update to reflect the above
14642 * Small changes to prepare for Array initialization.
14644 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14646 * typemanager.cs (ImplementsInterface): interface might be null;
14647 Deal with this problem;
14649 Also, we do store negative hits on the cache (null values), so use
14650 this instead of calling t.GetInterfaces on the type everytime.
14652 2001-10-28 Ravi Pratap <ravi@ximian.com>
14654 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14656 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14657 split functionality out into different classes.
14659 (New::FormArrayType): Move into NewBuiltinArray.
14661 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14664 (NewBuiltinArray): New class to handle creation of built-in arrays.
14666 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14667 account creation of one-dimensional arrays.
14669 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14671 (NewUserdefinedArray::DoResolve): Implement.
14673 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14675 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14676 we maintain inside the TypeManager. This is necessary to perform lookups on the
14679 (LookupType): Update to perform GetType on the module builders too.
14681 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14683 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14685 2001-10-23 Ravi Pratap <ravi@ximian.com>
14687 * expression.cs (New::DoResolve): Implement guts of array creation.
14689 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14691 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14693 * expression.cs: Fix bug I introduced lsat night that broke
14696 (Expression.Resolve): Report a 246 error (can not resolve name)
14697 if we find a SimpleName in the stream.
14699 (Expression.ResolveLValue): Ditto.
14701 (Expression.ResolveWithSimpleName): This function is a variant of
14702 ResolveName, this one allows SimpleNames to be returned without a
14703 warning. The only consumer of SimpleNames is MemberAccess
14705 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14707 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14708 might arrive here. I have my doubts that this is correct.
14710 * statement.cs (Lock): Implement lock statement.
14712 * cs-parser.jay: Small fixes to support `lock' and `using'
14714 * cs-tokenizer.cs: Remove extra space
14716 * driver.cs: New flag --checked, allows to turn on integer math
14719 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14720 Threading.Monitor.Exit
14722 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14724 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14725 Expression Class to be IndexerAccess.
14727 Notice that Indexer::DoResolve sets the eclass to Value.
14729 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14731 * class.cs (TypeContainer::Emit): Emit code for indexers.
14733 * assign.cs (IAssignMethod): New interface implemented by Indexers
14734 and Properties for handling assignment.
14736 (Assign::Emit): Simplify and reuse code.
14738 * expression.cs (IndexerAccess, PropertyExpr): Implement
14739 IAssignMethod, clean up old code.
14741 2001-10-22 Ravi Pratap <ravi@ximian.com>
14743 * typemanager.cs (ImplementsInterface): New method to determine if a type
14744 implements a given interface. Provides a nice cache too.
14746 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14749 (ConvertReferenceExplicit): Ditto.
14751 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14752 various methods, with correct names etc.
14754 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14755 Operator.UnaryNegation.
14757 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14758 we have a unary plus or minus operator.
14760 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
14763 * everywhere : update accordingly.
14765 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
14768 * class.cs (Method::Define): For the case where we are implementing a method
14769 inherited from an interface, we need to set the MethodAttributes.Final flag too.
14770 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
14772 2001-10-21 Ravi Pratap <ravi@ximian.com>
14774 * interface.cs (FindMembers): Implement to work around S.R.E
14777 * typemanager.cs (IsInterfaceType): Implement.
14779 (FindMembers): Update to handle interface types too.
14781 * expression.cs (ImplicitReferenceConversion): Re-write bits which
14782 use IsAssignableFrom as that is not correct - it doesn't work.
14784 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
14785 and accordingly override EmitStatement.
14787 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
14788 using the correct logic :-)
14790 2001-10-19 Ravi Pratap <ravi@ximian.com>
14792 * ../errors/cs-11.cs : Add to demonstrate error -11
14794 2001-10-17 Miguel de Icaza <miguel@ximian.com>
14796 * assign.cs (Assign::Resolve): Resolve right hand side first, and
14797 then pass this as a hint to ResolveLValue.
14799 * expression.cs (FieldExpr): Add Location information
14801 (FieldExpr::LValueResolve): Report assignment to readonly
14804 (Expression::ExprClassFromMemberInfo): Pass location information.
14806 (Expression::ResolveLValue): Add new method that resolves an
14809 (Expression::DoResolveLValue): Default invocation calls
14812 (Indexers): New class used to keep track of indexers in a given
14815 (IStackStore): Renamed from LValue, as it did not really describe
14816 what this did. Also ResolveLValue is gone from this interface and
14817 now is part of Expression.
14819 (ElementAccess): Depending on the element access type
14821 * typemanager.cs: Add `indexer_name_type' as a Core type
14822 (System.Runtime.CompilerServices.IndexerNameAttribute)
14824 * statement.cs (Goto): Take a location.
14826 2001-10-18 Ravi Pratap <ravi@ximian.com>
14828 * delegate.cs (Delegate::VerifyDelegate): New method to verify
14829 if two delegates are compatible.
14831 (NewDelegate::DoResolve): Update to take care of the case when
14832 we instantiate a delegate from another delegate.
14834 * typemanager.cs (FindMembers): Don't even try to look up members
14835 of Delegate types for now.
14837 2001-10-18 Ravi Pratap <ravi@ximian.com>
14839 * delegate.cs (NewDelegate): New class to take care of delegate
14842 * expression.cs (New): Split the delegate related code out into
14843 the NewDelegate class.
14845 * delegate.cs (DelegateInvocation): New class to handle delegate
14848 * expression.cs (Invocation): Split out delegate related code into
14849 the DelegateInvocation class.
14851 2001-10-17 Ravi Pratap <ravi@ximian.com>
14853 * expression.cs (New::DoResolve): Implement delegate creation fully
14854 and according to the spec.
14856 (New::DoEmit): Update to handle delegates differently.
14858 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
14859 because of which we were printing out arguments in reverse order !
14861 * delegate.cs (VerifyMethod): Implement to check if the given method
14862 matches the delegate.
14864 (FullDelegateDesc): Implement.
14866 (VerifyApplicability): Implement.
14868 * expression.cs (Invocation::DoResolve): Update to accordingly handle
14869 delegate invocations too.
14871 (Invocation::Emit): Ditto.
14873 * ../errors/cs1593.cs : Added.
14875 * ../errors/cs1594.cs : Added.
14877 * delegate.cs (InstanceExpression, TargetMethod): New properties.
14879 2001-10-16 Ravi Pratap <ravi@ximian.com>
14881 * typemanager.cs (intptr_type): Core type for System.IntPtr
14883 (InitCoreTypes): Update for the same.
14885 (iasyncresult_type, asynccallback_type): Ditto.
14887 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
14890 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
14893 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
14894 the builders for the 4 members of a delegate type :-)
14896 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
14899 * expression.cs (New::DoResolve): Implement guts for delegate creation.
14901 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
14903 2001-10-15 Miguel de Icaza <miguel@ximian.com>
14905 * statement.cs (Break::Emit): Implement.
14906 (Continue::Emit): Implement.
14908 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
14909 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
14910 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
14911 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
14914 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
14915 properties that track the label for the current loop (begin of the
14916 loop and end of the loop).
14918 2001-10-15 Ravi Pratap <ravi@ximian.com>
14920 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
14921 use of emitting anything at all.
14923 * class.cs, rootcontext.cs : Get rid of calls to the same.
14925 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
14927 (Populate): Define the constructor correctly and set the implementation
14930 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14933 (AddDelegateType): Implement.
14935 (IsDelegateType): Implement helper method.
14937 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14939 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14940 and accordingly handle it.
14942 * delegate.cs (Populate): Take TypeContainer argument.
14943 Implement bits to define the Invoke method. However, I still haven't figured out
14944 how to take care of the native int bit :-(
14946 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14947 Qualify the name of the delegate, not its return type !
14949 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14952 (StandardConversionExists): Checking for array types turns out to be recursive.
14954 (ConvertReferenceExplicit): Implement array conversion.
14956 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14958 2001-10-12 Ravi Pratap <ravi@ximian.com>
14960 * cs-parser.jay (delegate_declaration): Store the fully qualified
14961 name as it is a type declaration.
14963 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14966 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14967 as TypeContainer::DefineType.
14969 (Populate): Method in which all the definition of the various methods (Invoke)
14972 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14975 (CloseDelegate): Finally creates the delegate.
14977 * class.cs (TypeContainer::DefineType): Update to define delegates.
14978 (Populate, Emit and CloseType): Do the same thing here too.
14980 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14981 delegates in all these operations.
14983 2001-10-14 Miguel de Icaza <miguel@ximian.com>
14985 * expression.cs: LocalTemporary: a new expression used to
14986 reference a temporary that has been created.
14988 * assign.cs: Handle PropertyAccess back here, so that we can
14989 provide the proper semantic access to properties.
14991 * expression.cs (Expression::ConvertReferenceExplicit): Implement
14992 a few more explicit conversions.
14994 * modifiers.cs: `NEW' modifier maps to HideBySig.
14996 * expression.cs (PropertyExpr): Make this into an
14997 ExpressionStatement, and support the EmitStatement code path.
14999 Perform get/set error checking, clean up the interface.
15001 * assign.cs: recognize PropertyExprs as targets, and if so, turn
15002 them into toplevel access objects.
15004 2001-10-12 Miguel de Icaza <miguel@ximian.com>
15006 * expression.cs: PropertyExpr::PropertyExpr: use work around the
15009 * typemanager.cs: Keep track here of our PropertyBuilders again to
15010 work around lameness in SRE.
15012 2001-10-11 Miguel de Icaza <miguel@ximian.com>
15014 * expression.cs (LValue::LValueResolve): New method in the
15015 interface, used to perform a second resolution pass for LValues.
15017 (This::DoResolve): Catch the use of this in static methods.
15019 (This::LValueResolve): Implement.
15021 (This::Store): Remove warning, assigning to `this' in structures
15024 (Invocation::Emit): Deal with invocation of
15025 methods on value types. We need to pass the address to structure
15026 methods rather than the object itself. (The equivalent code to
15027 emit "this" for structures leaves the entire structure on the
15028 stack instead of a pointer to it).
15030 (ParameterReference::DoResolve): Compute the real index for the
15031 argument based on whether the method takes or not a `this' pointer
15032 (ie, the method is static).
15034 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
15035 value types returned from functions when we need to invoke a
15036 method on the sturcture.
15039 2001-10-11 Ravi Pratap <ravi@ximian.com>
15041 * class.cs (TypeContainer::DefineType): Method to actually do the business of
15042 defining the type in the Modulebuilder or Typebuilder. This is to take
15043 care of nested types which need to be defined on the TypeBuilder using
15044 DefineNestedMethod.
15046 (TypeContainer::GetClassBases): Implement. Essentially the code from the
15047 methods in RootContext, only ported to be part of TypeContainer.
15049 (TypeContainer::GetInterfaceOrClass): Ditto.
15051 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
15053 * interface.cs (Interface::DefineInterface): New method. Does exactly
15054 what RootContext.CreateInterface did earlier, only it takes care of nested types
15057 (Interface::GetInterfaces): Move from RootContext here and port.
15059 (Interface::GetInterfaceByName): Same here.
15061 * rootcontext.cs (ResolveTree): Re-write.
15063 (PopulateTypes): Re-write.
15065 * class.cs (TypeContainer::Populate): Populate nested types too.
15066 (TypeContainer::Emit): Emit nested members too.
15068 * typemanager.cs (AddUserType): Do not make use of the FullName property,
15069 instead just use the name argument passed in as it is already fully
15072 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
15073 to TypeContainer mapping to see if a type is user-defined.
15075 * class.cs (TypeContainer::CloseType): Implement.
15077 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
15078 the default constructor.
15080 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
15083 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
15085 * interface.cs (CloseType): Create the type here.
15087 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
15090 Remove all the methods which are now in TypeContainer.
15092 2001-10-10 Ravi Pratap <ravi@ximian.com>
15094 * delegate.cs (Define): Re-write bits to define the delegate
15097 2001-10-10 Miguel de Icaza <miguel@ximian.com>
15099 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
15101 * expression.cs (ImplicitReferenceConversion): handle null as well
15102 as a source to convert to any reference type.
15104 * statement.cs (Return): Perform any implicit conversions to
15105 expected return type.
15107 Validate use of return statement.
15109 * codegen.cs (EmitContext): Pass the expected return type here.
15111 * class.cs (Method, Constructor, Property): Pass expected return
15112 type to EmitContext.
15114 2001-10-09 Miguel de Icaza <miguel@ximian.com>
15116 * expression.cs: Make DoResolve take an EmitContext instead of a
15119 Replaced `l' and `location' for `loc', for consistency.
15121 (Error, Warning): Remove unneeded Tc argument.
15123 * assign.cs, literal.cs, constant.cs: Update to new calling
15126 * codegen.cs: EmitContext now contains a flag indicating whether
15127 code is being generated in a static method or not.
15129 * cs-parser.jay: DecomposeQI, new function that replaces the old
15130 QualifiedIdentifier. Now we always decompose the assembled
15131 strings from qualified_identifier productions into a group of
15134 2001-10-08 Miguel de Icaza <miguel@ximian.com>
15136 * rootcontext.cs: Deal with field-less struct types correctly now
15137 by passing the size option to Define Type.
15139 * class.cs: Removed hack that created one static field.
15141 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15143 * statement.cs: Moved most of the code generation here.
15145 2001-10-09 Ravi Pratap <ravi@ximian.com>
15147 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
15150 (ElementAccess): Remove useless bits for now - keep checks as the spec
15153 2001-10-08 Ravi Pratap <ravi@ximian.com>
15155 * expression.cs (ElementAccess::DoResolve): Remove my crap code
15156 and start performing checks according to the spec.
15158 2001-10-07 Ravi Pratap <ravi@ximian.com>
15160 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
15161 rank_specifiers instead.
15163 (rank_specifiers): Change the order in which the rank specifiers are stored
15165 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
15167 * expression.cs (ElementAccess): Implement the LValue interface too.
15169 2001-10-06 Ravi Pratap <ravi@ximian.com>
15171 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
15172 except that user defined conversions are not included.
15174 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
15175 perform the conversion of the return type, if necessary.
15177 (New::DoResolve): Check whether we are creating an array or an object
15178 and accordingly do the needful.
15180 (New::Emit): Same here.
15182 (New::DoResolve): Implement guts of array creation.
15184 (New::FormLookupType): Helper function.
15186 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15188 * codegen.cs: Removed most of the code generation here, and move the
15189 corresponding code generation bits to the statement classes.
15191 Added support for try/catch/finalize and throw.
15193 * cs-parser.jay: Added support for try/catch/finalize.
15195 * class.cs: Catch static methods having the flags override,
15196 virtual or abstract.
15198 * expression.cs (UserCast): This user cast was not really doing
15199 what it was supposed to do. Which is to be born in fully resolved
15200 state. Parts of the resolution were being performed at Emit time!
15204 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15206 * expression.cs: Implicity convert the result from UserCast.
15208 2001-10-05 Ravi Pratap <ravi@ximian.com>
15210 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
15211 prevented it from working correctly.
15213 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
15214 merely ConvertImplicit.
15216 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15218 * typemanager.cs: Make the LookupTypeContainer function static,
15219 and not per-instance.
15221 * class.cs: Make static FindMembers (the one that takes a Type
15224 * codegen.cs: Add EmitForeach here.
15226 * cs-parser.jay: Make foreach a toplevel object instead of the
15227 inline expansion, as we need to perform semantic analysis on it.
15229 2001-10-05 Ravi Pratap <ravi@ximian.com>
15231 * expression.cs (Expression::ImplicitUserConversion): Rename to
15232 UserDefinedConversion.
15234 (Expression::UserDefinedConversion): Take an extra argument specifying
15235 whether we look for explicit user conversions too.
15237 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
15239 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
15241 (ExplicitUserConversion): Make it a call to UserDefinedConversion
15242 with the appropriate arguments.
15244 * cs-parser.jay (cast_expression): Record location too.
15246 * expression.cs (Cast): Record location info.
15248 (Expression::ConvertExplicit): Take location argument.
15250 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
15251 to determine if we are doing explicit conversions.
15253 (UserCast::Emit): Update accordingly.
15255 (Expression::ConvertExplicit): Report an error if everything fails.
15257 * ../errors/cs0030.cs : Add.
15259 2001-10-04 Miguel de Icaza <miguel@ximian.com>
15261 * modifiers.cs: If the ABSTRACT keyword is present, also set the
15262 virtual and newslot bits.
15264 * class.cs (TypeContainer::RegisterRequiredImplementations):
15265 Record methods we need.
15267 (TypeContainer::MakeKey): Helper function to make keys for
15268 MethodBases, since the Methodbase key is useless.
15270 (TypeContainer::Populate): Call RegisterRequiredImplementations
15271 before defining the methods.
15273 Create a mapping for method_builders_to_methods ahead of time
15274 instead of inside a tight loop.
15276 (::RequireMethods): Accept an object as the data to set into the
15277 hashtable so we can report interface vs abstract method mismatch.
15279 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15281 * report.cs: Make all of it static.
15283 * rootcontext.cs: Drop object_type and value_type computations, as
15284 we have those in the TypeManager anyways.
15286 Drop report instance variable too, now it is a global.
15288 * driver.cs: Use try/catch on command line handling.
15290 Add --probe option to debug the error reporting system with a test
15293 * report.cs: Add support for exiting program when a probe
15294 condition is reached.
15296 2001-10-03 Ravi Pratap <ravi@ximian.com>
15298 * expression.cs (Binary::DoNumericPromotions): Fix the case when
15299 we do a forcible conversion regardless of type, to check if
15300 ForceConversion returns a null.
15302 (Binary::error19): Use location to report error.
15304 (Unary::error23): Use location here too.
15306 * ../errors/cs0019.cs : Check in.
15308 * ../errors/cs0023.cs : Check in.
15310 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
15311 case of a non-null MethodInfo object with a length of 0 !
15313 (Binary::ResolveOperator): Flag error if overload resolution fails to find
15314 an applicable member - according to the spec :-)
15315 Also fix logic to find members in base types.
15317 (Unary::ResolveOperator): Same here.
15319 (Unary::report23): Change name to error23 and make first argument a TypeContainer
15320 as I was getting thoroughly confused between this and error19 :-)
15322 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
15323 (::FindMostEncompassedType): Implement.
15324 (::FindMostEncompassingType): Implement.
15325 (::StandardConversionExists): Implement.
15327 (UserImplicitCast): Re-vamp. We now need info about most specific
15328 source and target types so that we can do the necessary conversions.
15330 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
15331 mathematical union with no duplicates.
15333 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15335 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
15336 in order from base classes to child classes, so that we can in
15337 child classes look up in our parent for method names and
15338 attributes (required for handling abstract, virtual, new, override
15339 constructs: we need to instrospect our base class, and if we dont
15340 populate the classes in order, the introspection might be
15341 incorrect. For example, a method could query its parent before
15342 the parent has any methods and would determine that the parent has
15343 no abstract methods (while it could have had them)).
15345 (RootContext::CreateType): Record the order in which we define the
15348 2001-10-02 Miguel de Icaza <miguel@ximian.com>
15350 * class.cs (TypeContainer::Populate): Also method definitions can
15351 fail now, keep track of this.
15353 (TypeContainer::FindMembers): Implement support for
15354 DeclaredOnly/noDeclaredOnly flag.
15356 (Constructor::Emit) Return the ConstructorBuilder.
15358 (Method::Emit) Return the MethodBuilder.
15359 Check for abstract or virtual methods to be public.
15361 * rootcontext.cs (RootContext::CreateType): Register all the
15362 abstract methods required for the class to be complete and the
15363 interface methods that must be implemented.
15365 * cs-parser.jay: Report error 501 (method requires body if it is
15366 not marked abstract or extern).
15368 * expression.cs (TypeOf::Emit): Implement.
15370 * typemanager.cs: runtime_handle_type, new global type.
15372 * class.cs (Property::Emit): Generate code for properties.
15374 2001-10-02 Ravi Pratap <ravi@ximian.com>
15376 * expression.cs (Unary::ResolveOperator): Find operators on base type
15377 too - we now conform exactly to the spec.
15379 (Binary::ResolveOperator): Same here.
15381 * class.cs (Operator::Define): Fix minor quirk in the tests.
15383 * ../errors/cs0215.cs : Added.
15385 * ../errors/cs0556.cs : Added.
15387 * ../errors/cs0555.cs : Added.
15389 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15391 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
15392 single integer which is really efficient
15394 2001-10-01 Ravi Pratap <ravi@ximian.com>
15396 * expression.cs (Expression::ImplicitUserConversion): Use location
15397 even in the case when we are examining True operators.
15399 * class.cs (Operator::Define): Perform extensive checks to conform
15400 with the rules for operator overloading in the spec.
15402 * expression.cs (Expression::ImplicitReferenceConversion): Implement
15403 some of the other conversions mentioned in the spec.
15405 * typemanager.cs (array_type): New static member for the System.Array built-in
15408 (cloneable_interface): For System.ICloneable interface.
15410 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
15411 we start resolving the tree and populating types.
15413 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
15415 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15417 * expression.cs (Expression::ExprClassFromMemberInfo,
15418 Expression::Literalize): Create literal expressions from
15419 FieldInfos which are literals.
15421 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
15422 type casts, because they were wrong. The test suite in tests
15425 (ImplicitNumericConversion): ushort to ulong requires a widening
15428 Int32 constant to long requires widening cast as well.
15430 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
15431 for integers because the type on the stack is not i4.
15433 2001-09-30 Miguel de Icaza <miguel@ximian.com>
15435 * expression.cs (report118): require location argument.
15437 * parameter.cs: Do not dereference potential null value.
15439 * class.cs: Catch methods that lack the `new' keyword when
15440 overriding a name. Report warnings when `new' is used without
15441 anything being there to override.
15443 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
15445 * class.cs: Only add constructor to hashtable if it is non-null
15446 (as now constructors can fail on define).
15448 (TypeManager, Class, Struct): Take location arguments.
15450 Catch field instance initialization in structs as errors.
15452 accepting_filter: a new filter for FindMembers that is static so
15453 that we dont create an instance per invocation.
15455 (Constructor::Define): Catch errors where a struct constructor is
15458 * cs-parser.jay: Pass location information for various new
15461 * delegate.cs (Delegate): take a location argument.
15463 * driver.cs: Do not call EmitCode if there were problesm in the
15464 Definition of the types, as many Builders wont be there.
15466 * decl.cs (Decl::Decl): Require a location argument.
15468 * cs-tokenizer.cs: Handle properly hex constants that can not fit
15469 into integers, and find the most appropiate integer for it.
15471 * literal.cs: Implement ULongLiteral.
15473 * rootcontext.cs: Provide better information about the location of
15474 failure when CreateType fails.
15476 2001-09-29 Miguel de Icaza <miguel@ximian.com>
15478 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
15481 * expression.cs (Binary::CheckShiftArguments): Add missing type
15483 (Binary::ResolveOperator): Add type to the logical and and logical
15484 or, Bitwise And/Or and Exclusive Or code paths, it was missing
15487 (Binary::DoNumericPromotions): In the case where either argument
15488 is ulong (and most signed types combined with ulong cause an
15489 error) perform implicit integer constant conversions as well.
15491 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15493 * expression.cs (UserImplicitCast): Method should always be
15495 (Invocation::BetterConversion): Simplified test for IntLiteral.
15497 (Expression::ImplicitNumericConversion): Split this routine out.
15498 Put the code that performs implicit constant integer conversions
15501 (Expression::Resolve): Become a wrapper around DoResolve so we can
15502 check eclass and type being set after resolve.
15504 (Invocation::Badness): Remove this dead function
15506 (Binary::ResolveOperator): Do not compute the expensive argumnets
15507 unless we have a union for it.
15509 (Probe::Emit): Is needs to do an isinst and then
15510 compare against null.
15512 (::CanConvert): Added Location argument. If the Location argument
15513 is null (Location.Null), then we do not report errors. This is
15514 used by the `probe' mechanism of the Explicit conversion. We do
15515 not want to generate an error for something that the user
15516 explicitly requested to be casted. But the pipeline for an
15517 explicit cast first tests for potential implicit casts.
15519 So for now, if the Location is null, it means `Probe only' to
15520 avoid adding another argument. Might have to revise this
15523 (ClassCast): New class used to type cast objects into arbitrary
15524 classes (used in Explicit Reference Conversions).
15526 Implement `as' as well.
15528 Reverted all the patches from Ravi below: they were broken:
15530 * The use of `level' as a mechanism to stop recursive
15531 invocations is wrong. That was there just to catch the
15532 bug with a strack trace but not as a way of addressing
15535 To fix the problem we have to *understand* what is going
15536 on and the interactions and come up with a plan, not
15537 just get things going.
15539 * The use of the type conversion cache that I proposed
15540 last night had an open topic: How does this work across
15541 protection domains. A user defined conversion might not
15542 be public in the location where we are applying the
15543 conversion, a different conversion might be selected
15544 (ie, private A->B (better) but public B->A (worse),
15545 inside A, A->B applies, but outside it, B->A will
15548 * On top of that (ie, even if the above is solved),
15549 conversions in a cache need to be abstract. Ie, `To
15550 convert from an Int to a Short use an OpcodeCast', not
15551 `To convert from an Int to a Short use the OpcodeCast on
15552 the variable 5' (which is what this patch was doing).
15554 2001-09-28 Ravi Pratap <ravi@ximian.com>
15556 * expression.cs (Invocation::ConversionExists): Re-write to use
15557 the conversion cache
15559 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
15560 cache all conversions done, not just user-defined ones.
15562 (Invocation::BetterConversion): The real culprit. Use ConversionExists
15563 to determine if a conversion exists instead of acutually trying to
15564 perform the conversion. It's faster too.
15566 (Expression::ConvertExplicit): Modify to use ConversionExists to check
15567 and only then attempt the implicit conversion.
15569 2001-09-28 Ravi Pratap <ravi@ximian.com>
15571 * expression.cs (ConvertImplicit): Use a cache for conversions
15572 already found. Check level of recursion and bail out if necessary.
15574 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15576 * typemanager.cs (string_concat_string_string, string_concat_object_object):
15577 Export standard methods that we expect for string operations.
15579 * statement.cs (Block::UsageWarning): Track usage of variables and
15580 report the errors for not used variables.
15582 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15585 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15587 * codegen.cs: remove unnneded code
15589 * expression.cs: Removed BuiltinTypeAccess class
15591 Fix the order in which implicit conversions are
15594 The previous fixed dropped support for boxed conversions (adding a
15595 test to the test suite now)
15597 (UserImplicitCast::CanConvert): Remove test for source being null,
15598 that code is broken. We should not feed a null to begin with, if
15599 we do, then we should track the bug where the problem originates
15600 and not try to cover it up here.
15602 Return a resolved expression of type UserImplicitCast on success
15603 rather than true/false. Ravi: this is what I was talking about,
15604 the pattern is to use a static method as a "constructor" for
15607 Also, do not create arguments until the very last minute,
15608 otherwise we always create the arguments even for lookups that
15609 will never be performed.
15611 (UserImplicitCast::Resolve): Eliminate, objects of type
15612 UserImplicitCast are born in a fully resolved state.
15614 * typemanager.cs (InitCoreTypes): Init also value_type
15615 (System.ValueType).
15617 * expression.cs (Cast::Resolve): First resolve the child expression.
15619 (LValue): Add new method AddressOf to be used by
15622 Change the argument of Store to take an EmitContext instead of an
15623 ILGenerator, because things like FieldExpr need to be able to call
15624 their children expression to generate the instance code.
15626 (Expression::Error, Expression::Warning): Sugar functions for
15629 (Expression::MemberLookup): Accept a TypeContainer instead of a
15630 Report as the first argument.
15632 (Expression::ResolvePrimary): Killed. I still want to improve
15633 this as currently the code is just not right.
15635 (Expression::ResolveMemberAccess): Simplify, but it is still
15638 (Unary::Resolve): Catch errors in AddressOf operators.
15640 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15641 index to a byte for the short-version, or the compiler will choose
15642 the wrong Emit call, which generates the wrong data.
15644 (ParameterReference::Emit, ::Store): same.
15646 (FieldExpr::AddressOf): Implement.
15648 * typemanager.cs: TypeManager: made public variable instead of
15651 * driver.cs: document --fatal.
15653 * report.cs (ErrorMessage, WarningMessage): new names for the old
15654 Error and Warning classes.
15656 * cs-parser.jay (member_access): Turn built-in access to types
15657 into a normal simplename
15659 2001-09-27 Ravi Pratap <ravi@ximian.com>
15661 * expression.cs (Invocation::BetterConversion): Fix to cope
15662 with q being null, since this was introducing a bug.
15664 * expression.cs (ConvertImplicit): Do built-in conversions first.
15666 2001-09-27 Ravi Pratap <ravi@ximian.com>
15668 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15670 2001-09-27 Ravi Pratap <ravi@ximian.com>
15672 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15673 I had introduced long ago (what's new ?).
15675 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15676 the work of all the checking.
15677 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15678 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15680 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15681 that is the right way.
15683 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15684 overloading resolution. Use everywhere instead of cutting and pasting code.
15686 (Binary::ResolveOperator): Use MakeUnionSet.
15688 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15689 we have to convert to bool types. Not complete yet.
15691 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15693 * typemanager.cs (TypeManager::CSharpName): support ushort.
15695 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15696 to provide an expression that performsn an implicit constant int
15697 conversion (section 6.1.6).
15698 (Expression::ConvertImplicitRequired): Reworked to include
15699 implicit constant expression conversions.
15701 (Expression::ConvertNumericExplicit): Finished.
15703 (Invocation::Emit): If InstanceExpression is null, then it means
15704 that we perform a call on this.
15706 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15708 * expression.cs (Unary::Emit): Remove some dead code.
15709 (Probe): Implement Resolve and Emit for `is'.
15710 (Expression::ConvertImplicitRequired): Attempt to do constant
15711 expression conversions here. Maybe should be moved to
15712 ConvertImplicit, but I am not sure.
15713 (Expression::ImplicitLongConstantConversionPossible,
15714 Expression::ImplicitIntConstantConversionPossible): New functions
15715 that tell whether is it possible to apply an implicit constant
15716 expression conversion.
15718 (ConvertNumericExplicit): Started work on explicit numeric
15721 * cs-parser.jay: Update operator constants.
15723 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15724 (Parameters::GetSignature): Hook up VerifyArgs here.
15725 (Parameters::VerifyArgs): Verifies that no two arguments have the
15728 * class.cs (Operator): Update the operator names to reflect the
15729 ones that the spec expects (as we are just stringizing the
15732 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15733 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15734 previous usage did only work for our methods.
15735 (Expression::ConvertImplicit): Handle decimal implicit numeric
15736 conversions as well.
15737 (Expression::InternalTypeConstructor): Used to invoke constructors
15738 on internal types for default promotions.
15740 (Unary::Emit): Implement special handling for the pre/post
15741 increment/decrement for overloaded operators, as they need to have
15742 the same semantics as the other operators.
15744 (Binary::ResolveOperator): ditto.
15745 (Invocation::ConversionExists): ditto.
15746 (UserImplicitCast::Resolve): ditto.
15748 2001-09-26 Ravi Pratap <ravi@ximian.com>
15750 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15751 operator, return after emitting body. Regression tests pass again !
15753 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15754 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15755 (Invocation::OverloadResolve): Ditto.
15756 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15758 * everywhere : update calls to the above methods accordingly.
15760 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15762 * assign.cs (Assign): Make it inherit from ExpressionStatement.
15764 * expression.cs (ExpressionStatement): New base class used for
15765 expressions that can appear in statements, so that we can provide
15766 an alternate path to generate expression that do not leave a value
15769 (Expression::Emit, and all the derivatives): We no longer return
15770 whether a value is left on the stack or not. Every expression
15771 after being emitted leaves a single value on the stack.
15773 * codegen.cs (EmitContext::EmitStatementExpression): Use the
15774 facilties of ExpressionStatement if possible.
15776 * cs-parser.jay: Update statement_expression.
15778 2001-09-25 Miguel de Icaza <miguel@ximian.com>
15780 * driver.cs: Change the wording of message
15782 2001-09-25 Ravi Pratap <ravi@ximian.com>
15784 * expression.cs (Binary::ResolveOperator): Had forgottten to set
15785 the type of the expression to the return type of the method if
15786 we have an overloaded operator match ! The regression tests pass again !
15787 (Unary::ResolveOperator): Ditto.
15789 * expression.cs (Invocation::ConversionExists): Correct the member lookup
15790 to find "op_Implicit", not "implicit" ;-)
15791 (UserImplicitCast): New class to take care of user-defined implicit conversions.
15792 (ConvertImplicit, ForceConversion): Take TypeContainer argument
15794 * everywhere : Correct calls to the above accordingly.
15796 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
15797 (ConvertImplicit): Do user-defined conversion if it exists.
15799 2001-09-24 Miguel de Icaza <miguel@ximian.com>
15801 * assign.cs: track location.
15802 (Resolve): Use implicit conversions on assignment.
15804 * literal.cs: Oops. Not good, Emit of short access values should
15805 pass (Bytes) or the wrong argument will be selected.
15807 * expression.cs (Unary::Emit): Emit code for -expr.
15809 (Unary::ResolveOperator): Handle `Substract' for non-constants
15810 (substract from zero from the non-constants).
15811 Deal with Doubles as well.
15813 (Expression::ConvertImplicitRequired): New routine that reports an
15814 error if no implicit conversion exists.
15816 (Invocation::OverloadResolve): Store the converted implicit
15817 expressions if we make them
15819 2001-09-24 Ravi Pratap <ravi@ximian.com>
15821 * class.cs (ConstructorInitializer): Take a Location argument.
15822 (ConstructorBaseInitializer): Same here.
15823 (ConstructorThisInitializer): Same here.
15825 * cs-parser.jay : Update all calls accordingly.
15827 * expression.cs (Unary, Binary, New): Take location argument.
15828 Update accordingly everywhere.
15830 * cs-parser.jay : Update all calls to the above to take a location
15833 * class.cs : Ditto.
15835 2001-09-24 Ravi Pratap <ravi@ximian.com>
15837 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
15838 (Invocation::BetterConversion): Same here
15839 (Invocation::ConversionExists): Ditto.
15841 (Invocation::ConversionExists): Implement.
15843 2001-09-22 Ravi Pratap <ravi@ximian.com>
15845 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
15846 Also take an additional TypeContainer argument.
15848 * All over : Pass in TypeContainer as argument to OverloadResolve.
15850 * typemanager.cs (CSharpName): Update to check for the string type and return
15853 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
15856 2001-09-21 Ravi Pratap <ravi@ximian.com>
15858 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
15859 (Invocation::BetterFunction): Implement.
15860 (Invocation::BetterConversion): Implement.
15861 (Invocation::ConversionExists): Skeleton, no implementation yet.
15863 Okay, things work fine !
15865 2001-09-21 Miguel de Icaza <miguel@ximian.com>
15867 * typemanager.cs: declare and load enum_type, delegate_type and
15870 * expression.cs (Expression::Emit): Now emit returns a value that
15871 tells whether a value is left on the stack or not. This strategy
15872 might be reveted tomorrow with a mechanism that would address
15873 multiple assignments.
15874 (Expression::report118): Utility routine to report mismatches on
15877 (Unary::Report23): Report impossible type/operator combination
15880 (Unary::IsIncrementableNumber): Whether the type can be
15881 incremented or decremented with add.
15882 (Unary::ResolveOperator): Also allow enumerations to be bitwise
15884 (Unary::ResolveOperator): Implement ++, !, ~,
15886 (Invocation::Emit): Deal with new Emit convetion.
15888 * All Expression derivatives: Updated their Emit method to return
15889 whether they leave values on the stack or not.
15891 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
15892 stack for expressions that are statements.
15894 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15896 * expression.cs (LValue): New interface. Must be implemented by
15898 (LocalVariableReference, ParameterReference, FieldExpr): Implement
15901 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
15902 interface for generating code, simplifies the code.
15904 2001-09-20 Ravi Pratap <ravi@ximian.com>
15906 * expression.cs (everywhere): Comment out return statements in ::Resolve
15907 methods to avoid the warnings.
15909 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15911 * driver.cs (parse): Report error 2001 if we can not open the
15914 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
15917 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
15920 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
15921 otherwise nested blocks end up with the same index.
15923 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
15925 * expression.cs: Instead of having FIXMEs in the Resolve
15926 functions, throw exceptions so it is obvious that we are facing a
15929 * cs-parser.jay (invocation_expression): Pass Location information.
15931 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15932 Use a basename for those routines because .NET does not like paths
15935 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15938 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15940 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15941 are loading the correct data types (throws an exception if not).
15942 (TypeManager::InitCoreTypes): Use CoreLookupType
15944 * expression.cs (Unary::ResolveOperator): return the child
15945 expression for expressions which are just +expr.
15946 (Unary::ResolveOperator): Return negative literals for -LITERAL
15947 expressions (otherwise they are Unary {Literal}).
15948 (Invocation::Badness): Take into account `Implicit constant
15949 expression conversions'.
15951 * literal.cs (LongLiteral): Implement long literal class.
15952 (IntLiteral): export the `Value' of the intliteral.
15954 2001-09-19 Ravi Pratap <ravi@ximian.com>
15956 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15958 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15959 instead of 'Operator'
15961 * expression.cs (Binary::ResolveOperator): Update accordingly.
15962 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15965 * cs-parser.jay (unary_expression): Update to use the new names.
15967 * gen-treedump.cs (GetUnary): Same here.
15969 * expression.cs (Unary::Resolve): Implement.
15970 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15971 operators are found instead of making noise ;-)
15972 (Unary::ResolveOperator): New method to do precisely the same thing which
15973 Binary::ResolveOperator does for Binary expressions.
15974 (Unary.method, .Arguments): Add.
15975 (Unary::OperName): Implement.
15976 (Unary::ForceConversion): Copy and Paste !
15978 * class.cs (Operator::Define): Fix a small bug for the case when we have
15981 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15982 for the inbuilt operators. Only overloading works for now ;-)
15984 2001-09-18 Miguel de Icaza <miguel@ximian.com>
15986 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15987 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15989 * expression.cs (This::Emit): Implement.
15990 (This::Resolve): Implement.
15991 (TypeOf:Resolve): Implement.
15992 (Expression::ResolveSimpleName): Add an implicit this to instance
15994 (MemberAccess::Resolve): Deal with Parameters and Fields.
15995 Bind instance variable to Field expressions.
15996 (FieldExpr::Instance): New field used to track the expression that
15997 represents the object instance.
15998 (FieldExpr::Resolve): Track potential errors from MemberLookup not
16000 (FieldExpr::Emit): Implement.
16002 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
16003 the last instruction contains a return opcode to avoid generating
16004 the last `ret' instruction (this generates correct code, and it is
16005 nice to pass the peverify output).
16007 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
16008 initializer for static and instance variables.
16009 (Constructor::Emit): Allow initializer to be null in the case of
16010 static constructors. Only emit initializer for instance
16013 (TypeContainer::FindMembers): Return a null array if there are no
16016 Also fix the code for the MemberTypes.Method branch, as it was not
16017 scanning that for operators (or tried to access null variables before).
16019 * assign.cs (Assign::Emit): Handle instance and static fields.
16023 * driver.cs: Stop compilation if there are parse errors.
16025 * cs-parser.jay (constructor_declaration): Provide default base
16026 initializer for non-static constructors.
16027 (constructor_declarator): Do not provide a default base
16028 initializers if none was specified.
16029 Catch the fact that constructors should not have parameters.
16031 * class.cs: Do not emit parent class initializers for static
16032 constructors, that should be flagged as an error.
16034 2001-09-18 Ravi Pratap <ravi@ximian.com>
16036 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
16037 Move back code into TypeContainer::Populate.
16039 2001-09-18 Ravi Pratap <ravi@ximian.com>
16041 * class.cs (TypeContainer::AddConstructor): Fix the check to
16042 compare against Name, not Basename.
16043 (Operator::OpType): Change Plus and Minus to Add and Subtract.
16045 * cs-parser.jay : Update accordingly.
16047 * class.cs (TypeContainer::FindMembers): For the case where we are searching
16048 for methods, don't forget to look into the operators too.
16049 (RegisterMethodBuilder): Helper method to take care of this for
16050 methods, constructors and operators.
16051 (Operator::Define): Completely revamp.
16052 (Operator.OperatorMethod, MethodName): New fields.
16053 (TypeContainer::Populate): Move the registering of builders into
16054 RegisterMethodBuilder.
16055 (Operator::Emit): Re-write.
16057 * expression.cs (Binary::Emit): Comment out code path to emit method
16058 invocation stuff for the case when we have a user defined operator. I am
16059 just not able to get it right !
16061 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16063 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
16066 (Expression::MemberLookup): Provide a version that allows to
16067 specify the MemberTypes and BindingFlags.
16069 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
16070 so it was not fetching variable information from outer blocks.
16072 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
16073 Beforefieldinit as it was buggy.
16075 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
16076 that Ravi put here.
16078 * class.cs (Constructor::Emit): Only emit if block is not null.
16079 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
16080 deal with this by semantically definining it as if the user had
16083 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
16084 constructors as we now "emit" them at a higher level.
16086 (TypeContainer::DefineDefaultConstructor): Used to define the
16087 default constructors if none was provided.
16089 (ConstructorInitializer): Add methods Resolve and Emit.
16091 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
16093 2001-09-17 Ravi Pratap <ravi@ximian.com>
16095 * class.cs (TypeContainer::EmitDefaultConstructor): Register
16096 the default constructor builder with our hashtable for methodbuilders
16099 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
16100 and argument_count is 0 in which case we have a match.
16101 (Binary::ResolveOperator): More null checking and miscellaneous coding
16104 2001-09-17 Ravi Pratap <ravi@ximian.com>
16106 * rootcontext.cs (IsNameSpace): Compare against null.
16108 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
16110 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
16111 and Unary::Operator.
16113 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
16116 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
16117 we have overloaded operators.
16118 (Binary::ResolveOperator): Implement the part which does the operator overload
16121 * class.cs (Operator::Emit): Implement.
16122 (TypeContainer::Emit): Emit the operators we have too.
16124 * expression.cs (Binary::Emit): Update to emit the appropriate code for
16125 the case when we have a user-defined operator.
16127 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16129 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
16131 2001-09-16 Ravi Pratap <ravi@ximian.com>
16133 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
16134 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
16135 (Constructor::Emit): Implement.
16136 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
16137 if we have no work to do.
16138 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
16141 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
16142 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
16144 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
16147 2001-09-15 Ravi Pratap <ravi@ximian.com>
16149 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
16151 (Tree::RecordNamespace): Method to do what the name says ;-)
16152 (Tree::Namespaces): Property to get at the namespaces hashtable.
16154 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
16157 * rootcontext.cs (IsNamespace): Fixed it :-)
16159 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16161 * class.cs (TypeContainer::FindMembers): Add support for
16163 (MethodCore): New class that encapsulates both the shared aspects
16164 of a Constructor and a Method.
16165 (Method, Constructor): Factored pieces into MethodCore.
16167 * driver.cs: Added --fatal which makes errors throw exceptions.
16168 Load System assembly as well as part of the standard library.
16170 * report.cs: Allow throwing exceptions on errors for debugging.
16172 * modifiers.cs: Do not use `parent', instead use the real type
16173 container to evaluate permission settings.
16175 * class.cs: Put Ravi's patch back in. He is right, and we will
16176 have to cope with the
16178 2001-09-14 Ravi Pratap <ravi@ximian.com>
16180 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
16181 FamORAssem, not FamANDAssem.
16183 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16185 * driver.cs: Added --parse option that only parses its input files
16188 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
16189 incorrect. IsTopLevel is not used to tell whether an object is
16190 root_types or not (that can be achieved by testing this ==
16191 root_types). But to see if this is a top-level *class* (not
16192 necessarly our "toplevel" container).
16194 2001-09-14 Ravi Pratap <ravi@ximian.com>
16196 * enum.cs (Enum::Define): Modify to call the Lookup method on the
16197 parent instead of a direct call to GetType.
16199 2001-09-14 Ravi Pratap <ravi@ximian.com>
16201 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
16202 Modifiers.TypeAttr. This should just be a call to that method.
16204 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
16205 object so that we can determine if we are top-level or not.
16207 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
16210 * enum.cs (Enum::Define): Ditto.
16212 * modifiers.cs (FieldAttr): Re-write.
16214 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
16215 (TypeContainer::HaveStaticConstructor): New property to provide access
16216 to precisely that info.
16218 * modifiers.cs (MethodAttr): Re-write.
16219 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
16221 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
16222 of top-level types as claimed.
16224 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16226 * expression.cs (MemberLookup): Fruitless attempt to lookup
16227 constructors. Maybe I need to emit default constructors? That
16228 might be it (currently .NET emits this for me automatically).
16229 (Invocation::OverloadResolve): Cope with Arguments == null.
16230 (Invocation::EmitArguments): new function, shared by the new
16231 constructor and us.
16232 (Invocation::Emit): Handle static and instance methods. Emit
16233 proper call instruction for virtual or non-virtual invocations.
16234 (New::Emit): Implement.
16235 (New::Resolve): Implement.
16236 (MemberAccess:Resolve): Implement.
16237 (MethodGroupExpr::InstanceExpression): used conforming to the spec
16238 to track instances.
16239 (FieldExpr::Resolve): Set type.
16241 * support.cs: Handle empty arguments.
16243 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
16244 SimpleLookup): Auxiliary routines to help parse a qualifier
16247 Update qualifier_identifier rule.
16249 * codegen.cs: Removed debugging messages.
16251 * class.cs: Make this a global thing, this acts just as a "key" to
16252 objects that we might have around.
16254 (Populate): Only initialize method_builders_to_methods once.
16256 * expression.cs (PropertyExpr): Initialize type from the
16259 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
16260 Resolve pattern. Attempt to implicitly convert value to boolean.
16263 * expression.cs: Set the type for the int32/int32 argument case.
16264 (Binary::ResolveOperator): Set the return type to boolean for
16265 comparission operators
16267 * typemanager.cs: Remove debugging print code.
16269 (Invocation::Resolve): resolve type.
16271 * class.cs: Allocate a MemberInfo of the correct size, as the code
16272 elsewhere depends on the test to reflect the correct contents.
16274 (Method::) Keep track of parameters, due to System.Reflection holes
16276 (TypeContainer::Populate): Keep track of MethodBuilders to Method
16279 (TypeContainer::FindMembers): Use ArrayList and then copy an array
16280 of the exact size and return that.
16282 (Class::LookupMethodByBuilder): New function that maps
16283 MethodBuilders to its methods. Required to locate the information
16284 on methods because System.Reflection bit us again.
16286 * support.cs: New file, contains an interface ParameterData and
16287 two implementations: ReflectionParameters and InternalParameters
16288 used to access Parameter information. We will need to grow this
16291 * expression.cs (Invocation::GetParameterData): implement a cache
16292 and a wrapper around the ParameterData creation for methods.
16293 (Invocation::OverloadResolve): Use new code.
16295 2001-09-13 Ravi Pratap <ravi@ximian.com>
16297 * class.cs (TypeContainer::EmitField): Remove and move into
16298 (Field::Define): here and modify accordingly.
16299 (Field.FieldBuilder): New member.
16300 (TypeContainer::Populate): Update accordingly.
16301 (TypeContainer::FindMembers): Implement.
16303 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16305 * statement.cs: (VariableInfo::VariableType): New field to be
16306 initialized with the full type once it is resolved.
16308 2001-09-12 Miguel de Icaza <miguel@ximian.com>
16310 * parameter.cs (GetParameterInfo): Use a type cache to compute
16311 things only once, and to reuse this information
16313 * expression.cs (LocalVariableReference::Emit): Implement.
16314 (OpcodeCast::Emit): fix.
16316 (ParameterReference::Resolve): Implement.
16317 (ParameterReference::Emit): Implement.
16319 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
16320 that are expressions need to stay as Expressions.
16322 * typemanager.cs (CSharpName): Returns the C# name of a type if
16325 * expression.cs (Expression::ConvertImplicit): New function that
16326 implements implicit type conversions.
16328 (Expression::ImplicitReferenceConversion): Implements implicit
16329 reference conversions.
16331 (EmptyCast): New type for transparent casts.
16333 (OpcodeCast): New type for casts of types that are performed with
16334 a sequence of bytecodes.
16336 (BoxedCast): New type used for casting value types into reference
16337 types. Emits a box opcode.
16339 (Binary::DoNumericPromotions): Implements numeric promotions of
16340 and computation of the Binary::Type.
16342 (Binary::EmitBranchable): Optimization.
16344 (Binary::Emit): Implement code emission for expressions.
16346 * typemanager.cs (TypeManager): Added two new core types: sbyte
16349 2001-09-12 Ravi Pratap <ravi@ximian.com>
16351 * class.cs (TypeContainer::FindMembers): Method which does exactly
16352 what Type.FindMembers does, only we don't have to use reflection. No
16353 implementation yet.
16355 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
16356 typecontainer objects as we need to get at them.
16357 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
16359 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
16360 typecontainer object.
16362 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
16363 of just a Report object.
16365 2001-09-11 Ravi Pratap <ravi@ximian.com>
16367 * class.cs (Event::Define): Go back to using the prefixes "add_" and
16369 (TypeContainer::Populate): Now define the delegates of the type too.
16370 (TypeContainer.Delegates): Property to access the list of delegates defined
16373 * delegates.cs (Delegate::Define): Implement partially.
16375 * modifiers.cs (TypeAttr): Handle more flags.
16377 2001-09-11 Ravi Pratap <ravi@ximian.com>
16379 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
16381 (Operator::Define): Re-write logic to get types by using the LookupType method
16382 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
16383 (Indexer::Define): Ditto.
16384 (Event::Define): Ditto.
16385 (Property::Define): Ditto.
16387 2001-09-10 Ravi Pratap <ravi@ximian.com>
16389 * class.cs (TypeContainer::Populate): Now define operators too.
16390 (TypeContainer.Operators): New property to access the list of operators
16392 (Operator.OperatorMethodBuilder): New member to hold the method builder
16393 for the operator we are defining.
16394 (Operator::Define): Implement.
16396 2001-09-10 Ravi Pratap <ravi@ximian.com>
16398 * class.cs (Event::Define): Make the prefixes of the accessor methods
16399 addOn_ and removeOn_
16401 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
16402 of the location being passed in too. Ideally, this should go later since all
16403 error reporting should be done through the Report object.
16405 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
16406 (Populate): Iterate thru the indexers we have and define them too.
16407 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
16408 for the get and set accessors.
16409 (Indexer::Define): Implement.
16411 2001-09-09 Miguel de Icaza <miguel@ximian.com>
16413 * expression.cs (Binary::Resolve): Beginning of it. I scratched
16414 my previous implementation, did not work.
16416 * typemanager.cs: Add a couple of missing types (the longs).
16418 * literal.cs: Use TypeManager.bool_type instead of getting it.
16420 * expression.cs (EventExpr): New kind of expressions.
16421 (Expressio::ExprClassFromMemberInfo): finish
16423 2001-09-08 Miguel de Icaza <miguel@ximian.com>
16425 * assign.cs: Emit stores to static fields differently.
16427 2001-09-08 Ravi Pratap <ravi@ximian.com>
16429 * Merge in changes and adjust code to tackle conflicts. Backed out my
16430 code in Assign::Resolve ;-)
16432 2001-09-08 Ravi Pratap <ravi@ximian.com>
16434 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
16435 instead Report.Error and also pass in the location.
16436 (CSharpParser::Lexer): New readonly property to return the reference
16437 to the Tokenizer object.
16438 (declare_local_variables): Use Report.Error with location instead of plain
16442 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
16443 (Operator.CheckBinaryOperator): Ditto.
16445 * cs-parser.jay (operator_declarator): Update accordingly.
16447 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
16448 (CheckBinaryOperator): Same here.
16450 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
16451 on the name without any prefixes of namespace names etc. This is because we
16452 already might have something already fully qualified like
16453 'System.Console.WriteLine'
16455 * assign.cs (Resolve): Begin implementation. Stuck ;-)
16457 2001-09-07 Ravi Pratap <ravi@ximian.com>
16459 * cs-tokenizer.cs (location): Return a string which also contains
16462 * expression.cs (ElementAccess): New class for expressions of the
16463 type 'element access.'
16464 (BaseAccess): New class for expressions of the type 'base access.'
16465 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
16468 * cs-parser.jay (element_access): Implement action.
16469 (base_access): Implement actions.
16470 (checked_expression, unchecked_expression): Implement.
16472 * cs-parser.jay (local_variable_type): Correct and implement.
16473 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
16475 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
16477 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
16478 name and the specifiers.
16480 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
16482 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
16483 making them all public ;-)
16485 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
16488 2001-09-07 Miguel de Icaza <miguel@ximian.com>
16490 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
16492 (FieldExpr, PropertyExprs): New resolved expressions.
16493 (SimpleName::MemberStaticCheck): Perform static checks for access
16494 to non-static fields on static methods. Maybe this should be
16495 generalized for MemberAccesses.
16496 (SimpleName::ResolveSimpleName): More work on simple name
16499 * cs-parser.jay (primary_expression/qualified_identifier): track
16500 the parameter index.
16502 * codegen.cs (CodeGen::Save): Catch save exception, report error.
16503 (EmitContext::EmitBoolExpression): Chain to expression generation
16504 instead of temporary hack.
16505 (::EmitStatementExpression): Put generic expression code generation.
16507 * assign.cs (Assign::Emit): Implement variable assignments to
16508 local variables, parameters and fields.
16510 2001-09-06 Miguel de Icaza <miguel@ximian.com>
16512 * statement.cs (Block::GetVariableInfo): New method, returns the
16513 VariableInfo for a variable name in a block.
16514 (Block::GetVariableType): Implement in terms of GetVariableInfo
16516 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
16517 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
16519 2001-09-06 Ravi Pratap <ravi@ximian.com>
16521 * cs-parser.jay (operator_declaration): Continue on my quest : update
16522 to take attributes argument.
16523 (event_declaration): Ditto.
16524 (enum_declaration): Ditto.
16525 (indexer_declaration): Ditto.
16527 * class.cs (Operator::Operator): Update constructor accordingly.
16528 (Event::Event): Ditto.
16530 * delegate.cs (Delegate::Delegate): Same here.
16532 * enum.cs (Enum::Enum): Same here.
16534 2001-09-05 Ravi Pratap <ravi@ximian.com>
16536 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
16538 * ../tests/cs0658.cs : New file to demonstrate error 0658.
16540 * attribute.cs (Attributes): New class to encapsulate all attributes which were
16541 being passed around as an arraylist.
16542 (Attributes::AddAttribute): Method to add attribute sections.
16544 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
16545 (struct_declaration): Update accordingly.
16546 (constant_declaration): Update.
16547 (field_declaration): Update.
16548 (method_header): Update.
16549 (fixed_parameter): Update.
16550 (parameter_array): Ditto.
16551 (property_declaration): Ditto.
16552 (destructor_declaration): Ditto.
16554 * class.cs (Struct::Struct): Update constructors accordingly.
16555 (Class::Class): Ditto.
16556 (Field::Field): Ditto.
16557 (Method::Method): Ditto.
16558 (Property::Property): Ditto.
16559 (TypeContainer::OptAttribute): update property's return type.
16561 * interface.cs (Interface.opt_attributes): New member.
16562 (Interface::Interface): Update to take the extra Attributes argument.
16564 * parameter.cs (Parameter::Parameter): Ditto.
16566 * constant.cs (Constant::Constant): Ditto.
16568 * interface.cs (InterfaceMemberBase): New OptAttributes field.
16569 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
16570 the attributes as a parameter.
16571 (InterfaceProperty): Update constructor call.
16572 (InterfaceEvent): Ditto.
16573 (InterfaceMethod): Ditto.
16574 (InterfaceIndexer): Ditto.
16576 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
16577 pass the attributes too.
16578 (interface_event_declaration): Ditto.
16579 (interface_property_declaration): Ditto.
16580 (interface_method_declaration): Ditto.
16581 (interface_declaration): Ditto.
16583 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16585 * class.cs (Method::Define): Track the "static Main" definition to
16586 create an entry point.
16588 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16589 EntryPoint if we find it.
16591 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16592 (EmitContext::ig): Make this variable public.
16594 * driver.cs: Make the default output file be the first file name
16595 with the .exe extension.
16597 Detect empty compilations
16599 Handle various kinds of output targets. Handle --target and
16600 rename -t to --dumper.
16602 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16603 methods inherited from Expression return now an Expression. This
16604 will is used during the tree rewriting as we resolve them during
16607 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16608 the spec. Missing entirely is the information about
16609 accessability of elements of it.
16611 (Expression::ExprClassFromMemberInfo): New constructor for
16612 Expressions that creates a fully initialized Expression based on
16613 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16616 (Invocation::Resolve): Begin implementing resolution of invocations.
16618 * literal.cs (StringLiteral): Implement Emit.
16620 2001-09-05 Ravi Pratap <ravi@ximian.com>
16622 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16625 2001-09-04 Ravi Pratap <ravi@ximian.com>
16627 * cs-parser.jay (attribute_arguments): Implement actions.
16628 (attribute): Fix bug in production. Implement action.
16629 (attribute_list): Implement.
16630 (attribute_target): Implement.
16631 (attribute_target_specifier, opt_target_specifier): Implement
16632 (CheckAttributeTarget): New method to check if the attribute target
16634 (attribute_section): Implement.
16635 (opt_attributes): Implement.
16637 * attribute.cs : New file to handle attributes.
16638 (Attribute): Class to hold attribute info.
16640 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16641 (attribute_section): Modify production to use 2 different rules to
16642 achieve the same thing. 1 s/r conflict down !
16643 Clean out commented, useless, non-reducing dimension_separator rules.
16645 * class.cs (TypeContainer.attributes): New member to hold list
16646 of attributes for a type.
16647 (Struct::Struct): Modify to take one more argument, the attribute list.
16648 (Class::Class): Ditto.
16649 (Field::Field): Ditto.
16650 (Method::Method): Ditto.
16651 (Property::Property): Ditto.
16653 * cs-parser.jay (struct_declaration): Update constructor call to
16654 pass in the attributes too.
16655 (class_declaration): Ditto.
16656 (constant_declaration): Ditto.
16657 (field_declaration): Ditto.
16658 (method_header): Ditto.
16659 (fixed_parameter): Ditto.
16660 (parameter_array): Ditto.
16661 (property_declaration): Ditto.
16663 * constant.cs (Constant::Constant): Update constructor similarly.
16664 Use System.Collections.
16666 * parameter.cs (Parameter::Parameter): Update as above.
16668 2001-09-02 Ravi Pratap <ravi@ximian.com>
16670 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16671 (TypeContainer.delegates): New member to hold list of delegates.
16673 * cs-parser.jay (delegate_declaration): Implement the action correctly
16674 this time as I seem to be on crack ;-)
16676 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16678 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16679 tell whether an identifier represents a namespace.
16681 * expression.cs (NamespaceExpr): A namespace expression, used only
16682 temporarly during expression resolution.
16683 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16684 utility functions to resolve names on expressions.
16686 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16688 * codegen.cs: Add hook for StatementExpressions.
16690 * class.cs: Fix inverted test for static flag in methods.
16692 2001-09-02 Ravi Pratap <ravi@ximian.com>
16694 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16695 to make it coincide with MS' number.
16696 (Operator::CheckBinaryOperator): Ditto.
16698 * ../errors/errors.txt : Remove error numbers added earlier.
16700 * ../errors/cs1019.cs : Test case for error # 1019
16702 * ../errros/cs1020.cs : Test case for error # 1020
16704 * cs-parser.jay : Clean out commented cruft.
16705 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16706 used anywhere - non-reducing rule.
16707 (namespace_declarations): Non-reducing rule - comment out.
16709 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16710 with TypeContainer::AddEnum.
16712 * delegate.cs : New file for delegate handling classes.
16713 (Delegate): Class for declaring delegates.
16715 * makefile : Update.
16717 * cs-parser.jay (delegate_declaration): Implement.
16719 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16721 * class.cs (Event::Define): Implement.
16722 (Event.EventBuilder): New member.
16724 * class.cs (TypeContainer::Populate): Update to define all enums and events
16726 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16727 readonly fields for all these cases ?
16729 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16731 * class.cs (Property): Revamp to use the convention of making fields readonly.
16732 Accordingly modify code elsewhere.
16734 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16735 the Define method of the Property class.
16737 * class.cs : Clean up applied patch and update references to variables etc. Fix
16739 (TypeContainer::Populate): Update to define all the properties we have. Also
16740 define all enumerations.
16742 * enum.cs (Define): Implement.
16744 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16746 * cs-parser.jay (overloadable_operator): The semantic value is an
16747 enum of the Operator class.
16748 (operator_declarator): Implement actions.
16749 (operator_declaration): Implement.
16751 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16752 validity of definitions.
16753 (Operator::CheckBinaryOperator): Static method to check for binary operators
16754 (TypeContainer::AddOperator): New method to add an operator to a type.
16756 * cs-parser.jay (indexer_declaration): Added line to actually call the
16757 AddIndexer method so it gets added ;-)
16759 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
16760 already taken care of by the MS compiler ?
16762 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16764 * class.cs (Operator): New class for operator declarations.
16765 (Operator::OpType): Enum for the various operators.
16767 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16769 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
16770 ostensibly handle this in semantic analysis.
16772 * cs-parser.jay (general_catch_clause): Comment out
16773 (specific_catch_clauses, specific_catch_clause): Ditto.
16774 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
16775 (catch_args, opt_catch_args): New productions.
16776 (catch_clause): Rewrite to use the new productions above
16777 (catch_clauses): Modify accordingly.
16778 (opt_catch_clauses): New production to use in try_statement
16779 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
16780 and re-write the code in the actions to extract the specific and
16781 general catch clauses by being a little smart ;-)
16783 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
16784 Hooray, try and catch statements parse fine !
16786 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16788 * statement.cs (Block::GetVariableType): Fix logic to extract the type
16789 string from the hashtable of variables.
16791 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
16792 I end up making that mistake ;-)
16793 (catch_clauses): Fixed gross error which made Key and Value of the
16794 DictionaryEntry the same : $1 !!
16796 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16798 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
16800 * cs-parser.jay (event_declaration): Correct to remove the semicolon
16801 when the add and remove accessors are specified.
16803 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16805 * cs-parser.jay (IndexerDeclaration): New helper class to hold
16806 information about indexer_declarator.
16807 (indexer_declarator): Implement actions.
16808 (parsing_indexer): New local boolean used to keep track of whether
16809 we are parsing indexers or properties. This is necessary because
16810 implicit_parameters come into picture even for the get accessor in the
16811 case of an indexer.
16812 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
16814 * class.cs (Indexer): New class for indexer declarations.
16815 (TypeContainer::AddIndexer): New method to add an indexer to a type.
16816 (TypeContainer::indexers): New member to hold list of indexers for the
16819 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16821 * cs-parser.jay (add_accessor_declaration): Implement action.
16822 (remove_accessor_declaration): Implement action.
16823 (event_accessors_declaration): Implement
16824 (variable_declarators): swap statements for first rule - trivial.
16826 * class.cs (Event): New class to hold information about event
16828 (TypeContainer::AddEvent): New method to add an event to a type
16829 (TypeContainer::events): New member to hold list of events.
16831 * cs-parser.jay (event_declaration): Implement actions.
16833 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16835 * cs-parser.jay (dim_separators): Implement. Make it a string
16836 concatenating all the commas together, just as they appear.
16837 (opt_dim_separators): Modify accordingly
16838 (rank_specifiers): Update accordingly. Basically do the same
16839 thing - instead, collect the brackets here.
16840 (opt_rank_sepcifiers): Modify accordingly.
16841 (array_type): Modify to actually return the complete type string
16842 instead of ignoring the rank_specifiers.
16843 (expression_list): Implement to collect the expressions
16844 (variable_initializer): Implement. We make it a list of expressions
16845 essentially so that we can handle the array_initializer case neatly too.
16846 (variable_initializer_list): Implement.
16847 (array_initializer): Make it a list of variable_initializers
16848 (opt_array_initializer): Modify accordingly.
16850 * expression.cs (New::NType): Add enumeration to help us
16851 keep track of whether we have an object/delegate creation
16852 or an array creation.
16853 (New:NewType, New::Rank, New::Indices, New::Initializers): New
16854 members to hold data about array creation.
16855 (New:New): Modify to update NewType
16856 (New:New): New Overloaded contructor for the array creation
16859 * cs-parser.jay (array_creation_expression): Implement to call
16860 the overloaded New constructor.
16862 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
16864 * class.cs (TypeContainer::Constructors): Return member
16865 constructors instead of returning null.
16867 2001-08-26 Miguel de Icaza <miguel@ximian.com>
16869 * typemanager.cs (InitCoreTypes): Initialize the various core
16870 types after we have populated the type manager with the user
16871 defined types (this distinction will be important later while
16872 compiling corlib.dll)
16874 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
16875 on Expression Classification. Now all expressions have a method
16876 `Resolve' and a method `Emit'.
16878 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
16879 generation from working. Also add some temporary debugging
16882 2001-08-24 Miguel de Icaza <miguel@ximian.com>
16884 * codegen.cs: Lots of code generation pieces. This is only the
16885 beginning, will continue tomorrow with more touches of polish. We
16886 handle the fundamentals of if, while, do, for, return. Others are
16887 trickier and I need to start working on invocations soon.
16889 * gen-treedump.cs: Bug fix, use s.Increment here instead of
16892 * codegen.cs (EmitContext): New struct, used during code
16893 emission to keep a context. Most of the code generation will be
16896 * cs-parser.jay: Add embedded blocks to the list of statements of
16897 this block. So code generation proceeds in a top down fashion.
16899 2001-08-23 Miguel de Icaza <miguel@ximian.com>
16901 * statement.cs: Add support for multiple child blocks.
16903 2001-08-22 Miguel de Icaza <miguel@ximian.com>
16905 * codegen.cs (EmitCode): New function, will emit the code for a
16906 Block of code given a TypeContainer and its ILGenerator.
16908 * statement.cs (Block): Standard public readonly optimization.
16909 (Block::Block constructors): Link children.
16910 (Block::Child): Child Linker.
16911 (Block::EmitVariables): Emits IL variable declarations.
16913 * class.cs: Drop support for MethodGroups here, delay until
16915 (Method::): Applied the same simplification that I did before, and
16916 move from Properties to public readonly fields.
16917 (Method::ParameterTypes): Returns the parameter types for the
16918 function, and implements a cache that will be useful later when I
16919 do error checking and the semantic analysis on the methods is
16921 (Constructor::GetCallingConvention): Renamed from CallingConvetion
16922 and made a method, optional argument tells whether this is a class
16923 or a structure to apply the `has-this' bit.
16924 (Method::GetCallingConvention): Implement, returns the calling
16926 (Method::Define): Defines the type, a second pass is performed
16927 later to populate the methods.
16929 (Constructor::ParameterTypes): implement a cache similar to the
16930 one on Method::ParameterTypes, useful later when we do semantic
16933 (TypeContainer::EmitMethod): New method. Emits methods.
16935 * expression.cs: Removed MethodGroup class from here.
16937 * parameter.cs (Parameters::GetCallingConvention): new method.
16939 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16941 * class.cs (TypeContainer::Populate): Drop RootContext from the
16944 (Constructor::CallingConvention): Returns the calling convention.
16945 (Constructor::ParameterTypes): Returns the constructor parameter
16948 (TypeContainer::AddConstructor): Keep track of default constructor
16949 and the default static constructor.
16951 (Constructor::) Another class that starts using `public readonly'
16952 instead of properties.
16954 (Constructor::IsDefault): Whether this is a default constructor.
16956 (Field::) use readonly public fields instead of properties also.
16958 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16959 track of static constructors; If none is used, turn on
16960 BeforeFieldInit in the TypeAttributes.
16962 * cs-parser.jay (opt_argument_list): now the return can be null
16963 for the cases where there are no arguments.
16965 (constructor_declarator): If there is no implicit `base' or
16966 `this', then invoke the default parent constructor.
16968 * modifiers.cs (MethodAttr): New static function maps a set of
16969 modifiers flags into a MethodAttributes enum
16970 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16971 MethodAttr, TypeAttr to represent the various mappings where the
16972 modifiers are used.
16973 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16975 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16977 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16980 * interface.cs (PopulateIndexer): Implemented the code generator
16981 for interface indexers.
16983 2001-08-17 Miguel de Icaza <miguel@ximian.com>
16985 * interface.cs (InterfaceMemberBase): Now we track the new status
16988 (PopulateProperty): Implement property population. Woohoo! Got
16989 Methods and Properties going today.
16991 Removed all the properties for interfaces, and replaced them with
16992 `public readonly' fields.
16994 2001-08-16 Miguel de Icaza <miguel@ximian.com>
16996 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16997 initialize their hashtables/arraylists only when they are needed
16998 instead of doing this always.
17000 * parameter.cs: Handle refs and out parameters.
17002 * cs-parser.jay: Use an ArrayList to construct the arguments
17003 instead of the ParameterCollection, and then cast that to a
17006 * parameter.cs: Drop the use of ParameterCollection and use
17007 instead arrays of Parameters.
17009 (GetParameterInfo): Use the Type, not the Name when resolving
17012 2001-08-13 Miguel de Icaza <miguel@ximian.com>
17014 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
17015 and instead use public readonly fields.
17017 * class.cs: Put back walking code for type containers.
17019 2001-08-11 Miguel de Icaza <miguel@ximian.com>
17021 * class.cs (MakeConstant): Code to define constants.
17023 * rootcontext.cs (LookupType): New function. Used to locate types
17026 2001-08-08 Miguel de Icaza <miguel@ximian.com>
17028 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
17029 this System.Reflection code is. Kudos to Microsoft
17031 * typemanager.cs: Implement a type cache and avoid loading all
17032 types at boot time. Wrap in LookupType the internals. This made
17033 the compiler so much faster. Wow. I rule!
17035 * driver.cs: Make sure we always load mscorlib first (for
17036 debugging purposes, nothing really important).
17038 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
17039 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
17041 * rootcontext.cs: Lookup types on their namespace; Lookup types
17042 on namespaces that have been imported using the `using' keyword.
17044 * class.cs (TypeContainer::TypeAttr): Virtualize.
17045 (Class::TypeAttr): Return attributes suitable for this bad boy.
17046 (Struct::TypeAttr): ditto.
17047 Handle nested classes.
17048 (TypeContainer::) Remove all the type visiting code, it is now
17049 replaced with the rootcontext.cs code
17051 * rootcontext.cs (GetClassBases): Added support for structs.
17053 2001-08-06 Miguel de Icaza <miguel@ximian.com>
17055 * interface.cs, statement.cs, class.cs, parameter.cs,
17056 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
17057 Drop use of TypeRefs, and use strings instead.
17059 2001-08-04 Miguel de Icaza <miguel@ximian.com>
17063 * class.cs (Struct::Struct): set the SEALED flags after
17064 checking the modifiers.
17065 (TypeContainer::TypeAttr): new property, returns the
17066 TypeAttributes for a class.
17068 * cs-parser.jay (type_list): Oops, list production was creating a
17069 new list of base types.
17071 * rootcontext.cs (StdLib): New property.
17072 (GetInterfaceTypeByName): returns an interface by type name, and
17073 encapsulates error handling here.
17074 (GetInterfaces): simplified.
17075 (ResolveTree): Encapsulated all the tree resolution here.
17076 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
17079 * driver.cs: Add support for --nostdlib, to avoid loading the
17080 default assemblies.
17081 (Main): Do not put tree resolution here.
17083 * rootcontext.cs: Beginning of the class resolution.
17085 2001-08-03 Miguel de Icaza <miguel@ximian.com>
17087 * rootcontext.cs: Provide better error reporting.
17089 * cs-parser.jay (interface_base): set our $$ to be interfaces.
17091 * rootcontext.cs (CreateInterface): Handle the case where there
17092 are no parent interfaces.
17094 (CloseTypes): Routine to flush types at the end.
17095 (CreateInterface): Track types.
17096 (GetInterfaces): Returns an array of Types from the list of
17097 defined interfaces.
17099 * typemanager.c (AddUserType): Mechanism to track user types (puts
17100 the type on the global type hash, and allows us to close it at the
17103 2001-08-02 Miguel de Icaza <miguel@ximian.com>
17105 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
17106 RecordInterface instead.
17108 * cs-parser.jay: Updated to reflect changes above.
17110 * decl.cs (Definition): Keep track of the TypeBuilder type that
17111 represents this type here. Not sure we will use it in the long
17112 run, but wont hurt for now.
17114 * driver.cs: Smaller changes to accomodate the new code.
17116 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
17119 * rootcontext.cs (CreateInterface): New method, used to create
17120 the System.TypeBuilder type for interfaces.
17121 (ResolveInterfaces): new entry point to resolve the interface
17123 (CodeGen): Property, used to keep track of the code generator.
17125 2001-07-26 Miguel de Icaza <miguel@ximian.com>
17127 * cs-parser.jay: Add a second production for delegate_declaration
17130 (enum_body): Put an opt_comma here instead of putting it on
17131 enum_body or enum_member_declarations so we can handle trailing
17132 commas on enumeration members. Gets rid of a shift/reduce.
17134 (type_list): Need a COMMA in the middle.
17136 (indexer_declaration): Tell tokenizer to recognize get/set
17138 * Remove old targets.
17140 * Re-add the parser target.
17142 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17144 * cs-parser.jay: Add precendence rules for a number of operators
17145 ot reduce the number of shift/reduce conflicts in the grammar.
17147 2001-07-17 Miguel de Icaza <miguel@ximian.com>
17149 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
17152 Get rid of old crufty code.
17154 * rootcontext.cs: Use this to keep track of the parsed
17155 representation and the defined types available to the program.
17157 * gen-treedump.cs: adjust for new convention.
17159 * type.cs: Split out the type manager, and the assembly builder
17162 * typemanager.cs: the type manager will live here now.
17164 * cil-codegen.cs: And the code generator here.
17166 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
17168 * makefile: Fixed up for easy making.
17170 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17172 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
17175 (unary_expression): Expand pre_increment_expression and
17176 post_decrement_expression to reduce a shift/reduce.
17178 2001-07-11 Simon Cozens
17180 * cs-tokenizer.cs: Hex numbers should begin with a 0.
17182 Improve allow_keyword_as_indent name.
17184 2001-06-19 Miguel de Icaza <miguel@ximian.com>
17186 * Adjustments for Beta2.
17188 2001-06-13 Miguel de Icaza <miguel@ximian.com>
17190 * decl.cs: Added `Define' abstract method.
17191 (InTransit): new property, used to catch recursive definitions.
17193 * interface.cs: Implement `Define'.
17195 * modifiers.cs: Map Modifiers.constants to
17196 System.Reflection.TypeAttribute flags.
17198 * class.cs: Keep track of types and user-defined types.
17199 (BuilderInit): New method for creating an assembly
17200 (ResolveType): New function to launch the resolution process, only
17201 used by interfaces for now.
17203 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
17204 that are inserted into the name space.
17206 2001-06-08 Miguel de Icaza <miguel@ximian.com>
17208 * ARGH. I have screwed up my tree so many times due to the use of
17209 rsync rather than using CVS. Going to fix this at once.
17211 * driver.cs: Objetify driver. Load assemblies, use assemblies to
17214 2001-06-07 Miguel de Icaza <miguel@ximian.com>
17216 * Experiment successful: Use System.Type rather that our own
17219 2001-05-25 Miguel de Icaza <miguel@ximian.com>
17221 * cs-parser.jay: Removed nsAliases from here.
17223 Use new namespaces, handle `using XXX;'
17225 * namespace.cs: Reimplemented namespace handling, use a recursive
17226 definition of the class. Now we can keep track of using clauses
17227 and catch invalid using clauses.
17229 2001-05-24 Miguel de Icaza <miguel@ximian.com>
17231 * gen-treedump.cs: Adapted for all the renaming.
17233 * expression.cs (Expression): this class now has a Type property
17234 which returns an expression Type.
17236 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
17237 `Type', as this has a different meaning now in the base
17239 2001-05-22 Miguel de Icaza <miguel@ximian.com>
17241 * interface.cs, class.cs: Removed from all the sources the
17242 references to signature computation, as we can not do method
17243 signature computation during the parsing time, as we are not
17244 trying to solve at that point distinguishing:
17248 void a (NS.Blah x) {}
17251 Which depending on the context might be valid or not, as we do not
17252 know if Blah is the same thing as NS.Blah at that point.
17254 * Redid everything so the code uses TypeRefs now instead of
17255 Types. TypeRefs are just temporary type placeholders, that need
17256 to be resolved. They initially have a pointer to a string and the
17257 current scope in which they are used. This is used later by the
17258 compiler to resolve the reference to an actual Type.
17260 * DeclSpace is no longer a CIR.Type, and neither are
17261 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
17262 are all DeclSpaces, but no Types.
17264 * type.cs (TypeRefManager): This implements the TypeRef manager,
17265 which keeps track of all the types that need to be resolved after
17266 the parsing has finished.
17268 2001-05-13 Miguel de Icaza <miguel@ximian.com>
17270 * ARGH. We are going to have to store `foreach' as a class rather
17271 than resolving it, as we need to verify error 1579 after name
17272 resolution. *OR* we could keep a flag that says `This request to
17273 IEnumerator comes from a foreach statement' which we can then use
17274 to generate the error.
17276 2001-05-10 Miguel de Icaza <miguel@ximian.com>
17278 * class.cs (TypeContainer.AddMethod): we now add methods to the
17279 MethodGroup instead of the method hashtable.
17281 * expression.cs: Add MethodGroup abstraction, which gets us one
17282 step closer to the specification in the way we handle method
17285 * cs-parser.jay (primary_expression): qualified_identifier now
17286 tried to match up an identifier to a local variable reference or
17287 to a parameter reference.
17289 current_local_parameters is now a parser global variable that
17290 points to the current parameters for the block, used during name
17293 (property_declaration): Now creates an implicit `value' argument to
17296 2001-05-09 Miguel de Icaza <miguel@ximian.com>
17298 * parameter.cs: Do not use `param' arguments as part of the
17299 signature, per the spec.
17301 2001-05-08 Miguel de Icaza <miguel@ximian.com>
17303 * decl.cs: Base class for classes, structs and interfaces. This
17304 is the "Declaration Space"
17306 * cs-parser.jay: Use CheckDef for checking declaration errors
17307 instead of having one on each function.
17309 * class.cs: Factor out some code for handling error handling in
17310 accordance to the "Declarations" section in the "Basic Concepts"
17311 chapter in the ECMA C# spec.
17313 * interface.cs: Make all interface member classes derive from
17314 InterfaceMemberBase.
17316 2001-05-07 Miguel de Icaza <miguel@ximian.com>
17318 * Many things: all interfaces are parsed and generated in
17319 gen-treedump. Support for member variables, constructors,
17320 destructors, properties, constants is there.
17322 Beginning of the IL backend, but very little done, just there for
17325 2001-04-29 Miguel de Icaza <miguel@ximian.com>
17327 * cs-parser.jay: Fix labeled statement.
17329 * cs-tokenizer.cs (escape): Escape " and ' always.
17330 ref_line, ref_name: keep track of the line/filename as instructed
17331 by #line by the compiler.
17334 2001-04-27 Miguel de Icaza <miguel@ximian.com>
17336 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
17337 to match the values in System.CodeDOM.
17339 Divid renamed to Divide.
17341 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
17343 (Statements.set): remove.
17345 * System.CodeDOM/CodeCatchClause.cs: always have a valid
17348 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
17349 falseStatements always have valid values.
17351 * cs-parser.jay: Use System.CodeDOM now.