1 2004-10-31 Marek Safar <marek.safar@seznam.cz>
4 * attribute.cs (GetMarshal): Add method argument for
7 * class.cs, codegen.cs, enum.cs, parameter.cs: Added
8 agument for GetMarshal and RuntimeMissingSupport.
10 2004-10-31 Marek Safar <marek.safar@seznam.cz>
12 * attribute.cs (ExtractSecurityPermissionSet): Removed
13 TypeManager.code_access_permission_type.
15 * typemanager.cs: Removed TypeManager.code_access_permission_type.
17 2004-10-27 Miguel de Icaza <miguel@ximian.com>
19 * expression.cs (LocalVariableReference.DoResolveLValue): Check
20 for obsolete use of a variable here. Fixes regression on errors
21 cs0619-25 and cs0619-26.
23 2004-10-27 Marek Safar <marek.safar@seznam.cz>
25 Fix #62358, implemented security attribute encoding.
27 * attribute.cs (Attribute.CheckSecurityActionValididy): New method.
28 Tests permitted SecurityAction for assembly or other types.
29 (Assembly.ExtractSecurityPermissionSet): New method. Transforms
30 data from SecurityPermissionAttribute to PermisionSet class.
32 * class.cs (ApplyAttributeBuilder): Added special handling
33 for System.Security.Permissions.SecurityAttribute based types.
35 * codegen.cs (AssemblyClass.ApplyAttributeBuilder): Added
36 special handling for System.Security.Permissions.SecurityAttribute
39 * enum.cs (ApplyAttributeBuilder): Added special handling
40 for System.Security.Permissions.SecurityAttribute based types.
42 * parameter.cs (ApplyAttributeBuilder): Added special handling
43 for System.Security.Permissions.SecurityAttribute based types.
45 * rootcontext.cs: Next 2 core types.
47 * typemanager.cs (TypeManager.security_permission_attr_type):
48 Built in type for the SecurityPermission Attribute.
49 (code_access_permission_type): Build in type.
51 2004-10-17 Miguel de Icaza <miguel@ximian.com>
53 * expression.cs (LocalVariableReference.DoResolveBase, Emit):
54 Remove the tests for `ec.RemapToProxy' from here, and encapsulate
55 all of this information into
56 EmitContext.EmitCapturedVariableInstance.
58 * codegen.cs (EmitCapturedVariableInstance): move here the
59 funcionality of emitting an ldarg.0 in the presence of a
60 remapping. This centralizes the instance emit code.
62 (EmitContext.EmitThis): If the ScopeInfo contains a THIS field,
63 then emit a load of this: it means that we have reached the
64 topmost ScopeInfo: the one that contains the pointer to the
65 instance of the class hosting the anonymous method.
67 * anonymous.cs (AddField, HaveCapturedFields): Propagate field
68 captures to the topmost CaptureContext.
70 2004-10-12 Miguel de Icaza <miguel@ximian.com>
72 * expression.cs (LocalVariableReference): Move the knowledge about
73 the iterators into codegen's EmitCapturedVariableInstance.
75 2004-10-11 Miguel de Icaza <miguel@ximian.com>
77 * codegen.cs (EmitContext.ResolveTopBlock): Emit a 1643 when not
78 all code paths return a value from an anonymous method (it is the
79 same as the 161 error, but for anonymous methods).
81 2004-10-08 Miguel de Icaza <miguel@ximian.com>
83 The introduction of anonymous methods in the compiler changed
84 various ways of doing things in the compiler. The most
85 significant one is the hard split between the resolution phase
86 and the emission phases of the compiler.
88 For instance, routines that referenced local variables no
89 longer can safely create temporary variables during the
90 resolution phase: they must do so from the emission phase,
91 since the variable might have been "captured", hence access to
92 it can not be done with the local-variable operations from the runtime.
96 (Block.Flags): New flag `IsTopLevel' to indicate that this block
99 (ToplevelBlock): A new kind of Block, these are the blocks that
100 are created by the parser for all toplevel method bodies. These
101 include methods, accessors and anonymous methods.
103 These contain some extra information not found in regular blocks:
104 A pointer to an optional CaptureContext (for tracking captured
105 local variables and parameters). A pointer to the parent
108 (Return.Resolve): Catch missmatches when returning a value from an
109 anonymous method (error 1662).
110 Invoke NeedReturnLabel from the Resolve phase instead of the emit
113 (Break.Resolve): ditto.
115 (SwitchLabel): instead of defining the labels during the
116 resolution phase, we now turned the public ILLabel and ILLabelCode
117 labels into methods called GetILLabelCode() and GetILLabel() that
118 only define the label during the Emit phase.
120 (GotoCase): Track the SwitchLabel instead of the computed label
121 (its contained therein). Emit the code by using
122 SwitchLabel.GetILLabelCode ().
124 (LocalInfo.Flags.Captured): A new flag has been introduce to track
125 whether the Local has been captured or not.
127 (LocalInfo.IsCaptured): New property, used to tell whether the
128 local has been captured.
130 * anonymous.cs: Vastly updated to contain the anonymous method
133 The main classes here are: CaptureContext which tracks any
134 captured information for a toplevel block and ScopeInfo used to
135 track the activation frames for various local variables.
137 Each toplevel block has an optional capture context associated
138 with it. When a method contains an anonymous method both the
139 toplevel method and the anonymous method will create a capture
140 context. When variables or parameters are captured, they are
141 recorded on the CaptureContext that owns them, for example:
145 MyDelegate d = delegate {
150 Here `a' will be recorded as captured on the toplevel
151 CapturedContext, the inner captured context will not have anything
152 (it will only have data if local variables or parameters from it
153 are captured in a nested anonymous method.
155 The ScopeInfo is used to track the activation frames for local
156 variables, for example:
158 for (int i = 0; i < 10; i++)
159 for (int j = 0; j < 10; j++){
160 MyDelegate d = delegate {
165 At runtime this captures a single captured variable `i', but it
166 captures 10 different versions of the variable `j'. The variable
167 `i' will be recorded on the toplevel ScopeInfo, while `j' will be
170 The toplevel ScopeInfo will also track information like the `this'
171 pointer if instance variables were referenced (this is necessary
172 as the anonymous method lives inside a nested class in the host
175 (AnonymousMethod): Expanded to track the Toplevel, implement
176 `AnonymousMethod.Compatible' to tell whether an anonymous method
177 can be converted to a target delegate type.
179 The routine now also produces the anonymous method content
181 (AnonymousDelegate): A helper class that derives from
182 DelegateCreation, this is used to generate the code necessary to
183 produce the delegate for the anonymous method that was created.
185 * assign.cs: API adjustments for new changes in
186 Convert.ImplicitStandardConversionExists.
188 * class.cs: Adjustments to cope with the fact that now toplevel
189 blocks are of type `ToplevelBlock'.
191 * cs-parser.jay: Now we produce ToplevelBlocks for toplevel blocks
192 insteda of standard blocks.
194 Flag errors if params arguments are passed to anonymous methods.
196 * codegen.cs (EmitContext): Replace `InAnonymousMethod' with
197 `CurrentAnonymousMethod' which points to the current Anonymous
198 Method. The variable points to the AnonymousMethod class that
199 holds the code being compiled. It is set in the new EmitContext
200 created for the anonymous method.
202 (EmitContext.Phase): Introduce a variable and an enumeration to
203 assist in enforcing some rules about when and where we are allowed
204 to invoke certain methods (EmitContext.NeedsReturnLabel is the
205 only one that enfonces this right now).
207 (EmitContext.HaveCaptureInfo): new helper method that returns
208 whether we have a CapturedContext initialized.
210 (EmitContext.CaptureVariable): New method used to register that a
211 LocalInfo must be flagged for capturing.
213 (EmitContext.CapturedParameter): New method used to register that a
214 parameters must be flagged for capturing.
216 (EmitContext.CapturedField): New method used to register that a
217 field must be flagged for capturing.
219 (EmitContext.HaveCapturedVariables,
220 EmitContext.HaveCapturedFields): Return whether there are captured
223 (EmitContext.EmitMethodHostInstance): This is used to emit the
224 instance for the anonymous method. The instance might be null
225 (static methods), this (for anonymous methods that capture nothing
226 and happen to live side-by-side with the current method body) or a
227 more complicated expression if the method has a CaptureContext.
229 (EmitContext.EmitTopBlock): Routine that drives the emission of
230 code: it will first resolve the top block, then emit any metadata
231 and then emit the code. The split is done so that we can extract
232 any anonymous methods and flag any captured variables/parameters.
234 (EmitContext.ResolveTopBlock): Triggers the resolution phase,
235 during this phase, the ILGenerator should not be used as labels
236 and local variables declared here might not be accessible to any
237 code that is part of an anonymous method.
239 Exceptions to this include the temporary variables that are
240 created by some statements internally for holding temporary
243 (EmitContext.EmitMeta): New routine, in charge of emitting all the
246 (EmitContext.TemporaryReturn): This method is typically called
247 from the Emit phase, and its the only place where we allow the
248 ReturnLabel to be defined other than the EmitMeta. The reason is
249 that otherwise we would have to duplicate a lot of logic in the
250 Resolve phases of various methods that today is on the Emit
253 (EmitContext.NeedReturnLabel): This no longer creates the label,
254 as the ILGenerator is not valid during the resolve phase.
256 (EmitContext.EmitThis): Extended the knowledge in this class to
257 work in anonymous methods in addition to iterators.
259 (EmitContext.EmitCapturedVariableInstance): This emits whatever
260 code is necessary on the stack to access the instance to a local
261 variable (the variable will be accessed as a field).
263 (EmitContext.EmitParameter, EmitContext.EmitAssignParameter,
264 EmitContext.EmitAddressOfParameter): Routines to support
265 parameters (not completed at this point).
267 Removals: Removed RemapLocal and RemapLocalLValue. We probably
268 will also remove the parameters.
270 * convert.cs (Convert): Define a `ConstantEC' which points to a
271 null. This is just to prefity some code that uses
272 ImplicitStandardConversion code and do not have an EmitContext
275 The idea is to flag explicitly that at that point in time, it is
276 known that the conversion will not trigger the delegate checking
277 code in implicit conversions (which requires a valid
280 Everywhere: pass new EmitContext parameter since
281 ImplicitStandardConversionExists now requires it to check for
282 anonymous method conversions.
284 (Convert.ImplicitStandardConversionExists): If the type of an
285 expression is the anonymous_method_type, and the type is a
286 delegate, we invoke the AnonymousMethod.Compatible method to check
287 whether an implicit conversion is possible.
289 (Convert.ImplicitConversionStandard): Only do implicit method
290 group conversions if the language level is not ISO_1.
292 * delegate.cs (Delegate.GetInvokeMethod): Common method to get the
293 MethodInfo for the Invoke method. used by Delegate and
296 * expression.cs (Binary.DoNumericPromotions): only allow anonymous
297 method conversions if the target type is a delegate.
299 Removed extra debugging nops.
301 (LocalVariableReference): Turn the `local_info' into a public
304 Add `prepared' field, the same hack used for FieldExprs to cope
305 with composed assignments, as Local variables do not necessarily
306 operate purely on the stack as they used to: they can be captured
309 Add `temp' for a temporary result, like fields.
311 Refactor DoResolve and DoResolveLValue into DoResolveBase.
313 It now copes with Local variables that are captured and emits the
314 proper instance variable to load it from a field in the captured
317 (ParameterReference.DoResolveBase): During the resolve phase,
318 capture parameters if we are in an anonymous method.
320 (ParameterReference.Emit, ParameterReference.AddressOf): If in an
321 anonymous method, use the EmitContext helper routines to emit the
324 * iterators.cs: Set RemapToProxy to true/false during the
327 * parameters.cs (GetParameterByName): New helper method.
329 * typemanager.cs (anonymous_method_type) a new type that
330 represents an anonyous method. This is always an internal type,
331 used as a fencepost to test against the anonymous-methodness of an
334 2004-10-24 Marek Safar <marek.safar@seznam.cz>
336 Fixed bugs #63705, #67130
337 * decl.cs (MemberCache.MemberCache): Add parameter to distinguish
338 imported and defined interfaces.
339 (CacheEntry, EntryType): Changed to protected internal.
341 * class.cs (TypeContainer.DoDefineMembers): Setup cache for
344 * typemanager.cs (LookupInterfaceContainer): New method.
345 Fills member container from base interfaces.
347 2004-10-20 Marek Safar <marek.safar@seznam.cz>
349 * class.cs (MethodCore.CheckBase): Add errors 505, 533, 544,
351 (PropertyBase.FindOutParentMethod): Add errors 545, 546 report.
353 2004-10-18 Martin Baulig <martin@ximian.com>
355 Merged latest changes into gmcs. Please keep this comment in
356 here, it makes it easier for me to see what changed in MCS since
357 the last time I merged.
359 2004-10-18 Martin Baulig <martin@ximian.com>
361 * statement.cs (Fixed.Resolve): Don't access the TypeExpr's
362 `Type' directly, but call ResolveType() on it.
363 (Catch.Resolve): Likewise.
364 (Foreach.Resolve): Likewise.
366 2004-10-18 Martin Baulig <martin@ximian.com>
368 * expression.cs (Cast.DoResolve): Don't access the TypeExpr's
369 `Type' directly, but call ResolveType() on it.
370 (Probe.DoResolve): Likewise.
371 (ArrayCreation.LookupType): Likewise.
372 (TypeOf.DoResolve): Likewise.
373 (SizeOf.DoResolve): Likewise.
375 2004-10-18 Martin Baulig <martin@ximian.com>
377 * expression.cs (Invocation.BetterFunction): Put back
378 TypeManager.TypeToCoreType().
380 2004-10-18 Raja R Harinath <rharinath@novell.com>
382 * class.cs (FieldMember.DoDefine): Reset ec.InUnsafe after doing
385 2004-10-18 Martin Baulig <martin@ximian.com>
387 * parameter.cs (Parameter.Resolve): Don't access the TypeExpr's
388 `Type' directly, but call ResolveType() on it.
390 2004-10-18 Martin Baulig <martin@ximian.com>
392 * class.cs (FieldMember.Define): Don't access the TypeExpr's
393 `Type' directly, but call ResolveType() on it.
394 (MemberBase.DoDefine): Likewise.
396 * expression.cs (New.DoResolve): Don't access the TypeExpr's
397 `Type' directly, but call ResolveType() on it.
398 (ComposedCast.DoResolveAsTypeStep): Likewise.
400 * statement.cs (LocalInfo.Resolve): Don't access the TypeExpr's
401 `Type' directly, but call ResolveType() on it.
403 2004-10-17 John Luke <john.luke@gmail.com>
405 * class.cs (Operator.GetSignatureForError): use CSharpName
407 * parameter.cs (Parameter.GetSignatureForError): Returns
408 correct name even if was not defined.
410 2004-10-13 Raja R Harinath <rharinath@novell.com>
413 * class.cs (TypeContainer.EmitContext): New property.
414 (DefineNestedTypes): Create an emitcontext for each part.
415 (MethodCore.DoDefineParameters): Use container's emitcontext.
416 Pass type array to InternalParameters.
417 (MemberBase.DoDefine): Use container's emitcontext.
418 (FieldMember.Define): Likewise.
419 (Event.Define): Likewise.
420 (SetMethod.GetParameterInfo): Change argument to EmitContext.
421 Pass type array to InternalParameters.
422 (SetIndexerMethod.GetParameterInfo): Likewise.
423 (SetMethod.Define): Pass emitcontext to GetParameterInfo.
424 * delegate.cs (Define): Pass emitcontext to
425 ComputeAndDefineParameterTypes and GetParameterInfo. Pass type
426 array to InternalParameters.
427 * expression.cs (ParameterReference.DoResolveBase): Pass
428 emitcontext to GetParameterInfo.
429 (ComposedCast.DoResolveAsTypeStep): Remove check on
430 ec.ResolvingTypeTree.
431 * parameter.cs (Parameter.Resolve): Change argument to
432 EmitContext. Use ResolveAsTypeTerminal.
433 (Parameter.GetSignature): Change argument to EmitContext.
434 (Parameters.ComputeSignature): Likewise.
435 (Parameters.ComputeParameterTypes): Likewise.
436 (Parameters.GetParameterInfo): Likewise.
437 (Parameters.ComputeAndDefineParameterTypes): Likewise.
438 Re-use ComputeParameterTypes. Set ec.ResolvingTypeTree.
439 * support.cs (InternalParameters..ctor): Remove variant that takes
441 * typemanager.cs (system_intptr_expr): New.
442 (InitExpressionTypes): Initialize it.
444 2004-10-12 Chris Toshok <toshok@ximian.com>
446 * cs-parser.jay: fix location for try_statement and catch_clause.
448 2004-10-11 Martin Baulig <martin@ximian.com>
450 * report.cs: Don't make --fatal abort on warnings, we have
451 -warnaserror for that.
453 2004-10-07 Raja R Harinath <rharinath@novell.com>
455 More DeclSpace.ResolveType avoidance.
456 * decl.cs (MemberCore.InUnsafe): New property.
457 * class.cs (MemberBase.DoDefine): Use ResolveAsTypeTerminal
458 with newly created EmitContext.
459 (FieldMember.Define): Likewise.
460 * delegate.cs (Delegate.Define): Likewise.
461 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup with alias
462 only if normal name-lookup fails.
463 (TypeExpr.DoResolve): Enable error-checking.
464 * expression.cs (ArrayCreation.DoResolve): Use ResolveAsTypeTerminal.
465 (SizeOf.DoResolve): Likewise.
466 (ComposedCast.DoResolveAsTypeStep): Likewise.
467 (StackAlloc.DoResolve): Likewise.
468 * statement.cs (Block.Flags): Add new flag 'Unsafe'.
469 (Block.Unsafe): New property.
470 (Block.EmitMeta): Set ec.InUnsafe as appropriate.
471 (Unsafe): Set 'unsafe' flag of contained block.
472 (LocalInfo.Resolve): Use ResolveAsTypeTerminal.
473 (Fixed.Resolve): Likewise.
474 (Catch.Resolve): Likewise.
475 (Using.ResolveLocalVariableDecls): Likewise.
476 (Foreach.Resolve): Likewise.
478 2004-10-05 John Luke <john.luke@gmail.com>
480 * cs-parser.jay: add location to error CS0175
482 2004-10-04 Miguel de Icaza <miguel@ximian.com>
484 * ecore.cs (Expression.Constantity): Add support for turning null
487 * const.cs (Const.Define): Allow constants to be reference types
488 as long as the value is Null.
490 2004-10-04 Juraj Skripsky <js@hotfeet.ch>
492 * namespace.cs (NamespaceEntry.Using): No matter which warning
493 level is set, check if this namespace name has already been added.
495 2004-10-03 Ben Maurer <bmaurer@ximian.com>
497 * expression.cs: reftype [!=]= null should always use br[true,false].
500 2004-10-03 Marek Safar <marek.safar@seznam.cz>
503 * attribute.cs: Enum conversion moved to
504 GetAttributeArgumentExpression to be applied to the all
507 2004-10-01 Raja R Harinath <rharinath@novell.com>
509 Fix #65833, test-300.cs, cs0122-5.cs, cs0122-6.cs.
510 * class.c (TypeContainer.DefineType): Flag error if
511 base types aren't accessible due to access permissions.
512 * decl.cs (DeclSpace.ResolveType): Move logic to
513 Expression.ResolveAsTypeTerminal.
514 (DeclSpace.ResolveTypeExpr): Thin layer over
515 Expression.ResolveAsTypeTerminal.
516 (DeclSpace.CheckAccessLevel, DeclSpace.FamilyAccess):
517 Refactor code into NestedAccess. Use it.
518 (DeclSpace.NestedAccess): New.
519 * ecore.cs (Expression.ResolveAsTypeTerminal): Add new
520 argument to silence errors. Check access permissions.
521 (TypeExpr.DoResolve, TypeExpr.ResolveType): Update.
522 * expression.cs (ProbeExpr.DoResolve): Use ResolveAsTypeTerminal.
523 (Cast.DoResolve): Likewise.
524 (New.DoResolve): Likewise.
525 (InvocationOrCast.DoResolve,ResolveStatement): Likewise.
526 (TypeOf.DoResolve): Likewise.
528 * expression.cs (Invocation.BetterConversion): Return the Type of
529 the better conversion. Implement section 14.4.2.3 more faithfully.
530 (Invocation.BetterFunction): Make boolean. Make correspondence to
531 section 14.4.2.2 explicit.
532 (Invocation.OverloadResolve): Update.
533 (Invocation): Remove is_base field.
534 (Invocation.DoResolve): Don't use is_base. Use mg.IsBase.
535 (Invocation.Emit): Likewise.
537 2004-09-27 Raja R Harinath <rharinath@novell.com>
539 * README: Update to changes.
541 2004-09-24 Marek Safar <marek.safar@seznam.cz>
543 * cs-parser.jay: Reverted 642 warning fix.
545 2004-09-23 Marek Safar <marek.safar@seznam.cz>
548 * decl.cs (FindMemberWithSameName): Indexer can have more than
551 2004-09-23 Marek Safar <marek.safar@seznam.cz>
553 * expression.cs (LocalVariableReference.DoResolveLValue):
554 Do not report warning 219 for out values.
555 (EmptyExpression.Null): New member to avoid extra allocations.
557 2004-09-23 Marek Safar <marek.safar@seznam.cz>
559 * cs-parser.jay: Fix wrong warning 642 report.
561 * cs-tokenizer.cs (CheckNextToken): New helper;
562 Inspect next character if is same as expected.
564 2004-09-23 Martin Baulig <martin@ximian.com>
566 * convert.cs (Convert.ImplicitReferenceConversion): Some code cleanup.
567 (Convert.ImplicitReferenceConversionExists): Likewise.
569 2004-09-23 Marek Safar <marek.safar@seznam.cz>
571 * class.cs (Operator.Define): Add error 448 and 559 report.
573 2004-09-22 Marek Safar <marek.safar@seznam.cz>
575 * class.cs (MemberBase.IsTypePermitted): New protected
576 method for checking error CS0610.
578 2004-09-22 Marek Safar <marek.safar@seznam.cz>
580 * class.cs (TypeContainer.HasExplicitLayout): New property
581 Returns whether container has StructLayout attribute set Explicit.
582 (FieldMember): New abstract class for consts and fields.
583 (FieldMember.ApplyAttributeBuilder): Add error 636 and 637 report.
584 (Field): Reuse FieldMember.
586 * const.cs (Const): Reuse FieldMember.
588 * rootcontext.cs: EmitConstants call moved to class.
590 2004-09-22 Martin Baulig <martin@ximian.com>
592 Thanks to Peter Sestoft for this bug report.
594 * expression.cs (Conditional): If both the `trueExpr' and the
595 `falseExpr' is a NullLiteral, return a NullLiteral.
597 2004-09-22 Martin Baulig <martin@ximian.com>
599 * statement.cs (Foreach.EmitCollectionForeach): If we're in an
600 iterator, use `enumerator.EmitThis()' instead of `ec.EmitThis()'
601 for the "get_Current" call.
603 2004-09-22 Martin Baulig <martin@ximian.com>
605 Marek and me just fixed one of our oldest bugs: #28562 :-)
607 * ecore.cs (EnumConstant.GetValueAsEnumType): New public method.
609 * attribute.cs (Attribute.GetAttributeArgumentExpression): If
610 we're an EnumConstant, just return that.
611 (Attribute.Resolve): GetAttributeArgumentExpression() may give us
612 an EnumConstant. In this case, we need to use GetValueAsEnumType()
613 to get the value which'll actually be written into the attribute.
614 However, we have to use GetValue() to access the attribute's value
617 2004-09-22 Marek Safar <marek.safar@seznam.cz>
619 * constant.cs (Constant.IsNegative): New abstract property
622 * expression.cs (ArrayAccess.DoResolve): Add warning 251.
623 (StackAlloc.DoResolve): Reused IsNegative.
625 2004-09-21 Martin Baulig <martin@ximian.com>
627 * codegen.cs (VariableStorage): Don't store the ILGenerator here;
628 if we're used in an iterator, we may be called from different
631 * statement.cs (Foreach.EmitFinally): Only emit an `Endfinally' if
632 we actually have an exception block.
634 2004-09-20 John Luke <jluke@cfl.rr.com>
636 * class.cs, cs-parser.jay: Improve the error report for 1520:
637 report the actual line where the error happens, not where the
640 * assign.cs, delegate.cs, ecore.cs, expression.cs, statement.cs:
641 Pass location information that was available elsewhere.
643 2004-09-19 Sebastien Pouliot <sebastien@ximian.com>
645 * codegen.cs: Fix bug #56621. It is now possible to use MCS on the MS
646 runtime to delay sign assemblies.
648 2004-09-19 Miguel de Icaza <miguel@ximian.com>
650 * cs-parser.jay: Do not report the stack trace, this is barely
653 2004-08-22 John Luke <john.luke@gmail.com>
655 * driver.cs : check that a resource id is not already used
656 before adding it, report CS1508 if it is, bug #63637
658 2004-09-19 Miguel de Icaza <miguel@ximian.com>
660 * ecore.cs: Removed dead code.
662 2004-09-18 Marek Safar <marek.safar@seznam.cz>
664 * class.cs: Do not report warning CS0067 on the interfaces.
666 2004-09-16 Marek Safar <marek.safar@seznam.cz>
668 * cs-parser.jay: Add error 504 report.
670 2004-09-16 Marek Safar <marek.safar@seznam.cz>
672 * rootcontext.cs: WarningLevel is 4 by default now.
674 * statement.cs (Fixed.Resolve): Do not null
677 2004-09-16 Marek Safar <marek.safar@seznam.cz>
680 * ecore.cs (PropertyExpr.FindAccessors): Do not perform
681 deep search when property is not virtual.
682 (PropertyExpr.ResolveAccessors): Make one call for both
685 2004-09-15 Marek Safar <marek.safar@seznam.cz>
688 * statement.cs: Error 152 report constains also location.
690 2004-09-15 Marek Safar <marek.safar@seznam.cz>
693 * const.cs: Explicitly set constant as static.
695 2004-09-15 Marek Safar <marek.safar@seznam.cz>
698 * cs-parser.jay: Add error 1017 report.
700 2004-09-15 Marek Safar <marek.safar@seznam.cz>
702 Fixed bug #59980, #64224
703 * expression.cs (Invocation.DoResolve): Fixed error CS0571 test.
705 * typemanager.cs (IsSpecialMethod): Simplified
707 2004-09-14 Marek Safar <marek.safar@seznam.cz>
709 * decl.cs (MemberCore.Emit): Resuscitated VerifyObsoleteAttribute
710 condition with better params.
712 2004-09-14 Marek Safar <marek.safar@seznam.cz>
715 * attribute.cs (Resolve): Property has to have both
718 2004-09-14 Martin Baulig <martin@ximian.com>
720 * decl.cs (MemberCore.Emit): Always call VerifyObsoleteAttribute().
722 2004-09-14 Marek Safar <marek.safar@seznam.cz>
725 * codegen.cs (TestObsoleteMethodUsage): Trace when method is
726 called and is obsolete then this member suppress message
727 when call is inside next [Obsolete] method or type.
729 * expression.cs: Use TestObsoleteMethodUsage member.
731 2004-09-14 Martin Baulig <martin@ximian.com>
733 * cs-parser.jay: Sync a bit with the GMCS version.
735 2004-09-14 Martin Baulig <martin@ximian.com>
737 * cs-parser.jay (CSharpParser): Don't derive from GenericsParser.
738 (CSharpParser.yacc_verbose_flag): New public field.
740 * genericparser.cs: Removed.
742 2004-09-14 Raja R Harinath <rharinath@novell.com>
744 * cs-parser.jay (event_declaration): Re-enable cs0071 error.
746 2004-09-13 Marek Safar <marek.safar@seznam.cz>
748 * class.cs (MethodCore.CheckBase): Fix bug #65757.
750 2004-09-10 Martin Baulig <martin@ximian.com>
752 Backported my MemberName changes from GMCS into MCS.
754 - we are now using a special `MemberName' class instead of using
755 strings; in GMCS, the `MemberName' also contains the type
758 - changed the grammar rules a bit:
759 * the old `member_name' is now a `namespace_or_type_name':
760 The rule is that we use `namespace_or_type_name' everywhere
761 where we expect either a "member name" (GetEnumerator) or a
762 "member name" with an explicit interface name
763 (IEnumerable.GetEnumerator).
764 In GMCS, the explicit interface name may include type arguments
765 (IEnumerable<T>.GetEnumerator).
766 * we use `member_name' instead of just `IDENTIFIER' for
768 The rule is that we use `member_name' wherever a member may
769 have type parameters in GMCS.
771 * decl.cs (MemberName): New public class.
772 (MemberCore.MemberName): New public readonly field.
773 (MemberCore.ctor): Take a `MemberName' argument, not a string.
774 (DeclSpace): Likewise.
776 * delegate.cs (Delegate.ctor): Take a MemberName, not a string.
777 * enum.cs (Enum.ctor): Likewise.
779 * namespace.cs (AliasEntry.Alias): Changed type from Expression to
781 (AliasEntry.ctor): Take a MemberName, not an Expression.
782 (AliasEntry.UsingAlias): Likewise.
784 * class.cs (TypeContainer.ctor): Take a MemberName, not a string.
785 (IMethodData.MemberName): Changed type from string to MemberName.
786 (MemberBase.ExplicitInterfaceName): Likewise.
787 (AbstractPropertyEventMethod.SetupName): Make this private.
788 (AbstractPropertyEventMethod.ctor): Added `string prefix'
789 argument; compute the member name here.
790 (AbstractPropertyEventMethod.UpdateName): Recompute the name based
791 on the `member.MemberName' and the `prefix'.
793 * cs-parser.jay (attribute_name): Use `namespace_or_type_name',
795 (struct_declaration): Use `member_name' instead of `IDENTIFIER';
796 thus, we get a `MemberName' instead of a `string'. These
797 declarations may have type parameters in GMCS.
798 (interface_method_declaration, delegate_declaration): Likewise.
799 (class_declaration, interface_declaration): Likewise.
800 (method_header): Use `namespace_or_type_name' instead of
801 `member_name'. We may be an explicit interface implementation.
802 (property_declaration, event_declaration): Likewise.
803 (member_name): This is now just an `IDENTIFIER', not a
804 `namespace_or_type_name'.
805 (type_name, interface_type): Removed.
806 (namespace_or_type_name): Return a MemberName, not an Expression.
807 (primary_expression): Use `member_name' instead of `IDENTIFIER';
808 call GetTypeExpression() on the MemberName to get an expression.
809 (IndexerDeclaration.interface_type): Changed type from string to
811 (MakeName): Operate on MemberName's instead of string's.
813 2004-09-13 Raja R Harinath <rharinath@novell.com>
816 * namespace.cs (AliasEntry.Resolve): Implement section 16.3.1.
817 (NamespaceEntry.Lookup): Add new argument to flag if we want the
818 lookup to avoid symbols introduced by 'using'.
819 * rootcontext.cs (NamespaceLookup): Update.
821 2004-09-12 Marek Safar <marek.safar@seznam.cz>
823 * class.cs (TypeContainer.DoDefineMembers): Do not call
824 DefineDefaultConstructor for static classes.
826 2004-09-12 Marek Safar <marek.safar@seznam.cz>
828 * attribute.cs (Attribute.Resolve): Add error 653 report.
830 * class.cs (Class.ApplyAttributeBuilder): Add error 641
832 (Method.ApplyAttributeBuilder): Add error 685 report.
833 (Operator.Define): Add error 564 report.
835 * cs-tokenizer.cs (handle_hex): Add error 1013 report.
837 * expression.cs (Invocation.DoResolve): Add error
840 * parameter.cs (Parameter.ApplyAttributeBuilder): Add
843 2004-09-11 Marek Safar <marek.safar@seznam.cz>
845 * class.cs (ConstructorInitializer.Resolve):
846 Wrong error number (515->516).
848 2004-09-11 Marek Safar <marek.safar@seznam.cz>
850 * class.cs (Indexer.Define): Add error 631 report.
852 2004-09-11 Marek Safar <marek.safar@seznam.cz>
854 * ecore.cs (Error_NegativeArrayIndex): Fix 248 error.
856 2004-09-11 Marek Safar <marek.safar@seznam.cz>
858 * expression.cs (Probe.DoResolve): Add error CS0241 report.
860 2004-09-10 Marek Safar <marek.safar@seznam.cz>
862 * cs-parser.jay: Added error CS0241 report.
864 2004-09-10 Raja R Harinath <rharinath@novell.com>
866 * cs-parser.jay (fixed_statement): Introduce a scope for the
867 declaration in the 'fixed' statement.
869 2004-09-09 Marek Safar <marek.safar@seznam.cz>
871 * cs-parser.jay: Added CS0230 error report.
873 2004-09-09 Marek Safar <marek.safar@seznam.cz>
875 * cs-parser.jay: Added errors CS0231 and CS0257 report.
877 2004-09-09 Marek Safar <marek.safar@seznam.cz>
879 * expression.cs (Argument.Resolve): Added error CS0192 and
882 2004-09-09 Marek Safar <marek.safar@seznam.cz>
884 C# 2.0 #pragma warning feature
886 * cs-tokenizer.cs (PreProcessPragma): New method;
887 Handles #pragma directive.
889 * report.cs (WarningRegions): New class; Support
890 class for #pragma warning directive. It tests whether
891 warning is enabled for a given line.
893 2004-09-08 Miguel de Icaza <miguel@ximian.com>
895 * const.cs: Add more descriptive error report, tahnks to
898 2004-09-08 Marek Safar <marek.safar@seznam.cz>
900 * ecore.cs (FieldExpr.DoResolveLValue): Fixed CS0198 report.
902 2004-09-07 Miguel de Icaza <miguel@ximian.com>
904 * expression.cs: Apply patch from Ben: Remove dead code from
905 ArrayCreation, and remove the TurnintoConstant call in const.cs,
906 as that code just threw an exception anwyays.
908 * const.cs: Remove the call to the turnintoconstant, for details
911 * literal.cs: The type of the null-literal is the null type; So
912 we use a placeholder type (literal.cs:System.Null, defined here)
915 * expression.cs (Conditional.DoResolve): Remove some old code that
916 is no longer needed, conversions have been fixed.
918 (ArrayCreationExpression.DoResolve): Return false if we fail to
919 resolve the inner expression.
921 2004-09-07 Raja R Harinath <rharinath@novell.com>
924 * cs-parser.jay (delegate_declaration): Record a delegate
925 declaration as a type declaration.
926 Reported by Jo Vermeulen <jo@lumumba.luc.ac.be>.
928 2004-09-06 Miguel de Icaza <miguel@ximian.com>
930 * parameter.cs: Do not crash if the type can not be resolved.
932 * expression.cs: Report errors with unsafe pointers, fixes #64896
934 2004-09-06 Ben Maurer <bmaurer@users.sourceforge.net>
936 * expression.cs: Pointer arith always needs to do a conv.i
937 if the operand is a long. fix 65320
939 2004-09-04 Marek Safar <marek.safar@seznam.cz>
941 Fixed cs0619-37.cs, cs0619-38.cs
943 * enum.cs (GetObsoleteAttribute): Removed.
945 * expression.cs (MemberAccess.DoResolve): Test for [Obsolete]
946 on Enum member is double staged. The first is tested member
949 2004-09-04 Marek Safar <marek.safar@seznam.cz>
951 Fixed #56986, #63631, #65231
953 * class.cs: (TypeContainer.AddToMemberContainer): New method,
954 adds member to name container.
955 (TypeContainer.AddToTypeContainer): New method, adds type to
957 (AddConstant, AddEnum, AddClassOrStruct, AddDelegate, AddMethod,
958 AddConstructor, AddInterface, AddField, AddProperty, AddEvent,
959 AddOperator): Simplified by reusing AddToMemberContainer.
960 (TypeContainer.UserDefinedStaticConstructor): Changed to property
962 (Method.CheckForDuplications): Fixed implementation to test all
964 (MemberBase): Detection whether member is explicit interface
965 implementation is now in constructor.
966 (MemberBase.UpdateMemberName): Handles IndexerName.
967 (Accessor): Changed to keep also location information.
968 (AbstractPropertyEventMethod): Is derived from MemberCore.
969 (AbstractPropertyEventMethod.IsDummy): Says whether accessor
970 will be emited or not.
971 (PropertyBase.AreAccessorsDuplicateImplementation):
972 Tests whether accessors are not in collision with some method.
973 (Operator): Is derived from MethodCore to simplify common
976 * decl.cs (Flags.TestMethodDuplication): Test for duplication
978 (DeclSpace.AddToContainer): Adds the member to defined_names
979 table. It tests for duplications and enclosing name conflicts.
981 * enum.cs (EnumMember): Clean up to reuse the base structures
983 2004-09-03 Martin Baulig <martin@ximian.com>
985 * class.cs (TypeContainer.DefineDefaultConstructor): Put this back
986 into TypeContainer, to make partial classes work again.
988 2004-09-03 Martin Baulig <martin@ximian.com>
990 * rootcontext.cs (RootContext.V2): Removed.
992 2004-03-23 Martin Baulig <martin@ximian.com>
994 * expression.cs (Invocation.OverloadResolve): Added `bool
995 may_fail' argument and use it instead of the Location.IsNull() hack.
997 2004-09-03 Martin Baulig <martin@ximian.com>
999 Merged latest changes into gmcs. Please keep this comment in
1000 here, it makes it easier for me to see what changed in MCS since
1001 the last time I merged.
1003 2004-09-03 Raja R Harinath <rharinath@novell.com>
1006 * expression.cs (BetterConversion): Don't allow either conversion
1007 to be null. Remove redundant implicit conversion test when 'q ==
1008 null' -- when this function is invoked, we already know that the
1009 implicit conversion exists.
1010 (BetterFunction): Assume that 'best' is non-null. Remove
1011 redundant reimplementation of IsApplicable when 'best' is null.
1012 (IsParamsMethodApplicable, IsApplicable): Add new parameter for
1013 number of arguments.
1014 (IsAncestralType): Extract from OverloadResolve.
1015 (OverloadResolve): Make robust to the MethodGroupExpr being
1016 unsorted. Implement all the logic of Section 14.5.5.1, and
1017 support overloading of methods from multiple applicable types.
1018 Clean up logic somewhat. Don't pass null methods to BetterFunction.
1020 * report.cs (SymbolRelatedToPreviousError): Cleanup output.
1021 (RealError, Warning): Append type of report to related symbol.
1023 2004-09-03 Marek Safar <marek.safar@seznam.cz>
1025 * enum.cs: Fixed CLS-Compliance checks for enum members.
1026 Error tests cs3008-8.cs, cs3014-8.cs
1028 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1030 Fixed bug #62342, #63102
1031 * class.cs: ImplementIndexer uses member.IsExplicitImpl
1032 like ImplementMethod.
1034 2004-09-02 Marek Safar <marek.safar@seznam.cz>
1036 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1039 2004-09-02 Martin Baulig <martin@ximian.com>
1041 * statement.cs (Using.EmitLocalVariableDeclFinally): Use
1042 TypeManager.GetArgumentTypes() rather than calling GetParameters()
1045 2004-09-01 Marek Safar <marek.safar@seznam.cz>
1047 C# 2.0 Static classes implemented
1049 * class.cs (TypeContainer): instance_constructors,
1050 initialized_fields, initialized_static_fields,
1051 default_constructor, base_inteface_types are protected to be
1052 accessible from StaticClass.
1053 (TypeContainer.DefineDefaultConstructor): New virtual method
1054 for custom default constructor generating
1055 (StaticClass): New class to handle "Static classes" feature.
1057 * cs-parser.jay: Handle static keyword on class like instance
1060 * driver.cs: Added "/langversion" command line switch with two
1061 options (iso-1, default).
1063 2004-08-31 Marek Safar <marek.safar@seznam.cz>
1065 * ecore.cs (FieldExpr.Resolve): Fixed bug #64689.
1067 2004-08-31 Miguel de Icaza <miguel@ximian.com>
1069 * delegate.cs: Style.
1071 2004-08-31 Ben Maurer <bmaurer@users.sourceforge.net>
1073 * delegate.cs: Add seperate instance expr field for miguel.
1075 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1077 * PointerArithmetic (Resolve): make sure we are not doing
1078 pointer arith on void*. Also, make sure we are resolved
1079 by not setting eclass until resolve.
1081 All callers: Make sure that PointerArithmetic gets resolved.
1083 2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net>
1085 * ArrayCreation (LookupType): If the type does not resolve
1086 to an array, give an error.
1088 2004-08-27 Marek Safar <marek.safar@seznam.cz>
1090 * statement.cs (Try.Resolve): Fixed bug #64222
1092 2004-08-27 Martin Baulig <martin@ximian.com>
1095 (TC.OperatorArrayList.OperatorEntry.CheckPairedOperators): Don't
1098 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1100 * ecore.cs (Constantify): Get underlying type via
1101 System.Enum.GetUnderlyingType to avoid StackOverflow on the
1102 Windows in special cases.
1104 2004-08-26 Marek Safar <marek.safar@seznam.cz>
1106 * typemanager.cs (GetAddMethod): Used GetAddMethod (true)
1107 for obtaining also private methods.
1108 (GetRemoveMethod): Used GetRemoveMethod (true)
1109 for obtaining also private methods.
1111 2004-08-24 Martin Baulig <martin@ximian.com>
1113 * class.cs (Method.Define): Set MethodAttributes.SpecialName and
1114 MethodAttributes.HideBySig for operators.
1116 2004-08-23 Martin Baulig <martin@ximian.com>
1118 Back to the old error reporting system :-)
1120 * report.cs (Message): Removed.
1121 (Report.MessageData, ErrorData, WarningData): Removed.
1122 (Report.Error, Warning): Back to the old system.
1124 2004-08-23 Martin Baulig <martin@ximian.com>
1126 * decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
1128 * class.cs (TypeContainer.ParentContainer): New public virtual
1129 method; replaces the explicit interface implementation.
1130 (ClassPart.ParentContainer): Override.
1132 2004-08-23 Martin Baulig <martin@ximian.com>
1134 * statement.cs (Switch): Added support for constant switches; see
1135 #59428 or test-285.cs.
1137 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1140 * statement.cs (GetEnumeratorFilter): Removed useless
1141 logic because C# specs is strict. GetEnumerator must be
1144 2004-08-22 Martin Baulig <martin@ximian.com>
1146 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
1147 a switch and may break, reset the barrier. Fixes #59867.
1149 2004-08-22 Marek Safar <marek.safar@seznam.cz>
1151 CLS-Compliance speed up (~5% for corlib)
1153 * attribute.cs (AttributeTester.VerifyTopLevelNameClsCompliance):
1154 New method. Tests container for CLS-Compliant names
1156 * class.cs (TypeContainer.VerifyClsName): New method.
1157 Checks whether container name is CLS Compliant.
1158 (Constructor): Implements IMethodData.
1160 * decl.cs (MemberCache.GetPublicMembers ): New method. Builds
1161 low-case table for CLS Compliance test.
1162 (MemberCache.VerifyClsParameterConflict): New method.
1163 Checks method parameters for CS3006 error.
1165 * enum.cs (EnumMember): Is derived from MemberCore.
1166 (Enum.VerifyClsName): Optimized for better performance.
1168 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1170 * report.cs: Renamed Error_T to Error and changed all
1173 2004-08-06 Marek Safar <marek.safar@seznam.cz>
1175 * class.cs (TypeContainer.IndexerArrayList): New inner class
1176 container for indexers.
1177 (TypeContainer.DefaultIndexerName): New constant for default
1178 indexer name. Replaced all "Item" with this constant.
1179 (TypeContainer.DefineIndexers): Moved to IndexerArrayList class.
1181 * typemanager.cs (TypeManager.default_member_ctor): Cache here
1182 DefaultMemberAttribute constructor.
1184 2004-08-05 Martin Baulig <martin@ximian.com>
1186 * flowanalysis.cs (FlowBranching.UsageVector.MergeJumpOrigins):
1189 2004-08-05 Marek Safar <marek.safar@seznam.cz>
1191 * mcs.exe.sources: $(EXTRA_SOURCES) are now here to avoid
1192 multi platforms problem.
1194 * compiler.csproj: Included shared files.
1196 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1198 Fix bug 60333, 55971 in the more general way
1199 * attribute.cs (Attribute.GetAttributeArgumentExpression):
1200 Added arg_type argument for constant conversion.
1201 (Attribute.Resolve): Reuse GetAttributeArgumentExpression.
1203 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1206 * class.cs (TypeContainer ): New inner classes MethodArrayList,
1207 OperatorArrayList, MethodCoreArrayList for typecontainer
1208 containers. Changed class member types to these new types.
1209 (MethodArrayList.DefineMembers): Added test for CS0659.
1211 2004-08-04 Miguel de Icaza <miguel@ximian.com>
1213 * cfold.cs: Synchronize the folding with the code in expression.cs
1214 Binary.DoNumericPromotions for uint operands.
1216 * attribute.cs: Revert patch from Raja, it introduced a regression
1217 while building Blam-1.2.1 (hard to isolate a test case).
1219 2004-08-04 Marek Safar <marek.safar@seznam.cz>
1223 (TypeContainer.Define): Renamed to DefineContainerMembers because of
1225 (MethodCore.parent_method): New member. The method we're overriding
1226 if this is an override method.
1227 (MethodCore.CheckBase): Moved from Method class and made common.
1228 (MethodCore.CheckMethodAgainstBase): Moved from MemberBase and made
1230 (MethodCore.CheckForDuplications): New abstract method. For custom
1231 member duplication search in a container
1232 (MethodCore.FindOutParentMethod): New abstract method. Gets parent
1233 method and its return type.
1234 (Event.conflict_symbol): New member. Symbol with same name in the
1238 (MemberCache.FindMemberWithSameName): New method. The method
1239 is looking for conflict with inherited symbols.
1241 2004-08-04 Martin Baulig <martin@ximian.com>
1243 * codegen.cs (VariableStorage.EmitLoadAddress): New public method.
1245 * statement.cs (Foreach.EmitFinally): Make this work for valuetypes.
1247 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1249 * report.cs (Message): New enum for better error, warning reference in
1251 (MessageData): New inner abstract class. It generally handles printing of
1252 error and warning messages.
1253 Removed unused Error, Warning, Message methods.
1255 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1257 Fix for cs0592-8.cs test
1259 (Attributable.ValidAttributeTargets): Made public.
1260 (Attribute.ExplicitTarget): New member for explicit target value.
1261 (Attribute.CheckTargets): Now we translate explicit attribute
1262 target to Target here.
1264 2004-08-03 Ben Maurer <bmaurer@ximian.com>
1266 * ecore.cs (MethodGroupExpr): new IsBase property.
1268 * expression.cs (BaseAccess): Set IsBase on MethodGroupExpr.
1270 * delegate.cs (DelegateCreation): store a MethodGroupExpr
1271 rather than an instance expr.
1273 (DelegateCreation.Emit): Use the method group rather than
1274 the instance expression. Also, if you have base.Foo as the
1275 method for a delegate, make sure to emit ldftn, not ldftnvirt.
1277 (ResolveMethodGroupExpr): Use the MethodGroupExpr.
1279 (NewDelegate.DoResolve): Only check for the existance of Invoke
1280 if the method is going to be needed. Use MethodGroupExpr.
1282 (NewDelegate.Emit): Remove, DelegateCreation implements this.
1284 * expression.cs: For pointer arith., make sure to use
1285 the size of the type, not the size of the pointer to
1288 2004-08-03 Marek Safar <marek.safar@seznam.cz>
1291 * class.cs (Class): Added error CS0502 test.
1293 2004-08-03 John Luke <jluke@cfl.rr.com>
1294 Raja R Harinath <rharinath@novell.com>
1297 * attribute.cs (Attribute.complained_before): New flag.
1298 (Attribute.ResolveType, Attribute.Resolve),
1299 (Attribute.DefinePInvokeMethod): Set it.
1300 (Attributes.Search): Pass 'complain' to Attribute.ResolveType.
1302 2004-08-03 Martin Baulig <martin@ximian.com>
1304 * expression.cs (Binary.ResolveOperator): Don't abort if we can't
1305 use a user-defined operator; we still need to do numeric
1306 promotions in case one argument is a builtin type and the other
1307 one has an implicit conversion to that type. Fixes #62322.
1309 2004-08-02 Martin Baulig <martin@ximian.com>
1311 * statement.cs (LocalInfo.Flags): Added `IsThis'.
1312 (LocalInfo.IsThis): New public property.
1313 (Block.EmitMeta): Don't create a LocalBuilder for `this'.
1315 2004-08-01 Martin Baulig <martin@ximian.com>
1317 * class.cs (TypeContainer.GetClassBases): Don't set the default
1318 here since we may get called from GetPartialBases().
1319 (TypeContainer.DefineType): If GetClassBases() didn't return a
1320 parent, use the default one.
1322 2004-07-30 Duncan Mak <duncan@ximian.com>
1324 * Makefile (mcs2.exe, mcs3.exe): add $(EXTRA_SOURCES).
1326 2004-07-30 Martin Baulig <martin@ximian.com>
1328 * Makefile (EXTRA_SOURCES): List the symbol writer's sources here.
1330 * class.cs (SourceMethod): New public class, derive from the
1331 symbol writer's ISourceMethod.
1332 (Method): Use the new symbol writer API.
1334 * codegen.cs (CodeGen.InitializeSymbolWriter): Take the filename
1335 as argument and use the new symbol writer.
1338 (SourceFile): Implement the symbol writer's ISourceFile.
1339 (Location.SymbolDocument): Removed.
1340 (Location.SourceFile): New public property.
1342 * symbolwriter.cs: Use the new symbol writer API.
1344 2004-07-30 Raja R Harinath <rharinath@novell.com>
1346 * Makefile (install-local): Remove. Functionality moved to
1349 2004-07-28 Lluis Sanchez Gual <lluis@novell.com>
1351 * Makefile: Install mcs.exe.config file together with mcs.exe.
1352 * mcs.exe.config: Added supportedRuntime entry to make sure it runs in the
1353 correct runtime version.
1355 2004-07-25 Martin Baulig <martin@ximian.com>
1358 (TypeContainer.RegisterOrder): Removed, this was unused.
1359 (TypeContainer, interface_order): Removed.
1360 (TypeContainer.AddClass, AddStruct, AddInterface): Take a
1361 TypeContainer as argument since we can also be called with a
1362 `PartialContainer' for a partial class/struct/interface.
1363 (TypeContainer.IsInterface): Use `Kind == Kind.Interface' instead
1364 of checking whether we're an `Interface' - we could be a
1366 (PartialContainer.Register): Override; call
1367 AddClass()/AddStruct()/AddInterface() on our parent.
1369 * cs-parser.jay (interface_member_declaration): Add things to the
1370 `current_container', not the `current_class'.
1372 * rootcontext.cs (RegisterOrder): The overloaded version which
1373 takes an `Interface' was unused, removed.
1375 * typemanager.cs (TypeManager.LookupInterface): Return a
1376 `TypeContainer', not an `Interface'.
1377 (TypeManager.IsInterfaceType): The `builder_to_declspace' may
1378 contain a `PartialContainer' for an interface, so check it's
1379 `Kind' to figure out what it is.
1381 2004-07-25 Martin Baulig <martin@ximian.com>
1383 * class.cs (Class.DefaultTypeAttributes): New public constant.
1384 (Struct.DefaultTypeAttributes): Likewise.
1385 (Interface.DefaultTypeAttributes): Likewise.
1386 (PartialContainer.TypeAttr): Override this and add the
1387 DefaultTypeAttributes.
1389 2004-07-25 Martin Baulig <martin@ximian.com>
1391 * decl.cs (DeclSpace.Emit): Removed the `TypeContainer' argument,
1392 we can just use the `Parent' field instead.
1394 2004-07-25 Martin Baulig <martin@ximian.com>
1396 * class.cs (TypeContainer.Emit): Renamed to EmitType().
1398 2004-07-25 Martin Baulig <martin@ximian.com>
1400 * class.cs (TypeContainer.DefineMembers): Call DefineMembers() on
1401 our parts before defining any methods.
1402 (TypeContainer.VerifyImplements): Make this virtual.
1403 (ClassPart.VerifyImplements): Override and call VerifyImplements()
1404 on our PartialContainer.
1406 2004-07-25 Martin Baulig <martin@ximian.com>
1408 * iterators.cs (Iterator.Define): Renamed to DefineIterator().
1410 * decl.cs (DeclSpace.Define): Removed the `TypeContainer'
1411 argument, we can just use the `Parent' field instead.
1414 (MemberBase.CheckBase): Removed the `TypeContainer' argument.
1415 (MemberBase.DoDefine): Likewise.
1417 2004-07-24 Martin Baulig <martin@ximian.com>
1419 * decl.cs (MemberCore.Parent): New public field.
1420 (DeclSpace.Parent): Moved to MemberCore.
1422 * class.cs (MethodCore.ds): Removed; use `Parent' instead.
1423 (MemberBase.ctor): Added TypeContainer argument, pass it to our
1425 (FieldBase, Field, Operator): Likewise.
1426 (EventProperty.ctor): Take a TypeContainer instead of a DeclSpace.
1427 (EventField, Event): Likewise.
1429 2004-07-23 Martin Baulig <martin@ximian.com>
1431 * class.cs (PartialContainer): New public class.
1432 (ClassPart): New public class.
1433 (TypeContainer): Added support for partial classes.
1434 (TypeContainer.GetClassBases): Splitted some of the functionality
1435 out into GetNormalBases() and GetPartialBases().
1437 * cs-tokenizer.cs (Token.PARTIAL): New token.
1438 (Tokenizer.consume_identifier): Added some hacks to recognize
1439 `partial', but only if it's immediately followed by `class',
1440 `struct' or `interface'.
1442 * cs-parser.jay: Added support for partial clases.
1444 2004-07-23 Martin Baulig <martin@ximian.com>
1446 * class.cs (MethodCore.ds): Made this a `TypeContainer' instead of
1447 a `DeclSpace' and also made it readonly.
1448 (MethodCore.ctor): Take a TypeContainer instead of a DeclSpace.
1449 (Method.ctor, Constructor.ctor, Destruktor.ctor): Likewise.
1450 (PropertyBase.ctor, Property.ctor, Indexer.ctor): Likewise.
1452 * cs-parser.jay: Pass the `current_class', not the
1453 `current_container' (at the moment, this is still the same thing)
1454 to a new Method, Property, Event, Indexer or Constructor.
1456 2004-07-23 Martin Baulig <martin@ximian.com>
1458 * cs-parser.jay (CSharpParser): Added a new `current_class' field
1459 and removed the `current_interface' one.
1460 (struct_declaration, class_declaration, interface_declaration):
1461 Set `current_class' to the newly created class/struct/interface;
1462 set their `Bases' and call Register() before parsing their body.
1464 2004-07-23 Martin Baulig <martin@ximian.com>
1466 * class.cs (Kind): New public enum.
1467 (TypeContainer): Made this class abstract.
1468 (TypeContainer.Kind): New public readonly field.
1469 (TypeContainer.CheckDef): New public method; moved here from
1471 (TypeContainer.Register): New public abstract method.
1472 (TypeContainer.GetPendingImplementations): New public abstract
1474 (TypeContainer.GetClassBases): Removed the `is_class' and
1475 `is_iface' parameters.
1476 (TypeContainer.DefineNestedTypes): Formerly known as
1478 (ClassOrStruct): Made this class abstract.
1480 * tree.cs (RootTypes): New public type.
1482 2004-07-20 Martin Baulig <martin@ximian.com>
1484 * tree.cs (Tree.RecordNamespace): Removed.
1485 (Tree.Namespaces): Removed.
1487 * rootcontext.cs (RootContext.IsNamespace): Removed.
1489 * cs-parser.jay (namespace_declaration): Just create a new
1490 NamespaceEntry here.
1492 2004-07-20 Martin Baulig <martin@ximian.com>
1494 * statement.cs (ExceptionStatement): New abstract class. This is
1495 now used as a base class for everyone who's using `finally'.
1496 (Using.ResolveLocalVariableDecls): Actually ResolveLValue() all
1497 our local variables before using them.
1499 * flowanalysis.cs (FlowBranching.StealFinallyClauses): New public
1500 virtual method. This is used by Yield.Resolve() to "steal" an
1501 outer block's `finally' clauses.
1502 (FlowBranchingException): The .ctor now takes an ExceptionStatement
1505 * codegen.cs (EmitContext.StartFlowBranching): Added overloaded
1506 version which takes an ExceptionStatement. This version must be
1507 used to create exception branchings.
1510 (Yield.Resolve): "Steal" all `finally' clauses from containing blocks.
1511 (Iterator.EmitMoveNext): Added exception support; protect the
1512 block with a `fault' clause, properly handle 'finally' clauses.
1513 (Iterator.EmitDispose): Run all the `finally' clauses here.
1515 2004-07-20 Martin Baulig <martin@ximian.com>
1517 * iterator.cs: This is the first of a set of changes in the
1518 iterator code. Match the spec more closely: if we're an
1519 IEnumerable, then GetEnumerator() must be called. The first time
1520 GetEnumerator() is called, it returns the current instance; all
1521 subsequent invocations (if any) must create a copy.
1523 2004-07-19 Miguel de Icaza <miguel@ximian.com>
1525 * expression.cs: Resolve the constant expression before returning
1528 2004-07-19 Martin Baulig <martin@ximian.com>
1530 * iterators.cs (Iterator.MapVariable): Don't define fields twice.
1531 (Iterator.MoveNextMethod.DoEmit): Use `TypeManager.int32_type' as
1532 the return type of the new EmitContext.
1534 2004-07-18 Martin Baulig <martin@ximian.com>
1536 * class.cs (Property.Define): Fix iterators.
1538 * iterators.cs (Iterator.Define): Moved the
1539 `container.AddInterator (this)' call here from the .ctor; only do
1540 it if we resolved successfully.
1542 2004-07-17 Miguel de Icaza <miguel@ximian.com>
1544 * cs-tokenizer.cs (handle_preprocessing_directive): Do not return
1545 `true' for preprocessing directives that we parse. The return
1546 value indicates whether we should return to regular tokenizing or
1547 not, not whether it was parsed successfully.
1549 In the past if we were in: #if false ... #line #endif, we would
1550 resume parsing after `#line'. See bug 61604.
1552 * typemanager.cs: Removed an old hack from Gonzalo to get corlib
1553 building: IsEnumType should return true only for enums, not for
1554 enums or System.Enum itself. This fixes #61593.
1556 Likely what happened is that corlib was wrong: mcs depended on
1557 this bug in some places. The bug got fixed, we had to add the
1558 hack, which caused bug 61593.
1560 * expression.cs (ArrayAccess.GetStoreOpCode): Remove an old hack
1561 that was a workaround for the older conditions.
1563 2004-07-16 Ben Maurer <bmaurer@ximian.com>
1565 * assign.cs: IAssignMethod has a new interface, as documented
1566 inline. All assignment code now uses this new api.
1568 * ecore.cs, expression.cs: All classes which implement
1569 IAssignMethod now use the new interface.
1571 * expression.cs (Invocation): add a hack to EmitCall so that
1572 IndexerAccess can be the target of a compound assignment without
1573 evaluating its arguments twice.
1575 * statement.cs: Handle changes in Invocation api.
1577 2004-07-16 Martin Baulig <martin@ximian.com>
1579 * iterators.cs: Rewrote this. We're now using one single Proxy
1580 class for both the IEnumerable and the IEnumerator interface and
1581 `Iterator' derives from Class so we can use the high-level API.
1583 * class.cs (TypeContainer.AddIterator): New method.
1584 (TypeContainer.DoDefineType): New protected virtual method, which
1585 is called from DefineType().
1586 (TypeContainer.DoDefineMembers): Call DefineType() and
1587 DefineMembers() on all our iterators.
1588 (TypeContainer.Emit): Call Emit() on all our iterators.
1589 (TypeContainer.CloseType): Call CloseType() on all our iterators.
1591 * codegen.cs (EmitContext.CurrentIterator): New public field.
1593 2004-07-15 Martin Baulig <martin@ximian.com>
1596 (TypeManager.not_supported_exception_type): New type.
1598 2004-07-14 Martin Baulig <martin@ximian.com>
1600 * iterators.cs: Use real error numbers.
1602 2004-07-14 Martin Baulig <martin@ximian.com>
1604 * iterator.cs (IteratorHandle.IsIEnumerable): The spec explicitly
1605 requires this to be a System.Collection.IEnumerable and not a
1606 class implementing that interface.
1607 (IteratorHandle.IsIEnumerator): Likewise, for IEnumerator.
1609 2004-07-13 Marek Safar <marek.safar@seznam.cz>
1611 * class.cs: Fixed previous fix, it broke some error tests.
1613 2004-07-12 Martin Baulig <martin@ximian.com>
1615 * enum.cs (Enum.Define): Call Emit() to emit the attributes.
1618 2004-07-09 Miguel de Icaza <miguel@ximian.com>
1620 * assign.cs (LocalTemporary): Add new argument: is_address,If
1621 `is_address' is true, then the value that we store is the address
1622 to the real value, and not the value itself.
1624 * ecore.cs (PropertyExpr): use the new local temporary
1625 stuff to allow us to handle X.Y += z (where X is a struct)
1627 2004-07-08 Martin Baulig <martin@ximian.com>
1629 * statement.cs (Lock.Resolve): Set ec.NeedReturnLabel() if we do
1630 not always return, just like we're doing in Using.Resolve().
1632 2004-07-07 Miguel de Icaza <miguel@ximian.com>
1634 * cs-parser.jay (fixed_statement): flag this as Pinned.
1636 2004-07-06 Miguel de Icaza <miguel@ximian.com>
1638 * typemanager.cs (TypeManager): Removed MakePinned method, this
1639 mechanism is replaced with the .NET 2.x compatible mechanism of
1640 calling `ILGenerator.DeclareLocal (Type t, bool pinned)'.
1642 * statement.cs (LocalInfo): Remove MakePinned, add Pinned property
1643 Rename `Fixed' to `Pinned' as a flag, to distinguish from the
1644 `IsFixed' property which has a different meaning.
1646 2004-07-02 Raja R Harinath <rharinath@novell.com>
1648 * ecore.cs (DoSimpleNameResolve): Expand CS0038 check to all names
1649 visible from inside a nested class, not just the names of the
1650 immediately enclosing class.
1653 2004-06-24 Raja R Harinath <rharinath@novell.com>
1655 * expression.cs (BetterConversion): Remove buggy special-case
1656 handling of "implicit constant expression conversions". At this
1657 point, we already know that the conversion is possible -- we're
1658 only checking to see which is better.
1660 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1662 * cs-parser.jay: Added error CS0210 test.
1664 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1666 * cs-parser.jay: Added error CS0134 test.
1668 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1671 * cs-parser.jay: Added error CS0145 test.
1673 2004-06-24 Marek Safar <marek.safar@seznam.cz>
1675 * class.cs (Operator.Define): Added test for errors CS0553, CS0554.
1677 2004-06-23 Ben Maurer <bmaurer@ximian.com>
1679 * expression.cs (StackAlloc.Resolve): The argument may not
1680 be a constant; deal with this case.
1682 2004-06-23 Marek Safar <marek.safar@seznam.cz>
1684 * attribute.cs (IndexerName_GetIndexerName): Renamed to
1685 GetIndexerAttributeValue.
1686 (ScanForIndexerName): Renamed to GetIndexerNameAttribute.
1688 * class.cs (Indexer.Define): Added error tests for CS0415,
1691 2004-06-23 Miguel de Icaza <miguel@ximian.com>
1693 * attribute.cs (Attribute.Resolve): Keep field code in sync with
1696 2004-06-23 Martin Baulig <martin@ximian.com>
1698 * flowanalysis.cs (UsageVector.MergeChild): If we're a loop and we
1699 neither return nor throw, reset the barrier as well. Fixes #60457.
1701 2004-06-22 Atsushi Enomoto <atsushi@ximian.com>
1703 * class.cs : EventAttributes is now set to None by default.
1704 This fixes bug #60459.
1706 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1709 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
1710 Don't throw exception but return null (it's sufficient now).
1712 2004-06-18 Marek Safar <marek.safar@seznam.cz>
1714 * typemanager.cs (GetArgumentTypes): Faster implementation.
1716 2004-06-18 Martin Baulig <martin@ximian.com>
1718 * attribute.cs (Attribute.Resolve): Check whether we're an
1719 EmptyCast which a Constant child. Fixes #60333.
1721 2004-06-17 Ben Maurer <bmaurer@ximian.com>
1723 * statement.cs (EmitCollectionForeach): Account for the fact that
1724 not all valuetypes are in areas which we can take the address of.
1725 For these variables, we store to a temporary variable. Also, make
1726 sure that we dont emit a `callvirt' on a valuetype method.
1728 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1730 * expression.cs (StackAlloc.DoReSolve): Added test for
1731 negative parameter (CS0247).
1733 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1736 * class.cs: (Event.DelegateMethod.Emit): Added synchronization flag.
1738 2004-06-15 Marek Safar <marek.safar@seznam.cz>
1741 * expression.cs: (Binary.DoNumericPromotions): Added conversion for
1744 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1746 Fix bug #58254 & cs1555.cs, cs1556.cs
1747 * driver.cs (MainDriver): Added tests for errors CS1555, CS1556.
1749 2004-06-14 Marek Safar <marek.safar@seznam.cz>
1751 * cs-parser.jay: Added error CS1669 test for indexers.
1753 2004-06-11 Martin Baulig <martin@ximian.com>
1755 * expression.cs (Invocation.IsParamsMethodApplicable): We need to
1756 call this twice: for params and varargs methods.
1758 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1761 (FieldBase.DoDefine, PropertyBase.DoDefine): Added error test CS0610.
1763 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1765 * attribute.cs (Attribute.GetValidTargets): Made public.
1768 (AbstractPropertyEventMethod): New class for better code sharing.
1769 (AbstractPropertyEventMethod.ApplyAttributeBuilder): Add error
1771 (PropertyMethod, DelegateMethod): Derived from AbstractPropertyEventMethod
1773 2004-06-11 Raja R Harinath <rharinath@novell.com>
1776 * ecore.cs (ResolveFlags): Add new 'Intermediate' flag to tell
1777 that the call to Resolve is part of a MemberAccess.
1778 (Expression.Resolve): Use it for SimpleName resolution.
1779 (SimpleName.SimpleNameResolve, SimpleName.DoResolveAllowStatic):
1780 Add 'intermediate' boolean argument.
1781 (SimpleName.DoSimpleNameResolve): Likewise. Use it to disable an
1782 error message when the SimpleName can be resolved ambiguously
1783 between an expression and a type.
1784 * expression.cs (MemberAccess.IdenticalNameAndTypeName): Make
1786 (MemberAccess.Resolve): Pass 'Intermediate' flag to the Resolve()
1787 call on the left-side.
1789 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1792 (MethodCore.VerifyClsCompliance): Added test for error CS3000.
1794 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1796 * attribute.cs (Attribute.Emit): Fixed error CS0579 reporting.
1798 2004-06-11 Martin Baulig <martin@ximian.com>
1800 * expression.cs (Invocation.EmitCall): Use OpCodes.Callvirt for
1801 varargs methods if applicable.
1803 2004-06-11 Martin Baulig <martin@ximian.com>
1805 * expression.cs (Invocation.EmitCall): Don't use
1806 `method.CallingConvention == CallingConventions.VarArgs' since the
1807 method could also have `CallingConventions.HasThis'.
1809 2004-06-11 Marek Safar <marek.safar@seznam.cz>
1811 * class.cs (Event.GetSignatureForError): Implemented.
1812 Fixed crash in error test cs3010.cs
1814 2004-06-10 Miguel de Icaza <miguel@ximian.com>
1816 * cs-tokenizer.cs: Change the way we track __arglist to be
1817 consistent with the other keywords.
1819 2004-06-09 Miguel de Icaza <miguel@ximian.com>
1821 * codegen.cs: FAQ avoider: turn 1577 into a warning for now until
1824 2004-06-09 Sebastien Pouliot <sebastien@ximian.com>
1826 * codegen.cs: Check that all referenced assemblies have a strongname
1827 before strongnaming the compiled assembly. If not report error CS1577.
1828 Fix bug #56563. Patch by Jackson Harper.
1829 * typemanager.cs: Added a method to return all referenced assemblies.
1830 Fix bug #56563. Patch by Jackson Harper.
1832 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1835 (Method.ApplyAttributeBuilder): Moved and added conditional
1836 attribute error tests (CS0577, CS0578, CS0243, CS0582, CS0629).
1839 (DelegateCreation.ResolveMethodGroupExpr): Added error CS1618 test.
1841 2004-06-08 Marek Safar <marek.safar@seznam.cz>
1844 * class.cs: (EventField.attribute_targets): Changed default target.
1846 2004-06-08 Martin Baulig <martin@ximian.com>
1848 * expression.cs (Invocation.EmitCall): Enable varargs methods.
1850 2004-06-08 Martin Baulig <martin@ximian.com>
1852 * rootcontext.cs (ResolveCore): Added "System.RuntimeArgumentHandle".
1854 2004-06-07 Martin Baulig <martin@ximian.com>
1856 Added support for varargs methods.
1858 * cs-tokenizer.cs (Token.ARGLIST): New token for the `__arglist'
1861 * cs-parser.jay: Added support for `__arglist'.
1863 * decl.cs (MemberCache.AddMethods): Don't ignore varargs methods.
1865 * expression.cs (Argument.AType): Added `ArgList'.
1866 (Invocation): Added support for varargs methods.
1867 (ArglistAccess): New public class.
1868 (Arglist): New public class.
1870 * parameter.cs (Parameter.Modifier): Added `ARGLIST'.
1872 * statement.cs (Block.Flags): Added `HasVarargs'. We set this on
1873 a method's top-level block if the method has varargs.
1875 * support.cs (ReflectionParameters, InternalParameters): Added
1876 support for varargs methods.
1878 2004-06-07 Miguel de Icaza <miguel@ximian.com>
1880 * class.cs: Provide location in indexer error report.
1882 * driver.cs: Use standard names.
1884 * namespace.cs: Catch the use of using after a namespace has been
1885 declared also on using aliases.
1887 2004-06-03 Raja R Harinath <rharinath@novell.com>
1890 * typemanager.cs (closure_private_ok, closure_invocation_type)
1891 (closure_qualifier_type, closure_invocation_assembly)
1892 (FilterWithClosure): Move to ...
1893 (Closure): New internal nested class.
1894 (Closure.CheckValidFamilyAccess): Split out from Closure.Filter.
1895 (MemberLookup, RealMemberLookup): Add new almost_match parameter.
1896 * ecore.cs (almostMatchedMembers): New variable to help report CS1540.
1897 (MemberLookup, MemberLookupFailed): Use it.
1898 * expression.cs (New.DoResolve): Treat the lookup for the
1899 constructor as being qualified by the 'new'ed type.
1900 (Indexers.GetIndexersForTypeOrInterface): Update.
1902 2004-06-03 Marek Safar <marek.safar@seznam.cz>
1905 (GetConditionalAttributeValue): New method. Returns
1906 condition of ConditionalAttribute.
1907 (SearchMulti): New method. Returns all attributes of type 't'.
1908 Use it when attribute is AllowMultiple = true.
1909 (IsConditionalMethodExcluded): New method.
1912 (Method.IsExcluded): Implemented. Returns true if method has conditional
1913 attribute and the conditions is not defined (method is excluded).
1914 (IMethodData): Extended interface for ConditionalAttribute support.
1915 (PropertyMethod.IsExcluded): Implemented.
1918 (MemberCore.Flags): Excluded_Undetected, Excluded new caching flags.
1921 (Invocation.IsMethodExcluded): Checks the ConditionalAttribute
1924 2004-06-02 Ben Maurer <bmaurer@users.sourceforge.net>
1926 * expression.cs (ArrayCreationExpression): Make this just an
1927 `expression'. It can't be a statement, so the code here was
1930 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1933 * typemanager.cs (GetFullNameSignature): New method for
1936 2004-06-02 Marek Safar <marek.safar@seznam.cz>
1939 * class.cs (MemberBase.GetSignatureForError): New virtual method.
1940 Use this method when MethodBuilder is null.
1941 (MethodData.DefineMethodBuilder): Encapsulated code to the new method.
1942 Added test for error CS0626 (MONO reports error for this situation).
1943 (IMethodData.GetSignatureForError): Extended interface.
1945 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1948 (AttributeTester.GetObsoleteAttribute): Returns instance of
1949 ObsoleteAttribute when type is obsolete.
1952 (TypeContainer.VerifyObsoleteAttribute): Override.
1953 (Method.GetSignatureForError): New method for usage when MethodBuilder is null.
1954 (MethodCode.VerifyObsoleteAttribute): Override.
1955 (MemberBase.VerifyObsoleteAttribute): Override.
1958 (MemberCore.CheckUsageOfObsoleteAttribute): Tests presence of ObsoleteAttribute
1959 and report proper error.
1962 Delegate.VerifyObsoleteAttribute): Override.
1965 (Expression.CheckObsoleteAttribute): Tests presence of ObsoleteAttribute
1966 and report proper error.
1967 (FieldExpr.DoResolve): Added tests for ObsoleteAttribute.
1970 (Enum.GetObsoleteAttribute): Returns ObsoleteAttribute for both enum type
1974 (Probe.DoResolve, Cast.DoResolve, LocalVariableReference.DoResolve,
1975 New.DoResolve, SizeOf.DoResolve, TypeOf.DoResolce, MemberAccess.DoResolve):
1976 Added test for ObsoleteAttribute.
1979 (Catch): Derived from Statement.
1981 2004-06-01 Marek Safar <marek.safar@seznam.cz>
1983 Fixed bug #59071 & cs0160.cs
1985 * statement.cs (Try.Resolve): Check here whether order of catch
1986 clauses matches their dependencies.
1988 2004-05-31 Miguel de Icaza <miguel@ximian.com>
1990 * Reverted patch to namespace.cs (Use lookuptypedirect). This
1991 caused a regression: #59343. Referencing nested classes from an
1992 assembly stopped working.
1994 2004-05-31 Martin Baulig <martin@ximian.com>
1996 MCS is now frozen for beta 2.
1998 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2000 * convert.cs: add a trivial cache for overload operator resolution.
2002 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2004 * decl.cs: If possible, use lookuptypedirect here. We can only do
2005 this if there is no `.' after the namespace. Avoids using
2006 LookupType, which does lots of slow processing.
2007 (FindNestedType) New method, does what it says :-).
2008 * namespace.cs: use LookupTypeDirect.
2009 * rootcontext.cs: use membercache, if possible.
2010 * typemanager.cs (LookupTypeDirect): Cache negative hits too.
2012 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2015 According to the spec,
2017 In a member access of the form E.I, if E is a single identifier,
2018 and if the meaning of E as a simple-name (§7.5.2) is a constant,
2019 field, property, localvariable, or parameter with the same type as
2020 the meaning of E as a type-name (§3.8), then both possible
2021 meanings of E are permitted.
2023 We did not check that E as a simple-name had the same type as E as
2026 This trivial check gives us 5-7% on bootstrap time.
2028 2004-05-30 Ben Maurer <bmaurer@users.sourceforge.net>
2030 * expression.cs (Invocation.OverloadResolve): Avoid the
2031 use of hashtables and boxing here by allocating on demand.
2033 2004-05-30 Martin Baulig <martin@ximian.com>
2035 * rootcontext.cs (RootContext.LookupType): Don't cache things if
2036 we're doing a silent lookup. Don't try to lookup nested types in
2037 TypeManager.object_type (thanks to Ben Maurer).
2039 2004-05-30 Martin Baulig <martin@ximian.com>
2041 Committing a patch from Ben Maurer.
2043 * rootcontext.cs (RootContext.LookupType): Cache negative results.
2045 2004-05-29 Martin Baulig <martin@ximian.com>
2047 * class.cs (IMethodData.ShouldIgnore): New method.
2049 * typemanager.cs (TypeManager.MethodFlags): Don't take a
2050 `Location' argument, we don't need it anywhere. Use
2051 `IMethodData.ShouldIgnore ()' instead of
2052 `MethodData.GetMethodFlags ()'.
2053 (TypeManager.AddMethod): Removed.
2054 (TypeManager.AddMethod2): Renamed to AddMethod.
2056 2004-05-29 Martin Baulig <martin@ximian.com>
2058 Committing a patch from Benjamin Jemlich <pcgod@gmx.net>.
2060 * convert.cs (Convert.ImplicitReferenceConversion): If we're
2061 converting from a class type S to an interface type and we already
2062 have an object on the stack, don't box it again. Fixes #52578.
2064 2004-05-29 Martin Baulig <martin@ximian.com>
2066 * class.cs (ConstructorInitializer.GetOverloadedConstructor):
2067 Added support for `params' parameters. Fixes #59267.
2069 2004-05-29 Martin Baulig <martin@ximian.com>
2071 * literal.cs (NullPointer): Provide a private .ctor which sets
2072 `type' to TypeManager.object_type. Fixes #59048.
2074 2004-05-29 Martin Baulig <martin@ximian.com>
2076 * expression.cs (MemberAccess.ResolveMemberAccess): If we're an
2077 EventExpr, set `ee.InstanceExpression = left'. Fixes #59188.
2079 * ecore.cs (EventExpr.instance_expr): Make the field private.
2081 2004-05-26 Marek Safar <marek.safar@seznam.cz>
2083 Fixed bug #50080 & cs0214-2.cs
2084 * expression.cs (Cast.DoResolve): Check unsafe context here.
2086 * statement.cs (Resolve.DoResolve): Likewise.
2088 2004-05-26 Martin Baulig <martin@ximian.com>
2090 * namespace.cs (NamespaceEntry.Lookup): Added `bool silent'.
2092 * rootcontext.cs (RootContext.NamespaceLookup): Added `bool silent'.
2093 (RootContext.LookupType): Pass down the `silent' flag.
2095 2004-05-25 Martin Baulig <martin@ximian.com>
2098 (MethodGroupExpr.IdenticalTypeName): New public property.
2099 (Invocation.DoResolve): Don't report a CS0176 if the "instance"
2100 expression actually refers to a type.
2102 2004-05-25 Martin Baulig <martin@ximian.com>
2104 * expression.cs (Invocation.DoResolve): Applied Ben Maurer's patch
2105 for #56176 and made it actually work.
2107 2004-05-25 Martin Baulig <martin@ximian.com>
2109 * ecore.cs (Expression.CacheTemporaries): Make this virtual.
2110 (FieldExpr, PropertyExpr): Override and implement
2111 CacheTemporaries. Fixes #52279.
2113 2004-05-25 Miguel de Icaza <miguel@ximian.com>
2115 * location.cs: In the new compiler listing a file twice is a
2116 warning, not an error.
2118 2004-05-24 Martin Baulig <martin@ximian.com>
2120 * enum.cs (Enum.DefineType): For the `BaseType' to be a
2121 TypeLookupExpression; otherwise, report a CS1008. Fixes #58571.
2123 2004-05-24 Martin Baulig <martin@ximian.com>
2125 * decl.cs (DeclSpace.FindType): Try doing an alias lookup before
2126 walking the `using' list. Fixes #53921.
2128 2004-05-24 Martin Baulig <martin@ximian.com>
2130 * const.cs (Const.LookupConstantValue): Added support for
2131 EmptyCast's; fixes #55251.
2133 2004-05-24 Martin Baulig <martin@ximian.com>
2135 * ecore.cs (SimpleName.SimpleNameResolve): Renamed to
2136 DoSimpleNameResolve() and provide a SimpleNameResolve() wrapper
2137 which does the CS0135 check. The reason is that we first need to
2138 check whether the variable actually exists.
2140 2004-05-24 Martin Baulig <martin@ximian.com>
2142 * class.cs (MemberBase.DoDefine): Use DeclSpace.FindType() rather
2143 than RootContext.LookupType() to find the explicit interface
2146 2004-05-24 Raja R Harinath <rharinath@novell.com>
2148 * Makefile: Simplify. Use executable.make.
2149 * mcs.exe.sources: New file. List of sources of mcs.exe.
2151 2004-05-24 Anders Carlsson <andersca@gnome.org>
2155 Use the invariant culture when doing String.Compare for CLS case
2158 2004-05-23 Martin Baulig <martin@ximian.com>
2160 * decl.cs (DeclSpace.FindType): Only check the `using' list if we
2161 don't have any dots. Fixes #52622, added cs0246-8.cs.
2163 * namespace.cs (NamespaceEntry.Lookup): Likewise.
2165 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2167 * class.cs (MemberBase.Define): Reuse MemberType member for
2168 resolved type. Other methods can use it too.
2170 2004-05-23 Martin Baulig <martin@ximian.com>
2172 * ecore.cs (SimpleName.SimpleNameResolve): Only report a CS0135 if
2173 the variable also exists in the current block (otherwise, we need
2174 to report a CS0103). Fixes #58670.
2176 2004-05-23 Martin Baulig <martin@ximian.com>
2178 * flowanalysis.cs (Reachability.Reachable): Compute this
2179 on-the-fly rather than storing it as a field.
2181 2004-05-23 Martin Baulig <martin@ximian.com>
2183 * flowanalysis.cs (Reachability.And): Manually compute the
2184 resulting `barrier' from the reachability.
2186 2004-05-23 Marek Safar <marek.safar@seznam.cz>
2189 * attribute.cs (AttributeTester.GetMethodObsoleteAttribute): Returns
2190 instance of ObsoleteAttribute when symbol is obsolete.
2193 (IMethodData): Extended interface for ObsoleteAttribute support.
2195 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2197 * attribute.cs: Fix bug #55970
2199 2004-05-22 Marek Safar <marek.safar@seznam.cz>
2203 (GetObsoleteAttribute): New method. Creates the instance of
2205 (AttributeTester.GetMemberObsoleteAttribute): Returns instance of
2206 ObsoleteAttribute when member is obsolete.
2207 (AttributeTester.Report_ObsoleteMessage): Common method for
2208 Obsolete error/warning reporting.
2211 (TypeContainer.base_classs_type): New member for storing parent type.
2214 (MemberCore.GetObsoleteAttribute): Returns instance of ObsoleteAttribute
2215 for this MemberCore.
2217 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2219 * attribute.cs, const.cs: Fix bug #58590
2221 2004-05-21 Martin Baulig <martin@ximian.com>
2223 * flowanalysis.cs (FlowBranching.MergeTopBlock): Don't check for
2224 out parameters if the end of the method is unreachable. Fixes
2227 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2229 * codegen.cs, cs-parser.jay: Removed SetAttributes method.
2230 Hari was right, why extra method.
2232 2004-05-21 Marek Safar <marek.safar@seznam.cz>
2234 * attribute.cs, cs-parser.jay: Fix errors/cs0579-7.cs.
2236 2004-05-20 Martin Baulig <martin@ximian.com>
2238 Merged this back from gmcs to keep the differences to a minumum.
2240 * attribute.cs (Attribute.CheckAttributeType): Take an EmitContext
2241 instead of a Declspace.
2242 (Attribute.ResolveType): Likewise.
2243 (Attributes.Search): Likewise.
2244 (Attributes.Contains): Likewise.
2245 (Attributes.GetClsCompliantAttribute): Likewise.
2247 * class.cs (TypeContainer.VerifyMembers): Added EmitContext
2249 (MethodData.ApplyAttributes): Take an EmitContext instead of a
2252 2004-05-19 Marek Safar <marek.safar@seznam.cz>
2254 Fix bug #58688 (MCS does not report error when the same attribute
2257 * attribute.cs (Attribute.Emit): Distinction between null and default.
2259 2004-05-19 Raja R Harinath <rharinath@novell.com>
2261 * cs-parser.jay (attribute): Create a GlobalAttribute for the case
2262 of a top-level attribute without an attribute target.
2263 * attribute.cs (Attribute.Error_AttributeConstructorMismatch):
2265 (Attribute.Conditional_GetConditionName),
2266 (Attribute.Obsolete_GetObsoleteMessage): Update.
2267 (Attribute.IndexerName_GetIndexerName): New. Attribute-specific
2268 part of ScanForIndexerName.
2269 (Attribute.CanIgnoreInvalidAttribute): New function.
2270 (Attribute.ScanForIndexerName): Move to ...
2271 (Attributes.ScanForIndexerName): ... here.
2272 (Attributes.Attrs): Rename from now-misnamed AttributeSections.
2273 (Attributes.Search): New internal variant that can choose not to
2274 complain if types aren't resolved. The original signature now
2276 (Attributes.GetClsCompliantAttribute): Use internal variant, with
2277 complaints suppressed.
2278 (GlobalAttribute.CheckAttributeType): Overwrite ds.NamespaceEntry
2279 only if it not useful.
2280 (CanIgnoreInvalidAttribute): Ignore assembly attribute errors at
2281 top-level for attributes that are shared between the assembly
2282 and a top-level class.
2283 * parameter.cs (ImplicitParameter): Rename from ParameterAtribute.
2284 * class.cs: Update to reflect changes.
2285 (DefineIndexers): Fuse loops.
2286 * codegen.cs (GetAssemblyName): Update to reflect changes. Accept
2287 a couple more variants of attribute names.
2289 2004-05-18 Marek Safar <marek.safar@seznam.cz>
2291 Fix bug #52585 (Implemented explicit attribute declaration)
2294 (Attributable.ValidAttributeTargets): New abstract method. It gets
2295 list of valid attribute targets for explicit target declaration.
2296 (Attribute.Target): It holds target itself.
2297 (AttributeSection): Removed.
2298 (Attribute.CheckTargets): New method. It checks whether attribute
2299 target is valid for the current element.
2302 (EventProperty): New class. For events that are declared like
2303 property (with add and remove accessors).
2304 (EventField): New class. For events that are declared like field.
2307 * cs-parser.jay: Implemented explicit attribute target declaration.
2309 * class.cs, decl.cs, delegate.cs, enum.cs, parameter.cs:
2310 Override ValidAttributeTargets.
2313 (ReturnParameter): Class for applying custom attributes on
2315 (ParameterAtribute): New class. Class for applying custom
2316 attributes on the parameter type.
2318 2004-05-17 Miguel de Icaza <miguel@ximian.com>
2320 * class.cs (MemberBase.DoDefine): Pass UNSAFE on interface
2323 (Method): Allow UNSAFE here.
2325 * modifiers.cs: Support unsafe reporting.
2327 2004-05-17 Marek Safar <marek.safar@seznam.cz>
2329 * decl.cs: Fix bug #58478.
2331 2004-05-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2333 * statement.cs: When checking for unreachable code on an EmptyStatement,
2334 set the location. Fixes bug #58488.
2336 2004-05-13 Miguel de Icaza <miguel@ximian.com>
2338 * driver.cs: Add -pkg handling.
2340 From Gonzalo: UseShelLExecute=false
2342 2004-05-12 Marek Safar <marek.safar@seznam.cz>
2345 (Attribute.GetAttributeTargets): New method. Gets AttributeTargets
2347 (Attribute.IsClsCompliaceRequired): Moved to base for better
2349 (Attribute.UsageAttribute): New property for AttributeUsageAttribute
2350 when attribute is AttributeUsageAttribute.
2351 (Attribute.GetValidTargets): Simplified.
2352 (Attribute.GetAttributeUsage): New method returns AttributeUsage
2353 attribute for this type.
2354 (Attribute.ApplyAttributes): Method renamed to Emit and make
2356 (GlobalAttributeSection): New class for special handling of global
2357 attributes (assembly, module).
2358 (AttributeSection.Emit): New method.
2360 * class.cs: Implemented Attributable abstract methods.
2361 (MethodCore.LabelParameters): Moved to Parameter class.
2362 (Accessor): Is back simple class.
2363 (PropertyMethod): Implemented Attributable abstract class.
2364 (DelegateMethod): Implemented Attributable abstract class.
2365 (Event): New constructor for disctintion between normal Event
2366 and Event with accessors.
2368 * cs-parser.jay: Used new Event ctor and GlobalAttributeSection.
2370 * codegen.cs, const.cs, decl.cs, delegate.cs:
2371 (CommonAssemblyModulClass): Implemented Attributable abstract class
2374 * enum.cs: Implement IAttributeSupport interface.
2375 (EnumMember): New class for emum members. Implemented Attributable
2379 (ParameterBase): Is abstract.
2380 (ReturnParameter): New class for easier [return:] attribute handling.
2382 * typemanager.cs: Removed builder_to_attr.
2384 2004-05-11 Raja R Harinath <rharinath@novell.com>
2387 * attribute.cs (Attribute.GetPositionalValue): New function.
2388 * class.cs (TypeContainer.VerifyMembers): New function.
2389 (TypeContainer.Emit): Use it.
2390 (ClassOrStruct): New base class for Class and Struct.
2391 (ClassOrStruct.ApplyAttributeBuilder): New function. Note if
2392 StructLayout(LayoutKind.Explicit) was ascribed to the struct or
2394 (ClassOrStruct.VerifyMembers): If the struct is explicitly laid out,
2395 then each non-static field should have a FieldOffset attribute.
2396 Otherwise, none of the fields should have a FieldOffset attribute.
2397 * rootcontext.cs (RootContext.ResolveCore): Resolve StructLayout
2398 and FieldOffset attributes.
2399 * typemanager.cs (TypeManager.struct_layout_attribute_type)
2400 (TypeManager.field_offset_attribute_type): New core types.
2401 (TypeManager.InitCoreTypes): Initialize them.
2403 2004-05-11 Michal Moskal <malekith@pld-linux.org>
2405 * class.cs (Event.RemoveDelegateMethod.DelegateMethodInfo):
2406 Return correct type.
2409 2004-05-09 Miguel de Icaza <miguel@ximian.com>
2411 * expression.cs (Binary.DoNumericPromotions): 0 long constant can
2412 be implicitly converted to ulong.
2414 * expression.cs: The logic for allowing operator &, | and ^ worked
2415 was wrong, it worked before because we did not report an error in
2416 an else branch. Fixes 57895.
2418 * class.cs: Applied patch from iain@mccoy.id.au Iain McCoy to
2419 allow volatile fields to be reference types.
2421 2004-05-07 Miguel de Icaza <miguel@ximian.com>
2423 * driver.cs: Add support for /debug-
2425 2004-05-07 Raja R Harinath <rharinath@novell.com>
2427 * attribute.cs (Attribute.CheckAttributeType, Attribute.ResolveType):
2428 Add a 'complain' parameter to silence errors.
2429 (Attribute.Resolve): Update to changes. Put in sanity check to catch
2430 silently overlooked type-resolutions.
2431 (Attribute.ScanForIndexerName, Attribute.DefinePInvokeMethod): Update
2433 (Attributes.Search): New function.
2434 (Attributes.Contains, Attributes.GetClsCompliantAttribute): Use Search.
2435 (Attributes.GetAttributeFullName): Remove hack.
2436 * class.cs (MethodCore.LabelParameters, MethodData.ApplyAttributes):
2437 Update to reflect changes.
2438 * codegen.cs (CommonAssemblyModulClass.GetClsCompliantAttribute):
2439 Use Attributes.Search instead of nested loops.
2441 2004-05-07 Marek Safar <marek.safar@seznam.cz>
2444 (MemberCore.Flags): Extended for caching presence of CLSCompliantAttribute.
2445 (MemberCore.VerifyClsCompliance): Implemented CS3019 error report.
2446 (DeclSpace.GetClsCompliantAttributeValue): Returns simple bool.
2448 * report.cs: (Report.Warning): Renamed to Warning_T because of
2449 parameter collision.
2451 2004-05-05 Raja R Harinath <rharinath@novell.com>
2453 * expression.cs (MemberAccess.ResolveMemberAccess):
2454 Exit with non-zero status after Report.Error.
2455 * rootcontext.cs (RootContext.BootstrapCorlib_ResolveDelegate):
2457 * typemanager.cs (TypeManager.CoreLookupType): Likewise.
2459 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2461 * support.cs: Don't hang when the file is empty.
2463 2004-05-04 Lluis Sanchez Gual <lluis@ximian.com>
2465 * support.cs: In SeekableStreamReader, compute the preamble size of the
2466 underlying stream. Position changes should take into account that initial
2469 2004-05-03 Todd Berman <tberman@sevenl.net>
2471 * driver.cs: remove unused GetSysVersion function.
2473 2004-05-03 Todd Berman <tberman@sevenl.net>
2475 * driver.cs: Remove the hack from saturday, as well as the hack
2476 from jackson (LoadAssemblyFromGac), also adds the CWD to the
2477 link_paths to get that bit proper.
2479 2004-05-01 Todd Berman <tberman@sevenl.net>
2481 * driver.cs: Try a LoadFrom before a Load, this checks the current
2482 path. This is currently a bug in mono that is be fixed, however, this
2483 provides a workaround for now. This will be removed when the bug
2486 2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
2488 * CryptoConvert.cs: Updated to latest version. Fix issue with
2489 incomplete key pairs (#57941).
2491 2004-05-01 Todd Berman <tberman@sevenl.net>
2493 * driver.cs: Remove '.' from path_chars, now System.* loads properly
2496 2004-04-30 Jackson Harper <jackson@ximian.com>
2498 * codegen.cs: Open keys readonly.
2500 2004-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2502 * typemanager.cs: don't report cyclic struct layout when a struct
2503 contains 2 or more fields of the same type. Failed for Pango.AttrShape
2504 which has 2 Pango.Rectangle fields.
2506 2004-04-29 Ben Maurer <bmaurer@users.sourceforge.net>
2508 * expression.cs: Handle IntPtr comparisons with IL code
2509 rather than a method call.
2511 2004-04-29 Martin Baulig <martin@ximian.com>
2513 * ecore.cs (PropertyExpr.FindAccessor): New private method. Walk
2514 the list of PropertyInfo's in class hierarchy and find the
2515 accessor. Fixes #56013.
2517 2004-04-29 Martin Baulig <martin@ximian.com>
2519 * typemanager.cs (TypeManager.CheckStructCycles): Fixed.
2521 2004-04-29 Martin Baulig <martin@ximian.com>
2523 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2525 * ecore.cs (FieldExpr.AddressOf): Make this work for valuetypes.
2527 2004-04-29 Martin Baulig <martin@ximian.com>
2529 * class.cs (ConstructorInitializer.Resolve): Check whether the
2530 parent .ctor is accessible. Fixes #52146.
2532 2004-04-29 Martin Baulig <martin@ximian.com>
2534 Applying a patch from Benjamin Jemlich <pcgod@gmx.net>.
2536 * statement.cs (Using.EmitLocalVariableDecls): Use
2537 TypeManager.idisposable_type, not typeof (IDisposable).
2538 (Foreach.EmitCollectionForeach): Added support for valuetypes.
2540 2004-04-29 Martin Baulig <martin@ximian.com>
2542 * class.cs (Event.Define): Don't emit the field and don't set
2543 RTSpecialName and SpecialName for events on interfaces. Fixes
2546 2004-04-29 Raja R Harinath <rharinath@novell.com>
2548 Refactor Attribute.ApplyAttributes.
2549 * attribute.cs (Attributable): New base class for objects that can
2550 have Attributes applied on them.
2551 (Attribute): Make AttributeUsage fields public.
2552 (Attribute.GetFieldValue, Attribute.GetMarshal): Make non-static.
2553 (Attribute.IsInternalCall): New property.
2554 (Attribute.UsageAttr): Convert to a public read-only property.
2555 (Attribute.CheckAttributeType): Use a DeclSpace, not an EmitContext.
2556 (Attribute.ResolveType, Attribute.Resolve)
2557 (Attribute.ScanForIndexerName): Update to reflect changes.
2558 (Attribute.CheckAttributeTarget): Re-format.
2559 (Attribute.ApplyAttributes): Refactor, to various
2560 Attributable.ApplyAttributeBuilder methods.
2561 * decl.cs (MemberCore): Make Attributable.
2562 * class.cs (Accessor): Make Attributable.
2563 (MethodData.ApplyAttributes): Use proper attribute types, not
2565 (TypeContainer.LabelParameters): Pass Parameter to ApplyAttributes.
2566 (TypeContainer.ApplyAttributeBuilder)
2567 (Method.ApplyAttributeBuilder, Constructor.ApplyAttributeBuilder)
2568 (Field.ApplyAttributeBuilder, Accessor.ApplyAttributeBuilder)
2569 (PropertyBase.ApplyAttributeBuilder, Event.ApplyAttributeBuilder)
2570 (Operator.ApplyAttributeBuilder): New factored-out methods.
2571 * const.cs (Const.ApplyAttributeBuilder): Likewise.
2572 * delegate.cs (Delegate.ApplyAttributeBuilder): Likewise.
2573 * enum.cs (Enum.ApplyAttributeBuilder): Likewise.
2574 * parameter.cs (ParameterBase): New Attributable base class
2575 that can also represent Return types.
2576 (Parameter): Update to the changes.
2578 2004-04-29 Jackson Harper <jackson@ximian.com>
2580 * driver.cs: Prefer the corlib system version when looking for
2581 assemblies in the GAC. This is still a hack, but its a better hack
2584 2004-04-29 Marek Safar <marek.safar@seznam.cz>
2586 * decl.cs, enum.cs: Improved error 3005 reporting.
2588 * report.cs (SymbolRelatedToPreviousError): New method for error reporting.
2589 (related_symbols): New private member for list of symbols
2590 related to reported error/warning.
2592 * tree.cs: Do not use now obsolete Report.LocationOfPreviousError.
2594 2004-04-29 Martin Baulig <martin@ximian.com>
2596 * ecore.cs (Expression.Constantify): If we're an enum and
2597 TypeManager.TypeToCoreType() doesn't give us another type, use
2598 t.UnderlyingSystemType. Fixes #56178.
2600 2004-04-29 Martin Baulig <martin@ximian.com>
2602 * decl.cs (MemberCache.SetupCacheForInterface): Look over all our
2603 interfaces and for each interface, only add members directly
2604 declared in that interface. Fixes #53255.
2606 2004-04-28 Martin Baulig <martin@ximian.com>
2608 * expression.cs (ConditionalLogicalOperator): Use a temporary
2609 variable for `left' to avoid that we evaluate it more than once;
2612 2004-04-28 Martin Baulig <martin@ximian.com>
2614 * expression.cs (ComposedCast.DoResolveAsTypeStep): Don't allow
2617 2004-04-28 Martin Baulig <martin@ximian.com>
2619 * statement.cs (LocalInfo.Resolve): Check whether the type is not
2622 * class.cs (MemberBase.CheckParameters, FieldBase.DoDefine): Check
2623 whether the type is not void (CS1547).
2625 2004-04-28 Martin Baulig <martin@ximian.com>
2627 * expression.cs (Unary.DoResolveLValue): Override this and report
2628 CS0131 for anything but Operator.Indirection.
2630 2004-04-28 Martin Baulig <martin@ximian.com>
2632 Committing a patch from Ben Maurer; see bug #50820.
2634 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2637 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2640 2004-04-28 Martin Baulig <martin@ximian.com>
2642 Committing a patch from Ben Maurer; see bug #50820.
2644 * typemanager.cs (TypeManager.FilterWithClosure): Added CS1540
2647 * ecore.cs (Expression.MemberLookupFailed): Added CS1540 check for
2650 2004-04-28 Martin Baulig <martin@ximian.com>
2652 * statement.cs (Block.LookupLabel): Also lookup in implicit child blocks.
2653 (Block.AddLabel): Call DoLookupLabel() to only search in the
2656 2004-04-28 Martin Baulig <martin@ximian.com>
2658 * cfold.cs (ConstantFold.BinaryFold): Added special support for
2659 comparing StringConstants and NullLiterals in Equality and Inequality.
2661 2004-04-28 Jackson Harper <jackson@ximian.com>
2663 * driver.cs: Attempt to load referenced assemblies from the
2664 GAC. This is the quick and dirty version of this method that
2665 doesnt take into account versions and just takes the first
2666 canidate found. Will be good enough for now as we will not have more
2667 then one version installed into the GAC until I update this method.
2669 2004-04-28 Martin Baulig <martin@ximian.com>
2671 * typemanager.cs (TypeManager.CheckStructCycles): New public
2672 static method to check for cycles in the struct layout.
2674 * rootcontext.cs (RootContext.PopulateTypes): Call
2675 TypeManager.CheckStructCycles() for each TypeContainer.
2676 [Note: We only need to visit each type once.]
2678 2004-04-28 Martin Baulig <martin@ximian.com>
2680 * constant.cs (StringConstant.Emit): Emit Ldnull if we're null.
2682 * const.cs (Const.LookupConstantValue): Return a `bool' signalling
2683 success and added `out object value'. Use a `bool resolved' field
2684 to check whether we've already been called rather than
2685 `ConstantValue != null' since this breaks for NullLiterals.
2687 2004-04-28 Raja R Harinath <rharinath@novell.com>
2689 * driver.cs (Driver.MainDriver) [IsModuleOnly]: Open code the
2690 setting of this flag, since the 'set' method may be non-public.
2692 2004-04-28 Raja R Harinath <rharinath@novell.com>
2694 * flowanalysis.cs (FlowBranchingException.LookupLabel): Add a null
2695 check on current_vector.Block.
2697 2004-04-27 Martin Baulig <martin@ximian.com>
2699 * expression.cs (BaseAccess.CommonResolve): Don't allow `base' in
2700 a field initializer. Fixes #56459.
2702 2004-04-27 Martin Baulig <martin@ximian.com>
2704 * ecore.cs (PropertyExpr.DoResolve/DoResolveLValue): Check whether
2705 we're not attempting to use an indexer. Fixes #52154.
2707 2004-04-27 Martin Baulig <martin@ximian.com>
2709 * statement.cs (Return): Don't create a return label if we don't
2710 need it; reverts my change from January 20th. Thanks to Ben
2713 2004-04-27 Martin Baulig <martin@ximian.com>
2715 According to the spec, `goto' can only leave a nested scope, but
2718 * statement.cs (Block.LookupLabel): Only lookup in the current
2719 block, don't recurse into parent or child blocks.
2720 (Block.AddLabel): Check in parent and child blocks, report
2721 CS0140/CS0158 if we find a duplicate.
2722 (Block): Removed this indexer for label lookups.
2723 (Goto.Resolve): Call LookupLabel() on our current FlowBranching;
2724 this already does the error reporting for us.
2727 (FlowBranching.UsageVector.Block): New public variable; may be null.
2728 (FlowBranching.CreateSibling): Added `Block' argument.
2729 (FlowBranching.LookupLabel): New public virtual method. Lookup a
2730 label for the target of a `goto' and check whether we're not
2731 leaving a `finally'.
2733 2004-04-27 Martin Baulig <martin@ximian.com>
2735 * flowanalysis.cs (FlowBranching.UsageVector.MergeChild): If we're
2736 a finite loop block, also do the ALWAYS->SOMETIMES for throws (not
2739 2004-04-27 Martin Baulig <martin@ximian.com>
2741 * statement.cs (Block.AddLabel): Also check for implicit blocks
2742 and added a CS0158 check.
2744 2004-04-27 Martin Baulig <martin@ximian.com>
2746 * flowanalysis.cs (FlowBranchingLoop): New class.
2747 (FlowBranching.UsageVector.MergeJumpOrigins): Take a list of
2748 UsageVector's instead of an ArrayList.
2749 (FlowBranching.Label): Likewise.
2750 (FlowBranching.UsageVector.MergeBreakOrigins): New method.
2751 (FlowBranching.AddBreakVector): New method.
2753 2004-04-27 Miguel de Icaza <miguel@ximian.com>
2755 * attribute.cs: Small regression fix: only convert the type if we
2756 the type is different, fixes System.Drawing build.
2758 2004-04-27 Martin Baulig <martin@ximian.com>
2760 * attribute.cs (Attribute.Resolve): If we have a constant value
2761 for a named field or property, implicity convert it to the correct
2764 2004-04-27 Raja R Harinath <rharinath@novell.com>
2766 * statement.cs (Block.Block): Implicit blocks share
2767 'child_variable_names' fields with parent blocks.
2768 (Block.AddChildVariableNames): Remove.
2769 (Block.AddVariable): Mark variable as "used by a child block" in
2770 every surrounding block.
2771 * ecore.cs (SimpleName.SimpleNameResolve): If the name has already
2772 been used in a child block, complain about violation of "Invariant
2773 meaning in blocks" rule.
2774 * cs-parser.jay (declare_local_variables): Don't use
2775 AddChildVariableNames.
2776 (foreach_statement): Don't create an implicit block: 'foreach'
2779 2004-04-23 Miguel de Icaza <miguel@ximian.com>
2781 * convert.cs (ImplicitNumericConversion): 0 is also positive when
2782 converting from 0L to ulong. Fixes 57522.
2784 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2786 * decl.cs (FindMemberToOverride): Fix wrong warning for case when
2787 derived class hides via 'new' keyword field from base class (test-242.cs).
2788 TODO: Handle this in the more general way.
2790 * class.cs (CheckBase): Ditto.
2792 2004-04-22 Marek Safar <marek.safar@seznam.cz>
2794 * decl.cs (caching_flags): New member for storing cached values
2796 (MemberCore.Flags): New enum where bit flags for caching_flags
2798 (MemberCore.cls_compliance): Moved to caching_flags.
2799 (DeclSpace.Created): Moved to caching_flags.
2801 * class.cs: Use caching_flags instead of DeclSpace.Created
2803 2004-04-21 Miguel de Icaza <miguel@ximian.com>
2805 * ecore.cs (PropertyExpr.GetAccesor): Only perform the 1540 check
2806 if we are only a derived class, not a nested class.
2808 * typemanager.cs: Same as above, but do this at the MemberLookup
2809 level (used by field and methods, properties are handled in
2810 PropertyExpr). Allow for the qualified access if we are a nested
2813 2004-04-21 Marek Safar <marek.safar@seznam.cz>
2815 * class.cs: Refactoring.
2816 (IMethodData): New inteface; Holds links to parent members
2817 to avoid member duplication (reduced memory allocation).
2818 (Method): Implemented IMethodData interface.
2819 (PropertyBase): New inner classes for get/set methods.
2820 (PropertyBase.PropertyMethod): Implemented IMethodData interface
2821 (Event): New inner classes for add/remove methods.
2822 (Event.DelegateMethod): Implemented IMethodData interface.
2824 * cs-parser.jay: Pass DeclSpace to Event class for creation of valid
2825 EmitContext (related to class.cs refactoring).
2827 2004-04-21 Raja R Harinath <rharinath@novell.com>
2829 * delegate.cs (Delegate.VerifyApplicability): If the number of
2830 arguments are the same as the number of parameters, first try to
2831 verify applicability ignoring any 'params' modifier on the last
2835 2004-04-16 Raja R Harinath <rharinath@novell.com>
2837 * class.cs (TypeContainer.AddIndexer): Use
2838 'ExplicitInterfaceName' to determine if interface name was
2839 explicitly specified. 'InterfaceType' is not initialized at this time.
2840 (TypeContainer.DefineIndexers): Remove use of temporary list. The
2841 Indexers array is already in the required order. Initialize
2842 'IndexerName' only if there are normal indexers.
2843 (TypeContainer.DoDefineMembers): Don't initialize IndexerName.
2844 (TypeContainer.Emit): Emit DefaultMember attribute only if
2845 IndexerName is initialized.
2848 2004-04-15 Benjamin Jemlich <pcgod@gmx.net>
2850 * enum.cs (Enum.DefineType): Don't allow char as type for enum.
2853 2004-04-15 Raja R Harinath <rharinath@novell.com>
2855 * attribute.cs (Attribute.CheckAttributeType): Check for ambiguous
2859 * attribute.cs (Attribute.Resolve): Check for duplicate named
2863 2004-04-15 Miguel de Icaza <miguel@ximian.com>
2865 * iterators.cs (MarkYield): track whether we are in an exception,
2866 and generate code accordingly. Use a temporary value to store the
2867 result for our state.
2869 I had ignored a bit the interaction of try/catch with iterators
2870 since their behavior was not entirely obvious, but now it is
2871 possible to verify that our behavior is the same as MS .NET 2.0
2875 2004-04-14 Miguel de Icaza <miguel@ximian.com>
2877 * iterators.cs: Avoid creating temporaries if there is no work to
2880 * expression.cs (ArrayAccess.EmitLoadOpcode): If dealing with
2881 Enumerations, use TypeManager.EnumToUnderlying and call
2884 Based on the patch from Benjamin Jemlich (pcgod@gmx.net), fixes
2887 (This.Emit): Use EmitContext.EmitThis to emit our
2890 (This.EmitAssign): Ditto.
2892 * ecore.cs (FieldExpr.Emit): Remove RemapToProxy special
2893 codepaths, we will move all the functionality into
2896 (FieldExpr.EmitAssign): Ditto.
2898 This fixes several hidden bugs that I uncovered while doing a code
2899 review of this today.
2901 * codegen.cs (EmitThis): reworked so the semantics are more clear
2902 and also support value types "this" instances.
2904 * iterators.cs: Changed so that for iterators in value types, we
2905 do not pass the value type as a parameter.
2907 Initialization of the enumerator helpers is now done in the caller
2908 instead of passing the parameters to the constructors and having
2909 the constructor set the fields.
2911 The fields have now `assembly' visibility instead of private.
2913 2004-04-11 Miguel de Icaza <miguel@ximian.com>
2915 * expression.cs (Argument.Resolve): Check if fields passed as ref
2916 or out are contained in a MarshalByRefObject.
2918 * typemanager.cs, rootcontext.cs: Add System.Marshalbyrefobject as
2919 another compiler type.
2921 2004-04-06 Ben Maurer <bmaurer@users.sourceforge.net>
2923 * class.cs (Indexer.Define): use the new name checking method.
2924 Also, return false on an error.
2925 * cs-tokenizer.cs (IsValidIdentifier): Checks for a valid identifier.
2926 (is_identifier_[start/part]_character): make static.
2928 2004-04-10 Miguel de Icaza <miguel@ximian.com>
2930 * expression.cs (Binary.ResolveOperator): Do no append strings
2931 twice: since we can be invoked more than once (array evaluation)
2932 on the same concatenation, take care of this here. Based on a fix
2933 from Ben (bug #56454)
2935 2004-04-08 Sebastien Pouliot <sebastien@ximian.com>
2937 * codegen.cs: Fix another case where CS1548 must be reported (when
2938 delay-sign isn't specified and no private is available #56564). Fix
2939 loading the ECMA "key" to delay-sign an assembly. Report a CS1548
2940 error when MCS is used on the MS runtime and we need to delay-sign
2941 (which seems unsupported by AssemblyBuilder - see #56621).
2943 2004-04-08 Marek Safar <marek.safar@seznam.cz>
2945 * typemanager.cs (TypeManager.TypeToCoreType): Handle IntPtr too.
2946 (TypeManager.ComputeNamespaces): Faster implementation for
2949 * compiler.csproj: Updated AssemblyName to mcs.
2951 2004-04-07 Miguel de Icaza <miguel@ximian.com>
2953 * rootcontext.cs: Add new types to the boot resolution.
2955 * ecore.cs (TypeExpr.CanInheritFrom): Inheriting from
2956 MulticastDelegate is not allowed.
2958 * typemanager.cs: Add new types to lookup: System.TypedReference
2961 * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
2962 check for TypedReference or ArgIterator, they are not allowed.
2964 * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
2965 makes us properly catch 1510 in some conditions (see bug 56016 for
2968 2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
2970 * CryptoConvert.cs: update from corlib version
2973 2004-04-05 Miguel de Icaza <miguel@ximian.com>
2975 * class.cs (Indexer.Define): Check indexername declaration
2977 2004-04-05 Marek Safar <marek.safar@seznam.cz>
2979 * attribute.cs (IsClsCompliant): Fixed problem with handling
2980 all three states (compliant, not-compliant, undetected).
2982 2004-03-30 Marek Safar <marek.safar@seznam.cz>
2984 * attribute.cs (Attribute): Location is now public.
2985 (Resolve): Store resolved arguments (pos_values) in attribute class.
2986 Attribute extractors (now GetClsCompliantAttributeValue) can reuse them.
2987 (GetClsCompliantAttributeValue): New method that gets
2988 CLSCompliantAttribute value.
2989 (GetClsCompliantAttribute): Returns CLSCompliantAttribute for DeclSpace
2990 if exists else null.
2991 (AttributeTester): New class for CLS-Compliant verification routines.
2993 * class.cs (Emit): Add CLS-Compliant verification.
2994 (Method.GetSignatureForError): Implemented.
2995 (Constructor.GetSignatureForError): Implemented
2996 (Constructor.HasCompliantArgs): Returns if constructor has
2997 CLS-Compliant arguments.
2998 (Constructor.Emit): Override.
2999 (Construcor.IsIdentifierClsCompliant): New method; For constructors
3000 is needed to test only parameters.
3001 (FieldBase.GetSignatureForError): Implemented.
3002 (TypeContainer): New member for storing base interfaces.
3003 (TypeContainer.FindMembers): Search in base interfaces too.
3005 * codegen.cs (GetClsComplianceAttribute): New method that gets
3006 assembly or module CLSCompliantAttribute value.
3007 (ResolveClsCompliance): New method that resolve CLSCompliantAttribute
3009 (ModuleClass.Emit): Add error 3012 test.
3011 * const.cs (Emit): Override and call base for CLS-Compliant tests.
3013 * decl.cs (ClsComplianceValue): New enum that holds CLS-Compliant
3014 state for all decl types.
3015 (MemberCore.Emit): Emit is now virtual and call VerifyClsCompliance
3016 if CLS-Compliant tests are required.
3017 (IsClsCompliaceRequired): New method. Analyze whether code
3018 must be CLS-Compliant.
3019 (IsExposedFromAssembly): New method. Returns true when MemberCore
3020 is exposed from assembly.
3021 (GetClsCompliantAttributeValue): New method. Resolve CLSCompliantAttribute
3022 value or gets cached value.
3023 (HasClsCompliantAttribute): New method. Returns true if MemberCore
3024 is explicitly marked with CLSCompliantAttribute.
3025 (IsIdentifierClsCompliant): New abstract method. This method is
3026 used to testing error 3005.
3027 (IsIdentifierAndParamClsCompliant): New method. Common helper method
3028 for identifier and parameters CLS-Compliant testing.
3029 (VerifyClsCompliance): New method. The main virtual method for
3030 CLS-Compliant verifications.
3031 (CheckAccessLevel): In one special case (System.Drawing) was TypeBuilder
3032 null. I don't know why is null (too many public members !).
3033 (GetClsCompliantAttributeValue). New method. Goes through class hierarchy
3034 and get value of first CLSCompliantAttribute that found.
3036 * delegate.cs (Emit): Override and call base for CLS-Compliant tests.
3037 (VerifyClsCompliance): Override and add extra tests.
3039 * driver.cs (CSCParseOption): New command line options (clscheck[+|-]).
3040 clscheck- disable CLS-Compliant verification event if assembly is has
3041 CLSCompliantAttribute(true).
3043 * enum.cs (Emit): Override and call base for CLS-Compliant tests.
3044 ApllyAttribute is now called in emit section as in the other cases.
3045 Possible future Emit integration.
3046 (IsIdentifierClsCompliant): New override.
3047 (VerifyClsCompliance): New override.
3048 (GetEnumeratorName): Returns full enum name.
3050 * parameter.cs (GetSignatureForError): Implemented.
3052 * report.cs (WarningData): New struct for Warning message information.
3053 (LocationOfPreviousError): New method.
3054 (Warning): New method. Reports warning based on the warning table.
3055 (Error_T): New method. Reports error based on the error table.
3057 * rootcontext.cs (EmitCode): Added new Emit(s) because CLS-Compliant
3058 verifications are done here.
3060 * tree.cs (RecordDecl): Used new LocationOfPreviousError method.
3062 * typemanager.cs (cls_compliant_attribute_type): New member thath holds
3063 CLSCompliantAttribute.
3064 (all_imported_types): New member holds all imported types from other
3066 (LoadAllImportedTypes): New method fills static table with exported types
3067 from all referenced assemblies.
3068 (Modules): New property returns all assembly modules.
3070 2004-03-30 Miguel de Icaza <miguel@ximian.com>
3072 * cs-parser.jay: Add a rule to catch wrong event syntax instead of
3073 throwing a parser error.
3075 * ecore.cs (PropertyExpr.GetAccessor): Apply patch from Patrik Reali
3076 which removes the hardcoded get_/set_ prefixes for properties, as
3077 IL allows for the properties to be named something else.
3081 * expression.cs: Do not override operand before we know if it is
3084 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3086 * typemanager.cs: support for pinned variables.
3088 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3090 * decl.cs, typemanager.cs: Avoid using an arraylist
3091 as a buffer if there is only one result set.
3093 2004-03-29 Ben Maurer <bmaurer@users.sourceforge.net>
3095 * expression.cs: Make sure you cant call a static method
3096 with an instance expression, bug #56174.
3098 2004-03-29 Miguel de Icaza <miguel@ximian.com>
3100 * class.cs (IsDuplicateImplementation): Improve error reporting to
3101 flag 663 (method only differs in parameter modifier).
3103 * cs-tokenizer.cs: Do not require whitespace when a ( or " will do
3104 in preprocessor directives.
3106 * location.cs (LookupFile): Allow for the empty path.
3108 * attribute.cs (DefinePInvokeMethod): Fix 56148; I would like a
3109 better approach for some of that patch, but its failing with the
3110 CharSet enumeration. For now try/catch will do.
3112 * typemanager.cs: Do not crash if a struct does not have fields.
3115 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3117 * expression.cs: cs0213, cant fix a fixed expression.
3120 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3122 * cs-parser.jay: detect invalid embeded statements gracefully.
3125 2004-03-28 Ben Maurer <bmaurer@users.sourceforge.net>
3127 * ecore.cs, typemanager.cs: Correct impl of cs1540 check.
3130 the invocation type may not be a subclass of the tye of the item/
3131 The type of the item must be a subclass of the invocation item.
3136 2004-03-25 Sebastien Pouliot <sebastien@ximian.com>
3138 * attribute.cs: Added methods to get a string and a bool from an
3139 attribute. Required to information from AssemblyKeyFileAttribute,
3140 AttributeKeyNameAttribute (string) and AssemblyDelaySign (bool).
3141 * codegen.cs: Modified AssemblyName creation to include support for
3142 strongnames. Catch additional exceptions to report them as CS1548.
3143 * compiler.csproj: Updated include CryptoConvert.cs.
3144 * compiler.csproj.user: Removed file - user specific configuration.
3145 * CryptoConvert.cs: New. A COPY of the class CryptoConvert from
3146 Mono.Security assembly. The original class is maintained and tested in
3147 /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs.
3148 * drivers.cs: Added support for /keyfile, /keycontainer and /delaysign
3149 like CSC 8.0 (C# v2) supports.
3150 * Makefile: Added CryptoConvert.cs to mcs sources.
3151 * rootcontext.cs: Added new options for strongnames.
3153 2004-03-24 Ben Maurer <bmaurer@users.sourceforge.net>
3155 * driver.cs: For --expect-error, report error code `2'
3156 if the program compiled with no errors, error code `1' if
3157 it compiled with an error other than the one expected.
3159 2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
3161 * compiler.csproj: Updated for Visual Studio .NET 2003.
3162 * compiler.csproj.user: Updated for Visual Studio .NET 2003.
3163 * compiler.sln: Updated for Visual Studio .NET 2003.
3165 2004-03-24 Ravi Pratap M <ravi@ximian.com>
3167 * expression.cs: Fix bug #47234. We basically need to apply the
3168 rule that we prefer the conversion of null to a reference type
3169 when faced with a conversion to 'object' (csc behaviour).
3171 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3173 * statement.cs: Shorter form for foreach, eliminates
3174 a local variable. r=Martin.
3176 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3178 * constant.cs, ecore.cs, literal.cs: New prop IsZeroInteger that
3179 checks if we can use brtrue/brfalse to test for 0.
3180 * expression.cs: use the above in the test for using brtrue/brfalse.
3183 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3185 * expression.cs: Rewrite string concat stuff. Benefits:
3187 - "a" + foo + "b" + "c" becomes "a" + foo + "bc"
3188 - "a" + foo + "b" + bar + "c" + baz ... uses concat (string []).
3189 rather than a concat chain.
3191 * typemanager.cs: Add lookups for more concat overloads.
3193 2004-03-23 Ben Maurer <bmaurer@users.sourceforge.net>
3195 * expression.cs: Emit shorter il code for array init.
3212 2004-03-22 Ben Maurer <bmaurer@users.sourceforge.net>
3214 * statement.cs: Before, two switch blocks would be merged if the
3215 total size of the blocks (end_item - begin_item + 1) was less than
3216 two times the combined sizes of the blocks.
3218 Now, it will only merge if after the merge at least half of the
3223 2004-03-20 Atsushi Enomoto <atsushi@ximian.com>
3225 * class.cs : csc build fix for GetMethods(). See bug #52503.
3227 2004-03-20 Ben Maurer <bmaurer@users.sourceforge.net>
3229 * expression.cs: Make sure fp comparisons work with NaN.
3230 This fixes bug #54303. Mig approved this patch a long
3231 time ago, but we were not able to test b/c the runtime
3234 2004-03-19 Miguel de Icaza <miguel@ximian.com>
3236 * ecore.cs (TypExpr.GetHashCode): implement this overload.
3238 2004-03-19 Martin Baulig <martin@ximian.com>
3240 * class.cs (MemberCore.IsDuplicateImplementation): Report the
3241 error here and not in our caller.
3243 2004-03-19 Martin Baulig <martin@ximian.com>
3245 * interface.cs: Completely killed this file.
3246 (Interface): We're now a TypeContainer and live in class.cs.
3248 * class.cs (TypeContainer.GetClassBases): Added `bool is_iface'
3249 argument; we're now also called for interfaces.
3250 (TypeContainer.DefineMembers): Allow this method being called
3252 (TypeContainer.GetMethods): New public method; formerly known as
3253 Interface.GetMethod(). This is used by PendingImplementation.
3254 (TypeContainer.EmitDefaultMemberAttr): Moved here from Interface;
3255 it's now private and non-static.
3256 (Interface): Moved this here; it's now implemented similar to
3258 (Method, Property, Event, Indexer): Added `bool is_interface'
3259 argument to their .ctor's.
3260 (MemberBase.IsInterface): New public field.
3262 * cs-parser.jay: Create normal Method, Property, Event, Indexer
3263 instances instead of InterfaceMethod, InterfaceProperty, etc.
3264 (opt_interface_base): Removed; we now use `opt_class_base' instead.
3265 (InterfaceAccessorInfo): Create `Get' and `Set' Accessor's.
3267 2004-03-19 Martin Baulig <martin@ximian.com>
3269 * class.cs (MethodCore.IsDuplicateImplementation): New private
3270 method which does the CS0111 checking.
3271 (Method.CheckBase, Constructor.CheckBase, PropertyBase.CheckBase):
3272 Use IsDuplicateImplementation().
3274 2004-03-17 Ben Maurer <bmaurer@users.sourceforge.net>
3276 * decl.cs (FindMemberToOverride): New method to find the correct
3277 method or property to override in the base class.
3279 - Make Method/Property use the above method to find the
3280 version in the base class.
3281 - Remove the InheritableMemberSignatureCompare as it is now
3284 This patch makes large code bases much faster to compile, as it is
3285 O(n) rather than O(n^2) to do this validation.
3287 Also, it fixes bug 52458 which is that nested classes are not
3288 taken into account when finding the base class member.
3290 Reviewed/Approved by Martin.
3292 2004-03-17 Marek Safar <marek.safar@seznam.cz>
3294 * interface.cs: In all interface classes removed redundant
3295 member initialization.
3297 2004-03-16 Martin Baulig <martin@ximian.com>
3299 * class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
3301 2004-03-15 Miguel de Icaza <miguel@ximian.com>
3303 * decl.cs (DefineTypeAndParents): New helper method to define a
3304 type's containers before the type itself is defined; This is a
3305 bug exposed by the recent changes to Windows.Forms when an
3306 implemented interface was defined inside a class that had not been
3309 * modifiers.cs (MethodAttr): All methods in C# are HideBySig.
3311 (Check): Loop correctly to report errors modifiers
3312 (UNSAFE was not in the loop, since it was the same as TOP).
3314 * interface.cs: Every interface member now takes a ModFlags,
3315 instead of a "is_new" bool, which we set on the base MemberCore.
3317 Every place where we called "UnsafeOk" in the interface, now we
3318 call the proper member (InterfaceMethod.UnsafeOK) instead to get
3319 the unsafe settings from the member declaration instead of the
3320 container interface.
3322 * cs-parser.jay (opt_new): Allow unsafe here per the spec.
3324 * pending.cs (TypeAndMethods): Add `get_indexer_name' and
3325 `set_indexer_name' to the pending bits (one per type).
3327 We fixed a bug today that was picking the wrong method to
3328 override, since for properties the existing InterfaceMethod code
3329 basically ignored the method name. Now we make sure that the
3330 method name is one of the valid indexer names.
3332 2004-03-14 Gustavo Giráldez <gustavo.giraldez@gmx.net>
3334 * support.cs (SeekableStreamReader): Keep track of stream byte
3335 positions and don't mix them with character offsets to the buffer.
3337 Patch from Gustavo Giráldez
3339 2004-03-15 Marek Safar <marek.safar@seznam.cz>
3341 * interface.cs (InterfaceSetGetBase): Removed double member
3342 initialization, base class does it as well.
3344 2004-03-13 Martin Baulig <martin@ximian.com>
3346 * class.cs: Reverted Miguel's latest commit; it makes mcs crash
3347 when compiling corlib.
3349 2004-03-13 Miguel de Icaza <miguel@ximian.com>
3351 * convert.cs (ExplicitConversion): We were reporting an error on
3352 certain conversions (object_type source to a value type, when the
3353 expression was `null') before we had a chance to pass it through
3354 the user defined conversions.
3356 * driver.cs: Replace / and \ in resource specifications to dots.
3359 * class.cs: Add check for duplicate operators. Fixes 52477
3361 2004-03-11 Miguel de Icaza <miguel@ximian.com>
3363 * statement.cs (Switch.SimpleSwitchEmit): Deal with default labels
3364 that are in the middle of the statements, not only at the end.
3367 * class.cs (TypeContainer.AddField): No longer set the
3368 `HaveStaticConstructor' flag, now we call it
3369 `UserDefineStaticConstructor' to diferentiate the slightly
3370 semantic difference.
3372 The situation is that we were not adding BeforeFieldInit (from
3373 Modifiers.TypeAttr) to classes that could have it.
3374 BeforeFieldInit should be set to classes that have no static
3379 http://www.yoda.arachsys.com/csharp/beforefieldinit.html
3381 And most importantly Zoltan's comment:
3383 http://bugzilla.ximian.com/show_bug.cgi?id=44229
3385 "I think beforefieldinit means 'it's ok to initialize the type sometime
3386 before its static fields are used', i.e. initialization does not need
3387 to be triggered by the first access to the type. Setting this flag
3388 helps the JIT to compile better code, since it can run the static
3389 constructor at JIT time, and does not need to generate code to call it
3390 (possibly lots of times) at runtime. Unfortunately, mcs does not set
3391 this flag for lots of classes like String.
3393 csc sets this flag if the type does not have an explicit static
3394 constructor. The reasoning seems to be that if there are only static
3395 initalizers for a type, and no static constructor, then the programmer
3396 does not care when this initialization happens, so beforefieldinit
3399 This bug prevents the AOT compiler from being usable, since it
3400 generates so many calls to mono_runtime_class_init that the AOT code
3401 is much slower than the JITted code. The JITted code is faster,
3402 because it does not generate these calls if the vtable is type is
3403 already initialized, which is true in the majority of cases. But the
3404 AOT compiler can't do this."
3406 2004-03-10 Miguel de Icaza <miguel@ximian.com>
3408 * class.cs (MethodData.Emit): Refactor the code so symbolic
3409 information is generated for destructors; For some reasons we
3410 were taking a code path that did not generate symbolic information
3413 2004-03-11 Ben Maurer <bmaurer@users.sourceforge.net>
3415 * class.cs: Create a Constructor.CheckBase method that
3416 takes care of all validation type code. The method
3417 contains some code that was moved from Define.
3419 It also includes new code that checks for duplicate ctors.
3420 This fixes bug #55148.
3422 2004-03-09 Joshua Tauberer <tauberer@for.net>
3424 * expression.cs (ArrayCreation): Fix: More than 6 nulls in
3425 a { ... }-style array creation invokes EmitStaticInitializers
3426 which is not good for reference-type arrays. String, decimal
3427 and now null constants (NullCast) are not counted toward
3428 static initializers.
3430 2004-03-05 Martin Baulig <martin@ximian.com>
3432 * location.cs (SourceFile.HasLineDirective): New public field;
3433 specifies whether the file contains or is referenced by a "#line"
3435 (Location.DefineSymbolDocuments): Ignore source files which
3436 either contain or are referenced by a "#line" directive.
3438 2004-02-29 Ben Maurer <bmaurer@users.sourceforge.net>
3440 * class.cs (Method.CheckBase): Avoid using FindMembers, we have
3441 direct access to our parent, so check the method inline there.
3443 2004-02-27 Ben Maurer <bmaurer@users.sourceforge.net>
3445 * expression.cs (Invocation.EmitCall): Miguel's last commit
3446 caused a regression. If you had:
3451 In Foo the implict this would be null.
3453 2004-02-27 Miguel de Icaza <miguel@ximian.com>
3455 * expression.cs (Invocation.EmitCall): If the method is not
3456 virtual, do not emit a CallVirt to it, use Call.
3458 * typemanager.cs (GetFullNameSignature): Improve the method to
3459 cope with ".ctor" and replace it with the type name.
3461 * class.cs (ConstructorInitializer.Resolve): Now the method takes
3462 as an argument the ConstructorBuilder where it is being defined,
3463 to catch the recursive constructor invocations.
3465 2004-02-26 Miguel de Icaza <miguel@ximian.com>
3467 * iterators.cs (IteratorHandler.IsIEnumerator, IsIEnumerable): New
3468 routines to check if a type is an enumerable/enumerator allow
3469 classes that implement the IEnumerable or IEnumerator interfaces.
3471 * class.cs (Property, Operator): Implement IIteratorContainer, and
3472 implement SetYields.
3474 (Property.Define): Do the block swapping for get_methods in the
3475 context of iterators. We need to check if Properties also
3476 include indexers or not.
3478 (Operator): Assign the Block before invoking the
3479 OperatorMethod.Define, so we can trigger the Iterator code
3482 * cs-parser.jay (SimpleIteratorContainer): new helper class. Both
3483 Property and Operator classes are not created when we parse the
3484 declarator but until we have the block completed, so we use a
3485 singleton SimpleIteratorContainer.Simple to flag whether the
3486 SetYields has been invoked.
3488 We propagate this setting then to the Property or the Operator to
3489 allow the `yield' to function.
3491 2004-02-25 Marek Safar <marek.safar@seznam.cz>
3493 * codegen.cs: Implemented attribute support for modules.
3494 New AssemblyClass, ModuleClass and CommonAssemblyModulClass for
3495 Assembly/Module functionality.
3497 * attribute.cs, class.cs, cs-parser.jay, delegate.cs, driver.cs, enum.cs
3498 interface.cs, rootcontext.cs, statement.cs, typemanager.cs:
3499 Updated dependencies on CodeGen.ModuleBuilder and CodeGen.AssemblyBuilder.
3501 2004-02-16 Marek Safar <marek.safar@seznam.cz>
3503 * interface.cs (FindMembers): The operation is performed on all base
3504 interfaces and not only on the first. It is required for future CLS Compliance patch.
3506 2004-02-12 Ben Maurer <bmaurer@users.sourceforge.net>
3508 * statement.cs, codegen.cs:
3509 This patch deals with patterns such as:
3511 public class List : IEnumerable {
3513 public MyEnumerator GetEnumerator () {
3514 return new MyEnumerator(this);
3517 IEnumerator IEnumerable.GetEnumerator () {
3521 public struct MyEnumerator : IEnumerator {
3526 Before, there were a few things we did wrong:
3527 1) we would emit callvirt on a struct, which is illegal
3528 2) we emited ldarg when we needed to emit ldarga
3529 3) we would mistakenly call the interface methods on an enumerator
3530 type that derived from IEnumerator and was in another assembly. For example:
3532 public class MyEnumerator : IEnumerator
3534 Would have the interface methods called, even if there were public impls of the
3535 method. In a struct, this lead to invalid IL code.
3537 2004-02-11 Marek Safar <marek.safar@seznam.cz>
3539 * const.cs: Const is now derived from FieldBase. Method EmitConstant name
3542 * delegate.cs (Define): Fixed crash when delegate type is undefined.
3544 2004-02-11 Miguel de Icaza <miguel@ximian.com>
3546 * cs-parser.jay: Fix small regression: we were not testing V2
3547 compiler features correctly.
3549 * interface.cs: If the emit context is null, then create one
3551 2004-02-09 Marek Safar <marek.safar@seznam.cz>
3553 * decl.cs (GetSignatureForError): New virtual method to get full name
3556 * attribute.cs (IAttributeSupport): New interface for attribute setting.
3557 Now it is possible to rewrite ApplyAttributes method to be less if/else.
3559 * interface.cs : All InterfaceXXX classes are now derived from MemberCore.
3560 Duplicated members and code in these classes has been removed.
3561 Better encapsulation in these classes.
3563 2004-02-07 Miguel de Icaza <miguel@ximian.com>
3565 * assign.cs (Assign.DoResolve): When dealing with compound
3566 assignments, there is a new rule in ECMA C# 2.4 (might have been
3567 there before, but it is documented here) that states that in:
3571 If b is of type int, and the `op' is a shift-operator, then the
3572 above is evaluated as:
3576 * expression.cs (Binary.ResolveOperator): Instead of testing for
3577 int/uint/long/ulong, try to implicitly convert to any of those
3578 types and use that in pointer arithmetic.
3580 * delegate.cs (Error_NoMatchingMethodForDelegate): Compute the
3581 method to print information for from the type, not from the
3582 null-method we were given.
3584 2004-02-01 Duncan Mak <duncan@ximian.com>
3586 * cs-tokenizer.cs (get_cmd_arg): Skip over whitespace before
3587 parsing for cmd, fixes bug #53694.
3589 2004-02-04 Marek Safar <marek.safar@seznam.cz>
3591 * class.cs, decl.cs: Fixed problem where IndexerName attribute was ignored
3592 in the member name duplication tests. Property and operator name duplication
3593 was missing too (error tests cs0102-{2,3,4,5}.cs, cs0111-{3,4}.cs).
3595 2004-02-03 Marek Safar <marek.safar@seznam.cz>
3597 * interface.cs (PopulateMethod): Fixed crash when interface method
3598 returns not existing type (error test cs0246-3.cs).
3600 2004-02-02 Ravi Pratap M <ravi@ximian.com>
3602 * cs-parser.jay (interface_accessors): Re-write actions to also
3603 store attributes attached to get and set methods. Fix spelling
3606 (inteface_property_declaration): Modify accordingly.
3608 (InterfaceAccessorInfo): New helper class to store information to pass
3609 around between rules that use interface_accessors.
3611 * interface.cs (Emit): Apply attributes on the get and set
3612 accessors of properties and indexers too.
3614 * attribute.cs (ApplyAttributes): Modify accordingly to use the
3615 right MethodBuilder when applying attributes to the get and set accessors.
3617 2004-01-31 Miguel de Icaza <miguel@ximian.com>
3619 * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
3621 2004-01-26 Miguel de Icaza <miguel@ximian.com>
3623 * cs-tokenizer.cs: Handle #line hidden from PDC bits.
3625 2004-01-25 Miguel de Icaza <miguel@ximian.com>
3627 * cs-parser.jay: Remove YIELD token, instead use the new grammar
3628 changes that treat `yield' specially when present before `break'
3631 * cs-tokenizer.cs: yield is no longer a keyword.
3633 2004-01-23 Marek Safar <marek.safar@seznam.cz>
3635 * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
3636 setting for default constructors.
3637 For default constructors are almost every time set wrong Modifier. The
3638 generated IL code has been alright. But inside mcs this values was
3639 wrong and this was reason why several of my CLS Compliance tests
3642 2004-01-22 Martin Baulig <martin@ximian.com>
3644 * cs-parser.jay (namespace_or_type_name): Return an Expression,
3645 not a QualifiedIdentifier. This is what `type_name_expression'
3646 was previously doing.
3647 (type_name_expression): Removed; the code is now in
3648 `namespace_or_type_name'.
3649 (qualified_identifier): Removed, use `namespace_or_type_name'
3651 (QualifiedIdentifier): Removed this class.
3653 2004-01-22 Martin Baulig <martin@ximian.com>
3655 * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
3656 not a string as alias name.
3658 2004-01-21 Miguel de Icaza <miguel@ximian.com>
3660 * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
3661 #52730 bug, and instead compute correctly the need to use a
3662 temporary variable when requesting an address based on the
3663 static/instace modified of the field and the constructor.
3665 2004-01-21 Martin Baulig <martin@ximian.com>
3667 * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
3668 class and namespace before looking up aliases. Fixes #52517.
3670 2004-01-21 Martin Baulig <martin@ximian.com>
3672 * flowanalysis.cs (UsageVector.Merge): Allow variables being
3673 assinged in a 'try'; fixes exception4.cs.
3675 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3676 * class.cs : Implemented parameter-less constructor for TypeContainer
3678 * decl.cs: Attributes are now stored here. New property OptAttributes
3680 * delegate.cs, enum.cs, interface.cs: Removed attribute member.
3682 * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
3684 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3686 * typemanager.cs (CSharpSignature): Now reports also inner class name.
3687 (CSharpSignature): New method for indexer and property signature.
3689 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3691 * pending.cs (IsVirtualFilter): Faster implementation.
3693 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3695 * typemanager.cs: Avoid inclusion of same assembly more than once.
3697 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3699 * cs-parser.jay: Fixed problem where the last assembly attribute
3700 has been applied also to following declaration (class, struct, etc.)
3702 2004-01-21 Marek Safar <marek.safar@seznam.cz>
3704 * class.cs: Added error CS0538, CS0539 reporting.
3705 Fixed crash on Microsoft runtime when field type is void.
3707 * cs-parser.jay: Added error CS0537 reporting.
3709 * pending.cs: Added error CS0535 reporting.
3710 Improved error report for errors CS0536, CS0534.
3712 2004-01-20 Miguel de Icaza <miguel@ximian.com>
3714 Merge a few bits from the Anonymous Method MCS tree.
3716 * statement.cs (ToplevelBlock): New class for toplevel methods,
3717 will hold anonymous methods, lifted variables.
3719 * cs-parser.jay: Create toplevel blocks for delegates and for
3720 regular blocks of code.
3722 2004-01-20 Martin Baulig <martin@ximian.com>
3724 * codegen.cs (EmitContext): Removed `InTry', `InCatch',
3725 `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
3726 and `NeedExplicitReturn'; added `IsLastStatement'.
3727 (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
3728 have a `ReturnLabel' or we're not unreachable.
3730 * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
3731 child's reachability; don't just override ours with it. Fixes
3732 #58058 (lluis's example).
3733 (FlowBranching): Added public InTryOrCatch(), InCatch(),
3734 InFinally(), InLoop(), InSwitch() and
3735 BreakCrossesTryCatchBoundary() methods.
3737 * statement.cs (Return): Do all error checking in Resolve().
3738 Unless we are the last statement in a top-level block, always
3739 create a return label and jump to it.
3740 (Break, Continue): Do all error checking in Resolve(); also make
3741 sure we aren't leaving a `finally'.
3742 (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
3743 statement in a top-level block.
3744 (Block.Flags): Added `IsDestructor'.
3745 (Block.IsDestructor): New public property.
3747 2004-01-20 Martin Baulig <martin@ximian.com>
3749 * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
3751 2004-01-20 Martin Baulig <martin@ximian.com>
3753 * statement.cs (Statement.ResolveUnreachable): New public method.
3754 (If, While): Do the dead-code elimination in Resolve(), not in Emit().
3755 (Block.Resolve): Resolve unreachable statements.
3757 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3759 * expression.cs: We need to fix the case where we do
3760 not have a temp variable here.
3762 * assign.cs: Only expression compound assignments need
3763 temporary variables.
3765 2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
3767 * flowanalysis.cs: Reduce memory allocation in a few ways:
3768 - A block with no variables should not allocate a bit
3770 - A method with no out parameters does not need any tracking
3771 for assignment of the parameters, so we need not allocate
3774 public readonly Type[] VariableTypes;
3775 public readonly string[] VariableNames;
3776 Are redundant. The data is already stored in the variable
3777 map, so we need not allocate another array for it.
3778 - We need to add alot of checks for if (params | locals) == null
3779 due to the first two changes.
3781 2004-01-18 Miguel de Icaza <miguel@ximian.com>
3783 * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
3784 implement IMemoryLocation, we store a copy on a local variable and
3785 take the address of it. Patch from Benjamin Jemlich
3787 * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
3788 to use a special "type_name_expression" rule which reduces the
3789 number of "QualifiedIdentifier" classes created, and instead
3790 directly creates MemberAccess expressions.
3792 2004-01-17 Miguel de Icaza <miguel@ximian.com>
3794 * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
3795 that fixes #52853. Null literal assignment to ValueType
3797 * class.cs (MethodData.Emit): Instead of checking the name of the
3798 method to determine if its a destructor, create a new derived
3799 class from Method called Destructor, and test for that.
3801 * cs-parser.jay: Create a Destructor object instead of a Method.
3803 Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
3807 2004-01-16 Miguel de Icaza <miguel@ximian.com>
3809 * expression.cs (Binary.ResolveOperator): Perform an implicit
3810 conversion from MethodGroups to their delegate types on the
3813 * delegate.cs: Introduce a new class DelegateCreation that is the
3814 base class for `NewDelegate' and `ImplicitDelegateCreation',
3815 factor some code in here.
3817 * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
3818 conversion from MethodGroups to compatible delegate types.
3820 * ecore.cs (Expression.Resolve): Do not flag error 654
3821 (Methodgroupd needs parenthesis) if running on the V2 compiler, as
3822 we allow conversions from MethodGroups to delegate types now.
3824 * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
3825 assignments in v2 either.
3827 2004-01-10 Miguel de Icaza <miguel@ximian.com>
3829 * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
3830 static read-only fields in ctors.
3832 Applied patch from Benjamin Jemlich
3834 * expression.cs (UnaryMutator): Avoid leaking local variables.
3836 2004-01-09 Miguel de Icaza <miguel@ximian.com>
3838 * cs-tokenizer.cs (IsCastToken): Allow the various native types
3839 here to return true, as they can be used like this:
3843 Fixed 49836 and all the other dups
3845 2004-01-09 Zoltan Varga <vargaz@freemail.hu>
3847 * driver.cs: Implement /win32res and /win32icon.
3849 2004-01-08 Miguel de Icaza <miguel@ximian.com>
3851 * cs-parser.jay: Add a rule to improve error handling for the
3852 common mistake of placing modifiers after the type.
3854 2004-01-07 Miguel de Icaza <miguel@ximian.com>
3856 * cs-parser.jay (interface_event_declaration): Catch
3857 initialization of events on interfaces, and report cs0068
3859 * cs-parser.jay (interface_event_declaration): Catch
3860 initialization of events.
3862 * ecore.cs: Better report missing constructors.
3864 * expression.cs (Binary.ResolveOperator): My previous bug fix had
3865 the error reporting done in the wrong place. Fix.
3867 * expression.cs (Binary.ResolveOperator): Catch the
3868 operator + (E x, E y) error earlier, and later allow for implicit
3869 conversions in operator +/- (E e, U x) from U to the underlying
3872 * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
3873 52596, if the container class is abstract, the default constructor
3874 is protected otherwise its public (before, we were always public).
3876 * statement.cs (Fixed.Resolve): Catch a couple more errors in the
3879 (Using.EmitLocalVariableDecls): Applied patch from Benjamin
3880 Jemlich that fixes bug #52597, MCS was generating invalid code for
3881 idisposable structs. Thanks to Ben for following up with this
3884 2004-01-06 Miguel de Icaza <miguel@ximian.com>
3886 * driver.cs: Allow assemblies without code to be generated, fixes
3889 2004-01-07 Nick Drochak <ndrochak@gol.com>
3891 * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
3893 2004-01-05 Miguel de Icaza <miguel@ximian.com>
3895 * cs-parser.jay: Add rules to improve error reporting if fields or
3896 methods are declared at the namespace level (error 116)
3898 * Add rules to catch event add/remove
3900 2004-01-04 David Sheldon <dave-mono@earth.li>
3902 * expression.cs: Added matching ")" to error message for
3905 2004-01-03 Todd Berman <tberman@gentoo.org>
3907 * ecore.cs, attribute.cs:
3908 Applying fix from #52429.
3910 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3912 * ecore.cs, expression.cs, statement.cs:
3913 Total rewrite of how we handle branching. We
3914 now handle complex boolean expressions with fewer
3915 jumps. As well if (x == 0) no longer emits a ceq.
3917 if (x is Foo) is much faster now, because we generate
3920 Overall, we get a pretty big improvement on our benchmark
3921 tests. The code we generate is smaller and more readable.
3923 I did a full two-stage bootstrap. The patch was reviewed
3924 by Martin and Miguel.
3926 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3928 * cs-parser.jay: Make primary_expression not take a QI.
3929 we dont need this because the member_access rule covers
3930 us here. So we replace the rule with just IDENTIFIER.
3932 This has two good effects. First, we remove a s/r conflict.
3933 Second, we allocate many fewer QualifiedIdentifier objects.
3935 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3937 * attribute.cs: Handle MarshalAs attributes as pseudo, and
3938 set the correct information via SRE. This prevents
3939 hanging on the MS runtime. Fixes #29374.
3941 2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
3943 * convert.cs: correctly handle conversions to value types
3944 from Enum and ValueType as unboxing conversions.
3946 Fixes bug #52569. Patch by Benjamin Jemlich.
3948 2004-01-02 Ravi Pratap <ravi@ximian.com>
3950 * expression.cs (BetterConversion): Prefer int -> uint
3951 over int -> ulong (csc's behaviour). This fixed bug #52046.
3953 2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
3955 * decl.cs (MemberCache.FindMembers): now returns a
3958 * typemanager.cs: In general, go with with ^^.
3959 (CopyNewMethods): take an IList.
3960 (RealMemberLookup): Only allocate an arraylist
3961 if we copy from two sets of methods.
3963 This change basically does two things:
3964 1) Fewer array lists allocated due to CopyNewMethods.
3965 2) the explicit cast in MemberList costed ALOT.
3967 2004-01-02 Zoltan Varga <vargaz@freemail.hu>
3969 * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
3970 a hashtable to avoid needless string allocations when an identifier is
3971 used more than once (the common case).
3973 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3975 * pending.cs: MS's TypeBuilder.GetInterfaces ()
3976 is broken, it will not return anything. So, we
3977 have to use the information we have in mcs to
3980 * typemanager.cs: Add a cache for GetInterfaces,
3981 since this will now be used more often (due to ^^)
3983 (GetExplicitInterfaces) New method that gets the
3984 declared, not effective, interfaces on a type
3985 builder (eg, if you have interface IFoo, interface
3986 IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
3989 This patch makes MCS able to bootstrap itself on
3992 2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
3994 * expression.cs: Remove the Nop's that Miguel put
3997 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
3999 * report.cs, codegen.cs: Give the real stack trace to
4000 the error when an exception is thrown.
4002 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4004 * decl.cs: only allocate hashtables for ifaces if
4007 2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
4009 * expression.cs: fix the error from cs0121-2.cs
4010 (a parent interface has two child interfaces that
4011 have a function with the same name and 0 params
4012 and the function is called through the parent).
4014 2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
4016 * class.cs, rootcontext.cs, typmanager.cs: do not
4019 2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
4021 * codegen.cs: remove stack for the ec flow branching.
4022 It is already a linked list, so no need.
4024 2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
4026 * Makefile: Allow custom profiler here.
4028 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4030 * typemanager.cs (LookupType):
4031 - Use a static char [], because split takes
4032 a param array for args, so it was allocating
4034 - Do not store true in a hashtable, it boxes.
4036 2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
4038 * flowanalysis.cs: bytify common enums.
4040 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4042 * modifiers.cs: Add a new set of flags for the
4043 flags allowed on explicit interface impls.
4044 * cs-parser.jay: catch the use of modifiers in
4045 interfaces correctly.
4046 * class.cs: catch private void IFoo.Blah ().
4048 All related to bug #50572.
4050 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4052 * decl.cs: Rewrite the consistant accessability checking.
4053 Accessability is not linear, it must be implemented in
4054 a tableish way. Fixes #49704.
4056 2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
4058 * expression.cs: Handle negation in a checked context.
4059 We must use subtraction from zero. Fixes #38674.
4061 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4063 * class.cs: Ignore static void main in DLLs.
4064 * rootcontext.cs: Handle the target type here,
4065 since we are have to access it from class.cs
4066 * driver.cs: account for the above.
4068 2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
4070 * report.cs: Give line numbers and files if available.
4072 2003-12-20 Zoltan Varga <vargaz@freemail.hu>
4074 * driver.cs: Implement /addmodule.
4076 * typemanager.cs: Change 'modules' field so it now contains Modules not
4079 2003-12-20 Martin Baulig <martin@ximian.com>
4081 * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
4082 (FieldBase.IsAssigned): Removed this field.
4083 (FieldBase.SetAssigned): New public method.
4084 (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
4086 2003-12-20 Martin Baulig <martin@ximian.com>
4088 * expression.cs (LocalVariableReference.DoResolve): Don't set
4089 `vi.Used' if we're called from DoResolveLValue().
4091 * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
4092 returns the usage vector it just merged into the current one -
4093 pass this one to UsageWarning().
4094 (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
4095 of the `EmitContext', don't call this recursively on our children.
4097 2003-12-19 Zoltan Varga <vargaz@freemail.hu>
4099 * driver.cs: Implement /target:module.
4101 2003-12-18 Zoltan Varga <vargaz@freemail.hu>
4103 * support.cs (CharArrayHashtable): New helper class.
4105 * cs-tokenizer.cs: Store keywords in a hashtable indexed by
4106 char arrays, not strings, so we can avoid creating a string in
4107 consume_identifier if the identifier is a keyword.
4109 2003-12-16 Martin Baulig <martin@ximian.com>
4111 * statement.cs (LocalInfo.Assigned): Removed this property.
4112 (LocalInfo.Flags): Removed `Assigned'.
4113 (LocalInfo.IsAssigned): New public method; takes the EmitContext
4114 and uses flow analysis.
4115 (Block.UsageWarning): Made this method private.
4116 (Block.Resolve): Call UsageWarning() if appropriate.
4118 * expression.cs (LocalVariableReference.DoResolve): Always set
4119 LocalInfo.Used here.
4121 2003-12-13 Martin Baulig <martin@ximian.com>
4123 * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
4124 any value here; we're now using flow analysis to figure out
4125 whether a statement/block returns a value.
4127 2003-12-13 Martin Baulig <martin@ximian.com>
4129 * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
4131 (FlowBranching.MergeFinally): Don't call
4132 `branching.CheckOutParameters()' here, this is called in
4134 (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
4135 when adding the `finally' vector.
4137 2003-12-13 Martin Baulig <martin@ximian.com>
4140 (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
4141 actually work and also fix #48962.
4143 2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
4145 * decl.cs: Do not check System.Object for nested types,
4146 since we know it does not have any. Big bang for buck:
4151 corlib: 17.99 seconds
4155 corlib: 17.39 seconds
4157 2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
4159 * class.cs (FindMembers): Allocate arraylists on demand. Most of the
4160 time we are returning 0 members, so we save alot here.
4162 2003-12-11 Martin Baulig <martin@ximian.com>
4164 * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
4165 `MergeChild()', also just take the `FlowBranching' as argument;
4166 call Merge() on it and return the result.
4167 (FlowBranching.Merge): We don't need to do anything if we just
4170 2003-12-11 Martin Baulig <martin@ximian.com>
4172 * flowanalysis.cs: Use a list of `UsageVector's instead of storing
4173 them in an `ArrayList' to reduce memory usage. Thanks to Ben
4174 Maurer for this idea.
4176 2003-12-11 Martin Baulig <martin@ximian.com>
4178 * flowanalysis.cs (MergeResult): This class is now gone; we now
4179 use the `UsageVector' for this. The reason for this is that if a
4180 branching just has one sibling, we don't need to "merge" them at
4181 all - that's the next step to do.
4182 (FlowBranching.Merge): We now return a `UsageVector' instead of a
4185 2003-12-11 Martin Baulig <martin@ximian.com>
4187 Reworked flow analyis and made it more precise and bug-free. The
4188 most important change is that we're now using a special `Reachability'
4189 class instead of having "magic" meanings of `FlowReturns'. I'll
4190 do some more cleanups and optimizations and also add some more
4191 documentation this week.
4193 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
4194 largely reworked this class.
4195 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
4196 the new `Reachability' class instead of having "magic" values here.
4197 (FlowBranching): We're now using an instance of `Reachability'
4198 instead of having separate `Returns', `Breaks' etc. fields.
4200 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
4201 based on flow analysis; ignore the return value of block.Emit ().
4203 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
4205 * driver.cs typemanager.cs: Find the mono extensions to corlib even
4206 if they are private.
4208 2003-12-09 Martin Baulig <martin@ximian.com>
4210 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4211 call them directly on the UsageVector.
4213 2003-12-09 Martin Baulig <martin@ximian.com>
4215 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
4216 Changed return type from `FlowReturns' to `Reachability'.
4218 2003-12-09 Martin Baulig <martin@ximian.com>
4220 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
4221 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
4222 `Reachable' fields with a single `Reachability' one.
4224 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4226 * class.cs (FindMembers): Remove foreach's.
4239 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4244 This patch does a few things:
4245 1. EmptyStatement is now a singleton, so it is never reallocated.
4246 2. All blah is EmptyStatement constructs have been changed to
4247 blah == EmptyStatement.Value, which is much faster and valid
4248 now that EmptyStatement is a singleton.
4249 3. When resolving a block, rather than allocating a new array for
4250 the non-empty statements, empty statements are replaced with
4251 EmptyStatement.Value
4252 4. Some recursive functions have been made non-recursive.
4253 Mainly the performance impact is from (3), however (1) and (2) are needed for
4254 this to work. (4) does not make a big difference in normal situations, however
4255 it makes the profile look saner.
4260 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4261 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
4262 Total memory allocated: 56397 KB
4265 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
4266 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
4267 Total memory allocated: 55666 KB
4269 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4271 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
4272 than the hashtable in a hashtable version
4274 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
4275 we always end up concating a string. This results in a huge perf
4276 loss, because many strings have to be tracked by the GC. In this
4277 patch, we first use a hashtable that works with two keys, so that
4278 the strings do not need to be concat'ed.
4289 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
4291 * Makefile: Add a new target `do-time' that does a quick and simple
4292 profile, leaving easy to parse output.
4294 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
4296 * codegen.cs (Init): Create the dynamic assembly with
4297 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
4299 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
4301 * support.cs: Make the PtrHashtable use only one
4302 instance of its comparer.
4304 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
4306 * typemanager.cs: Fix lookup of GetNamespaces.
4308 2003-11-29 Miguel de Icaza <miguel@ximian.com>
4310 * expression.cs: Removed redundant line.
4312 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
4313 ArrayLists, use for loops with bounds.
4315 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
4318 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
4319 arraylists, use for loop with bounds.
4321 The above three changes give us a 0.071 second performance
4322 improvement out of 3.294 seconds down to 3.223. On my machine
4323 the above changes reduced the memory usage by 1,387 KB during
4326 * cs-parser.jay (QualifiedIdentifier): New class used to represent
4327 QualifiedIdentifiers. Before we created a new string through
4328 concatenation, and mostly later on, the result would be
4329 manipulated by DecomposeQI through string manipulation.
4331 This reduced the compiler memory usage for bootstrapping from
4332 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
4333 compile times in 0.05 seconds.
4335 2003-11-28 Dick Porter <dick@ximian.com>
4337 * support.cs: Do string compares with the Invariant culture.
4345 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
4346 the comparison is done with the Invariant culture.
4348 2003-11-27 Miguel de Icaza <miguel@ximian.com>
4350 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
4351 GetEnumerator method.
4353 (ProbeCollectionType): Iterate starting at the most specific type
4354 upwards looking for a GetEnumerator
4356 * expression.cs: Shift count can be up to 31 for int/uint and 63
4359 2003-11-26 Miguel de Icaza <miguel@ximian.com>
4361 * statement.cs (Block.LookupLabel): Also look for the label on the
4362 children blocks. Use a hash table to keep track of visited
4365 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
4366 we actually did transform the other operand, otherwise fall back
4367 to the common codepath that casts to long.
4369 * cs-tokenizer.cs: Use the same code pattern as the int case.
4370 Maybe I should do the parsing myself, and avoid depending on the
4371 Parse routines to get this done.
4373 2003-11-25 Miguel de Icaza <miguel@ximian.com>
4375 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4376 which fixes bug 51347. This time test it.
4378 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
4379 attributes for example can not tell the difference between these.
4380 The difference was only a syntax feature of the language.
4382 * attribute.cs: Apply attributes to delegates.
4384 * delegate.cs: Call the apply attributes method.
4386 2003-11-24 Miguel de Icaza <miguel@ximian.com>
4388 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
4389 comparing 0 vs Byte.MinValue, not the value
4391 (ImplicitConversionRequired): When reporting a conversion error,
4392 use error 31 to print out the constant error instead of the
4395 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
4396 which fixes bug 51347.
4398 2003-11-22 Miguel de Icaza <miguel@ximian.com>
4400 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
4401 which fixes the -warnaserror command line option.
4403 2003-11-21 Miguel de Icaza <miguel@ximian.com>
4405 * cfold.cs (DoNumericPromotions): During constant folding of
4406 additions on UIntConstant, special case intconstants with
4407 IntConstants like we do on the expression binary operator.
4409 2003-11-12 Miguel de Icaza <miguel@ximian.com>
4411 * convert.cs (ImplicitReferenceConversion): We were missing a case
4412 (System.Enum are not value types or class types, so we need to
4413 classify them separatedly).
4415 * driver.cs: We do not support error 2007.
4417 2003-11-12 Jackson Harper <jackson@ximian.com>
4419 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
4420 system directory. Also use the full file name so users can
4421 libraries names mscorlib-o-tron.dll in a non system dir.
4423 2003-11-10 Martin Baulig <martin@ximian.com>
4425 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
4426 (TypeManager.InitCoreTypes): Initialize them here, but instead of
4427 calling `ResolveType()' on them, directly assign their `Type'.
4429 2003-11-08 Martin Baulig <martin@ximian.com>
4431 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
4432 return value and the `out parent' parameter.
4433 (TypeContainer.DefineType): Moved the CS0644 check into
4434 GetClassBases(). Don't pass the interface types to the
4435 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
4436 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
4438 * ecore.cs (TypeExpr.IsAttribute): New property.
4439 (TypeExpr.GetInterfaces): New method.
4441 * interface.cs (Interface.GetInterfaceTypeByName): Return a
4442 TypeExpr instead of a Type.
4443 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
4444 (Interface.DefineType): Don't pass the interface types to the
4445 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
4446 them later and then call `TypeBulider.AddInterfaceImplementation()'.
4448 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
4449 instead of a `Type[]'.
4450 (TypeManager.RegisterBuilder): Likewise.
4451 (TypeManager.AddUserInterface): Likewise.
4452 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
4453 `Type[]' and also return a `TypeExpr[]'.
4454 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
4456 2003-11-08 Martin Baulig <martin@ximian.com>
4458 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
4461 2003-11-08 Martin Baulig <martin@ximian.com>
4463 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
4464 TypeManager.ResolveExpressionTypes().
4466 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
4467 instead of an Expression.
4468 (TypeExpr): This is now an abstract base class for `TypeExpression'.
4469 (TypeExpression): New public class; formerly known as `TypeExpr'.
4471 * expression.cs (ComposedCast): Derive from TypeExpr.
4473 * typemanager.cs (TypeManager.system_*_expr): These are now
4474 TypExpr's instead of Expression's.
4475 (TypeManager.ResolveExpressionTypes): New public static function;
4476 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
4479 2003-11-06 Miguel de Icaza <miguel@ximian.com>
4481 * expression.cs (New.DoResolve): Do not dereference value that
4482 might be a null return.
4484 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
4485 sure that the constant value has the right type. Fixes an
4486 unreported bug, similar to 50425.
4488 * const.cs (Const.LookupConstantValue): Call
4489 ImplicitStandardConversionExists before doing a conversion to
4490 avoid havng the TypeManager.ChangeType do conversions.
4492 Reduced the number of casts used
4494 (Const.ChangeType): New routine to enable reuse of the constant
4495 type changing code from statement.
4497 * typemanager.cs (ChangeType): Move common initialization to
4498 static global variables.
4502 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
4503 every value type to go through, even if it was void. Fix that.
4505 * cs-tokenizer.cs: Use is_identifier_start_character on the start
4506 character of the define, and the is_identifier_part_character for
4507 the rest of the string.
4509 2003-11-05 Miguel de Icaza <miguel@ximian.com>
4511 * expression.cs (UnaryMutator.EmitCode): When I updated
4512 LocalVariableReference.DoResolve, I overdid it, and dropped an
4513 optimization done on local variable references.
4515 2003-11-04 Miguel de Icaza <miguel@ximian.com>
4517 * ecore.cs: Convert the return from Ldlen into an int.
4519 2003-10-20 Miguel de Icaza <miguel@ximian.com>
4521 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
4522 the accessibility, this is a special case for toplevel non-public
4523 classes (internal for instance).
4525 2003-10-20 Nick Drochak <ndrochak@gol.com>
4527 * ecore.cs: Fix typo and build. Needed another right paren.
4529 2003-10-19 Miguel de Icaza <miguel@ximian.com>
4531 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
4532 `internal' case regular and protected, but not allowing protected
4533 to be evaluated later. Bug 49840
4535 2003-10-15 Miguel de Icaza <miguel@ximian.com>
4537 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
4538 to kb.Nlast, and not the kb.nFirst to isolate the switch
4541 Extract the underlying type, so enumerations of long/ulong are
4542 treated like long/ulong.
4544 2003-10-14 Miguel de Icaza <miguel@ximian.com>
4546 * expression.cs (New): Overload the meaning of RequestedType to
4547 track the possible creation of the NewDelegate type, since
4548 DoResolve is invoked more than once for new constructors on field
4551 See bugs: #48800 and #37014
4553 * cs-parser.jay (declare_local_constants): Take an arraylist
4554 instead of a single constant.
4556 (local_constant_declaration): It should take a
4557 constant_declarators, not a constant_declarator. Fixes 49487
4559 * convert.cs: Fix error report.
4561 2003-10-13 Jackson Harper <jackson@ximian.com>
4563 * typemanager.cs (TypeToCoreType): Add float and double this fixes
4566 2003-10-09 Martin Baulig <martin@ximian.com>
4568 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
4570 (MethodCore.DoDefineParameters): Removed the TypeContainer
4571 argument; use the DeclSpace which was passed to the .ctor instead.
4572 (MethodCore.CheckParameter): Take a DeclSpace instead of a
4573 TypeContainer; we only need a DeclSpace here.
4575 2003-10-09 Martin Baulig <martin@ximian.com>
4577 * class.cs (MethodData): Added additional `DeclSpace ds' argument
4579 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
4580 EmitContext's .ctor.
4582 2003-10-09 Martin Baulig <martin@ximian.com>
4584 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
4585 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
4586 AsAccessible(), moved them as well.
4588 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
4590 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
4592 * cs-parser.jay : Renamed yyName to yyNames related to jay.
4594 2003-10-07 Miguel de Icaza <miguel@ximian.com>
4596 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
4597 generation for >=, as spotted by Paolo, bug 48679.
4598 Patch from David Waite.
4600 * cs-tokenizer.cs: Add handling for #pragma.
4602 * cs-parser.jay: Allow for both yield and yield return in the
4603 syntax. The anti-cobolization of C# fight will go on!
4605 * class.cs (TypeBuilder.DefineType): Catch error condition here
4606 (Parent.DefineType erroring out and returning null).
4608 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
4609 coping with enumerations variables, we were mistakenly processing
4610 them as a regular value type instead of built-in types. Fixes the
4613 * typemanager.cs (IsBuiltinOrEnum): New method.
4615 2003-09-30 Miguel de Icaza <miguel@ximian.com>
4617 * cs-parser.jay: Upgrade: yield now needs the return clause.
4619 2003-09-19 Martin Baulig <martin@ximian.com>
4621 * decl.cs (MemberCache.SetupCacheForInterface): Take a
4622 `MemberCache parent' argument. Normally, an interface doesn't
4623 have a parent type except System.Object, but we use this in gmcs
4624 for generic type parameters.
4626 2003-09-18 Martin Baulig <martin@ximian.com>
4628 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
4629 on `type.IsInterface'; don't check whether the type has a parent
4630 to determine whether it's an interface.
4632 2003-09-15 Martin Baulig <martin@ximian.com>
4634 * class.cs (TypeContainer.DefineType): Added an error flag to
4635 avoid reporting duplicate CS0146's ("class definition is
4638 * driver.cs (Driver.MainDriver): Abort if
4639 RootContext.ResolveTree() reported any errors.
4641 2003-09-07 Martin Baulig <martin@ximian.com>
4643 * report.cs (Error, Warning): Added overloaded versions which take
4644 a `params object[] args' and call String.Format().
4646 2003-09-07 Martin Baulig <martin@ximian.com>
4648 * decl.cs (DeclSpace..ctor): Don't call
4649 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
4650 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
4651 (DeclSpace.RecordDecl): New method.
4653 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
4655 2003-09-02 Ravi Pratap <ravi@ximian.com>
4657 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
4658 value attributes to be applied to ParameterBuilders.
4660 * class.cs (MethodCore.LabelParameters): Make static and more
4661 generic so that it can be used from other places - like interface
4662 methods, for instance.
4664 * interface.cs (Interface.Emit): Call LabelParameters before
4665 emitting attributes on the InterfaceMethod.
4667 2003-08-26 Martin Baulig <martin@ximian.com>
4669 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
4670 resolving aliases; fixes #47927.
4672 2003-08-26 Martin Baulig <martin@ximian.com>
4674 * statement.cs (Using.DoResolve): This is internally emitting a
4675 try/finally clause, so we need to set ec.NeedExplicitReturn if we
4676 do not always return. Fixes #47681.
4678 2003-08-26 Martin Baulig <martin@ximian.com>
4680 * decl.cs (MemberCore): Moved WarningNotHiding(),
4681 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
4683 (AdditionResult): Make this nested in DeclSpace.
4684 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
4685 argument; call NamespaceEntry.Define() unless we're nested in a
4688 * namespace.cs (Namespace.DefineName): New public function. This
4689 is called from DeclSpace's .ctor to add
4690 (Namespace.Lookup): Include DeclSpaces in the lookup.
4692 * class.cs (Operator): Derive from MemberBase, not MemberCore.
4694 * const.cs (Const): Derive from MemberBase, not MemberCore.
4696 2003-08-25 Martin Baulig <martin@ximian.com>
4698 * convert.cs (Convert.ExplicitReferenceConversion): When
4699 converting from an interface type to a class, unbox if the target
4700 type is a struct type. Fixes #47822.
4702 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4704 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
4707 2003-08-22 Martin Baulig <martin@ximian.com>
4709 * class.cs (TypeManager.DefineType): When defining a nested type,
4710 call DefineType() on our parent; fixes #47801.
4712 2003-08-22 Martin Baulig <martin@ximian.com>
4714 * class.cs (MethodData.Define): While checking if a method is an
4715 interface implementation, improve the test a bit more to fix #47654.
4717 2003-08-22 Martin Baulig <martin@ximian.com>
4719 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
4720 correctly; fixes #47722.
4722 2003-08-22 Martin Baulig <martin@ximian.com>
4724 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
4725 LocalVariableReference, ensure it's not read-only. Fixes #47536.
4727 * statement.cs (Fixed.DoResolve): Make all variables read-only.
4729 2003-08-22 Martin Baulig <martin@ximian.com>
4731 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
4732 can only be assigned in static constructors. Fixes #47161.
4734 2003-08-22 Martin Baulig <martin@ximian.com>
4736 Rewrote and improved the flow analysis code.
4738 * flowbranching.cs (FlowBranching): Make this class abstract.
4739 (FlowBranching.CreateBranching): New static function to create a
4741 (FlowBranchingBlock, FlowBranchingException): New classes.
4742 (FlowBranching.UsageVector.Type): New public readonly field.
4743 (FlowBranching.UsageVector.Breaks): Removed the setter.
4744 (FlowBranching.UsageVector.Returns): Removed the setter.
4745 (FlowBranching.UsageVector): Added Break(), Return(),
4746 NeverReachable() and Throw() methods to modify the reachability.
4747 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
4748 done by FlowBranching.Merge().
4749 (FlowBranching.UsageVector.MergeChild): New method; merges the
4750 merge result into the current vector.
4751 (FlowBranching.Merge): New abstract method to merge a branching.
4753 2003-08-12 Martin Baulig <martin@ximian.com>
4755 * expression.cs (Indirection.CacheTemporaries): Create the
4756 LocalTemporary with the pointer type, not its element type.
4758 2003-08-10 Miguel de Icaza <miguel@ximian.com>
4760 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
4761 token was a keyword or not.
4763 Add `error' options where an IDENTIFIER was expected; Provide
4764 CheckToken and CheckIdentifierToken convenience error reporting
4767 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
4769 * decl.cs: Rename `NamespaceEntry Namespace' public field into
4770 NameSpaceEntry NameSpaceEntry.
4772 (LookupInterfaceOrClass): Avoid creating a full qualified name
4773 from namespace and name: avoid doing lookups when we know the
4774 namespace is non-existant. Use new Tree.LookupByNamespace which
4775 looks up DeclSpaces based on their namespace, name pair.
4777 * driver.cs: Provide a new `parser verbose' to display the
4778 exception thrown during parsing. This is turned off by default
4779 now, so the output of a failure from mcs is more graceful.
4781 * namespace.cs: Track all the namespaces defined in a hashtable
4784 (IsNamespace): New method
4786 2003-08-09 Miguel de Icaza <miguel@ximian.com>
4788 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
4789 we know that we need to concatenate (full typename can never be
4794 * statement.cs: Use a bitfield; Do not initialize to null things
4795 which are done by the constructor by default.
4797 * cs-parser.jay: bug fix, parameter was 4, not 3.
4799 * expression.cs: Just use the property;
4801 * statement.cs: No need for GetVariableInfo method.
4803 2003-08-08 Martin Baulig <martin@ximian.com>
4805 * flowanalysis.cs (FlowReturns): This is now nested in the
4806 `FlowBranching' class.
4807 (MyBitVector): Moved this here from statement.cs.
4808 (FlowBranching.SiblingType): New enum type.
4809 (FlowBranching.CreateSibling): Added `SiblingType' argument.
4811 2003-08-07 Martin Baulig <martin@ximian.com>
4813 * flowanalysis.cs (FlowBranchingType): This is now nested in the
4814 `FlowBranching' class and called `BranchingType'.
4816 2003-08-07 Martin Baulig <martin@ximian.com>
4818 * flowanalysis.cs: Moved all the control flow analysis code into
4821 2003-08-07 Martin Baulig <martin@ximian.com>
4823 * assign.cs (Assign.DoResolve): `target' must either be an
4824 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
4827 2003-08-07 Miguel de Icaza <miguel@ximian.com>
4829 * expression.cs (BinaryMethod): This kind of expression is created by the
4830 Binary class if it determines that the operator has to be handled
4833 (BinaryDelegate): This kind of expression is created if we are
4834 dealing with a + or - operator on delegates.
4836 (Binary): remove method, argumetns, and DelegateOperator: when
4837 dealing with methods,
4839 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
4841 * statement.cs (Block): use bitfields for the three extra booleans
4842 we had in use. Remove unused topblock parameter.
4844 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
4846 * assign.cs: Drop extra unneeded tests.
4848 2003-08-06 Miguel de Icaza <miguel@ximian.com>
4850 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
4852 * statement.cs (Foreach): Use VariableStorage instead of
4855 * codegen.cs (VariableStorage): New class used by clients that
4856 require a variable stored: locals or fields for variables that
4857 need to live across yield.
4859 Maybe provide a convenience api for EmitThis+EmitLoad?
4861 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
4864 2003-08-05 Miguel de Icaza <miguel@ximian.com>
4866 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
4867 RemapParameterLValue): New methods that are used to turn a
4868 precomputed FieldInfo into an expression like this:
4872 The idea is to use this instead of making LocalVariableReference
4873 have more than one meaning.
4875 * cs-parser.jay: Add error production to BASE.
4877 * ecore.cs: Deal with TypeManager.GetField returning null, which
4878 is now a valid return value.
4880 (FieldExprNoAddress): New expression for Fields whose address can
4883 * expression.cs (LocalVariableReference): During the resolve
4884 phases, create new expressions if we are in a remapping context.
4885 Remove code that dealt with remapping here.
4887 (ParameterReference): same.
4889 (ProxyInstance): New expression, like the `This' expression, but
4890 it is born fully resolved. We know what we are doing, so remove
4891 the errors that are targeted to user-provided uses of `this'.
4893 * statement.cs (Foreach): our variable is now stored as an
4894 Expression; During resolution, follow the protocol, dont just
4895 assume it will return this.
4897 2003-08-06 Martin Baulig <martin@ximian.com>
4899 * support.cs (SeekableStreamReader.cs): New public class.
4901 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
4902 SeekableStreamReader instead of the normal StreamReader.
4904 2003-08-04 Martin Baulig <martin@ximian.com>
4906 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
4907 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
4908 deambiguate casts and delegate invocations.
4909 (parenthesized_expression): Use the new tokens to ensure this is
4910 not a cast of method invocation.
4912 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
4913 when reading a `)' and Deambiguate_CloseParens () was previously
4916 * expression.cs (ParenthesizedExpression): New class. This is
4917 just used for the CS0075 test.
4918 (Binary.DoResolve): Check for CS0075.
4920 2003-07-29 Ravi Pratap <ravi@ximian.com>
4922 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
4923 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
4924 reference comparison.
4926 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
4927 examine the ReturnType for equality - this is necessary in the
4928 cases of implicit and explicit operators whose signature also
4929 includes the return type.
4931 2003-07-26 Miguel de Icaza <miguel@ximian.com>
4933 * namespace.cs: Cache the result of the namespace computation,
4934 instead of computing it every time.
4936 2003-07-24 Miguel de Icaza <miguel@ximian.com>
4938 * decl.cs: Use a global arraylist that we reuse over invocations
4939 to avoid excesive memory consumption. Reduces memory usage on an
4940 mcs compile by one meg (45 average).
4942 * typemanager.cs (LookupTypeReflection): In .NET pointers are
4943 private, work around that.
4945 2003-07-23 Miguel de Icaza <miguel@ximian.com>
4947 * literal.cs (IntLiteral): Define Zero and One static literals.
4949 * cs-parser.jay (integer_literal): use static literals to reduce
4950 memory usage for the most used literals (0, 1 and -1). 211kb
4951 reduced in memory usage.
4953 Replace all calls to `new ArrayList' with `new
4954 ArrayList(4)' which is a good average number for most allocations,
4955 and also requires only 16 bytes of memory for its buffer by
4958 This reduced MCS memory usage in seven megabytes for the RSS after
4961 2003-07-28 Ravi Pratap <ravi@ximian.com>
4963 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
4964 handle params methods the correct way by forming only one
4965 applicable set with params and normal methods in them. Earlier we
4966 were looking at params methods only if we found no normal methods
4967 which was not the correct thing to do.
4969 (Invocation.BetterFunction): Take separate arguments indicating
4970 when candidate and the best method are params methods in their
4973 This fixes bugs #43367 and #46199.
4975 * attribute.cs: Documentation updates.
4977 (CheckAttribute): Rename to CheckAttributeTarget.
4978 (GetValidPlaces): Rename to GetValidTargets.
4980 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
4981 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
4985 2003-07-28 Martin Baulig <martin@ximian.com>
4987 * class.cs (TypeContainer.DefineMembers): Use the base type's full
4988 name when looking up the base class of a nested class. Fixes #46977.
4990 2003-07-26 Martin Baulig <martin@ximian.com>
4992 * expression.cs (Indexers.Indexer): New nested struct; contains
4993 getter, setter and the indexer's type.
4994 (Indexers.Properties): This is now an ArrayList of
4996 (IndexerAccess.DoResolveLValue): Correctly set the type if the
4997 indexer doesn't have any getters.
4999 * assign.cs (Assign.DoResolve): Also do the implicit conversions
5000 for embedded property and indexer assignments.
5002 2003-07-26 Martin Baulig <martin@ximian.com>
5004 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
5005 preprocessor directive is not the first non-whitespace character
5008 2003-07-26 Martin Baulig <martin@ximian.com>
5010 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
5011 namespace parsing, follow the spec more closely.
5013 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
5014 NamespaceEntry.Lookup().
5016 2003-07-25 Martin Baulig <martin@ximian.com>
5018 * MethodCore.cs (OverridesSomething): New public field; it's set
5019 from TypeContainer.DefineMembers if this method overrides
5020 something (which doesn't need to be a method). Fix #39462.
5022 2003-07-25 Ravi Pratap <ravi@ximian.com>
5024 * typemanager.cs (GetMembers): Ensure that the list of members is
5025 reversed. This keeps things in sync.
5027 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
5028 find an AttributeUsage attribute.
5030 * expression.cs (Invocation.OverloadResolve): Perform the check
5031 which disallows Invoke to be directly called on a Delegate.
5033 (Error_InvokeOnDelegate): Report error cs1533.
5035 2003-07-25 Martin Baulig <martin@ximian.com>
5037 * expression.cs (Indexers.GetIndexersForType): Only look in the
5038 interface hierarchy if the requested type is already an
5039 interface. Fixes #46788 while keeping #46502 fixed.
5041 2003-07-25 Martin Baulig <martin@ximian.com>
5043 * class.cs (TypeContainer.DefineMembers): Check whether all
5044 readonly fields have been assigned and report warning CS0649 if
5047 * statement.cs (LocalInfo.IsFixed): Always return true if this is
5050 2003-07-24 Ravi Pratap <ravi@ximian.com>
5052 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
5053 returned from GetMethods to make things consistent with the
5054 assumptions MCS makes about ordering of methods.
5056 This should comprehensively fix bug #45127 and it does :-)
5058 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
5059 ordering is actually reverse.
5061 * Clean up some debug messages I left lying around.
5063 * interface.cs (Populate*): Get rid of code which emits attributes
5064 since the stage in which we emit attributes is the 'Emit' stage,
5065 not the define stage.
5067 (Emit): Move attribute emission for interface members here.
5069 2003-07-22 Ravi Pratap <ravi@ximian.com>
5071 * expression.cs (Invocation.OverloadResolve): Follow the spec more
5072 closely: we eliminate methods in base types when we have an
5073 applicable method in a top-level type.
5075 Please see section 14.5.5.1 for an exact description of what goes
5078 This fixes bug #45127 and a host of other related to corlib compilation.
5080 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
5081 array is the method corresponding to the top-level type (this is
5082 because of the changes made to icall.c) so we change this
5085 (MethodGroupExpr.Name): This too.
5087 * typemanager.cs (GetElementType): New method which does the right
5088 thing when compiling corlib.
5090 * everywhere: Make use of the above in the relevant places.
5092 2003-07-22 Martin Baulig <martin@ximian.com>
5094 * cs-parser.jay (invocation_expression): Moved
5095 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
5096 `cast_expression', but create a InvocationOrCast which later
5097 resolves to either an Invocation or a Cast.
5099 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
5100 method; call this before EmitStatement() to make sure that this
5101 expression can be used as a statement.
5103 * expression.cs (InvocationOrCast): New class; resolves to either
5104 an Invocation or a Cast.
5106 * statement.cs (StatementExpression): Call ResolveStatement() on
5107 the ExpressionStatement before emitting it.
5109 2003-07-21 Martin Baulig <martin@ximian.com>
5111 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
5112 `ref' and `out' attributes match; fixes #46220.
5113 (MemberAccess.ResolveMemberAccess): You can't reference a type
5114 through an expression; fixes #33180.
5115 (Indexers.GetIndexersForType): Don't return the indexers from
5116 interfaces the class implements; fixes #46502.
5118 2003-07-21 Martin Baulig <martin@ximian.com>
5120 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
5121 CS0661 checks; fixes bug #30442.
5123 2003-07-21 Martin Baulig <martin@ximian.com>
5125 * decl.cs (AdditionResult): Added `Error'.
5127 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
5129 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
5130 makes cs0031.cs actually work.
5132 2003-07-20 Martin Baulig <martin@ximian.com>
5134 * namespace.cs: Fixed that bug which caused a crash when compiling
5137 2003-07-20 Miguel de Icaza <miguel@ximian.com>
5139 * typemanager.cs (LookupTypeReflection): Never expose types which
5140 are NotPublic, NestedPrivate, NestedAssembly, or
5141 NestedFamANDAssem. We used to return these, and later do a check
5142 that would report a meaningful error, but the problem is that we
5143 would not get the real match, if there was a name override.
5145 2003-07-18 Miguel de Icaza <miguel@ximian.com>
5147 * namespace.cs (Namespace, Name): Do not compute the namespace
5148 name dynamically, compute it in the constructor. This reduced
5149 memory usage by 1697 KB.
5151 * driver.cs: Use --pause to pause at the end.
5153 2003-07-17 Peter Williams <peter@newton.cx>
5155 * Makefile: Change the name of the test target so that it doesn't
5156 conflict with the recursive test target.
5158 2003-07-17 Miguel de Icaza <miguel@ximian.com>
5160 * expression.cs (LocalVariableReference.Emit, EmitAssign,
5161 AddressOf): Do not use EmitThis, that was wrong, use the actual
5164 2003-07-15 Miguel de Icaza <miguel@ximian.com>
5166 * class.cs (MethodData.Define): While checking if a method is an
5167 interface implementation, improve the test: If we are not public
5168 (use new test here: use the computed MethodAttributes directly,
5169 instead of the parsed modifier flags) check if the `implementing'
5170 method comes from an interface or not.
5172 * pending.cs (VerifyPendingMethods): Slightly better error
5175 * makefile: add test target that does the mcs bootstrap.
5177 2003-07-16 Ravi Pratap <ravi@ximian.com>
5179 * interface.cs (Define): Do nothing here since there are no
5180 members to populate etc. Move the attribute emission out of here
5181 since this was just totally the wrong place to put it. Attribute
5182 application happens during the 'Emit' phase, not in the 'Define'
5185 (Emit): Add this method and move the attribute emission here
5187 * rootcontext.cs (EmitCode): Call the Emit method on interface
5190 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5192 * expression.cs (OverloadResolve): Report error only if Location
5193 is not 'Null' which means that there was a probe going on.
5195 2003-07-14 Martin Baulig <martin@ximian.com>
5197 * expression.cs (ConditionalLogicalOperator): New public class to
5198 implement user defined conditional logical operators.
5199 This is section 14.11.2 in the spec and bug #40505.
5201 2003-07-14 Martin Baulig <martin@ximian.com>
5203 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
5205 2003-07-14 Martin Baulig <martin@ximian.com>
5207 * codegen.cs (EmitContext.InFixedInitializer): New public field.
5209 * ecore.cs (IVariable.VerifyFixed): New interface method.
5211 * expression.cs (Unary.ResolveOperator): When resolving the `&'
5212 operator, check whether the variable is actually fixed. Fixes bug
5213 #36055. Set a variable definitely assigned when taking its
5214 address as required by the spec.
5216 * statement.cs (LocalInfo.IsFixed): New field.
5217 (LocalInfo.MakePinned): Set `IsFixed' to true.
5219 2003-07-14 Ravi Pratap M <ravi@ximian.com>
5221 * attribute.cs (Attribute.Resolve): While doing a Member lookup
5222 for .ctors, ensure that we only ask for members declared in the
5223 attribute type (BindingFlags.DeclaredOnly).
5227 * expression.cs (Error_WrongNumArguments): Report error 1501
5228 correctly the way CSC does.
5230 2003-07-13 Martin Baulig <martin@ximian.com>
5232 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
5233 lookup on the fully qualified name, to make things like "X.X" work
5234 where "X.X" is a fully qualified type name, but we also have a
5235 namespace "X" in the using list. Fixes #41975.
5237 2003-07-13 Martin Baulig <martin@ximian.com>
5239 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
5240 function. If we're a CompoundAssign, we need to create an embedded
5241 CompoundAssign, not an embedded Assign.
5242 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
5245 2003-07-13 Martin Baulig <martin@ximian.com>
5247 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
5248 work to fix bug #46088.
5250 2003-07-13 Ravi Pratap <ravi@ximian.com>
5252 * class.cs (Operator.Emit): Do not emit attributes here - it is
5253 taken care of by the Method class that we delegate too. This takes
5256 2003-07-10 Martin Baulig <martin@ximian.com>
5258 * expression.cs (TypeOfVoid): New class.
5259 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
5261 2003-07-10 Martin Baulig <martin@ximian.com>
5263 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
5266 2003-07-10 Martin Baulig <martin@ximian.com>
5268 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
5269 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
5271 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
5273 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
5275 2003-07-10 Martin Baulig <martin@ximian.com>
5277 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
5278 of decimal. Fixes #42850.
5280 NOTE: I also fixed the created byte blob, but this doesn't work on
5281 the MS runtime and csc never produces any byte blobs for decimal
5284 2003-07-10 Martin Baulig <martin@ximian.com>
5286 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
5287 structs; fixes #32068.
5288 (Block.AddChildVariableNames): Fixed #44302.
5290 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5292 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
5294 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5296 * attribute.cs: And this test is onger needed.
5298 2003-07-08 Martin Baulig <martin@ximian.com>
5300 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
5301 inaccessible types. Fixes #36313.
5303 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
5305 * namespace.cs (NamespaceEntry): Create implicit entries for all
5306 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
5307 implicit entries for N1.N2 and N1.
5309 2003-07-08 Martin Baulig <martin@ximian.com>
5311 Rewrote the handling of namespaces to fix a lot of the issues
5312 wrt. `using' aliases etc.
5314 * namespace.cs (Namespace): Splitted this class into a
5315 per-assembly `Namespace' and a per-file `NamespaceEntry'.
5317 * typemanager.cs (TypeManager.IsNamespace): Removed.
5318 (TypeManager.ComputeNamespaces): Only compute namespaces from
5319 loaded assemblies here, not the namespaces from the assembly we're
5320 currently compiling.
5322 2003-07-08 Martin Baulig <martin@ximian.com>
5324 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
5326 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5328 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
5331 I thought about the memory savings here, but LookupTypeReflection
5332 is used under already very constrained scenarios. Compiling
5333 corlib or mcs only exposes one hit, so it would not really reduce
5334 any memory consumption.
5336 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5338 * typemanager.cs: fixes bug #45889 by only adding public types from
5339 other assemblies to the list of known types.
5341 2003-07-07 Miguel de Icaza <miguel@ximian.com>
5343 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
5344 on the type we resolved.
5346 2003-07-05 Martin Baulig <martin@ximian.com>
5348 * pending.cs (PendingImplementation.ParentImplements): Don't
5349 create the proxy if the parent is abstract.
5351 * class.cs (TypeContainer.DefineIndexers): Process explicit
5352 interface implementations first. Fixes #37714.
5354 2003-07-04 Miguel de Icaza <miguel@ximian.com>
5356 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
5357 defined recursively; but since we modify the input parameters
5358 (left is set to `this' temporarily), we reset this value if the
5359 left_is_explicit is false, which gives the original semantics to
5362 * literal.cs (NullPointer): new class used to represent a null
5363 literal in a pointer context.
5365 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
5366 type is a pointer, use a NullPointer object instead of a
5367 NullLiteral. Closes 43687
5369 (ExplicitConversion): Convert pointer values using
5370 the conv opcode to the proper type.
5372 * ecore.cs (New): change ValueTypeVariable property into a method,
5373 that returns whether the valuetype is suitable for being used.
5375 * expression.cs (Binary.DoNumericPromotions): Only return if we
5376 the int constant was a valid uint, and we can return both left and
5377 right as uints. If not, we continue processing, to trigger the
5378 type conversion. This fixes 39018.
5380 * statement.cs (Block.EmitMeta): During constant resolution, set
5381 the CurrentBlock property on the emitcontext, so that we resolve
5382 constants propertly.
5384 2003-07-02 Martin Baulig <martin@ximian.com>
5386 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
5387 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
5389 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
5390 than emitting it here.
5392 * statement.cs: Fixed some more flow analysis bugs.
5394 2003-07-02 Martin Baulig <martin@ximian.com>
5396 * class.cs (MethodData.Define): When implementing interface
5397 methods, set Final unless we're Virtual.
5399 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
5400 check work for interface methods.
5402 2003-07-01 Martin Baulig <martin@ximian.com>
5404 * ecore.cs (EmitContext.This): Replaced this property with a
5405 GetThis() method which takes a Location argument. This ensures
5406 that we get the correct error location for a CS0188.
5408 2003-07-01 Miguel de Icaza <miguel@ximian.com>
5410 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
5411 ImplicitStandardConversion.
5413 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
5415 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
5417 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
5420 2003-06-30 Miguel de Icaza <miguel@ximian.com>
5422 * class.cs (Constructor.Define): Turn off initlocals for unsafe
5425 (MethodData.Define): Turn off initlocals for unsafe methods.
5427 2003-06-29 Miguel de Icaza <miguel@ximian.com>
5429 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
5430 complete; Fixes #37521.
5432 * delegate.cs: Use Modifiers.TypeAttr to compute the
5433 TypeAttributes, instead of rolling our own. This makes the flags
5434 correct for the delegates.
5436 2003-06-28 Miguel de Icaza <miguel@ximian.com>
5438 * class.cs (Constructor.Define): Set the private flag for static
5439 constructors as well.
5441 * cs-parser.jay (statement_expression): Set the return value to
5442 null, to avoid a crash when we catch an error.
5444 2003-06-24 Miguel de Icaza <miguel@ximian.com>
5446 * cs-parser.jay: Applied patch from Jackson that adds support for
5447 extern and unsafe modifiers to destructor declarations.
5449 * expression.cs: Report error 21 if the user is trying to index a
5452 * driver.cs: Add an error message, suggested by the bug report.
5454 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
5455 if we do not have a ": this ()" constructor initializer. Fixes 45149
5457 2003-06-14 Miguel de Icaza <miguel@ximian.com>
5459 * namespace.cs: Add some information to reduce FAQs.
5461 2003-06-13 Miguel de Icaza <miguel@ximian.com>
5463 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
5464 underlying enumeration types. Fixes #43915.
5466 * expression.cs: Treat ushort/short as legal values to be used in
5469 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
5471 * delegate.cs: transfer custom attributes for paramenters from
5472 the delegate declaration to Invoke and BeginInvoke.
5474 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
5476 * attribute.cs: handle custom marshalers and emit marshal info
5479 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
5481 * makefile.gnu: Added anonymous.cs to the compiler sources.
5483 2003-05-28 Miguel de Icaza <miguel@ximian.com>
5485 * iterators.cs: Change the name of the proxy class to include two
5488 * cs-parser.jay: Update grammar to include anonymous methods.
5490 * anonymous.cs: new file.
5492 2003-05-27 Miguel de Icaza <miguel@ximian.com>
5494 * class.cs (Field.Define): Add missing test for pointers and
5497 2003-05-27 Ravi Pratap <ravi@ximian.com>
5499 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
5500 we use the stobj opcode.
5502 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
5503 since it wasn't the correct fix.
5505 It still is puzzling that we are required to use stobj for IntPtr
5506 which seems to be a ValueType.
5508 2003-05-26 Miguel de Icaza <miguel@ximian.com>
5510 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
5511 during regular simple name resolution. Now, the trick is that
5512 instead of returning for processing the simplename, we do a
5513 TypeManager.LookupType (ie, a rooted lookup as opposed to a
5514 contextual lookup type). If a match is found, return that, if
5515 not, return for further composition.
5517 This fixes long-standing 30485.
5519 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
5520 using the address to initialize an object, do an Stobj instead of
5521 using the regular Stelem.
5523 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
5524 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
5525 Because if we are a BaseIndexerAccess that value will be true.
5528 * statement.cs (GotoCase.Resolve): Return after reporting an
5529 error, do not attempt to continue.
5531 * expression.cs (PointerArithmetic.Emit): If our operand is a
5532 long, convert our constants to match the operand before
5533 multiplying. Convert to I type before adding. Fixes 43670.
5535 2003-05-14 Ravi Pratap <ravi@ximian.com>
5537 * enum.cs (ImplicitConversionExists) : Rename to
5538 ImplicitEnumConversionExists to remove ambiguity.
5540 * ecore.cs (NullCast): New type of cast expression class which
5541 basically is very similar to EmptyCast with the difference being
5542 it still is a constant since it is used only to cast a null to
5546 * convert.cs (ImplicitReferenceConversion): When casting a null
5547 literal, we return a NullCast.
5549 * literal.cs (NullLiteralTyped): Remove - I don't see why this
5550 should be around anymore.
5552 The renaming (reported was slightly wrong). Corrections:
5554 ConvertImplicitStandard -> ImplicitConversionStandard
5555 ConvertExplicitStandard -> ExplicitConversionStandard
5557 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
5558 before passing them in !
5560 * convert.cs (ImplicitConversionStandard): When comparing for
5561 equal expr and target types, ensure that expr is not a
5564 In general, we must not be checking (expr_type ==
5565 target_type) in the top level conversion methods
5566 (ImplicitConversion, ExplicitConversion etc). This checking is
5567 done in the methods that they delegate to.
5569 2003-05-20 Miguel de Icaza <miguel@ximian.com>
5571 * convert.cs: Move Error_CannotConvertType,
5572 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
5573 ImplicitNumericConversion, ImplicitConversionExists,
5574 ImplicitUserConversionExists, StandardConversionExists,
5575 FindMostEncompassedType, FindMostSpecificSource,
5576 FindMostSpecificTarget, ImplicitUserConversion,
5577 ExplicitUserConversion, GetConversionOperators,
5578 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
5579 TryImplicitIntConversion, Error_CannotConvertImplicit,
5580 ConvertImplicitRequired, ConvertNumericExplicit,
5581 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
5582 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
5585 Perform the following renames:
5587 StandardConversionExists -> ImplicitStandardConversionExists
5588 ConvertImplicit -> ImplicitConversion
5589 ConvertImplicitStandard -> ImplicitStandardConversion
5590 TryImplicitIntConversion -> ImplicitIntConversion
5591 ConvertImplicitRequired -> ImplicitConversionRequired
5592 ConvertNumericExplicit -> ExplicitNumericConversion
5593 ConvertReferenceExplicit -> ExplicitReferenceConversion
5594 ConvertExplicit -> ExplicitConversion
5595 ConvertExplicitStandard -> ExplicitStandardConversion
5597 2003-05-19 Martin Baulig <martin@ximian.com>
5599 * statement.cs (TypeInfo.StructInfo): Made this type protected.
5600 (TypeInfo): Added support for structs having structs as fields.
5602 * ecore.cs (FieldExpr): Implement IVariable.
5603 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
5604 VariableInfo for the field.
5606 2003-05-18 Martin Baulig <martin@ximian.com>
5608 * expression.cs (This.DoResolve): Report a CS0027 if we're
5609 emitting a field initializer.
5611 2003-05-18 Martin Baulig <martin@ximian.com>
5613 * expression.cs (This.ResolveBase): New public function.
5614 (This.DoResolve): Check for CS0188.
5616 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
5619 * ecore.cs (MethodGroupExpr.DoResolve): Set the
5620 `instance_expression' to null if we don't have any non-static
5623 2003-05-18 Martin Baulig <martin@ximian.com>
5625 Reworked the way how local variables and parameters are handled by
5626 the flow analysis code.
5628 * statement.cs (TypeInfo, VariableMap): New public classes.
5629 (VariableInfo): New public class. This is now responsible for
5630 checking whether a variable has been assigned. It is used for
5631 parameters and local variables.
5632 (Block.EmitMeta): Take the InternalParameters as argument; compute
5633 the layout of the flow vectors here.
5634 (Block.LocalMap, Block.ParameterMap): New public properties.
5635 (FlowBranching): The .ctor doesn't get the InternalParameters
5636 anymore since Block.EmitMeta() now computes the layout of the flow
5638 (MyStructInfo): This class is now known as `StructInfo' and nested
5639 in `TypeInfo'; we don't access this directly anymore.
5641 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
5642 property and removed IsAssigned(), IsFieldAssigned(),
5643 SetAssigned() and SetFieldAssigned(); we now call them on the
5644 VariableInfo so we don't need to duplicate this code everywhere.
5646 * expression.cs (ParameterReference): Added `Block block' argument
5648 (LocalVariableReference, ParameterReference, This): The new
5649 VariableInfo class is now responsible for all the definite
5652 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
5653 IsParameterAssigned, SetParameterAssigned): Removed.
5655 2003-05-18 Martin Baulig <martin@ximian.com>
5657 * typemanager.cs (InitCoreTypes): Try calling
5658 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
5659 the 3-args-version. Corlib now also needs our `void_type'.
5660 (GetMethod): Added overloaded version which takes an optional
5661 `bool report_errors' to allow lookups of optional methods.
5663 2003-05-12 Martin Baulig <martin@ximian.com>
5665 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
5666 only used for locals and not for parameters.
5668 2003-05-12 Miguel de Icaza <miguel@ximian.com>
5670 * support.cs (InternalParameters.ParameterType): Return the
5671 ExternalType of the parameter.
5673 * parameter.cs (Parameter.ExternalType): drop the two arguments,
5676 2003-05-11 Miguel de Icaza <miguel@ximian.com>
5678 * class.cs (MethodData.Define): Do not set the `newslot' on
5679 interface members, if they are also flagged as "override".
5681 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
5682 better code for ++i and i++. This only works for static fields
5683 and local variables.
5685 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
5686 want to pull the DeclSpace out of the builder_to_declspace instead
5687 of the TypeBuilder (like in TypeContainer.FindMembers).
5689 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
5690 instead of LookupTypeContainer. Fixes the crash on .NET for
5691 looking up interface members.
5693 * const.cs: Create our own emit context during the Definition
5694 stage, so that constants are evaluated in the proper context, when
5695 a recursive definition happens.
5697 2003-05-11 Martin Baulig <martin@ximian.com>
5699 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
5700 new block for a switch section.
5701 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
5702 the adding/lookup in the switch block. Fixes #39828.
5704 2003-05-09 Miguel de Icaza <miguel@ximian.com>
5706 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
5707 functionality: I needed to convert the data after I had performed
5708 the add/sub operation into the operands type size.
5710 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
5711 pass the type for the box operation, otherwise the resulting
5712 object would have been of type object.
5714 (BoxedCast): Add constructor to specify the type to box as.
5716 2003-05-07 Miguel de Icaza <miguel@ximian.com>
5718 * iterators.cs: I was reusing the `count' variable inadvertently,
5719 take steps to not allow this to happen.
5721 2003-05-06 Miguel de Icaza <miguel@ximian.com>
5723 * attribute.cs (Attribute.Resolve): Params attributes are encoded
5724 by creating an array at the point where the params starts and
5725 putting all those arguments there, then adjusting the size of the
5728 2003-05-05 Miguel de Icaza <miguel@ximian.com>
5730 * expression.cs (New.AddressOf): Implement interface
5731 IMemoryLocation. This is used when the `new' operator is used in
5732 the context of an invocation to a method on a value type.
5734 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
5737 * namespace.cs: Also check the using aliases here.
5739 * driver.cs: Move the test for using validity after the types have
5740 been entered, so we do a single pass that also includes the using
5743 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
5744 in the regular case. CreateSiblingForFinally is doing extra
5747 * attribute.cs (GetAttributeArgumentExpression): Store the result
5748 on an out value, and use the return value to indicate failure
5749 instead of using null (which is a valid return for Constant.GetValue).
5751 * statement.cs: Perform the analysis flow for the increment
5752 portion after the statement, because this will be the real flow of
5753 execution. Fixes #42385
5755 * codegen.cs (EmitContext.EmitArgument,
5756 EmitContext.EmitStoreArgument): New helper functions when the
5757 RemapToProxy flag is set.
5759 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
5762 Add support for remapping parameters.
5764 * iterators.cs: Propagate parameter values; Store parameter
5765 values in the proxy classes.
5767 2003-05-04 Miguel de Icaza <miguel@ximian.com>
5769 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
5770 need a proxy reference; I do not know what I was thinking
5772 * cs-parser.jay (constructor_initializer): catch another error,
5773 and display nice message.
5775 (field_declaration): catch void field declaration
5776 to flag a better error.
5778 * class.cs (MemberBase.CheckBase): Report an error instead of a
5779 warning if a new protected member is declared in a struct.
5780 (Field.Define): catch the error of readonly/volatile.
5782 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
5784 (FieldExpr.AddressOf): ditto. Catch error where the address of a
5785 volatile variable is taken
5787 2003-05-02 Miguel de Icaza <miguel@ximian.com>
5789 * statement.cs (Fixed.Resolve): Report an error if we are not in
5792 2003-05-01 Miguel de Icaza <miguel@ximian.com>
5794 * typemanager.cs: reuse the code that handles type clashes for
5795 delegates and enumerations.
5797 * class.cs (Report28): Always report.
5799 * expression.cs (EncodeAsAttribute): Allow nulls here.
5801 2003-04-28 Miguel de Icaza <miguel@ximian.com>
5803 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
5804 the functionality for testing whether an expression is valid for
5805 an attribute here. Also handle the case of arrays of elements
5808 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
5809 encoding a linear array into an array of objects that are suitable
5810 to be passed to an CustomAttributeBuilder.
5812 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
5814 * ecore.cs: (FieldExpr): Handle field remapping here.
5816 * iteratators.cs: Pass the instance variable (if the method is an
5817 instance method) to the constructors, so we can access the field
5818 variables on the class.
5820 TODO: Test this with structs. I think the THIS variable on
5821 structs might have to be a pointer, and not a refenrece
5823 2003-04-27 Miguel de Icaza <miguel@ximian.com>
5825 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
5826 local variables to fields in a proxy class.
5828 * iterators.cs (PopulateProxy): Rename our internal fields to
5830 Create a <THIS> field if we are an instance method, so we can
5831 reference our parent container variables.
5832 (MapVariable): Called back from the EmitContext code to enter a
5833 new variable to field mapping into the proxy class (we just create
5837 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
5838 for using the remapped locals to fields.
5840 I placed the code here, because that gives the same semantics to
5841 local variables, and only changes the Emit code.
5843 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
5844 statements inside iterators.
5845 (VariableInfo): Add a FieldBuilder for the cases when we are
5846 remapping local variables to fields in a proxy class
5848 * ecore.cs (SimpleNameResolve): Avoid testing two times for
5849 current_block != null.
5851 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
5852 not cope with strings, as it has been moved to the
5853 TableSwitchEmit. Fixed bug in switch generation.
5855 * expression.cs (New.DoResolve): Provide more context for the user
5856 when reporting an error.
5858 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
5861 * expression.cs (MemberAccess.DoResolve): When we get a type back,
5862 check the permissions for it. Note than in a type-resolution
5863 context the check was already present in DeclSpace.ResolveType,
5864 but was missing from the MemberAccess.
5866 (ArrayCreation.CheckIndices): warn if the user has
5867 more nested levels of expressions, but there are no more
5868 dimensions specified. Avoids crash on bug 41906.
5870 2003-04-26 Miguel de Icaza <miguel@ximian.com>
5872 * statement.cs (Block): replace Implicit bool, for a generic
5874 New flag: `Unchecked'. This is used during the EmitMeta phase
5875 (which is out-of-line with the regular Resolve/Emit process for a
5876 statement, as this is done ahead of time, but still gets a chance
5877 to call constant resolve).
5879 (Block.Flags): new enum for adding a new flag.
5881 (Block.EmitMeta): track the state of unchecked.
5883 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
5884 to enable constant resolution to work there as well.
5886 2003-04-22 Miguel de Icaza <miguel@ximian.com>
5888 * typemanager.cs (ienumerable_type): Also look up
5889 System.Collections.IEnumerable.
5891 2003-04-21 Miguel de Icaza <miguel@ximian.com>
5893 TODO: Test more than one conditional per method.
5895 * class.cs (Indexer.Define): Report the location where the user is
5896 referencing the unsupported feature.
5898 (MethodData): Overload the use of `conditionals' to
5899 minimize the creation of needless ArrayLists. This saves roughly
5900 212kb on my machine.
5902 (Method): Implement the new IIteratorContainer interface.
5903 (Method.SetYields): Implement the method by setting the ModFlags
5904 to contain METHOD_YIELDS.
5906 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
5907 which just got set to null.
5909 * iterators.cs: New file.
5911 (Yield, YieldBreak): New statements.
5913 * statement.cs (Return.Resolve): Flag an error if we are used in
5916 * codegen.cs (InIterator): New flag set if the code is being
5917 compiled in an iterator method.
5919 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
5920 internal modifier, and we just use it to avoid adding extra
5921 fields, as this is seldom used.
5923 * cs-parser.jay: Add yield_statement (yield and yield break).
5925 * driver.cs: New flag -v2 to turn on version 2 features.
5927 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
5928 hashtable when v2 is enabled.
5930 2003-04-20 Miguel de Icaza <miguel@ximian.com>
5932 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
5933 there is already a namespace defined with this name.
5935 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
5936 people upgraded their corlibs.
5938 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
5939 always use fully qualified types, no need to use the compiler
5942 (TypeManager.IsNamespace): Use binarysearch.
5944 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
5945 AddDelegate): I did not quite use the new IsValid API properly: I
5946 have to pass the short-name and the fullname. I was passing only
5947 the basename instead of the fullname sometimes.
5949 (TypeContainer.DefineType): call NamespaceClash.
5951 * interface.cs (Interface.DefineType): use NamespaceClash before
5954 * delegate.cs (Delegate.DefineType): use NamespaceClash before
5957 * enum.cs: (Enum.DefineType): use NamespaceClash before
5960 * typemanager.cs (: 3-line patch that gives us some tasty 11%
5961 speed increase. First, use the negative_hits cache when we get a
5962 negative. Second, add the type with its full original name
5963 instead of the new . and + encoded name (reflection uses + to
5964 separate type from a nested type). Use LookupTypeReflection
5965 directly which bypasses the type->name hashtable (that we already
5966 know does not contain the type.
5968 * decl.cs (DeclSpace.ResolveTypeExpr): track the
5969 location/container type.
5971 * driver.cs: When passing utf8, use directly the UTF8Encoding.
5973 2003-04-19 Miguel de Icaza <miguel@ximian.com>
5975 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
5977 * delegate.cs (NewDelegate.Resolve): Test whether an instance
5978 method is being referenced in the method group from a static
5979 context, and report error 120 if so.
5981 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
5984 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
5985 is created, we create the A namespace).
5987 * cs-parser.jay: A namespace also introduces a DeclarationFound.
5990 2003-04-18 Miguel de Icaza <miguel@ximian.com>
5992 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
5993 invocation to ModuleBuilder.GetType with the same values will
5994 return a new type instance, so we need to cache its return
5997 * expression.cs (Binary.ResolveOperator): Only allow the compare
5998 operators on enums if they are of the same type.
6000 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
6001 types of ValueType on their own case. Before we were giving them
6002 the same treatment as objects.
6004 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
6005 fullname. Short name is used to compare against container name.
6006 Fullname is used to check against defined namespace names.
6008 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
6009 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
6011 (Method.CheckBase): Call parent.
6012 (MemberBase.CheckBase): Check for protected members on sealed
6014 (PropertyBase.CheckBase): Call parent.
6015 (Field.Define): Call parent.
6017 * report.cs: Negative error codes are now mapped to 8000 - code,
6018 so that the display is render more nicely.
6020 * typemanager.cs: Do not use try/catch, instead report a regular
6023 (GetPointerType, GetReferenceType): These methods provide
6024 mechanisms to obtain the T* and T& from a T. We had the code
6025 previously scattered around the code base, and it also used
6026 TypeManager.LookupType that would go through plenty of caches.
6027 This one goes directly to the type source.
6029 In some places we did the Type.GetType followed by
6030 ModuleBuilder.GetType, but not in others, so this unifies the
6033 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
6034 statements now that we have namespace information.
6036 * typemanager.cs (IsNamespace): New method, returns whether the
6037 string presented is a namespace or not.
6039 (ComputeNamespaces): New public entry point, computes the list of
6040 available namespaces, using the GetNamespaces API call in Mono, or
6041 the slower version in MS.NET.
6043 Now before we start the semantic analysis phase, we have a
6044 complete list of namespaces including everything that the user has
6047 Deleted old code to cache namespaces in .nsc files.
6049 2003-04-17 Miguel de Icaza <miguel@ximian.com>
6051 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
6052 class/struct location definition Location for the implicit
6053 constructor location.
6055 (Operator.Define): Use the location of the operator for the
6056 implicit Method definition.
6058 (Constructor.Emit): use the constructor location for the implicit
6059 base initializer constructor.
6061 * ecore.cs: Remove ITypeExpression. This interface is now gone,
6062 and the Expression class now contains two new methods:
6064 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
6065 isolate type lookup from the rest of the resolution process.
6067 Since we use Expressions to hold type definitions due to the way
6068 we parse the input we have historically overloaded Resolve to
6069 perform the Type lookups if a special flag is passed. Now this is
6070 eliminated and two methods take their place.
6072 The differences in the two methods between xStep and xTerminal is
6073 that xStep is involved in our current lookup system that uses
6074 SimpleNames to compose a name, while xTerminal is used just to
6075 catch the case where the simplename lookup failed.
6077 2003-04-16 Miguel de Icaza <miguel@ximian.com>
6079 * expression.cs (ResolveMemberAccess): Remove redundant code.
6080 TypeExpr expressions are always born fully resolved.
6082 * interface.cs (PopulateMethod): Do not lookup the types twice.
6083 We were doing it once during SemanticAnalysis and once during
6086 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
6087 in local variable type definitions, were being returned as a
6088 SimpleName (we decomposed everything into a string), that is
6089 because primary_expression was being used instead of a type in the
6090 grammar (reduce/reduce conflicts).
6092 The part that was wrong is that we converted the expression into a
6093 string (an oversimplification in one hand, compounded with primary
6094 expressions doing string concatenation).
6100 Would return "A.B.C[]" as a SimpleName. This stopped things like
6101 using clauses from working on this particular context. And a type
6102 was being matched directly against "A.B.C[]".
6104 We now use the correct approach, and allow for ComposedCast to be
6105 part of the unary expression. So the "A.B.C []" become a composed
6106 cast of "A.B.C" (as a nested group of MemberAccess with a
6107 SimpleName at the end) plus the rank composition "[]".
6111 2003-04-10 Miguel de Icaza <miguel@ximian.com>
6113 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
6114 for the access level checking.
6116 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
6117 `TypeContainer container', because I kept getting confused when I
6118 was debugging this code.
6120 * expression.cs (Indexers): Instead of tracking getters/setters,
6121 we now track them in parallel. We create one arraylist less, but
6122 most importantly it is possible now for the LValue code to find a
6123 matching get for a set.
6125 (IndexerAccess.DoResolveLValue): Update the code.
6126 GetIndexersForType has been modified already to extract all the
6127 indexers from a type. The code assumed it did not.
6129 Also make the code set the correct return type for the indexer.
6130 This was fixed a long time ago for properties, but was missing for
6131 indexers. It used to be void_type.
6133 (Binary.Emit): Test first for doubles instead of
6134 floats, as they are more common.
6136 (Binary.EmitBranchable): Use the .un version of the branch opcodes
6137 when dealing with floats and the <=, >= operators. This fixes bug
6140 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
6141 to load the array value by emitting a load on the foreach variable
6142 type. This was incorrect.
6144 We now emit the code to load an element using the the array
6145 variable type, and then we emit the conversion operator.
6149 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
6151 * attribute.cs: Avoid allocation of ArrayLists in the common case.
6153 2003-04-09 Miguel de Icaza <miguel@ximian.com>
6155 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
6156 test for protection before we test for signatures.
6158 (MethodSignature.ToString): implement.
6160 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
6161 to the case where we reduced into a LongConstant.
6163 * decl.cs (CheckAccessLevel): If the type is an array, we can not
6164 depend on whether the information is acurrate, because the
6165 Microsoft runtime will always claim that the array type is public,
6166 regardless of the real state.
6168 If the type is a pointer, another problem happens: the type is
6169 reported as non-public in Microsoft.
6171 In both cases we have to call CheckAccessLevel recursively with
6172 the underlying type as the argument to be tested.
6174 2003-04-08 Miguel de Icaza <miguel@ximian.com>
6176 * assign.cs (Assign.Emit): If we are dealing with a compound
6177 assignment expression, we should use the code path that stores the
6178 intermediate result in a temporary value. This fixes #40903.
6180 *expression.cs (Indirection.ToString): Provide ToString method for
6183 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
6185 * class.cs: Null out fields holding references to Block objects so
6186 they can be garbage collected.
6188 * expression.cs (OverloadResolve): Remove unused local.
6190 2003-04-07 Martin Baulig <martin@ximian.com>
6192 * codegen.cs (EmitContext.CurrentFile): New public field.
6193 (EmitContext.Mark): Use the CurrentFile to check whether the
6194 location is in the correct file.
6195 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
6197 2003-04-07 Martin Baulig <martin@ximian.com>
6199 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
6201 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
6202 location. [FIXME: The location argument which gets passed to this
6203 method is sometimes wrong!]
6205 2003-04-07 Nick Drochak <ndrochak@gol.com>
6207 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
6209 2003-04-07 Miguel de Icaza <miguel@ximian.com>
6211 * expression.cs (Indirection.EmitAssign): We were using the
6212 temporary, but returning immediately instead of continuing the
6215 2003-04-06 Martin Baulig <martin@ximian.com>
6217 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
6218 if it's a nested child, but also deriving from the outer class.
6221 * typemanager.cs (IsNestedChildOf): Make this work if it's a
6222 nested child, but also deriving from the outer class. See
6224 (FilterWithClosure): We may access private members of the outer
6225 class if we're a nested child and deriving from the outer class.
6226 (RealMemberLookup): Only set `closure_private_ok' if the
6227 `original_bf' contained BindingFlags.NonPublic.
6229 2003-04-05 Martin Baulig <martin@ximian.com>
6231 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
6233 2003-04-02 Miguel de Icaza <miguel@ximian.com>
6235 * class.cs (Event.Define): Do not allow abstract events to have
6238 2003-04-01 Miguel de Icaza <miguel@ximian.com>
6240 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
6241 block in event declarations.
6243 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
6244 value type, get its address.
6246 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
6247 leaving a class on the stack instead of a boolean value (int
6248 0/1). Change the code so we compare against null, and then the
6249 result against zero.
6251 * class.cs (TypeContainer.GetClassBases): We were checking for the
6252 parent class being sealed too late.
6254 * expression.cs (Binary.Emit): For <= and >= when dealing with
6255 floating point values, use cgt.un and clt.un instead of cgt and
6258 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
6260 * statement.cs: Apply the same optimization as MS: skip the
6261 GetEnumerator returning an IEnumerator, and use the one returning a
6262 CharEnumerator instead. This allows us to avoid the try-finally block
6265 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
6267 * cs-parser.jay: Attributes cannot be applied to
6268 namespaces. Fixes #40473
6270 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6273 (Add*): check if the name is valid using the full name for constants,
6274 fields, properties and events.
6276 2003-03-28 Miguel de Icaza <miguel@ximian.com>
6278 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
6279 char constants to be part of the enumeration.
6281 * expression.cs (Conditional.DoResolve): Add support for operator
6282 true. Implements the missing functionality from 14.12
6284 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
6285 operator true/false as required by the spec.
6287 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
6288 implicit conversion to boolean.
6290 * statement.cs (Statement.ResolveBoolean): A boolean expression is
6291 also one where the type implements `operator true'.
6293 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
6294 get an expression that will invoke operator true based on an
6297 (GetConversionOperators): Removed the hack that called op_True
6300 (Expression.ResolveBoolean): Move this from Statement.
6302 2003-03-17 Miguel de Icaza <miguel@ximian.com>
6304 * ecore.cs (FieldExpr): do not allow initialization of initonly
6305 fields on derived classes
6307 2003-03-13 Martin Baulig <martin@ximian.com>
6309 * statement.cs (Block.Emit): Call ig.BeginScope() and
6310 ig.EndScope() when compiling with debugging info; call
6311 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
6313 2003-03-08 Miguel de Icaza <miguel@ximian.com>
6315 * expression.cs (Indexers): Do not construct immediately, allow
6316 for new members to be appended as we go. Fixes 38143
6318 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6320 * expression.cs: save/restore context when resolving an unchecked
6323 2003-03-05 Miguel de Icaza <miguel@ximian.com>
6325 * cfold.cs: Catch division by zero in modulus operator during
6328 2003-03-03 Miguel de Icaza <miguel@ximian.com>
6330 * interface.cs (Interface.DefineMembers): Avoid defining members
6333 2003-02-27 Miguel de Icaza <miguel@ximian.com>
6335 * driver.cs: handle the +/- options for -noconfig
6337 * statement.cs (Unckeched.Resolve): Also track the state of
6338 unchecked in the Resolve phase.
6340 2003-02-27 Martin Baulig <martin@ximian.com>
6342 * ecore.cs (Expression.MemberLookup): Don't create a
6343 MethodGroupExpr for something which is not a method. Fixes #38291.
6345 2003-02-25 Miguel de Icaza <miguel@ximian.com>
6347 * class.cs (MemberBase.CheckParameters): Also check that the type
6348 is unmanaged if it is a pointer.
6350 * expression.cs (SizeOf.Resolve): Add location information.
6352 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
6353 a managed type is declared.
6355 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
6356 parameter modifiers as well. Fixes bug 38606
6358 * class.cs: Very sad. Am backing out the speed up changes
6359 introduced by the ArrayList -> Array in the TypeContainer, as they
6360 were not actually that much faster, and introduced a bug (no error
6361 reports on duplicated methods).
6363 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
6364 source first, this will guarantee that we have a valid expression
6365 before calling in lower levels functions that will require a
6366 resolved object. Then use this original_source in the
6367 target.ResolveLValue instead of the original source that was
6370 Another change. Use target.Resolve instead of LValueResolve.
6371 Although we are resolving for LValues, we will let the Assign code
6372 take care of that (it will be called again from Resolve). This
6373 basically allows code like this:
6375 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
6376 class Y { void A (X x) { x [0] += o; }
6378 The problem was that the indexer was trying to resolve for
6379 set_Item (idx, object o) and never finding one. The real set_Item
6380 was set_Item (idx, X). By delaying the process we get the right
6385 2003-02-23 Martin Baulig <martin@ximian.com>
6387 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
6388 while calling DoEmit ().
6390 * codegen.cs (EmitContext.Mark): Don't mark locations in other
6391 source files; if you use the #line directive inside a method, the
6392 compiler stops emitting line numbers for the debugger until it
6393 reaches the end of the method or another #line directive which
6394 restores the original file.
6396 2003-02-23 Martin Baulig <martin@ximian.com>
6398 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
6400 2003-02-23 Martin Baulig <martin@ximian.com>
6402 * statement.cs (Block.AddChildVariableNames): We need to call this
6403 recursively, not just for our immediate children.
6405 2003-02-23 Martin Baulig <martin@ximian.com>
6407 * class.cs (Event.Define): Always make the field private, like csc does.
6409 * typemanager.cs (TypeManager.RealMemberLookup): Make events
6410 actually work, fixes bug #37521.
6412 2003-02-23 Miguel de Icaza <miguel@ximian.com>
6414 * delegate.cs: When creating the various temporary "Parameters"
6415 classes, make sure that we call the ComputeAndDefineParameterTypes
6416 on those new parameters (just like we do with the formal ones), to
6417 allow them to be resolved in the context of the DeclSpace.
6419 This fixes the bug that Dick observed in Bugzilla #38530.
6421 2003-02-22 Miguel de Icaza <miguel@ximian.com>
6423 * expression.cs (ResolveMemberAccess): When resolving a constant,
6424 do not attempt to pull a constant if the value was not able to
6425 generate a valid constant.
6427 * const.cs (LookupConstantValue): Do not report more errors than required.
6429 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6431 * expression.cs: fixes bug #38328.
6433 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6435 * class.cs: Changed all the various members that can be part of a
6436 class from being an ArrayList to be an Array of the right type.
6437 During the DefineType type_list, interface_list, delegate_list and
6438 enum_list are turned into types, interfaces, delegates and enums
6441 And during the member population, indexer_list, event_list,
6442 constant_list, field_list, instance_constructor_list, method_list,
6443 operator_list and property_list are turned into their real arrays.
6445 Although we could probably perform this operation earlier, for
6446 good error reporting we need to keep the lists and remove the
6447 lists for longer than required.
6449 This optimization was triggered by Paolo profiling the compiler
6450 speed on the output of `gen-sample-program.pl' perl script.
6452 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
6453 not crash in methods like MemberLookupFailed that use this field.
6455 This problem arises when the compiler fails to resolve a type
6456 during interface type definition for example.
6458 2003-02-18 Miguel de Icaza <miguel@ximian.com>
6460 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
6461 inherit from System.Object, so we have to stop at null, not only
6462 when reaching System.Object.
6464 2003-02-17 Miguel de Icaza <miguel@ximian.com>
6466 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
6467 DeclaredOnly because the parent indexer might have had a different
6468 name, but did not loop until the top of the hierarchy was reached.
6470 The problem this one fixes is 35492: when a class implemented an
6471 indexer from an interface, we were getting the interface method
6472 (which was abstract) and we were flagging an error (can not invoke
6475 This also keeps bug 33089 functioning, and test-148 functioning.
6477 * typemanager.cs (IsSpecialMethod): The correct way of figuring
6478 out if a method is special is to see if it is declared in a
6479 property or event, or whether it is one of the predefined operator
6480 names. This should fix correctly #36804.
6482 2003-02-15 Miguel de Icaza <miguel@ximian.com>
6484 The goal here is to remove the dependency on EmptyCast.Peel ().
6485 Killing it completely.
6487 The problem is that currently in a number of places where
6488 constants are expected, we have to "probe" for an EmptyCast, and
6489 Peel, which is not the correct thing to do, as this will be
6490 repetitive and will likely lead to errors.
6492 The idea is to remove any EmptyCasts that are used in casts that
6493 can be reduced to constants, so we only have to cope with
6496 This bug hunt was triggered by Bug 37363 and the desire to remove
6497 the duplicate pattern where we were "peeling" emptycasts to check
6498 whether they were constants. Now constants will always be
6501 * ecore.cs: Use an enumconstant here instead of wrapping with
6504 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
6505 throwing me off. By handling this we can get rid of a few hacks.
6507 * statement.cs (Switch): Removed Peel() code.
6509 2003-02-14 Miguel de Icaza <miguel@ximian.com>
6511 * class.cs: Location information for error 508
6513 * expression.cs (New.DoResolve): Add a guard against double
6514 resolution of an expression.
6516 The New DoResolve might be called twice when initializing field
6517 expressions (see EmitFieldInitializers, the call to
6518 GetInitializerExpression will perform a resolve on the expression,
6519 and later the assign will trigger another resolution
6521 This leads to bugs (#37014)
6523 * delegate.cs: The signature for EndInvoke should contain any ref
6524 or out parameters as well. We were not doing this in the past.
6526 * class.cs (Field.Define): Do not overwrite the type definition
6527 inside the `volatile' group. Turns out that volatile enumerations
6528 were changing the type here to perform a validity test, which
6531 2003-02-12 Miguel de Icaza <miguel@ximian.com>
6533 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
6534 and structs, we do not want to load the instance variable
6536 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
6537 enum_type has to be handled like an object reference (implicit
6538 conversions exists from this to object), but the regular IsClass
6539 and IsValueType tests will never return true for this one.
6541 Also we use TypeManager.IsValueType instead of type.IsValueType,
6542 just for consistency with the rest of the code (this is only
6543 needed if we ever use the construct exposed by test-180.cs inside
6544 corlib, which we dont today).
6546 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
6548 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
6551 2003-02-09 Martin Baulig <martin@ximian.com>
6553 * namespace.cs (Namespace..ctor): Added SourceFile argument.
6554 (Namespace.DefineNamespaces): New static public method; this is
6555 called when we're compiling with debugging to add all namespaces
6558 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
6559 pass it to the Namespace's .ctor.
6561 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
6562 and MethodBase arguments; pass the namespace ID to the symwriter;
6563 pass the MethodBase instead of the token to the symwriter.
6564 (SymbolWriter.DefineNamespace): New method to add a namespace to
6567 2003-02-09 Martin Baulig <martin@ximian.com>
6569 * symbolwriter.cs: New file. This is a wrapper around
6570 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
6571 methods here in near future.
6573 2003-02-09 Martin Baulig <martin@ximian.com>
6575 * codegen.cs (EmitContext.Mark): Just pass the arguments to
6576 ILGenerator.MarkSequencePoint() which are actually used by the
6579 2003-02-09 Martin Baulig <martin@ximian.com>
6581 * location.cs (SourceFile): New public sealed class. This
6582 contains the name and an index which is used in the location's token.
6583 (Location): Reserve an appropriate number of bits in the token for
6584 the source file instead of walking over that list, this gives us a
6585 really huge performance improvement when compiling with debugging.
6587 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
6588 `SourceFile' argument instead of a string.
6589 (Driver.ProcessFile): Add all the files via Location.AddFile(),
6590 but don't parse/tokenize here, we need to generate the list of all
6591 source files before we do that.
6592 (Driver.ProcessFiles): New static function. Parses/tokenizes all
6595 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
6596 instead of a string.
6598 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
6601 2003-02-09 Martin Baulig <martin@ximian.com>
6603 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
6604 filename on `#line default'.
6606 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
6608 * statement.cs: don't clear the pinned var when the fixed statement
6609 returns from the method (fixes bug#37752).
6611 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
6613 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
6616 2003-02-07 Martin Baulig <martin@ximian.com>
6618 * driver.cs: Removed the `--debug-args' command line argument.
6620 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
6621 automatically by the AsssemblyBuilder.
6622 (CodeGen.InitializeSymbolWriter): We don't need to call any
6623 initialization function on the symbol writer anymore. This method
6624 doesn't take any arguments.
6626 2003-02-03 Miguel de Icaza <miguel@ximian.com>
6628 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
6629 from referenced assemblies as well.
6631 2003-02-02 Martin Baulig <martin@ximian.com>
6633 * class.cs (MethodData.Emit): Generate debugging info for external methods.
6635 2003-02-02 Martin Baulig <martin@ximian.com>
6637 * class.cs (Constructor.Emit): Open the symbol writer before
6638 emitting the constructor initializer.
6639 (ConstructorInitializer.Emit): Call ec.Mark() to allow
6640 single-stepping through constructor initializers.
6642 2003-01-30 Miguel de Icaza <miguel@ximian.com>
6644 * class.cs: Handle error 549: do not allow virtual methods in
6647 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
6649 * decl.cs: Check access levels when resolving types
6651 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
6653 * statement.cs: Add parameters and locals set in catch blocks that might
6654 return to set vector
6656 2003-01-29 Miguel de Icaza <miguel@ximian.com>
6658 * class.cs (Operator): Set the SpecialName flags for operators.
6660 * expression.cs (Invocation.DoResolve): Only block calls to
6661 accessors and operators on SpecialName methods.
6663 (Cast.TryReduce): Handle conversions from char constants.
6666 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
6668 * statement.cs: small memory and time optimization in FlowBranching.
6670 2003-01-28 Pedro Mart <yoros@wanadoo.es>
6672 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
6673 problem that the last fix but in the other sid (Set).
6675 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
6676 access when there is no indexer in the hierarchy.
6678 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
6680 * class.cs: Combine some if statements.
6682 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6684 * driver.cs: fixed bug #37187.
6686 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
6688 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
6689 any indexer, it's needed to build a list with all the indexers in the
6690 hierarchy (AllGetters), else we have problems. Fixes #35653.
6692 2003-01-23 Miguel de Icaza <miguel@ximian.com>
6694 * class.cs (MethodData.Define): It is wrong for an interface
6695 implementation to be static in both cases: explicit and implicit.
6696 We were only handling this in one case.
6698 Improve the if situation there to not have negations.
6700 * class.cs (Field.Define): Turns out that we do not need to check
6701 the unsafe bit on field definition, only on usage. Remove the test.
6703 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6705 * driver.cs: use assembly.Location instead of Codebase (the latest
6706 patch made mcs fail when using MS assemblies).
6708 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
6710 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
6711 get the path to *corlib.dll.
6713 2003-01-21 Nick Drochak <ndrochak@gol.com>
6717 * typemanager.cs: Remove compiler warnings
6719 2003-01-20 Duncan Mak <duncan@ximian.com>
6721 * AssemblyInfo.cs: Bump the version number to 0.19.
6723 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6725 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
6727 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
6729 * class.cs (Constructor::Emit): Emit debugging info for constructors.
6731 2003-01-17 Miguel de Icaza <miguel@ximian.com>
6733 * cs-parser.jay: Small fix: we were not comparing the constructor
6734 name correctly. Thanks to Zoltan for the initial pointer.
6736 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
6738 * cs-tokenizer.cs: Set file name when specified with #line
6740 2003-01-15 Miguel de Icaza <miguel@ximian.com>
6742 * cs-parser.jay: Only perform the constructor checks here if we
6743 are named like the class; This will help provider a better
6744 error. The constructor path is taken when a type definition is
6745 not found, but most likely the user forgot to add the type, so
6746 report that rather than the constructor error.
6748 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
6750 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
6753 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6755 * cs-parser.jay: Add cleanup call.
6757 2003-01-13 Duncan Mak <duncan@ximian.com>
6759 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
6760 consistent with other methods.
6762 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
6764 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
6766 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
6768 * attribute.cs: only set GuidAttr to true when we have a
6771 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6775 * typemanager.cs: fixes to allow mcs compile corlib with the new
6776 Type.IsSubclassOf fix.
6778 2003-01-08 Miguel de Icaza <miguel@ximian.com>
6780 * expression.cs (LocalVariableReference.DoResolve): Classify a
6781 constant as a value, not as a variable. Also, set the type for
6784 * cs-parser.jay (fixed_statement): take a type instead of a
6785 pointer_type, so we can produce a better error message later.
6787 * statement.cs (Fixed.Resolve): Flag types that are not pointers
6790 (For.DoEmit): Make inifinite loops have a
6791 non-conditional branch back.
6793 (Fixed.DoEmit): First populate the pinned variables, then emit the
6794 statement, then clear the variables. Before I was emitting the
6795 code once for each fixed piece.
6798 2003-01-08 Martin Baulig <martin@ximian.com>
6800 * statement.cs (FlowBranching.MergeChild): A break in a
6801 SWITCH_SECTION does not leave a loop. Fixes #36155.
6803 2003-01-08 Martin Baulig <martin@ximian.com>
6805 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
6806 lives in the same number space than `param_map'. Fixes #36154.
6808 2003-01-07 Miguel de Icaza <miguel@ximian.com>
6810 * cs-parser.jay (constructor_declaration): Set the
6811 Constructor.ModFlags before probing for it. This makes the
6812 compiler report 514, 515 and 132 (the code was there, but got
6815 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
6816 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
6817 (GotoCase.Resolve): Set `Returns' to ALWAYS.
6819 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
6821 * enum.cs: create the enum static fields using the enum type.
6823 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
6825 * class.cs: don't try to create the ParamBuilder for the return
6826 type if it's not needed (and handle it breaking for the ms runtime
6829 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
6831 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
6833 2002-12-29 Miguel de Icaza <miguel@ximian.com>
6835 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
6836 the command. This showed up while compiling the JANET source
6837 code, which used \r as its only newline separator.
6839 2002-12-28 Miguel de Icaza <miguel@ximian.com>
6841 * class.cs (Method.Define): If we are an operator (because it
6842 reuses our code), then set the SpecialName and HideBySig. #36128
6844 2002-12-22 Miguel de Icaza <miguel@ximian.com>
6846 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
6847 exception, report error 120 `object reference required'.
6849 * driver.cs: Add --pause option, used during to measure the size
6850 of the process as it goes with --timestamp.
6852 * expression.cs (Invocation.DoResolve): Do not allow methods with
6853 SpecialName to be invoked.
6855 2002-12-21 Miguel de Icaza <miguel@ximian.com>
6857 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
6858 number before adding it.
6860 2002-12-21 Ravi Pratap <ravi@ximian.com>
6862 * ecore.cs (StandardImplicitConversion): When in an unsafe
6863 context, we allow conversion between void * to any other pointer
6864 type. This fixes bug #35973.
6866 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
6868 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
6869 is not thrown when extensionless outputs are used
6871 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6873 * rootcontext.cs: fixed compilation of corlib.
6875 2002-12-19 Miguel de Icaza <miguel@ximian.com>
6877 * attribute.cs (Attributes.Contains): Add new method.
6879 * class.cs (MethodCore.LabelParameters): if the parameter is an
6880 `out' parameter, check that no attribute `[In]' has been passed.
6882 * enum.cs: Handle the `value__' name in an enumeration.
6884 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
6886 * decl.cs: Added special case to allow overrides on "protected
6889 2002-12-18 Ravi Pratap <ravi@ximian.com>
6891 * attribute.cs (Attributes.AddAttributeSection): Rename to this
6892 since it makes much more sense.
6894 (Attributes.ctor): Don't require a Location parameter.
6896 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
6898 * attribute.cs (ApplyAttributes): Remove extra Location parameters
6899 since we already have that information per attribute.
6901 * everywhere : make appropriate changes.
6903 * class.cs (LabelParameters): Write the code which actually
6904 applies attributes to the return type. We can't do this on the MS
6905 .NET runtime so we flag a warning in the case an exception is
6908 2002-12-18 Miguel de Icaza <miguel@ximian.com>
6910 * const.cs: Handle implicit null conversions here too.
6912 2002-12-17 Ravi Pratap <ravi@ximian.com>
6914 * class.cs (MethodCore.LabelParameters): Remove the extra
6915 Type [] parameter since it is completely unnecessary. Instead
6916 pass in the method's attributes so that we can extract
6917 the "return" attribute.
6919 2002-12-17 Miguel de Icaza <miguel@ximian.com>
6921 * cs-parser.jay (parse): Use Report.Error to flag errors instead
6922 of ignoring it and letting the compile continue.
6924 * typemanager.cs (ChangeType): use an extra argument to return an
6925 error condition instead of throwing an exception.
6927 2002-12-15 Miguel de Icaza <miguel@ximian.com>
6929 * expression.cs (Unary.TryReduce): mimic the code for the regular
6930 code path. Perform an implicit cast in the cases where we can
6931 implicitly convert to one of the integral types, and then reduce
6932 based on that constant. This fixes bug #35483.
6934 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6936 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
6938 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6940 * namespace.cs: fixed bug #35489.
6942 2002-12-12 Miguel de Icaza <miguel@ximian.com>
6944 * class.cs: Remove some dead code.
6946 * cs-parser.jay: Estimate the number of methods needed
6947 (RootContext.MethodCount);
6949 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
6950 numbers instead of StringBuilders.
6952 * support.cs (PtrHashtable): Add constructor with initial size;
6953 We can now reduce reallocations of the method table.
6955 2002-12-10 Ravi Pratap <ravi@ximian.com>
6957 * attribute.cs (ApplyAttributes): Keep track of the emitted
6958 attributes on a per-target basis. This fixes bug #35413.
6960 2002-12-10 Miguel de Icaza <miguel@ximian.com>
6962 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
6963 default to the Windows 1252 encoding.
6965 (UnixParseOption): Support version, thanks to Alp for the missing
6968 * AssemblyInfo.cs: Add nice assembly information.
6970 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
6973 * cs-parser.jay: Allow a trailing comma before the close bracked
6974 in the attribute_section production.
6976 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
6977 address of the instance was being taken, I will take this out,
6978 because we take the address of the object immediately here.
6980 2002-12-09 Ravi Pratap <ravi@ximian.com>
6982 * typemanager.cs (AreMultipleAllowed): Take care of the most
6983 obvious case where attribute type is not in the current assembly -
6986 2002-12-08 Miguel de Icaza <miguel@ximian.com>
6988 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
6989 definitions, instead of doing that afterwards.
6991 Also we use a nice little hack, depending on the constructor, we
6992 know if we are a "composed" name or a simple name. Hence, we
6993 avoid the IndexOf test, and we avoid
6995 * codegen.cs: Add code to assist in a bug reporter to track down
6996 the source of a compiler crash.
6998 2002-12-07 Ravi Pratap <ravi@ximian.com>
7000 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
7001 types have been emitted for a given element and flag an error
7002 if something which does not have AllowMultiple set is used more
7005 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
7006 attribute types and their corresponding AllowMultiple properties
7008 (AreMultipleAllowed): Check the property for a given type.
7010 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
7011 property in the case we have a TypeContainer.
7013 (Attributes.AddAttribute): Detect duplicates and just skip on
7014 adding them. This trivial fix catches a pretty gross error in our
7015 attribute emission - global attributes were being emitted twice!
7017 Bugzilla bug #33187 is now fixed.
7019 2002-12-06 Miguel de Icaza <miguel@ximian.com>
7021 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
7024 * expression.cs (Binary.ResolveOperator): I can only use the
7025 Concat (string, string, string) and Concat (string, string,
7026 string, string) if the child is actually a concatenation of
7029 2002-12-04 Miguel de Icaza <miguel@ximian.com>
7031 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
7032 context where we need a 2-character lookahead.
7034 * pending.cs (PendingImplementation): Rework so we can keep track
7035 of interface types all the time, and flag those which were
7036 implemented by parents as optional.
7038 2002-12-03 Miguel de Icaza <miguel@ximian.com>
7040 * expression.cs (Binary.ResolveOperator): Use
7041 String.Concat(string,string,string) or
7042 String.Concat(string,string,string,string) when possible.
7044 * typemanager: More helper methods.
7047 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
7049 * pending.cs: remove the bogus return from GetMissingInterfaces()
7050 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
7052 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7054 * namespace.cs: avoid duplicated 'using xxx' being added to
7055 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
7056 when we get more than one 'using' statement for the same namespace.
7057 Report a CS0105 warning for it.
7059 2002-11-30 Miguel de Icaza <miguel@ximian.com>
7061 * cs-tokenizer.cs (consume_identifier): use read directly, instead
7062 of calling getChar/putback, uses internal knowledge of it.
7064 (xtoken): Reorder tokenizer so most common patterns are checked
7065 first. This reduces the compilation time in another 5% (from 8.11s
7066 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
7068 The parsing time is 22% of the compilation in mcs, and from that
7069 64% is spent on the tokenization process.
7071 I tried using a binary search for keywords, but this is slower
7072 than the hashtable. Another option would be to do a couple of
7075 * Not use a StringBuilder, instead use an array of chars,
7076 with a set value. Notice that this way we could catch
7077 the 645 error without having to do it *afterwards*.
7079 * We could write a hand-parser to avoid the hashtable
7080 compares altogether.
7082 The identifier consumption process takes 37% of the tokenization
7083 time. Another 15% is spent on is_number. 56% of the time spent
7084 on is_number is spent on Int64.Parse:
7086 * We could probably choose based on the string length to
7087 use Int32.Parse or Int64.Parse and avoid all the 64-bit
7090 Another 3% is spend on wrapping `xtoken' in the `token' function.
7092 Handle 0xa0 as whitespace (#34752)
7094 2002-11-26 Miguel de Icaza <miguel@ximian.com>
7096 * typemanager.cs (IsCLRType): New routine to tell whether a type
7097 is one of the builtin types.
7099 Maybe it needs to use TypeCodes to be faster. Maybe we could use
7100 typecode in more places instead of doing pointer comparissions.
7101 We could leverage some knowledge about the way the typecodes are
7104 New code to cache namespaces in assemblies, it is currently not
7105 invoked, to be used soon.
7107 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
7109 * expression.cs (Binary.ResolveOperator): specially handle
7110 strings, and do not perform user-defined operator overloading for
7113 2002-11-24 Miguel de Icaza <miguel@ximian.com>
7115 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
7116 internalcall as it is a pretty simple operation; Avoid whenever
7117 possible to call Char.IsLetter.
7119 (consume_identifier): Cut by half the number of
7120 hashtable calls by merging the is_keyword and GetKeyword behavior.
7122 Do not short-circuit, because if we do, we
7123 report errors (ie, #if false && true would produce an invalid
7127 2002-11-24 Martin Baulig <martin@ximian.com>
7129 * expression.cs (Cast.TryReduce): If we're in checked syntax,
7130 check constant ranges and report a CS0221. Fixes #33186.
7132 2002-11-24 Martin Baulig <martin@ximian.com>
7134 * cs-parser.jay: Make this work for uninitialized variable
7135 declarations in the `for' initializer. Fixes #32416.
7137 2002-11-24 Martin Baulig <martin@ximian.com>
7139 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
7140 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
7142 2002-11-24 Martin Baulig <martin@ximian.com>
7144 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
7145 argument; if true, we also check for user-defined conversions.
7146 This is only needed if both arguments are of a user-defined type.
7147 Fixes #30443, added test-175.cs.
7148 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
7150 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
7152 2002-11-24 Martin Baulig <martin@ximian.com>
7154 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
7155 function to get the store opcode.
7156 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
7157 only emit the Ldelema if the store opcode is Stobj. You must run
7158 both test-34 and test-167 to test this. Fixes #34529.
7160 2002-11-23 Martin Baulig <martin@ximian.com>
7162 * ecore.cs (Expression.MemberLookup): Added additional
7163 `qualifier_type' argument which is used when we're being called
7164 from MemberAccess.DoResolve() and null if we're called from a
7166 (Expression.MemberLookupFailed): New method to report errors; this
7167 does the CS1540 check and reports the correct error message.
7169 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
7170 argument for the CS1540 check and redone the way how we're dealing
7171 with private members. See the comment in the source code for details.
7172 (FilterWithClosure): Reverted this back to revision 1.197; renamed
7173 `closure_start_type' to `closure_qualifier_type' and check whether
7174 it's not null. It was not this filter being broken, it was just
7175 being called with the wrong arguments.
7177 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
7178 and pass it the correct `qualifier_type'; this also does the error
7181 2002-11-22 Miguel de Icaza <miguel@ximian.com>
7183 * expression.cs (Invocation.EmitParams): If the we are dealing
7184 with a non-built-in value type, load its address as well.
7186 (ArrayCreation): Use a a pretty constant instead
7187 of the hardcoded value 2. Use 6 instead of 2 for the number of
7188 static initializers.
7190 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
7191 because they are not really value types, just glorified integers.
7193 * driver.cs: Do not append .exe, the CSC compiler does not do it.
7195 * ecore.cs: Remove redundant code for enumerations, make them use
7196 the same code path as everything else, fixes the casting issue
7197 with enumerations in Windows.Forms.
7199 * attribute.cs: Do only cast to string if it is a string, the
7200 validation happens later.
7202 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
7203 people upgrade their corlibs.
7205 * ecore.cs: Oops, enumerations were not following the entire code path
7207 2002-11-21 Miguel de Icaza <miguel@ximian.com>
7209 * typemanager.cs (FilterWithClosure): Commented out the test for
7210 1540 in typemanager.cs, as it has problems when accessing
7211 protected methods from a parent class (see test-174.cs).
7213 * attribute.cs (Attribute.ValidateGuid): new method.
7214 (Attribute.Resolve): Use above.
7216 2002-11-19 Miguel de Icaza <miguel@ximian.com>
7218 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
7220 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
7221 handling for enumerations, as we only needed the TypeContainer
7222 functionality to begin with (this is required for the fix below to
7223 work for enums that reference constants in a container class for
7226 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
7228 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
7229 a valid TypeBuilder to perform lookups on.o
7231 * class.cs (InheritableMemberSignatureCompare): Use true in the
7232 call to GetGetMethod and GetSetMethod, because we are comparing
7233 the signature, and we need to get the methods *even* if they are
7236 (PropertyBase.CheckBase): ditto.
7238 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
7239 GotoCase.Resolve): Use Peel on EmpytCasts.
7241 * ecore.cs (EmptyCast): drop child, add Peel method.
7243 2002-11-17 Martin Baulig <martin@ximian.com>
7245 * ecore.cs (EmptyCast.Child): New public property.
7247 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
7248 label resolved to an EmptyCast. Fixes #34162.
7249 (GotoCase.Resolve): Likewise.
7250 (Block.EmitMeta): Likewise.
7252 2002-11-17 Martin Baulig <martin@ximian.com>
7254 * expression.cs (Invocation.BetterConversion): Prefer int over
7255 uint; short over ushort; long over ulong for integer literals.
7256 Use ImplicitConversionExists instead of StandardConversionExists
7257 since we also need to check for user-defined implicit conversions.
7258 Fixes #34165. Added test-173.cs.
7260 2002-11-16 Martin Baulig <martin@ximian.com>
7262 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
7263 with the `true' and `false' literals. Fixes #33151.
7265 2002-11-16 Martin Baulig <martin@ximian.com>
7267 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
7268 October 22nd; don't do the cs1540 check for static members.
7270 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
7271 now using our own filter here and doing the cs1540 check again.
7273 2002-11-16 Martin Baulig <martin@ximian.com>
7275 * support.cs (InternalParameters): Don't crash if we don't have
7276 any fixed parameters. Fixes #33532.
7278 2002-11-16 Martin Baulig <martin@ximian.com>
7280 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
7281 when looking up static methods to make this work on Windows.
7284 2002-11-16 Martin Baulig <martin@ximian.com>
7286 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
7287 a setter rather than using PropertyInfo.CanWrite.
7289 2002-11-15 Nick Drochak <ndrochak@gol.com>
7291 * class.cs: Allow acces to block member by subclasses. Fixes build
7294 2002-11-14 Martin Baulig <martin@ximian.com>
7296 * class.cs (Constructor.Emit): Added the extern/block check.
7299 2002-11-14 Martin Baulig <martin@ximian.com>
7301 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
7302 iteration while looking for indexers, this is needed because the
7303 indexer may have a different name in our base classes. Fixed the
7304 error reporting (no indexers at all, not get accessor, no
7305 overloaded match). Fixes bug #33089.
7306 (IndexerAccess.DoResolveLValue): Likewise.
7308 2002-11-14 Martin Baulig <martin@ximian.com>
7310 * class.cs (PropertyBase.CheckBase): Make this work for multiple
7311 indexers. Fixes the first part of bug #33089.
7312 (MethodSignature.InheritableMemberSignatureCompare): Added support
7315 2002-11-13 Ravi Pratap <ravi@ximian.com>
7317 * attribute.cs (Attribute.Resolve): Catch the
7318 NullReferenceException and report it since it isn't supposed to
7321 2002-11-12 Miguel de Icaza <miguel@ximian.com>
7323 * expression.cs (Binary.EmitBranchable): Also handle the cases for
7324 LogicalOr and LogicalAnd that can benefit from recursively
7325 handling EmitBranchable. The code now should be nice for Paolo.
7327 2002-11-08 Miguel de Icaza <miguel@ximian.com>
7329 * typemanager.cs (LookupType): Added a negative-hit hashtable for
7330 the Type lookups, as we perform quite a number of lookups on
7331 non-Types. This can be removed once we can deterministically tell
7332 whether we have a type or a namespace in advance.
7334 But this might require special hacks from our corlib.
7338 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
7339 and double which avoids a conversion from an integer to a double.
7341 * expression.cs: tiny optimization, avoid calling IsConstant,
7342 because it effectively performs the lookup twice.
7344 2002-11-06 Miguel de Icaza <miguel@ximian.com>
7346 But a bogus return here to keep the semantics of the old code
7347 until the Mono runtime is fixed.
7349 * pending.cs (GetMissingInterfaces): New method used to remove all
7350 the interfaces that are already implemented by our parent
7351 classes from the list of pending methods.
7353 * interface.cs: Add checks for calls after ResolveTypeExpr.
7355 2002-11-05 Miguel de Icaza <miguel@ximian.com>
7357 * class.cs (Class.Emit): Report warning 67: event not used if the
7358 warning level is beyond 3.
7360 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
7361 being a NullLiteral.
7363 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
7366 * class.cs (TypeContainer.GetClassBases): Cover a missing code
7367 path that might fail if a type can not be resolved.
7369 * expression.cs (Binary.Emit): Emit unsigned versions of the
7372 * driver.cs: use error 5.
7374 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
7376 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
7378 2002-11-01 Miguel de Icaza <miguel@ximian.com>
7380 * cs-parser.jay (switch_section): A beautiful patch from Martin
7381 Baulig that fixed 33094.
7383 2002-10-31 Miguel de Icaza <miguel@ximian.com>
7385 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
7386 Check whether the base is abstract and report an error if so.
7388 * expression.cs (IndexerAccess.DoResolveLValue,
7389 IndexerAccess.DoResolve): ditto.
7391 (Invocation.DoResolve): ditto.
7393 (Invocation.FullMethodDesc): Improve the report string.
7395 * statement.cs (Block): Eliminate IsVariableDefined as it is
7396 basically just a wrapper for GetVariableInfo.
7398 * ecore.cs (SimpleName): Use new
7400 * support.cs (ReflectionParamter.ParameterType): We unwrap the
7401 type, as we return the actual parameter ref/unref state on a
7404 2002-10-30 Miguel de Icaza <miguel@ximian.com>
7406 * support.cs: Return proper flags REF/OUT fixing the previous
7409 * expression.cs: Reverted last patch, that was wrong. Is_ref is
7410 not used to mean `ref' but `ref or out' in ParameterReference
7412 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
7413 full type signature instead of calling TypeManger.CSharpName
7416 * support.cs (InternalParameters.ParameterDesc): Do not compare
7417 directly to the modflags, because REF/OUT will actually be bitsets
7420 * delegate.cs (VerifyMethod): Check also the modifiers.
7422 * cs-tokenizer.cs: Fix bug where floating point values with an
7423 exponent where a sign was missing was ignored.
7425 * driver.cs: Allow multiple assemblies to be specified in a single
7428 2002-10-28 Miguel de Icaza <miguel@ximian.com>
7430 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
7431 because identifiers after a parenthesis would end up in this kind
7432 of production, and we needed to desamiguate it for having casts
7435 (UserDefinedType *) xxx
7437 2002-10-24 Miguel de Icaza <miguel@ximian.com>
7439 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
7440 we should set on the Bindingflags.NonPublic, but not turn on
7441 private_ok. private_ok controls whether a Private member is
7442 returned (this is chekced on the filter routine), while the
7443 BindingFlags.NonPublic just controls whether private/protected
7444 will be allowed. This fixes the problem part of the problem of
7445 private properties being allowed to be used in derived classes.
7447 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
7448 so we can call the children DoResolveLValue method (this will
7449 properly signal errors on lvalue assignments to base properties)
7451 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
7452 getter are null, and we have a property info, we know that this
7453 happened because the lookup failed, so we report an error 122 for
7454 protection level violation.
7456 We also silently return if setter and getter are null in the
7457 resolve functions, this condition only happens if we have flagged
7458 the error before. This is the other half of the problem.
7460 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
7461 not have accessibility information, that is why we were returning
7462 true in the filter function in typemanager.cs.
7464 To properly report 122 (property is inaccessible because of its
7465 protection level) correctly, we report this error in ResolveAccess
7466 by failing if both the setter and the getter are lacking (ie, the
7469 DoResolve and DoLResolve have been modified to check for both
7470 setter/getter being null and returning silently, the reason being
7471 that I did not want to put the knowledge about this error in upper
7474 int old = Report.Errors;
7475 x = new PropertyExpr (...);
7476 if (old != Report.Errors)
7481 So the property expr is returned, but it is invalid, so the error
7482 will be flagged during the resolve process.
7484 * class.cs: Remove InheritablePropertySignatureCompare from the
7485 class, as we no longer depend on the property signature to compute
7486 whether it is possible to implement a method or not.
7488 The reason is that calling PropertyInfo.GetGetMethod will return
7489 null (in .NET, in Mono it works, and we should change this), in
7490 cases where the Get Method does not exist in that particular
7495 class X { public virtual int A { get { return 1; } } }
7497 class Z : Y { public override int A { get { return 2; } } }
7499 Would fail in Z because the parent (Y) would not have the property
7500 defined. So we avoid this completely now (because the alternative
7501 fix was ugly and slow), and we now depend exclusively on the
7504 (PropertyBase.CheckBase): Use a method-base mechanism to find our
7505 reference method, instead of using the property.
7507 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
7508 routines are gone now.
7510 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
7511 names, they were incorrectly named.
7513 * cs-tokenizer.cs: Return are more gentle token on failure.
7515 * pending.cs (PendingImplementation.InterfaceMethod): This routine
7516 had an out-of-sync index variable, which caused it to remove from
7517 the list of pending methods the wrong method sometimes.
7519 2002-10-22 Miguel de Icaza <miguel@ximian.com>
7521 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
7522 CanWrite, because those refer to this particular instance of the
7523 property, and do not take into account the fact that we can
7524 override single members of a property.
7526 Constructor requires an EmitContext. The resolution process does
7527 not happen here, but we need to compute the accessors before,
7528 because the resolution does not always happen for properties.
7530 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
7531 subclass, before we did not update this flag, but we did update
7534 (GetAccessors): Drop this routine, as it did not work in the
7535 presence of partially overwritten set/get methods.
7537 Notice that this broke the cs1540 detection, but that will require
7540 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7544 * driver.cs: issue a warning instead of an error if we don't support
7545 debugging for the platform. Also ignore a couple of errors that may
7546 arise when trying to write the symbols. Undo my previous patch.
7548 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7550 * driver.cs: ignore /debug switch except for Unix platforms.
7552 2002-10-23 Nick Drochak <ndrochak@gol.com>
7554 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
7556 2002-10-21 Miguel de Icaza <miguel@ximian.com>
7558 * driver.cs: Do not make mcs-debug conditional, so we do not break
7561 * statement.cs (UsageVector.MergeChildren): I would like Martin to
7562 review this patch. But basically after all the children variables
7563 have been merged, the value of "Breaks" was not being set to
7564 new_breaks for Switch blocks. I think that it should be set after
7565 it has executed. Currently I set this to the value of new_breaks,
7566 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
7567 conservative, but I do not understand this code very well.
7569 I did not break anything in the build, so that is good ;-)
7571 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
7573 2002-10-20 Mark Crichton <crichton@gimp.org>
7575 * cfold.cs: Fixed compile blocker. Really fixed it this time.
7577 2002-10-20 Nick Drochak <ndrochak@gol.com>
7579 * cfold.cs: Fixed compile blocker.
7581 2002-10-20 Miguel de Icaza <miguel@ximian.com>
7583 * driver.cs: I was chekcing the key, not the file.
7585 2002-10-19 Ravi Pratap <ravi@ximian.com>
7587 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
7588 message that we were generating - we just need to silently return
7591 2002-10-19 Miguel de Icaza <miguel@ximian.com>
7593 * class.cs (Event.Define): Change my previous commit, as this
7594 breaks the debugger. This is a temporary hack, as it seems like
7595 the compiler is generating events incorrectly to begin with.
7597 * expression.cs (Binary.ResolveOperator): Added support for
7598 "U operator - (E x, E y)"
7600 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
7603 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
7604 init-only variables, but this path did not take into account that
7605 there might be also instance readonly variables. Correct this
7608 This fixes bug 32253
7610 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
7613 * driver.cs: Change the extension for modules to `netmodule'
7615 * cs-parser.jay: Improved slightly the location tracking for
7616 the debugger symbols.
7618 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
7619 modifiers that were specified instead of the hardcoded value
7620 (FamAndAssem). This was basically ignoring the static modifier,
7621 and others. Fixes 32429.
7623 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
7624 fixed a bug in the process (32476)
7626 * expression.cs (ArrayAccess.EmitAssign): Patch from
7627 hwang_rob@yahoo.ca that fixes bug 31834.3
7629 2002-10-18 Miguel de Icaza <miguel@ximian.com>
7631 * driver.cs: Make the module extension .netmodule.
7633 2002-10-16 Miguel de Icaza <miguel@ximian.com>
7635 * driver.cs: Report an error if the resource file is not found
7636 instead of crashing.
7638 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
7639 false, like Emit does.
7641 2002-10-16 Nick Drochak <ndrochak@gol.com>
7643 * typemanager.cs: Remove unused private member. Also reported mcs
7644 bug to report this as a warning like csc.
7646 2002-10-15 Martin Baulig <martin@gnome.org>
7648 * statement.cs (Statement.Emit): Made this a virtual method; emits
7649 the line number info and calls DoEmit().
7650 (Statement.DoEmit): New protected abstract method, formerly knows
7651 as Statement.Emit().
7653 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
7655 2002-10-11 Miguel de Icaza <miguel@ximian.com>
7657 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
7658 have fixed a remaining problem: not every AddXXXX was adding a
7659 fully qualified name.
7661 Now everyone registers a fully qualified name in the DeclSpace as
7662 being defined instead of the partial name.
7664 Downsides: we are slower than we need to be due to the excess
7665 copies and the names being registered this way.
7667 The reason for this is that we currently depend (on the corlib
7668 bootstrap for instance) that types are fully qualified, because
7669 we dump all the types in the namespace, and we should really have
7670 types inserted into the proper namespace, so we can only store the
7671 basenames in the defined_names array.
7673 2002-10-10 Martin Baulig <martin@gnome.org>
7675 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
7676 from bug #31834, see the bug report for a testcase which is
7679 2002-10-10 Martin Baulig <martin@gnome.org>
7681 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
7682 flow analysis code for this.
7684 * statement.cs (Do, While, For): Tell the flow analysis code about
7686 (FlowBranching.UsageVector): Added support for infinite loops.
7687 (Block.Resolve): Moved the dead code elimination here and use flow
7690 2002-10-09 Miguel de Icaza <miguel@ximian.com>
7692 * class.cs (Field.Define): Catch cycles on struct type
7695 * typemanager.cs (IsUnmanagedtype): Do not recursively check
7696 fields if the fields are static. We only need to check instance
7699 * expression.cs (As.DoResolve): Test for reference type.
7701 * statement.cs (Using.ResolveExpression): Use
7702 ConvertImplicitRequired, not ConvertImplicit which reports an
7704 (Using.ResolveLocalVariableDecls): ditto.
7706 * expression.cs (Binary.ResolveOperator): Report errors in a few
7707 places where we had to.
7709 * typemanager.cs (IsUnmanagedtype): Finish implementation.
7711 2002-10-08 Miguel de Icaza <miguel@ximian.com>
7713 * expression.cs: Use StoreFromPtr instead of extracting the type
7714 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
7716 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
7717 an enumeration value to a System.Enum, but System.Enum is not a
7718 value type, but an class type, so we need to box.
7720 (Expression.ConvertExplicit): One codepath could return
7721 errors but not flag them. Fix this. Fixes #31853
7723 * parameter.cs (Resolve): Do not allow void as a parameter type.
7725 2002-10-06 Martin Baulig <martin@gnome.org>
7727 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
7728 if it's a class type and not a struct. Fixes #31815.
7730 2002-10-06 Martin Baulig <martin@gnome.org>
7732 * statement.cs: Reworked the flow analysis code a bit to make it
7733 usable for dead code elimination.
7735 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
7737 * cs-parser.jay: allow empty source files. Fixes bug #31781.
7739 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7741 * expression.cs (ComposedCast.DoResolveType): A quick workaround
7742 to fix the test 165, will investigate deeper.
7744 2002-10-04 Martin Baulig <martin@gnome.org>
7746 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
7747 finally blocks actually work.
7748 (Try.Resolve): We don't need to create a sibling for `finally' if
7749 there is no finally block.
7751 2002-10-04 Martin Baulig <martin@gnome.org>
7753 * class.cs (Constructor.Define): The default accessibility for a
7754 non-default constructor is private, not public.
7756 2002-10-04 Miguel de Icaza <miguel@ximian.com>
7758 * class.cs (Constructor): Make AllowedModifiers public, add
7761 * cs-parser.jay: Perform the modifiers test here, as the
7762 constructor for the Constructor class usually receives a zero
7763 because of the way we create it (first we create, later we
7764 customize, and we were never checking the modifiers).
7766 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
7767 is a version of LookupTypeReflection that includes the type-name
7768 cache. This can be used as a fast path for functions that know
7769 the fully qualified name and are only calling into *.GetType() to
7770 obtain a composed type.
7772 This is also used by TypeManager.LookupType during its type
7775 (LookupType): We now also track the real type name, as sometimes
7776 we can get a quey for the real type name from things like
7777 ComposedCast. This fixes bug 31422.
7779 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
7780 complete type fullname, it does not have to go through the type
7781 resolution system to obtain the composed version of the type (for
7782 obtaining arrays or pointers).
7784 (Conditional.Emit): Use the EmitBoolExpression to
7785 generate nicer code, as requested by Paolo.
7787 (ArrayCreation.CheckIndices): Use the patch from
7788 hwang_rob@yahoo.ca to validate the array initializers.
7790 2002-10-03 Miguel de Icaza <miguel@ximian.com>
7792 * class.cs (ConstructorInitializer.Emit): simplify code by using
7793 Invocation.EmitCall, and at the same time, fix the bugs in calling
7794 parent constructors that took variable arguments.
7796 * ecore.cs (Expression.ConvertNumericExplicit,
7797 Expression.ImplicitNumericConversion): Remove the code that
7798 manually wrapped decimal (InternalTypeConstructor call is now gone
7801 * expression.cs (Cast.TryReduce): Also handle decimal types when
7802 trying to perform a constant fold on the type.
7804 * typemanager.cs (IsUnmanagedtype): Partially implemented.
7806 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
7807 that only turned off an error report, and did nothing else.
7809 2002-10-02 Miguel de Icaza <miguel@ximian.com>
7811 * driver.cs: Handle and ignore /fullpaths
7813 2002-10-01 Miguel de Icaza <miguel@ximian.com>
7815 * expression.cs (Binary.ResolveOperator): Catch the case where
7816 DoNumericPromotions returns true,
7818 (Binary.DoNumericPromotions): Simplify the code, and the tests.
7820 2002-09-27 Miguel de Icaza <miguel@ximian.com>
7822 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
7825 2002-09-26 Miguel de Icaza <miguel@ximian.com>
7827 * ecore.cs (ConvertNumericExplicit): It is not enough that the
7828 conversion exists, but it is also required that the conversion be
7829 performed. This manifested in "(Type64Enum) 2".
7831 * class.cs (TypeManager.AddMethod): The fix is not to change
7832 AddEnum, because that one was using a fully qualified name (every
7833 DeclSpace derivative does), but to change the AddMethod routine
7834 that was using an un-namespaced name. This now correctly reports
7835 the duplicated name.
7837 Revert patch until I can properly fix it. The issue
7838 is that we have a shared Type space across all namespaces
7839 currently, which is wrong.
7841 Options include making the Namespace a DeclSpace, and merge
7842 current_namespace/current_container in the parser.
7844 2002-09-25 Miguel de Icaza <miguel@ximian.com>
7846 * cs-parser.jay: Improve error reporting when we get a different
7847 kind of expression in local_variable_type and
7848 local_variable_pointer_type.
7850 Propagate this to avoid missleading errors being reported.
7852 * ecore.cs (ImplicitReferenceConversion): treat
7853 TypeManager.value_type as a target just like object_type. As
7858 Is valid, and needs to result in the int 1 being boxed before it
7859 is assigned to the value type v.
7861 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
7862 to validate the enumeration name.
7864 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
7865 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
7866 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
7868 * ecore.cs (TryImplicitIntConversion): When doing an
7869 implicit-enumeration-conversion, check if the type is 64-bits and
7870 perform a conversion before passing to EnumConstant.
7872 2002-09-23 Miguel de Icaza <miguel@ximian.com>
7874 * decl.cs (Error_AmbiguousTypeReference); New routine used to
7875 report ambiguous type references. Unlike the MS version, we
7876 report what the ambiguity is. Innovation at work ;-)
7878 (DeclSpace.FindType): Require a location argument to
7879 display when we display an ambiguous error.
7881 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
7883 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
7885 * expression.cs (EmitDynamicInitializers): Apply patch from
7886 hwang_rob@yahoo.ca that fixes the order in which we emit our
7889 2002-09-21 Martin Baulig <martin@gnome.org>
7891 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
7892 delegate takes no arguments.
7894 2002-09-20 Miguel de Icaza <miguel@ximian.com>
7896 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
7899 * expression.cs: Extract the underlying type.
7901 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
7903 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
7905 2002-09-19 Miguel de Icaza <miguel@ximian.com>
7907 * class.cs (TypeContainer.DefineType): We can not use the nice
7908 PackingSize with the size set to 1 DefineType method, because it
7909 will not allow us to define the interfaces that the struct
7912 This completes the fixing of bug 27287
7914 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
7915 means also structs. This fixes part of the problem.
7916 (Expresion.ImplicitReferenceConversionExists): ditto.
7918 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
7919 error if there were no errors reported during the type lookup
7920 process, to avoid duplicates or redundant errors. Without this
7921 you would get an ambiguous errors plus a type not found. We have
7922 beaten the user enough with the first error.
7924 (DeclSparce.FindType): Emit a warning if we have an ambiguous
7927 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
7928 during the resolution process, stop the lookup, this avoids
7929 repeated error reports (same error twice).
7931 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
7933 * typemanager.cs (LookupType): Redo the type lookup code to match
7934 the needs of System.Reflection.
7936 The issue is that System.Reflection requires references to nested
7937 types to begin with a "+" sign instead of a dot. So toplevel
7938 types look like: "NameSpace.TopLevelClass", and nested ones look
7939 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
7942 2002-09-19 Martin Baulig <martin@gnome.org>
7944 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
7945 says that a method always returns or always throws an exception,
7946 don't report the CS0161.
7948 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
7949 set `Returns = new_returns'.
7951 2002-09-19 Martin Baulig <martin@gnome.org>
7953 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
7954 to an enum constant, check for a CS0176.
7956 2002-09-18 Miguel de Icaza <miguel@ximian.com>
7958 * class.cs (TypeContainer.CheckPairedOperators): Now we check
7959 for operators that must be in pairs and report errors.
7961 * ecore.cs (SimpleName.DoResolveType): During the initial type
7962 resolution process, when we define types recursively, we must
7963 check first for types in our current scope before we perform
7964 lookups in the enclosing scopes.
7966 * expression.cs (MakeByteBlob): Handle Decimal blobs.
7968 (Invocation.VerifyArgumentsCompat): Call
7969 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
7970 I thought we were supposed to always call this, but there are a
7971 few places in the code where we dont do it.
7973 2002-09-17 Miguel de Icaza <miguel@ximian.com>
7975 * driver.cs: Add support in -linkres and -resource to specify the
7976 name of the identifier.
7978 2002-09-16 Miguel de Icaza <miguel@ximian.com>
7980 * ecore.cs (StandardConversionExists): Sync with the conversion
7981 code: allow anything-* to void* conversions.
7983 (FindMostSpecificSource): Use an Expression argument
7984 instead of a Type, because we might be handed over a Literal which
7985 gets a few more implicit conversions that plain types do not. So
7986 this information was being lost.
7988 Also, we drop the temporary type-holder expression when not
7991 2002-09-17 Martin Baulig <martin@gnome.org>
7993 * class.cs (PropertyBase.CheckBase): Don't check the base class if
7994 this is an explicit interface implementation.
7996 2002-09-17 Martin Baulig <martin@gnome.org>
7998 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
7999 different `IndexerName' attributes.
8001 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
8002 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
8003 virtual CommonResolve().
8005 2002-09-16 Miguel de Icaza <miguel@ximian.com>
8007 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
8008 and convert that to the UnderlyingType.
8010 * statement.cs (Foreach.Resolve): Indexers are just like variables
8011 or PropertyAccesses.
8013 * cs-tokenizer.cs (consume_string): Track line numbers and columns
8014 inside quoted strings, we were not doing this before.
8016 2002-09-16 Martin Baulig <martin@gnome.org>
8018 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
8019 resolve it. This is needed for the definite assignment check of the
8020 instance expression, fixes bug #29846.
8021 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
8023 2002-09-16 Nick Drochak <ndrochak@gol.com>
8025 * parameter.cs: Fix compile error. Cannot reference static member
8026 from an instance object. Is this an mcs bug?
8028 2002-09-14 Martin Baulig <martin@gnome.org>
8030 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
8031 multiple times. Fixes bug #30295, added test-166.cs.
8033 2002-09-14 Martin Baulig <martin@gnome.org>
8035 * statement.cs (Block.Emit): Don't emit unreachable code.
8036 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
8038 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
8040 2002-09-14 Martin Baulig <martin@gnome.org>
8042 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
8045 2002-09-14 Martin Baulig <martin@gnome.org>
8047 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
8048 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
8049 be false on the ms runtime.
8051 2002-09-13 Martin Baulig <martin@gnome.org>
8053 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
8054 the CS0038 error message.
8056 2002-09-12 Miguel de Icaza <miguel@ximian.com>
8058 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
8059 constant inside, return it.
8061 2002-09-12 Martin Baulig <martin@gnome.org>
8063 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
8064 implicit conversion can be done between enum types.
8066 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
8067 check whether an implicit conversion to the current enum's UnderlyingType
8068 exists and report an error if not.
8070 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
8071 without debugging support.
8073 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
8074 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
8076 2002-09-12 Martin Baulig <martin@gnome.org>
8078 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
8080 * ecore.cs (IMemberExpr.DeclaringType): New property.
8081 (SimpleName.SimpleNameResolve): Check whether we're accessing a
8082 nonstatic member of an outer type (CS0038).
8084 2002-09-11 Miguel de Icaza <miguel@ximian.com>
8086 * driver.cs: Activate the using-error detector at warning level
8087 4 (at least for MS-compatible APIs).
8089 * namespace.cs (VerifyUsing): Small buglett fix.
8091 * pending.cs (PendingImplementation): pass the container pointer.
8093 * interface.cs (GetMethods): Allow for recursive definition. Long
8094 term, I would like to move every type to support recursive
8095 definitions, not the current ordering mechanism that we have right
8098 The situation is this: Attributes are handled before interfaces,
8099 so we can apply attributes to interfaces. But some attributes
8100 implement interfaces, we will now handle the simple cases
8101 (recursive definitions will just get an error).
8103 * parameter.cs: Only invalidate types at the end if we fail to
8106 2002-09-09 Martin Baulig <martin@gnome.org>
8108 * ecore.cs (PropertyExpr.Emit): Also check for
8109 TypeManager.system_int_array_get_length so this'll also work when
8110 compiling corlib. Fixes #30003.
8112 2002-09-09 Martin Baulig <martin@gnome.org>
8114 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
8115 and throw an exception if we can't get the type's size. Fixed #30040,
8118 2002-09-09 Martin Baulig <martin@gnome.org>
8120 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
8122 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
8123 context. Fixes bug #30027.
8125 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
8126 virtual functions. Fixes bug #30043, added test-164.cs.
8128 2002-09-08 Ravi Pratap <ravi@ximian.com>
8130 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
8132 2002-09-08 Nick Drochak <ndrochak@gol.com>
8134 * driver.cs: Use an object to get the windows codepage since it's not a
8137 2002-09-08 Miguel de Icaza <miguel@ximian.com>
8139 * statement.cs (For.Emit): for infinite loops (test == null)
8140 return whether there is a break inside, not always "true".
8142 * namespace.cs (UsingEntry): New struct to hold the name of the
8143 using definition, the location where it is defined, and whether it
8144 has been used in a successful type lookup.
8146 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
8151 2002-09-06 Ravi Pratap <ravi@ximian.com>
8153 * attribute.cs : Fix incorrect code which relied on catching
8154 a NullReferenceException to detect a null being passed in
8155 where an object was expected.
8157 2002-09-06 Miguel de Icaza <miguel@ximian.com>
8159 * statement.cs (Try): flag the catch variable as assigned
8161 * expression.cs (Cast): Simplified by using ResolveType instead of
8164 * statement.cs (Catch): Fix bug by using ResolveType.
8166 2002-09-06 Ravi Pratap <ravi@ximian.com>
8168 * expression.cs (BetterConversion): Special case for when we have
8169 a NullLiteral as the argument and we have to choose between string
8170 and object types - we choose string the way csc does.
8172 * attribute.cs (Attribute.Resolve): Catch the
8173 NullReferenceException and report error #182 since the Mono
8174 runtime no more has the bug and having this exception raised means
8175 we tried to select a constructor which takes an object and is
8178 2002-09-05 Ravi Pratap <ravi@ximian.com>
8180 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
8181 message (1502, 1503) when we can't locate a method after overload
8182 resolution. This is much more informative and closes the bug
8185 * interface.cs (PopulateMethod): Return if there are no argument
8186 types. Fixes a NullReferenceException bug.
8188 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
8189 expressions too. Previously we were checking only in one place for
8190 positional arguments leaving out named arguments.
8192 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
8193 type to the enum type is not allowed. Remove code corresponding to
8196 (ConvertNumericExplicit): Allow explicit conversions from
8197 the underlying type to enum type. This precisely follows the spec
8198 and closes a bug filed by Gonzalo.
8200 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8203 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
8205 2002-09-03 Miguel de Icaza <miguel@ximian.com>
8207 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
8208 it was important that we stored the right value after the
8209 reduction in `converted'.
8211 2002-09-04 Martin Baulig <martin@gnome.org>
8213 * location.cs (Location.SymbolDocument): Use full pathnames for the
8216 2002-08-30 Miguel de Icaza <miguel@ximian.com>
8218 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
8219 of the expression resolve mechanism, because that will catch the
8220 SimpleName error failures.
8222 (Conditional): If we can not resolve the
8223 expression, return, do not crash.
8225 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8228 (location): display token name instead of its number.
8230 2002-08-28 Martin Baulig <martin@gnome.org>
8232 * expression.cs (Binary.ResolveOperator): Don't silently return
8233 but return an error if an operator cannot be applied between two
8236 2002-08-28 Martin Baulig <martin@gnome.org>
8238 * class.cs (Constructor.Define): Set the permission attributes
8239 correctly instead of making all constructors public.
8241 2002-08-28 Martin Baulig <martin@gnome.org>
8243 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
8244 for private members before reporting a CS0103; if we find anything,
8247 2002-08-28 Martin Baulig <martin@gnome.org>
8249 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
8250 to check whether `closure_start_type == closure_invocation_type',
8251 we also need to check whether `m.DeclaringType == closure_invocation_type'
8252 before bypassing the permission checks. We might be accessing
8253 protected/private members from the base class.
8254 (TypeManager.RealMemberLookup): Only set private_ok if private
8255 members were requested via BindingFlags.NonPublic.
8257 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
8259 * expression.cs (MemberAccess.ResolveMemberAccess): Set
8260 MethodGroupExpr.IsExplicitImpl if appropriate.
8261 (Invocation.DoResolve): Don't report the CS0120 for explicit
8262 interface implementations.
8264 2002-08-27 Martin Baulig <martin@gnome.org>
8266 * expression.cs (Invocation.DoResolve): If this is a static
8267 method and we don't have an InstanceExpression, we must report
8270 2002-08-25 Martin Baulig <martin@gnome.org>
8272 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
8273 `==' between a valuetype and an object.
8275 2002-08-25 Miguel de Icaza <miguel@ximian.com>
8277 * ecore.cs (TypeExpr): Provide a ToString method.
8279 2002-08-24 Martin Baulig <martin@gnome.org>
8281 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
8282 now called proggie.dbg and it's a binary file.
8284 2002-08-23 Martin Baulig <martin@gnome.org>
8286 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
8288 2002-08-23 Martin Baulig <martin@gnome.org>
8290 * struct.cs (MyStructInfo.ctor): Make this work with empty
8291 structs; it's not allowed to use foreach() on null.
8293 2002-08-23 Martin Baulig <martin@gnome.org>
8295 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
8296 writer the full pathname of the generated assembly.
8298 2002-08-23 Martin Baulig <martin@gnome.org>
8300 * statements.cs (FlowBranching.UsageVector.MergeChildren):
8301 A `finally' block never returns or breaks; improved handling of
8304 2002-08-23 Martin Baulig <martin@gnome.org>
8306 * statement.cs (Throw.Resolve): Allow `throw null'.
8308 2002-08-23 Martin Baulig <martin@gnome.org>
8310 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
8311 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
8312 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
8313 MemberLookup would return a wrong event if this is an explicit
8314 interface implementation and the class has an event with the same
8317 2002-08-23 Martin Baulig <martin@gnome.org>
8319 * statement.cs (Block.AddChildVariableNames): New public method.
8320 (Block.AddChildVariableName): Likewise.
8321 (Block.IsVariableNameUsedInChildBlock): Likewise.
8322 (Block.AddVariable): Check whether a variable name has already
8323 been used in a child block.
8325 * cs-parser.jay (declare_local_variables): Mark all variable names
8326 from the current block as being used in a child block in the
8329 2002-08-23 Martin Baulig <martin@gnome.org>
8331 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
8332 find the symbol writer.
8334 * driver.cs: csc also allows the arguments to /define being
8335 separated by commas, not only by semicolons.
8337 2002-08-23 Martin Baulig <martin@gnome.org>
8339 * interface.cs (Interface.GetMembers): Added static check for events.
8341 2002-08-15 Martin Baulig <martin@gnome.org>
8343 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
8344 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
8346 * ecore.cs (Expression.MemberLookup): Added documentation and explained
8347 why the MethodData.EmitDestructor() change was necessary.
8349 2002-08-20 Martin Baulig <martin@gnome.org>
8351 * class.cs (TypeContainer.FindMembers): Added static check for events.
8353 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
8355 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
8356 use Type.GetEvents(), not Type.FindMembers().
8358 2002-08-20 Martin Baulig <martin@gnome.org>
8360 * decl.cs (MemberCache): Added a special method cache which will
8361 be used for method-only searched. This ensures that a method
8362 search will return a MethodInfo with the correct ReflectedType for
8365 2002-08-20 Martin Baulig <martin@gnome.org>
8367 * decl.cs (DeclSpace.FindMembers): Made this public.
8369 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8371 * delegate.cs: fixed build on windows.
8372 [FIXME: Filed as bug #29150: MCS must report these errors.]
8374 2002-08-19 Ravi Pratap <ravi@ximian.com>
8376 * ecore.cs (StandardConversionExists): Return a false
8377 if we are trying to convert the void type to anything else
8378 since that is not allowed.
8380 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
8381 we flag error 70 in the event an event is trying to be accessed
8382 directly from outside the declaring type.
8384 2002-08-20 Martin Baulig <martin@gnome.org>
8386 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
8387 MemberCache from typemanager.cs to decl.cs.
8389 2002-08-19 Martin Baulig <martin@gnome.org>
8391 * class.cs (TypeContainer): Implement IMemberContainer.
8392 (TypeContainer.DefineMembers): Create the MemberCache.
8393 (TypeContainer.FindMembers): Do better BindingFlags checking; only
8394 return public members if BindingFlags.Public was given, check
8395 whether members are static.
8397 2002-08-16 Martin Baulig <martin@gnome.org>
8399 * decl.cs (DeclSpace.Define): Splitted this in Define and
8400 DefineMembers. DefineMembers is called first and initializes the
8403 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
8404 DefineMembers() on all our DeclSpaces.
8406 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
8407 but call DefineMembers() on all nested interfaces. We call their
8408 Define() in our new Define() function.
8410 * interface.cs (Interface): Implement IMemberContainer.
8411 (Interface.Define): Moved all code except the attribute stuf to
8413 (Interface.DefineMembers): Initialize the member cache.
8415 * typemanager.cs (IMemberFinder): Removed this interface, we don't
8416 need this anymore since we can use MemberCache.FindMembers directly.
8418 2002-08-19 Martin Baulig <martin@gnome.org>
8420 * typemanager.cs (MemberCache): When creating the cache for an
8421 interface type, add all inherited members.
8422 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
8423 to `out bool used_cache' and documented it.
8424 (TypeManager.MemberLookup): If we already used the cache in the first
8425 iteration, we don't need to do the interfaces check.
8427 2002-08-19 Martin Baulig <martin@gnome.org>
8429 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
8430 here from IMemberFinder and don't implement this interface anymore.
8431 (DeclSpace.MemberCache): Moved here from IMemberFinder.
8433 * typemanager.cs (IMemberFinder): This interface is now only used by
8434 classes which actually support the member cache.
8435 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
8436 since we only put DeclSpaces into this Hashtable.
8437 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
8438 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
8440 2002-08-16 Martin Baulig <martin@gnome.org>
8442 * typemanager.cs (ICachingMemberFinder): Removed.
8443 (IMemberFinder.MemberCache): New property.
8444 (TypeManager.FindMembers): Merged this with RealFindMembers().
8445 This function will never be called from TypeManager.MemberLookup()
8446 so we can't use the cache here, just the IMemberFinder.
8447 (TypeManager.MemberLookup_FindMembers): Check whether the
8448 IMemberFinder has a MemberCache and call the cache's FindMembers
8450 (MemberCache): Rewrote larger parts of this yet another time and
8451 cleaned it up a bit.
8453 2002-08-15 Miguel de Icaza <miguel@ximian.com>
8455 * driver.cs (LoadArgs): Support quoting.
8457 (Usage): Show the CSC-like command line arguments.
8459 Improved a few error messages.
8461 2002-08-15 Martin Baulig <martin@gnome.org>
8463 * typemanager.cs (IMemberContainer.Type): New property.
8464 (IMemberContainer.IsInterface): New property.
8466 The following changes are conditional to BROKEN_RUNTIME, which is
8467 defined at the top of the file.
8469 * typemanager.cs (MemberCache.MemberCache): Don't add the base
8470 class'es members, but add all members from TypeHandle.ObjectType
8471 if we're an interface.
8472 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
8473 is the current type.
8474 (MemberCache.CacheEntry.Container): Removed this field.
8475 (TypeHandle.GetMembers): Include inherited members.
8477 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8479 * typemanager.cs: fixed compilation and added a comment on a field that
8482 2002-08-15 Martin Baulig <martin@gnome.org>
8484 * class.cs (ConstructorInitializer.Resolve): In the
8485 Expression.MemberLookup call, use the queried_type as
8488 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
8489 declared' attribute, it's always true.
8490 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
8491 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
8492 temporary wrapper for FindMembers which tells MemberLookup whether
8493 members from the base classes are included in the return value.
8494 This will go away soon.
8495 (TypeManager.MemberLookup): Use this temporary hack here; once the
8496 new MemberCache is completed, we don't need to do the DeclaredOnly
8497 looping here anymore since the MemberCache will take care of this.
8498 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
8499 (MemberCache): When creating the MemberCache for a class, get
8500 members from the current class and all its base classes.
8501 (MemberCache.CacheEntry.Container): New field. This is a
8502 temporary hack until the Mono runtime is fixed to distinguish
8503 between ReflectedType and DeclaringType. It allows us to use MCS
8504 with both the MS runtime and the unfixed Mono runtime without
8505 problems and without accecting performance.
8506 (MemberCache.SearchMembers): The DeclaredOnly looping from
8507 TypeManager.MemberLookup is now done here.
8509 2002-08-14 Martin Baulig <martin@gnome.org>
8511 * statement.cs (MyStructInfo.MyStructInfo): Don't call
8512 Type.GetFields on dynamic types but get the fields from the
8513 corresponding TypeContainer.
8514 (MyStructInfo.GetStructInfo): Added check for enum types.
8516 * typemanager.cs (MemberList.IsSynchronized): Implemented.
8517 (MemberList.SyncRoot): Implemented.
8518 (TypeManager.FilterWithClosure): No need to check permissions if
8519 closure_start_type == closure_invocation_type, don't crash if
8520 closure_invocation_type is null.
8522 2002-08-13 Martin Baulig <martin@gnome.org>
8524 Rewrote TypeContainer.FindMembers to use a member cache. This
8525 gives us a speed increase of about 35% for the self-hosting MCS
8526 build and of about 15-20% for the class libs (both on GNU/Linux).
8528 * report.cs (Timer): New class to get enhanced profiling. This
8529 whole class is "TIMER" conditional since it remarkably slows down
8532 * class.cs (MemberList): New class. This is an IList wrapper
8533 which we're now using instead of passing MemberInfo[]'s around to
8534 avoid copying this array unnecessarily.
8535 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
8536 (ICachingMemberFinder, IMemberContainer): New interface.
8537 (TypeManager.FilterWithClosure): If `criteria' is null, the name
8538 has already been checked, otherwise use it for the name comparision.
8539 (TypeManager.FindMembers): Renamed to RealMemberFinder and
8540 provided wrapper which tries to use ICachingMemberFinder.FindMembers
8541 if possible. Returns a MemberList, not a MemberInfo [].
8542 (TypeHandle): New class, implements IMemberContainer. We create
8543 one instance of this class per type, it contains a MemberCache
8544 which is used to do the member lookups.
8545 (MemberCache): New class. Each instance of this class contains
8546 all members of a type and a name-based hash table.
8547 (MemberCache.FindMembers): This is our new member lookup
8548 function. First, it looks up all members of the requested name in
8549 the hash table. Then, it walks this list and sorts out all
8550 applicable members and returns them.
8552 2002-08-13 Martin Baulig <martin@gnome.org>
8554 In addition to a nice code cleanup, this gives us a performance
8555 increase of about 1.4% on GNU/Linux - not much, but it's already
8556 half a second for the self-hosting MCS compilation.
8558 * typemanager.cs (IMemberFinder): New interface. It is used by
8559 TypeManager.FindMembers to call FindMembers on a TypeContainer,
8560 Enum, Delegate or Interface.
8561 (TypeManager.finder_to_member_finder): New PtrHashtable.
8562 (TypeManager.finder_to_container): Removed.
8563 (TypeManager.finder_to_delegate): Removed.
8564 (TypeManager.finder_to_interface): Removed.
8565 (TypeManager.finder_to_enum): Removed.
8567 * interface.cs (Interface): Implement IMemberFinder.
8569 * delegate.cs (Delegate): Implement IMemberFinder.
8571 * enum.cs (Enum): Implement IMemberFinder.
8573 * class.cs (TypeContainer): Implement IMemberFinder.
8575 2002-08-12 Martin Baulig <martin@gnome.org>
8577 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
8579 2002-08-12 Martin Baulig <martin@gnome.org>
8581 * ecore.cs (ITypeExpression): New interface for expressions which
8583 (TypeExpression): Renamed to TypeLookupExpression.
8584 (Expression.DoResolve): If we're doing a types-only lookup, the
8585 expression must implement the ITypeExpression interface and we
8586 call DoResolveType() on it.
8587 (SimpleName): Implement the new ITypeExpression interface.
8588 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
8589 hack, the situation that we're only looking up types can't happen
8590 anymore when this method is called. Moved the type lookup code to
8591 DoResolveType() and call it.
8592 (SimpleName.DoResolveType): This ITypeExpression interface method
8593 is now doing the types-only lookup.
8594 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
8595 (ResolveFlags): Added MaskExprClass.
8597 * expression.cs (MemberAccess): Implement the ITypeExpression
8599 (MemberAccess.DoResolve): Added support for a types-only lookup
8600 when we're called via ITypeExpression.DoResolveType().
8601 (ComposedCast): Implement the ITypeExpression interface.
8603 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
8604 Expression.Resolve() with ResolveFlags.Type instead.
8606 2002-08-12 Martin Baulig <martin@gnome.org>
8608 * interface.cs (Interface.Define): Apply attributes.
8610 * attribute.cs (Attribute.ApplyAttributes): Added support for
8611 interface attributes.
8613 2002-08-11 Martin Baulig <martin@gnome.org>
8615 * statement.cs (Block.Emit): Only check the "this" variable if we
8616 do not always throw an exception.
8618 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
8619 whether the property has a set accessor.
8621 2002-08-11 Martin Baulig <martin@gnome.org>
8623 Added control flow analysis support for structs.
8625 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
8626 with control flow analysis turned off.
8627 (IVariable): New interface.
8628 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
8629 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
8630 (FieldExpr.DoResolve): Resolve the instance expression with flow
8631 analysis turned off and do the definite assignment check after the
8632 resolving when we know what the expression will resolve to.
8634 * expression.cs (LocalVariableReference, ParameterReference):
8635 Implement the new IVariable interface, only call the flow analysis
8636 code if ec.DoFlowAnalysis is true.
8637 (This): Added constructor which takes a Block argument. Implement
8638 the new IVariable interface.
8639 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
8640 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
8641 This does the definite assignment checks for struct members.
8643 * class.cs (Constructor.Emit): If this is a non-static `struct'
8644 constructor which doesn't have any initializer, call
8645 Block.AddThisVariable() to tell the flow analysis code that all
8646 struct elements must be initialized before control returns from
8649 * statement.cs (MyStructInfo): New public class.
8650 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
8651 argument to this indexer. If non-zero, check an individual struct
8652 member, not the whole struct.
8653 (FlowBranching.CheckOutParameters): Check struct members.
8654 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
8655 overloaded versions of these methods which take an additional
8656 `int field_idx' argument to check struct members.
8657 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
8658 overloaded versions of these methods which take an additional
8659 `string field_name' argument to check struct member.s
8660 (VariableInfo): Implement the IVariable interface.
8661 (VariableInfo.StructInfo): New public property. Returns the
8662 MyStructInfo instance of the variable if it's a struct or null.
8663 (Block.AddThisVariable): New public method. This is called from
8664 Constructor.Emit() for non-static `struct' constructor which do
8665 not have any initializer. It creates a special variable for the
8666 "this" instance variable which will be checked by the flow
8667 analysis code to ensure that all of the struct's fields are
8668 initialized before control returns from the constructor.
8669 (UsageVector): Added support for struct members. If a
8670 variable/parameter is a struct with N members, we reserve a slot
8671 in the usage vector for each member. A struct is considered fully
8672 initialized if either the struct itself (slot 0) or all its
8673 members are initialized.
8675 2002-08-08 Martin Baulig <martin@gnome.org>
8677 * driver.cs (Driver.MainDriver): Only report an error CS5001
8678 if there were no compilation errors.
8680 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
8681 `UnsafeContext' property to determine whether the parent is in
8682 unsafe context rather than checking the parent's ModFlags:
8683 classes nested in an unsafe class are unsafe as well.
8685 2002-08-08 Martin Baulig <martin@gnome.org>
8687 * statement.cs (UsageVector.MergeChildren): Distinguish between
8688 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
8689 we return. Added test17() and test18() to test-154.cs.
8691 2002-08-08 Martin Baulig <martin@gnome.org>
8693 * typemanager.cs (TypeManager.FilterWithClosure): If we have
8694 Family access, make sure the invoking type isn't a subclass of the
8695 queried type (that'd be a CS1540).
8697 * ecore.cs (Expression.MemberLookup): Added overloaded version of
8698 this method which takes an additional `Type invocation_type'.
8700 * expression.cs (BaseAccess.DoResolve): Use the base type as
8701 invocation and query type.
8702 (MemberAccess.DoResolve): If the lookup failed and we're about to
8703 report a CS0122, try a lookup with the ec.ContainerType - if this
8704 succeeds, we must report a CS1540.
8706 2002-08-08 Martin Baulig <martin@gnome.org>
8708 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
8709 (MethodGroupExpr): Implement the IMemberExpr interface.
8711 * expression (MemberAccess.ResolveMemberAccess): No need to have
8712 any special code for MethodGroupExprs anymore, they're now
8715 2002-08-08 Martin Baulig <martin@gnome.org>
8717 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
8718 Family, FamANDAssem and FamORAssem permissions.
8719 (TypeManager.IsSubclassOrNestedChildOf): New public method.
8721 2002-08-08 Martin Baulig <martin@gnome.org>
8723 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
8724 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
8727 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
8729 * driver.cs: implemented /resource option to embed managed resources.
8731 2002-08-07 Martin Baulig <martin@gnome.org>
8733 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
8734 (FieldBase.HasFieldInitializer): New public property.
8735 (FieldBase.GetInitializerExpression): New public method. Resolves and
8736 returns the field initializer and makes sure it is only resolved once.
8737 (TypeContainer.EmitFieldInitializers): Call
8738 FieldBase.GetInitializerExpression to get the initializer, this ensures
8739 that it isn't resolved multiple times.
8741 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
8742 the resolving process (SimpleName/MemberLookup) that we're currently
8743 emitting a field initializer (which must not access any instance members,
8744 this is an error CS0236).
8746 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
8747 argument, if the `IsFieldInitializer' flag is set, we must report and
8748 error CS0236 and not an error CS0120.
8750 2002-08-07 Martin Baulig <martin@gnome.org>
8752 * ecore.cs (IMemberExpr): New public interface.
8753 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
8754 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
8755 if the expression is an IMemberExpr.
8757 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
8758 to be null, implicitly default to `this' if we're non-static in
8759 this case. Simplified the code a lot by using the new IMemberExpr
8760 interface. Also fixed bug #28176 here.
8762 2002-08-06 Martin Baulig <martin@gnome.org>
8764 * cs-parser.jay (SimpleLookup): Removed. We need to create
8765 ParameterReferences during semantic analysis so that we can do a
8766 type-only search when resolving Cast, TypeOf and SizeOf.
8767 (block): Pass the `current_local_parameters' to the Block's
8770 * class.cs (ConstructorInitializer): Added `Parameters parameters'
8771 argument to the constructor.
8772 (ConstructorInitializer.Resolve): Create a temporary implicit
8773 block with the parameters.
8775 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
8776 references here if we aren't doing a type-only search.
8778 * statement.cs (Block): Added constructor which takes a
8779 `Parameters parameters' argument.
8780 (Block.Parameters): New public property.
8782 * support.cs (InternalParameters.Parameters): Renamed `parameters'
8783 to `Parameters' and made it public readonly.
8785 2002-08-06 Martin Baulig <martin@gnome.org>
8787 * ecore.cs (Expression.Warning): Made this public as well.
8789 * report.cs (Report.Debug): Print the contents of collections.
8791 2002-08-06 Martin Baulig <martin@gnome.org>
8793 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
8794 used to tell Resolve() which kinds of expressions it may return.
8795 (Expression.Resolve): Added overloaded version of this method which
8796 takes a `ResolveFlags flags' argument. This can be used to tell
8797 Resolve() which kinds of expressions it may return. Reports a
8799 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
8800 ResolveFlags.SimpleName.
8801 (Expression.Error118): Added overloaded version of this method which
8802 takes a `ResolveFlags flags' argument. It uses the flags to determine
8803 which kinds of expressions are allowed.
8805 * expression.cs (Argument.ResolveMethodGroup): New public method.
8806 Resolves an argument, but allows a MethodGroup to be returned.
8807 This is used when invoking a delegate.
8809 * TODO: Updated a bit.
8811 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8813 Fixed compilation with csc.
8815 * ecore.cs: Expression.Error made public. Is this correct? Should
8816 Warning be made public too?
8818 * expression.cs: use ea.Location instead of ea.loc.
8819 [FIXME: Filed as bug #28607: MCS must report these errors.]
8821 2002-08-06 Martin Baulig <martin@gnome.org>
8823 * ecore.cs (Expression.loc): Moved the location here instead of
8824 duplicating it in all derived classes.
8825 (Expression.Location): New public property.
8826 (Expression.Error, Expression.Warning): Made them non-static and
8827 removed the location argument.
8828 (Expression.Warning): Added overloaded version which takes an
8829 `int level' argument.
8830 (Expression.Error118): Make this non-static and removed the
8831 expression and location arguments.
8832 (TypeExpr): Added location argument to the constructor.
8834 * expression.cs (StaticCallExpr): Added location argument to
8836 (Indirection, PointerArithmetic): Likewise.
8837 (CheckedExpr, UnCheckedExpr): Likewise.
8838 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
8839 (StringPtr): Likewise.
8842 2002-08-05 Martin Baulig <martin@gnome.org>
8844 * expression.cs (BaseAccess.DoResolve): Actually report errors.
8846 * assign.cs (Assign.DoResolve): Check whether the source
8847 expression is a value or variable.
8849 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
8850 while resolving the corresponding blocks.
8852 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
8853 an error, don't silently return null.
8855 * statement.cs (Block.AddVariable): Do the error reporting here
8856 and distinguish between CS0128 and CS0136.
8857 (Block.DoResolve): Report all unused labels (warning CS0164).
8858 (LabeledStatement): Pass the location to the constructor.
8859 (LabeledStatement.HasBeenReferenced): New property.
8860 (LabeledStatement.Resolve): Set it to true here.
8862 * statement.cs (Return.Emit): Return success even after reporting
8863 a type mismatch error (CS0126 or CS0127), this is what csc does and
8864 it avoids confusing the users with any consecutive errors.
8866 2002-08-05 Martin Baulig <martin@gnome.org>
8868 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
8870 * const.cs (Const.LookupConstantValue): Catch circular definitions.
8872 * expression.cs (MemberAccess.DoResolve): Silently return if an
8873 error has already been reported.
8875 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
8876 error has already been reported.
8878 2002-08-05 Martin Baulig <martin@gnome.org>
8880 * statement.cs (UsageVector): Only initialize the `parameters'
8881 vector if we actually have any "out" parameters.
8883 2002-08-05 Martin Baulig <martin@gnome.org>
8885 * expression.cs (Binary.ResolveOperator): When combining delegates,
8886 they must have the same type.
8888 2002-08-05 Martin Baulig <martin@gnome.org>
8890 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
8891 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
8892 work with the ms runtime and we also don't need it: if we're a
8893 PropertyBuilder and not in the `indexer_arguments' hash, then we
8894 are a property and not an indexer.
8896 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
8897 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
8898 since the latter one doesn't work with the ms runtime.
8900 2002-08-03 Martin Baulig <martin@gnome.org>
8902 Fixed bugs #27998 and #22735.
8904 * class.cs (Method.IsOperator): New public field.
8905 (Method.CheckBase): Report CS0111 if there's already a method
8906 with the same parameters in the current class. Report CS0508 when
8907 attempting to change the return type of an inherited method.
8908 (MethodData.Emit): Report CS0179 if a method doesn't have a body
8909 and it's not marked abstract or extern.
8910 (PropertyBase): New abstract base class for Property and Indexer.
8911 (PropertyBase.CheckBase): Moved here from Property and made it work
8913 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
8914 the same so we can reuse it there.
8915 (Property, Indexer): Derive from PropertyBase.
8916 (MethodSignature.inheritable_property_signature_filter): New delegate
8917 to find properties and indexers.
8919 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
8920 argument and improved error reporting.
8922 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
8923 EmptyReadOnlyParameters and made it a property.
8925 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
8926 version of this method which takes a `PropertyInfo indexer'.
8927 (TypeManager.RegisterIndexer): New method.
8929 * class.cs: Added myself as author of this file :-)
8931 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
8933 * class.cs: fixed compilation on windoze.
8935 2002-08-03 Martin Baulig <martin@gnome.org>
8937 * interface.cs (Interface.GetInterfaceBases): Check whether all
8938 base interfaces are at least as accessible than the current one.
8940 * class.cs (TypeContainer.GetClassBases): Check whether base types
8941 are at least as accessible than the current type.
8942 (TypeContainer.AsAccessible): Implemented and made non-static.
8943 (MemberBase.CheckParameters): Report errors if the accessibility
8946 * delegate.cs (Delegate.Delegate): The default visibility is
8947 internal for top-level types and private for nested types.
8948 (Delegate.Define): Report errors if the accessibility checks fail.
8950 * enum.cs (Enum.Enum): The default visibility is internal for
8951 top-level types and private for nested types.
8952 (Enum.DefineType): Compute the correct visibility.
8954 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
8955 function which takes a `bool is_toplevel' instead of a TypeContainer.
8957 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
8960 2002-08-02 Martin Baulig <martin@gnome.org>
8962 * expression.cs (LocalVariableReferenc): Added constructor which
8963 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
8964 (LocalVariableReference.IsReadOnly): New property.
8965 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
8966 variable is readonly, use our own readonly flag to do this; you can
8967 use the new constructor to get a writable reference to a read-only
8970 * cs-parser.jay (foreach_statement, using_statement): Get a writable
8971 reference to the local variable.
8973 2002-08-01 Miguel de Icaza <miguel@ximian.com>
8975 * rootcontext.cs (ResolveCore): Also include System.Exception
8977 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
8978 we reach an EmptyStatement.
8980 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
8983 * expression.cs (Binary.ResolveOperator): Check error result in
8986 use brtrue/brfalse directly and avoid compares to null.
8988 2002-08-02 Martin Baulig <martin@gnome.org>
8990 * class.cs (TypeContainer.Define): Define all nested interfaces here.
8991 Fixes bug #28407, added test-155.cs.
8993 2002-08-01 Martin Baulig <martin@gnome.org>
8995 * class.cs (Event.EmitDefaultMethod): Make this work with static
8996 events. Fixes #28311, added verify-3.cs.
8998 2002-08-01 Martin Baulig <martin@gnome.org>
9000 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
9001 `is_disposable' fields.
9002 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
9003 `hm.is_disposable' if we're using the collection pattern.
9004 (Foreach.EmitCollectionForeach): Use the correct type for the
9005 enumerator's local variable, only emit the try/finally block if
9006 necessary (fixes #27713).
9008 2002-08-01 Martin Baulig <martin@gnome.org>
9010 * ecore.cs (Expression.report118): Renamed to Error118 and made
9013 * statement.cs (Throw.Resolve): Check whether the expression is of
9014 the correct type (CS0118) and whether the type derives from
9015 System.Exception (CS0155).
9016 (Catch.Resolve): New method. Do the type lookup here and check
9017 whether it derives from System.Exception (CS0155).
9018 (Catch.CatchType, Catch.IsGeneral): New public properties.
9020 * typemanager.cs (TypeManager.exception_type): Added.
9022 2002-07-31 Miguel de Icaza <miguel@ximian.com>
9024 * driver.cs: Updated About function.
9026 2002-07-31 Martin Baulig <martin@gnome.org>
9028 Implemented Control Flow Analysis.
9030 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
9031 (EmitContext.CurrentBranching): Added.
9032 (EmitContext.StartFlowBranching): Added.
9033 (EmitContext.EndFlowBranching): Added.
9034 (EmitContext.KillFlowBranching): Added.
9035 (EmitContext.IsVariableAssigned): Added.
9036 (EmitContext.SetVariableAssigned): Added.
9037 (EmitContext.IsParameterAssigned): Added.
9038 (EmitContext.SetParameterAssigned): Added.
9039 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
9040 Added control flow analysis stuff here.
9042 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
9043 resolve the expression as lvalue.
9044 (LocalVariableReference.DoResolve): Check whether the variable has
9045 already been assigned.
9046 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
9047 the parameter as assigned here.
9048 (ParameterReference.DoResolve): Check whether the parameter has already
9050 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
9051 expression as lvalue.
9053 * statement.cs (FlowBranching): New class for the flow analysis code.
9054 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
9055 (LabeledStatement.IsDefined): New public property.
9056 (LabeledStatement.AddUsageVector): New public method to tell flow
9057 analyis that the label may be reached via a forward jump.
9058 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
9060 (VariableInfo.Number): New public field. This is used by flow analysis
9061 to number all locals of a block.
9062 (Block.CountVariables): New public property. This is the number of
9063 local variables in this block (including the locals from all parent
9065 (Block.EmitMeta): Number all the variables.
9067 * statement.cs: Added flow analysis support to all classes.
9069 2002-07-31 Martin Baulig <martin@gnome.org>
9071 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
9072 To get debugging messages, compile mcs with /define:MCS_DEBUG and
9073 then use this argument.
9075 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
9077 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
9078 use this to specify /define options.
9080 2002-07-29 Martin Baulig <martin@gnome.org>
9082 * statement.cs (Fixed): Moved all code that does variable lookups
9083 and resolvings from Emit to Resolve.
9085 * statement.cs (For): Moved all code that does variable lookups
9086 and resolvings from Emit to Resolve.
9088 * statement.cs (Using): Moved all code that does variable lookups
9089 and resolvings from Emit to Resolve.
9091 2002-07-29 Martin Baulig <martin@gnome.org>
9093 * attribute.cs (Attribute.Resolve): Explicitly catch a
9094 System.NullReferenceException when creating the
9095 CustromAttributeBuilder and report a different warning message.
9097 2002-07-29 Martin Baulig <martin@gnome.org>
9099 * support.cs (ParameterData.ParameterName): Added method to
9100 get the name of a parameter.
9102 * typemanager.cs (TypeManager.IsValueType): New public method.
9104 2002-07-29 Martin Baulig <martin@gnome.org>
9106 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
9107 is a flag which specifies that it's either ref or out.
9108 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
9109 the out parameter to `out Parameter.Modifier mod', also set the
9110 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
9112 * support.cs (InternalParameters.ParameterModifier): Distinguish
9113 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9114 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9116 * expression.cs (Argument.GetParameterModifier): Distinguish
9117 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
9118 Parameter.Modifier.ISBYREF flag if it's either ref or out.
9120 2002-07-29 Martin Baulig <martin@gnome.org>
9122 * expression.cs (ParameterReference.ParameterReference): Added
9123 `Location loc' argument to the constructor.
9125 * cs-parser.jay: Pass location to ParameterReference.
9127 2002-07-28 Miguel de Icaza <miguel@ximian.com>
9129 * statement.cs (Try): Initialize the location.
9131 * cs-parser.jay: pass location to Try.
9133 * expression.cs (Unary.Reduce): Change the prototype to return
9134 whether a constant fold could be performed or not. The result is
9135 returned in an out parameters. In the case of Indirection and
9136 AddressOf, we want to perform the full tests.
9138 2002-07-26 Miguel de Icaza <miguel@ximian.com>
9140 * statement.cs (Statement.Emit): Flag dead code.
9142 2002-07-27 Andrew Birkett <andy@nobugs.org>
9144 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
9146 2002-07-27 Martin Baulig <martin@gnome.org>
9148 * class.cs (MethodData.Define): Put back call to
9149 TypeManager.AddMethod(), accidentally commented this out.
9151 * report.cs (Debug): New public method to print debugging information,
9152 this is `[Conditional ("DEBUG")]'.
9154 2002-07-26 Martin Baulig <martin@gnome.org>
9156 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
9157 (switch_statement): Push the current_block to the switch_stack and
9158 pop it again when we're done with the switch.
9159 (switch_section): The new block is a child of the current_block.
9160 Fixes bug #24007, added test-152.cs.
9162 2002-07-27 Martin Baulig <martin@gnome.org>
9164 * expression.cs (Invocation.EmitArguments): When calling a varargs
9165 function with only its fixed arguments, we need to pass an empty
9168 2002-07-27 Martin Baulig <martin@gnome.org>
9170 Mono 0.13 has been released.
9172 2002-07-25 Miguel de Icaza <miguel@ximian.com>
9174 * driver.cs: Rename --resource to --linkres, because that is what
9175 we do currently, we dont support --resource yet.
9177 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
9179 2002-07-25 Martin Baulig <martin@gnome.org>
9181 * class.cs (MethodData): New public class. This is a `method builder'
9182 class for a method or one accessor of a Property/Indexer/Event.
9183 (MethodData.GetMethodFlags): Moved here from MemberBase.
9184 (MethodData.ApplyAttributes): Likewise.
9185 (MethodData.ApplyObsoleteAttribute): Likewise.
9186 (MethodData.ApplyConditionalAttribute): Likewise.
9187 (MethodData.ApplyDllImportAttribute): Likewise.
9188 (MethodData.CheckAbstractAndExternal): Likewise.
9189 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
9190 (MethodData.Emit): Formerly known as Method.Emit().
9191 (MemberBase): Moved everything which was specific to a single
9192 accessor/method to MethodData.
9193 (Method): Create a new MethodData and call Define() and Emit() on it.
9194 (Property, Indexer, Event): Create a new MethodData objects for each
9195 accessor and call Define() and Emit() on them.
9197 2002-07-25 Martin Baulig <martin@gnome.org>
9199 Made MethodCore derive from MemberBase to reuse the code from there.
9200 MemberBase now also checks for attributes.
9202 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
9203 (MemberBase.GetMethodFlags): Moved here from class Method and marked
9205 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
9206 `CallingConventions cc' and `Attributes opt_attrs' arguments.
9207 (MemberBase.ApplyAttributes): New virtual method; applies the
9208 attributes to a method or accessor.
9209 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
9210 (MemberBase.ApplyConditionalAttribute): Likewise.
9211 (MemberBase.ApplyDllImportAttribute): Likewise.
9212 (MemberBase.CheckAbstractAndExternal): Likewise.
9213 (MethodCore.ParameterTypes): This is now a property instead of a
9214 method, it's initialized from DoDefineParameters().
9215 (MethodCore.ParameterInfo): Removed the set accessor.
9216 (MethodCore.DoDefineParameters): New protected virtual method to
9217 initialize ParameterTypes and ParameterInfo.
9218 (Method.GetReturnType): We can now simply return the MemberType.
9219 (Method.GetMethodFlags): Override the MemberBase version and add
9220 the conditional flags.
9221 (Method.CheckBase): Moved some code from Define() here, call
9222 DoDefineParameters() here.
9223 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
9224 here to avoid some larger code duplication.
9225 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
9226 ensure that abstract and external accessors don't declare a body.
9228 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
9229 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
9230 lookup in the attribute's parent classes, so we need to abort as soon
9231 as we found the first match.
9232 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
9233 the attribute has no arguments.
9235 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
9238 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9240 * cs-parser.jay: reverted previous patch.
9242 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9244 * cs-parser.jay: fixed bug #22119.
9246 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9248 * attribute.cs: fixed compilation. The error was:
9249 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
9250 be assigned to before control leaves the current method."
9251 [FIXME: Filed as bug #28186: MCS must report this error.]
9253 2002-07-25 Martin Baulig <martin@gnome.org>
9255 * attribute.cs (Attribute.Conditional_GetConditionName): New static
9256 method to pull the condition name ouf of a Conditional attribute.
9257 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
9258 the obsolete message and error flag out of an Obsolete attribute.
9260 * class.cs (Method.GetMethodFlags): New public method to get the
9261 TypeManager.MethodFlags for this method.
9262 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
9264 (Method.Define): Get and apply the Obsolete and Conditional attributes;
9265 if we're overriding a virtual function, set the new private variable
9266 `parent_method'; call the new TypeManager.AddMethod().
9268 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
9269 the MethodBuilder and the Method in a PtrHashtable.
9270 (TypeManager.builder_to_method): Added for this purpose.
9271 (TypeManager.MethodFlags): Added IsObsoleteError.
9272 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
9273 Obsolete and Conditional arguments in MethodBuilders. If we discover
9274 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
9275 the message from the attribute.
9277 2002-07-24 Martin Baulig <martin@gnome.org>
9279 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
9280 preprocessor directives, ensure that the argument to #define/#undef is
9281 exactly one identifier and that it's actually an identifier.
9283 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
9286 2002-07-24 Martin Baulig <martin@gnome.org>
9288 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
9289 initialize it to TypeManager.object_type in the constructor.
9290 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
9291 of the `hm.get_current' method if we're using the collection pattern.
9292 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
9293 for the explicit conversion to make it work when we're using the collection
9294 pattern and the `Current' property has a different return type than `object'.
9297 2002-07-24 Martin Baulig <martin@gnome.org>
9299 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
9300 does not match, but don't report any errors. This method is called in
9301 order for all methods in a MethodGroupExpr until a matching method is
9302 found, so we don't want to bail out if the first method doesn't match.
9303 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
9304 matches, report the 123. Fixes #28070.
9306 2002-07-24 Martin Baulig <martin@gnome.org>
9308 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
9309 TypeManager.TypeToCoreType() to the top of the method so the
9310 following equality checks will work. Fixes #28107.
9312 2002-07-24 Martin Baulig <martin@gnome.org>
9314 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
9315 operand is of type uint, and the other operand is of type sbyte,
9316 short or int, the operands are converted to type long." -
9317 Actually do what this comment already told us. Fixes bug #28106,
9320 2002-07-24 Martin Baulig <martin@gnome.org>
9322 * class.cs (MethodBase): New abstract class. This is now a base
9323 class for Property, Indexer and Event to avoid some code duplication
9324 in their Define() and DefineMethods() methods.
9325 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
9326 generic methods for Define() and DefineMethods().
9327 (FieldBase): Derive from MemberBase, not MemberCore.
9328 (Property): Derive from MemberBase, not MemberCore.
9329 (Property.DefineMethod): Moved all the code from this method to the
9330 new MethodBase.DefineAccessor(), just call it with appropriate
9332 (Property.Define): Call the new Property.DoDefine(), this does some
9333 sanity checks and we don't need to duplicate the code everywhere.
9334 (Event): Derive from MemberBase, not MemberCore.
9335 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
9336 accessors, this will also make them work with interface events.
9337 (Indexer): Derive from MemberBase, not MemberCore.
9338 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
9339 (Indexer.Define): Use the new MethodBase functions.
9341 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
9342 argument to the constructor.
9343 (Interface.FindMembers): Added support for interface events.
9344 (Interface.PopluateEvent): Implemented.
9346 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
9348 2002-07-22 Miguel de Icaza <miguel@ximian.com>
9350 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
9351 but this is required to check for a method name being the same as
9352 the containing class.
9356 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9358 * interface.cs: initialize variable.
9360 2002-07-23 Martin Baulig <martin@gnome.org>
9362 Implemented the IndexerName attribute in interfaces.
9364 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
9365 name if this is an explicit interface implementation.
9366 (Indexer.InterfaceIndexerName): New public variable. If we're
9367 implementing an interface indexer, this is the IndexerName in that
9368 interface. Otherwise, it's the IndexerName.
9369 (Indexer.DefineMethod): If we're implementing interface indexer,
9370 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
9371 and Pending.ImplementIndexer methods.
9372 (Indexer.Define): Also define the PropertyBuilder if we're
9373 implementing an interface indexer and this is neither an explicit
9374 interface implementation nor do the IndexerName match the one in
9377 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
9378 If a method is defined here, then we always need to create a proxy
9379 for it. This is used when implementing interface indexers.
9380 (Pending.IsInterfaceIndexer): New public method.
9381 (Pending.ImplementIndexer): New public method.
9382 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
9383 This is used when implementing interface indexers to define a proxy
9385 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
9386 define a proxy if necessary.
9388 * interface.cs (Interface.IndexerName): New public variable.
9389 (Interface.PopulateIndexer): Set the IndexerName.
9390 (Interface.DefineIndexers): New private method. Populate all the
9391 indexers and make sure their IndexerNames match.
9393 * typemanager.cs (IndexerPropertyName): Added support for interface
9396 2002-07-22 Martin Baulig <martin@gnome.org>
9398 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
9399 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
9400 ret if HasReturnLabel.
9401 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
9404 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
9405 and set the ec.LoopBeginTryCatchLevel.
9406 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
9407 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
9408 the current ec.TryCatchLevel, the branch goes out of an exception
9409 block. In this case, we need to use Leave and not Br.
9411 2002-07-22 Martin Baulig <martin@gnome.org>
9413 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
9414 block unless the block does not always return or it is contained in
9415 another try { ... } catch { ... } block. Fixes bug #26506.
9416 Added verify-1.cs to the test suite.
9418 2002-07-22 Martin Baulig <martin@gnome.org>
9420 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
9421 then we do not always return. Fixes bug #24985.
9423 2002-07-22 Martin Baulig <martin@gnome.org>
9425 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
9426 lookup on a per-class level; ie. walk up the class hierarchy until we
9427 found at least one applicable method, then choose the best among them.
9428 Fixes bug #24463 and test-29.cs.
9430 2002-07-22 Martin Baulig <martin@gnome.org>
9432 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
9433 return types of the methods. The return type is not part of the
9434 signature and we must not check it to make the `new' modifier work.
9435 Fixes bug #27999, also added test-147.cs.
9436 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
9438 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
9439 on the method's return type.
9441 2002-07-21 Martin Baulig <martin@gnome.org>
9443 * assign.cs: Make this work if the rightmost source is a constant and
9444 we need to do an implicit type conversion. Also adding a few more tests
9445 to test-38.cs which should have caught this.
9447 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
9448 target in the makefile for this. The makefile.gnu is primarily intended
9449 for end-users who don't want to debug the compiler.
9451 2002-07-21 Martin Baulig <martin@gnome.org>
9453 * assign.cs: Improved the Assign class so it can now handle embedded
9454 assignments (X = Y = Z = something). As a side-effect this'll now also
9455 consume less local variables. test-38.cs now passes with MCS, added
9456 a few new test cases to that test.
9458 2002-07-20 Martin Baulig <martin@gnome.org>
9460 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
9461 instructions. Fixes bug #27977, also added test-146.cs.
9463 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9465 * cs-tokenizer.cs: fixed getHex ().
9467 2002-07-19 Martin Baulig <martin@gnome.org>
9469 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
9470 not Type.GetType() to lookup the array type. This is needed when
9471 we're constructing an array of a user-defined type.
9472 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
9473 single-dimensional arrays, but also for single-dimensial arrays of
9476 2002-07-19 Martin Baulig <martin@gnome.org>
9478 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
9479 this function is called, it's not allowed to share LocalBuilders
9482 2002-07-19 Martin Baulig <martin@gnome.org>
9484 * expression.cs (Argument.Resolve): Report an error 118 when trying
9485 to pass a type as argument.
9487 2002-07-18 Martin Baulig <martin@gnome.org>
9489 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
9490 Conv_R_Un for the signed `long' type.
9492 2002-07-15 Miguel de Icaza <miguel@ximian.com>
9494 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
9495 `expr' for the temporary result, as that will fail if we do
9496 multiple resolves on the same expression.
9498 2002-07-05 Miguel de Icaza <miguel@ximian.com>
9500 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
9501 ec.TypeContainer for looking up aliases.
9503 * class.cs (TypeContainer): Remove LookupAlias from here.
9505 * decl.cs (DeclSpace); Move here.
9507 2002-07-01 Miguel de Icaza <miguel@ximian.com>
9509 * class.cs (FindMembers): Only call filter if the constructor
9510 bulider is not null.
9512 Also handle delegates in `NestedTypes' now. Now we will perform
9513 type lookups using the standard resolution process. This also
9516 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
9517 This uses Expressions (the limited kind that can be parsed by the
9518 tree) instead of strings.
9520 * expression.cs (ComposedCast.ToString): Implement, used to flag
9521 errors since now we have to render expressions.
9523 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
9526 * ecore.cs (SimpleName.ToString): ditto.
9528 * cs-parser.jay: Instead of using strings to assemble types, use
9529 Expressions to assemble the type (using SimpleName, ComposedCast,
9530 MemberAccess). This should fix the type lookups in declarations,
9531 because we were using a different code path for this.
9533 * statement.cs (Block.Resolve): Continue processing statements
9534 even when there is an error.
9536 2002-07-17 Miguel de Icaza <miguel@ximian.com>
9538 * class.cs (Event.Define): Also remove the `remove' method from
9539 the list of pending items.
9541 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
9542 generate more compact code.
9544 2002-07-17 Martin Baulig <martin@gnome.org>
9546 * const.cs (Const.LookupConstantValue): Add support for constant
9547 `unchecked' and `checked' expressions.
9548 Also adding test case test-140.cs for this.
9550 2002-07-17 Martin Baulig <martin@gnome.org>
9552 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
9553 check whether mi.ReturnType implements the IEnumerator interface; the
9554 `==' and the IsAssignableFrom() will fail in this situation.
9556 2002-07-16 Ravi Pratap <ravi@ximian.com>
9558 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
9561 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9563 * expression.cs: fixed bug #27811.
9565 2002-07-14 Miguel de Icaza <miguel@ximian.com>
9567 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
9568 Molaro: when we are a ref, the value already contains a pointer
9569 value, do not take the address of it.
9571 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
9572 * removed mb-parser.jay and mb-tokenizer.cs
9574 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9576 * expression.cs: check against the building corlib void type.
9578 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
9580 * ecore.cs: fix for valuetype static readonly fields: when
9581 initializing them, we need their address, not the address of a copy.
9583 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
9585 * typemanager.cs: register also enum_type in corlib.
9587 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9589 * class.cs: allow calling this (but not base) initializers in structs.
9591 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
9593 * ecore.cs: make sure we compare against the building base types
9596 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
9598 * typemanager.cs: fix TypeToCoreType() to handle void and object
9599 (corlib gets no more typerefs after this change).
9601 2002-07-12 Miguel de Icaza <miguel@ximian.com>
9603 * expression.cs (ArrayCreation.EmitArrayArguments): use
9604 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
9606 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
9607 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
9608 array indexes, the runtime actually forbids them.
9610 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
9611 for array arguments here.
9613 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
9614 instead of the default for ValueTypes.
9616 (New.DoEmit): Use IsValueType instead of
9617 IsSubclassOf (value_type)
9618 (New.DoResolve): ditto.
9619 (Invocation.EmitCall): ditto.
9621 * assign.cs (Assign): ditto.
9623 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
9624 Statements *are* currently doing part of their resolution during
9627 Expressions do always resolve during resolve, but statements are
9628 only required to propagate resolution to their children.
9630 2002-07-11 Miguel de Icaza <miguel@ximian.com>
9632 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
9634 (LoadAssembly): Do not add the dll if it is already specified
9636 (MainDriver): Add the System directory to the link path at the end,
9637 after all the other -L arguments.
9639 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
9640 wrong opcode for loading bytes and bools (ldelem.i1 instead of
9641 ldelem.u1) and using the opposite for sbytes.
9643 This fixes Digger, and we can finally run it.
9645 * driver.cs (UnixParseOption): Move the option parsing here.
9646 (CSCParseOption): Implement CSC-like parsing of options.
9648 We now support both modes of operation, the old Unix way, and the
9649 new CSC-like way. This should help those who wanted to make cross
9652 The only thing broken is that /r:, /reference: and /lib: are not
9653 implemented, because I want to make those have the same semantics
9654 as the CSC compiler has, and kill once and for all the confussion
9655 around this. Will be doing this tomorrow.
9657 * statement.cs (Unsafe.Resolve): The state is checked during
9658 resolve, not emit, so we have to set the flags for IsUnsfe here.
9660 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9662 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
9663 not catch the Error_ObjectRefRequired in SimpleName (as it is
9664 possible to have a class/instance variable name that later gets
9665 deambiguated), we have to check this here.
9667 2002-07-10 Ravi Pratap <ravi@ximian.com>
9669 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
9670 make static and put into Expression.
9672 (Event.Define): Register the private field of the event with the
9673 TypeManager so that GetFieldFromEvent can get at it.
9675 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
9676 keep track of the private field associated with an event which
9679 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
9682 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
9684 2002-07-10 Miguel de Icaza <miguel@ximian.com>
9686 * expression.cs (Binary.EmitBranchable): this routine emits the
9687 Binary expression in a branchable context. This basically means:
9688 we need to branch somewhere, not just get the value on the stack.
9690 This works together with Statement.EmitBoolExpression.
9692 * statement.cs (Statement.EmitBoolExpression): Use
9695 2002-07-09 Miguel de Icaza <miguel@ximian.com>
9697 * statement.cs (For): Reduce the number of jumps in loops.
9699 (For): Implement loop inversion for the For statement.
9701 (Break): We can be breaking out of a Try/Catch controlled section
9702 (foreach might have an implicit try/catch clause), so we need to
9703 use Leave instead of Br.
9705 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
9706 now). If the instace expression supports IMemoryLocation, we use
9707 the AddressOf method from the IMemoryLocation to extract the
9708 address instead of emitting the instance.
9710 This showed up with `This', as we were emitting the instance
9711 always (Emit) instead of the Address of This. Particularly
9712 interesting when This is a value type, as we dont want the Emit
9713 effect (which was to load the object).
9715 2002-07-08 Miguel de Icaza <miguel@ximian.com>
9717 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
9719 * statement.cs (Checked): Set the CheckedState during the resolve
9720 process too, as the ConvCast operations track the checked state on
9721 the resolve process, and not emit.
9723 * cs-parser.jay (namespace_member_declaration): Flag that we have
9724 found a declaration when we do. This is used to flag error 1529
9726 * driver.cs: Report ok when we display the help only.
9728 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
9730 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
9732 2002-07-04 Miguel de Icaza <miguel@ximian.com>
9734 * cs-tokenizer.cs (define): We also have to track locally the
9735 defines. AllDefines is just used for the Conditional Attribute,
9736 but we also need the local defines for the current source code.
9738 2002-07-03 Miguel de Icaza <miguel@ximian.com>
9740 * statement.cs (While, For, Do): These loops can exit through a
9741 Break statement, use this information to tell whether the
9742 statement is the last piece of code.
9744 (Break): Flag that we break.
9746 * codegen.cs (EmitContexts): New `Breaks' state variable.
9748 2002-07-03 Martin Baulig <martin@gnome.org>
9750 * class.cs (TypeContainer.MethodModifiersValid): Allow override
9751 modifiers in method declarations in structs. Otherwise, you won't
9752 be able to override things like Object.Equals().
9754 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9756 * class.cs (Method, Property, Indexer): Do not allow the public
9757 modifier to be used in explicit interface implementations.
9759 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
9760 override modifiers in method declarations in structs
9762 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
9764 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
9765 integer or real overflow, report an error
9767 2002-07-02 Martin Baulig <martin@gnome.org>
9769 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
9770 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
9771 to tell the runtime about our newly created System.Object and
9772 System.ValueType types.
9774 2002-07-02 Miguel de Icaza <miguel@ximian.com>
9776 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
9777 struct instead of Ldarg/Starg.
9779 2002-07-02 Martin Baulig <martin@gnome.org>
9781 * expression.cs (Indirection.Indirection): Call
9782 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
9784 2002-07-02 Martin Baulig <martin@gnome.org>
9786 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
9787 ValueType, call TypeManager.TypeToCoreType() on it.
9788 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
9789 the OpCodes.Newarr argument.
9791 2002-07-02 Martin Baulig <martin@gnome.org>
9793 * expression.cs (Invocation.EmitCall): When compiling corlib,
9794 replace all calls to the system's System.Array type to calls to
9795 the newly created one.
9797 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
9798 System.Array methods.
9799 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
9800 from the system's System.Array type which must be replaced.
9802 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
9804 * typemanager.cs: load unverifiable_code_ctor so we can build
9805 corlib using the correct type. Avoid using GetTypeCode() with
9807 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
9808 TypeManager.object_type to allow building corlib.
9810 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
9812 * ecore.cs: handle System.Enum separately in LoadFromPtr().
9814 2002-07-01 Martin Baulig <martin@gnome.org>
9816 * class.cs: Make the last change actually work, we need to check
9817 whether `ifaces != null' to avoid a crash.
9819 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
9821 * class.cs: when we build structs without fields that implement
9822 interfaces, we need to add the interfaces separately, since there is
9823 no API to both set the size and add the interfaces at type creation
9826 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
9828 * expression.cs: the dimension arguments to the array constructors
9829 need to be converted if they are a long.
9831 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
9833 * class.cs: don't emit ldarg.0 if there is no parent constructor
9834 (fixes showstopper for corlib).
9836 2002-06-29 Martin Baulig <martin@gnome.org>
9838 MCS now compiles corlib on GNU/Linux :-)
9840 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
9841 ie. check for MethodImplOptions.InternalCall.
9843 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
9844 and TypeManager.attribute_type are null, so we must explicitly check
9845 whether parent is not null to find out whether it's an attribute type.
9846 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
9847 and SetBuilder, not only if the property is neither abstract nor external.
9848 This is necessary to set the MethodImplOptions on the accessor methods.
9849 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
9850 SetBuilder, see Property.Emit().
9852 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
9853 populate "System.Object", "System.ValueType" and "System.Attribute" since
9854 they've already been populated from BootCorlib_PopulateCoreTypes().
9856 2002-06-29 Martin Baulig <martin@gnome.org>
9858 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
9859 is the NullLiteral, we also need to make sure that target_type is not
9862 2002-06-29 Martin Baulig <martin@gnome.org>
9864 * rootcontext.cs (RootContext.ResolveCore): We must initialize
9865 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
9866 before calling BootstrapCorlib_ResolveDelegate ().
9868 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
9870 * statement.cs: fixed build-breaker. All tests passed ok.
9872 2002-06-27 Martin Baulig <martin@gnome.org>
9874 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
9875 for System.Decimal when compiling corlib.
9877 2002-06-27 Martin Baulig <martin@gnome.org>
9879 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
9880 switch blocks which contain nothing but a default clause.
9882 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
9884 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
9886 2002-06-27 Martin Baulig <martin@gnome.org>
9888 * ecore.cs (PropertyExpr.PropertyExpr): Call
9889 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
9891 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
9892 is already a TypeBuilder.
9894 2002-06-27 Martin Baulig <martin@gnome.org>
9896 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
9897 `target_type == TypeManager.array_type', not IsAssignableFrom() in
9898 the "from an array-type to System.Array" case. This makes it work
9899 when compiling corlib.
9901 2002-06-27 Martin Baulig <martin@gnome.org>
9903 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
9904 non-static PropertyExpr, set its InstanceExpression. This makes
9905 the `ICollection.Count' property work in System/Array.cs.
9907 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
9909 * driver.cs: Made error handling more consistent. Errors now
9910 tracked by Report class, so many methods which used to return int
9911 now return void. Main() now prints success/failure and
9912 errors/warnings message.
9914 Renamed '--probe' compiler argument to '--expect-error'. Removed
9915 the magic number return values (123 and 124). Now, if the
9916 expected error occurs, the compiler exits with success (exit value
9917 0). If the compilation completes without seeing that particular
9918 error, the compiler exits with failure (exit value 1). The
9919 makefile in mcs/errors has been changed to handle the new behaviour.
9921 * report.cs: Made 'expected error' number a property and renamed
9922 it from 'Probe' to 'ExpectedError'.
9924 * genericparser.cs: Removed error handling support, since it is
9925 now all done by Report class.
9927 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
9928 class, so parse() no longer returns an int.
9930 * namespace.cs: Use Report.Error instead of GenericParser.error
9932 2002-06-22 Miguel de Icaza <miguel@ximian.com>
9934 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
9935 TypeContainer.AddOperator): At the front of the list put the
9936 explicit implementations, so they get resolved/defined first.
9938 2002-06-21 Miguel de Icaza <miguel@ximian.com>
9940 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
9941 interface type is implemented by this TypeContainer. Used during
9942 explicit interface implementation.
9944 (Property.Define, Indexer.Define, Method.Define): Validate that
9945 the given interface in the explicit implementation is one of the
9946 base classes for the containing type.
9948 Also if we are explicitly implementing an interface, but there is
9949 no match in the pending implementation table, report an error.
9951 (Property.Define): Only define the property if we are
9952 not explicitly implementing a property from an interface. Use the
9953 correct name also for those properties (the same CSC uses,
9954 although that is really not needed).
9956 (Property.Emit): Do not emit attributes for explicitly implemented
9957 properties, as there is no TypeBuilder.
9959 (Indexer.Emit): ditto.
9961 Hiding then means that we do not really *implement* a pending
9962 implementation, which makes code fail.
9964 2002-06-22 Martin Baulig <martin@gnome.org>
9966 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
9967 the return value of Object.GetType(). [FIXME: we need to do this whenever
9968 we get a type back from the reflection library].
9970 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
9972 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
9974 2002-06-20 Miguel de Icaza <miguel@ximian.com>
9976 * attribute.cs: Return null if we can not look up the type.
9978 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
9979 the interface types found.
9981 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
9982 interface types found.
9984 * typemanager.cs (GetInterfaces): Make this routine returns alll
9985 the interfaces and work around the lame differences between
9986 System.Type and System.Reflection.Emit.TypeBuilder in the results
9987 result for GetInterfaces.
9989 (ExpandInterfaces): Given an array of interface types, expand and
9990 eliminate repeated ocurrences of an interface. This expands in
9991 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
9994 2002-06-21 Martin Baulig <martin@gnome.org>
9996 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
9999 2002-06-21 Martin Baulig <martin@gnome.org>
10001 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
10002 and called with one of the core types, return the corresponding typebuilder for
10005 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
10008 2002-06-21 Martin Baulig <martin@gnome.org>
10010 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
10011 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
10012 (Expression.ConvertReferenceExplicit): Likewise.
10014 * expression.cs (ElementAccess.DoResolve): Likewise.
10015 (ElementAccess.DoResolveLValue): Likewise.
10017 2002-06-10 Martin Baulig <martin@gnome.org>
10019 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
10020 add the "value" parameter to the parameter list.
10022 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
10025 2002-06-19 Miguel de Icaza <miguel@ximian.com>
10027 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
10028 the argument to an int, uint, long or ulong, per the spec. Also
10029 catch negative constants in array creation.
10031 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
10033 * class.cs: do not allow the same interface to appear twice in
10034 the definition list.
10036 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
10038 * ecore.cs: don't use ldlen with System.Array.
10040 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
10042 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
10044 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
10046 * modifiers.cs: produce correct field attributes for protected
10047 internal. Easy fix so miguel can work on ther harder stuff:-)
10049 2002-06-18 Miguel de Icaza <miguel@ximian.com>
10051 * pending.cs: New file. Move the code from class.cs here.
10052 Support clearning the pending flag for all methods (when not doing
10053 explicit interface implementation).
10055 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
10057 * rootcontext.cs: added a couple more types needed to bootstrap.
10059 2002-06-17 Miguel de Icaza <miguel@ximian.com>
10061 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
10062 constructor in the type, instead of any constructor in the type
10063 hierarchy. Thanks to Paolo for finding this bug (it showed up as
10064 a bug in the Mono runtime when applying the params attribute).
10066 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
10067 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
10069 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
10071 * expression.cs (Unary.ResolveOperator): Use TypeManager
10072 to resolve the type.
10074 2002-06-13 Ravi Pratap <ravi@ximian.com>
10076 * cs-parser.jay (enum_member_declaration): Pass in the attributes
10079 * enum.cs (AddEnumMember): Add support to store the attributes associated
10080 with each member too.
10082 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
10083 field builders too - this takes care of the enum member case.
10085 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
10087 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
10088 address-of operator on both value types and pointers.
10090 2002-06-10 Martin Baulig <martin@gnome.org>
10092 * interface.cs (Interface.PopulateIndexer): Add the indexer's
10093 PropertyBuilder to the `property_builders' list.
10095 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
10096 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
10097 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
10098 find any indexers which are inherited from an interface.
10100 2002-06-09 Martin Baulig <martin@gnome.org>
10102 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
10103 the same type as the constant if necessary. There's also a test-130.cs
10106 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
10108 * typemanager.cs (TypeManager.ChangeType): Previously known as
10109 Enum.ChangeEnumType().
10111 2002-06-09 Martin Baulig <martin@gnome.org>
10113 * expression.cs (Cast.TryReduce): Added support for consts.
10115 2002-06-08 Ravi Pratap <ravi@ximian.com>
10117 * class.cs (Accessor): Hold attributes information so we can pass
10120 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
10121 Modify to pass in attributes attached to the methods.
10123 (add_accessor_declaration, remove_accessor_declaration): Ditto.
10125 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
10126 to handle the Accessor kind :-)
10128 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
10130 2002-06-08 Martin Baulig <martin@gnome.org>
10132 * expression.cs (Unary.TryReduceNegative): Added support for
10135 2002-06-08 Martin Baulig <martin@gnome.org>
10137 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
10138 name can't be found in the `defined_names' - the caller will do a
10139 MemberLookup in this case and thus find methods in System.Enum
10140 such as Enum.IsDefined().
10142 2002-06-08 Martin Baulig <martin@gnome.org>
10144 * enum.cs (Enum.ChangeEnumType): This is a custom version of
10145 Convert.ChangeType() which works with TypeBuilder created types.
10146 (Enum.LookupEnumValue, Enum.Define): Use it here.
10148 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
10149 `TypeBuilder.BaseType != null' check.
10150 (TypeContainer.FindMembers): Only lookup parent members if we
10151 actually have a parent.
10152 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
10153 (ConstructorInitializer.Resolve): Likewise.
10155 * interface.cs (Interface.FindMembers): Added
10156 `TypeBuilder.BaseType != null' check.
10158 * rootcontext.cs (RootContext.ResolveCore): Added
10159 "System.Runtime.CompilerServices.IndexerNameAttribute" to
10160 classes_second_stage.
10162 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
10163 debug_type and trace_type when compiling with --nostdlib.
10165 2002-06-07 Martin Baulig <martin@gnome.org>
10167 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
10168 (AddField): Set it to true when adding a non-static field.
10169 (DefineType): Use `have_nonstatic_fields' to find out whether we
10170 have non-static fields, not `Fields != null'.
10172 2002-06-02 Miguel de Icaza <miguel@ximian.com>
10174 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
10175 dereferencing a null on the static-field code path)
10177 2002-05-30 Martin Baulig <martin@gnome.org>
10179 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
10180 to take command line arguments. Use reflection to call the new
10181 custom `Initialize' function on the symbol writer and pass it the
10182 command line arguments.
10184 * driver.cs (--debug-args): New command line argument to pass command
10185 line arguments to the symbol writer.
10187 2002-05-28 Miguel de Icaza <miguel@ximian.com>
10189 * assign.cs (DoResolve): Forgot to do the implicit conversion to
10190 the target type for indexers and properties. Thanks to Joe for
10193 2002-05-27 Miguel de Icaza <miguel@ximian.com>
10195 * typemanager.cs (MethodFlags): returns the method flags
10196 (Obsolete/ShouldIgnore) that control warning emission and whether
10197 the invocation should be made, or ignored.
10199 * expression.cs (Invocation.Emit): Remove previous hack, we should
10200 not do this on matching a base type, we should do this based on an attribute
10202 Only emit calls to System.Diagnostics.Debug and
10203 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
10204 on the command line.
10206 * rootcontext.cs: Global settings for tracing and debugging.
10208 * cs-tokenizer.cs (define): New utility function to track
10209 defines. Set the global settings for TRACE and DEBUG if found.
10211 2002-05-25 Ravi Pratap <ravi@ximian.com>
10213 * interface.cs (Populate*): Pass in the TypeContainer as well as
10214 the DeclSpace as parameters so that we can create EmitContexts and
10215 then use that to apply attributes etc.
10217 (PopulateMethod, PopulateEvent, PopulateProperty)
10218 (PopulateIndexer): Apply attributes everywhere.
10220 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
10223 (ApplyAttributes): Update accordingly.
10225 We now apply interface attributes for all members too.
10227 2002-05-26 Miguel de Icaza <miguel@ximian.com>
10229 * class.cs (Indexer.Define); Correctly check if we are explicit
10230 implementation (instead of checking the Name for a ".", we
10231 directly look up if the InterfaceType was specified).
10233 Delay the creation of the PropertyBuilder.
10235 Only create the PropertyBuilder if we are not an explicit
10236 interface implementation. This means that explicit interface
10237 implementation members do not participate in regular function
10238 lookups, and hence fixes another major ambiguity problem in
10239 overload resolution (that was the visible effect).
10241 (DefineMethod): Return whether we are doing an interface
10244 * typemanager.cs: Temporary hack until we get attributes in
10245 interfaces (Ravi is working on that) and we get IndexerName
10246 support in interfaces.
10248 * interface.cs: Register the indexers as properties.
10250 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
10251 warning, I have verified that this is a bug in the .NET runtime
10252 (JavaScript suffers of the same problem).
10254 * typemanager.cs (MemberLookup): When looking up members for
10255 interfaces, the parent of an interface is the implicit
10256 System.Object (so we succeed in searches of Object methods in an
10257 interface method invocation. Example: IEnumerable x; x.ToString
10260 2002-05-25 Miguel de Icaza <miguel@ximian.com>
10262 * class.cs (Event): Events should also register if they do
10263 implement the methods that an interface requires.
10265 * typemanager.cs (MemberLookup); use the new GetInterfaces
10268 (GetInterfaces): The code used to lookup interfaces for a type is
10269 used in more than one place, factor it here.
10271 * driver.cs: Track the errors at the bottom of the file, we kept
10274 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
10275 instance if the method we are calling is static!
10277 2002-05-24 Miguel de Icaza <miguel@ximian.com>
10279 * attribute.cs (ApplyAttributes): Make this function filter out
10280 the IndexerName attribute (as that attribute in reality is never
10281 applied) and return the string constant for the IndexerName
10284 * class.cs (TypeContainer.Emit): Validate that all the indexers
10285 have the same IndexerName attribute, and if so, set the
10286 DefaultName attribute on the class.
10288 * typemanager.cs: The return value might contain other stuff (not
10289 only methods). For instance, consider a method with an "Item"
10290 property and an Item method.
10292 * class.cs: If there is a problem with the parameter types,
10295 2002-05-24 Ravi Pratap <ravi@ximian.com>
10297 * ecore.cs (ImplicitConversionExists): Wrapper function which also
10298 looks at user defined conversion after making a call to
10299 StandardConversionExists - we need this for overload resolution.
10301 * expression.cs : Update accordingly the various method calls.
10303 This fixes 2 bugs filed against implicit user defined conversions
10305 2002-05-22 Miguel de Icaza <miguel@ximian.com>
10307 * statement.cs: Track the result of the assignment.
10309 2002-05-21 Miguel de Icaza <miguel@ximian.com>
10311 * expression.cs (MemberAccess): Improved error reporting for
10312 inaccessible members.
10314 2002-05-22 Martin Baulig <martin@gnome.org>
10316 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
10317 itself with debugging support.
10319 2002-05-22 Martin Baulig <martin@gnome.org>
10321 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
10322 Removed, this isn't needed anymore.
10324 2002-05-20 Martin Baulig <martin@gnome.org>
10326 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
10327 be underlying type for an enum.
10329 2002-05-20 Miguel de Icaza <miguel@ximian.com>
10331 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
10332 that splits out the loading of just the core types.
10334 * rootcontext.cs (ResolveCore): Split the struct resolution in
10335 two, so we can load the enumeration underlying types before any
10338 * expression.cs (Is): Bandaid until we fix properly Switch (see
10339 bug #24985 for details).
10341 * typemanager.cs (ImplementsInterface): The hashtable will contain
10342 a null if there are no interfaces implemented.
10344 2002-05-18 Miguel de Icaza <miguel@ximian.com>
10346 * cs-parser.jay (indexer_declarator): It is fine to have array
10349 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10351 * typemanager.cs: (RegisterBuilder): New function used to register
10352 TypeBuilders that implement interfaces. Since
10353 TypeBuilder.GetInterfaces (as usual) does not work with lame
10355 (AddUserType): register interfaces.
10357 (ImplementsInterface): Use the builder_to_ifaces hash if we are
10358 dealing with TypeBuilder. Also, arrays are showing up as
10359 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
10360 methods can not be invoked on them!
10362 * ecore.cs (ExplicitReferenceConversionExists): Made public.
10363 (ImplicitReferenceConversionExists): Split out from
10364 StandardConversionExists.
10366 * expression.cs (As): We were only implementing one of the three
10367 cases for the as operator. We now implement them all.
10368 (Is): Implement the various other cases for Is as well.
10370 * typemanager.cs (CACHE): New define used to control if we want or
10371 not the FindMembers cache. Seems to have a negative impact on
10372 performance currently
10374 (MemberLookup): Nested types have full acess to
10375 enclosing type members
10377 Remove code that coped with instance/static returns for events, we
10378 now catch this in RealFindMembers.
10380 (RealFindMembers): only perform static lookup if the instance
10381 lookup did not return a type or an event.
10383 2002-05-17 Miguel de Icaza <miguel@ximian.com>
10385 * assign.cs (CompoundAssign): We pass more semantic information
10386 now to Compound Assignments than we did before: now we have all
10387 the information at hand, and now we resolve the target *before* we
10388 do the expression expansion, which allows the "CacheValue" method
10389 to have the effect we intended (before, a [x] += 1 would generate
10390 two differen ArrayAccess expressions from the ElementAccess,
10391 during the resolution process).
10393 (CompoundAssign.DoResolve): Resolve target and original_source here.
10395 2002-05-16 Miguel de Icaza <miguel@ximian.com>
10397 * expression.cs (ArrayAccess): dropped debugging information.
10399 * typemanager.cs: Small bug fix: I was always returning i_members,
10400 instead of one of i_members or s_members (depending on which had
10403 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
10404 method is invoked before any code generation takes place, and it
10405 is a mechanism to inform that the expression will be invoked more
10406 than once, and that the method should use temporary values to
10407 avoid having side effects
10409 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
10411 * ecore.cs (Expression.CacheTemporaries): Provide empty default
10414 * expression.cs (Indirection, ArrayAccess): Add support for
10415 CacheTemporaries in these two bad boys.
10417 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
10418 ldobj or ldind_ref.
10419 (StoreFromPtr): Handle stobj as well.
10421 * expression.cs (UnaryMutator): Share more code.
10423 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
10424 down: I was not tracking the Filter function as well, which
10425 was affecting the results of the cache.
10427 2002-05-15 Miguel de Icaza <miguel@ximian.com>
10429 * attribute.cs: Remove the hack to handle the CharSet property on
10432 2002-05-14 Miguel de Icaza <miguel@ximian.com>
10434 * attribute.cs (DoResolve): More uglyness, we now only try to
10435 resolve the attribute partially, to extract the CharSet
10436 information (only if we are a StructLayout attribute). Otherwise
10438 (GetExtraTypeInfo): Add some code to conditionally kill in the
10439 future this. I am more and more convinced that the .NET
10440 framework has special code to handle the attribute setting on
10443 * expression.cs (IsParamsMethodApplicable): Revert my previous
10444 foreach change here, it was wrong.
10446 2002-05-13 Miguel de Icaza <miguel@ximian.com>
10448 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
10449 (pp_expr): do not abort on unknown input, just return.
10450 (eval): abort if there are pending chars.
10452 * attribute.cs (Attribute.Resolve): Positional parameters are
10453 optional. Deal with that case.
10455 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
10456 the Ansi/Unicode/Auto information for the type.
10458 (TypeContainer.DefineType): instantiate the EmitContext here, as
10459 we will be using it during the type definition (to resolve
10460 attributes) and during the emit phase.
10462 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
10463 to pull type information out of the attributes
10465 (Attribute.Resolve): track the constructor builder, and allow for
10466 multiple invocations (structs and classes will use this).
10468 * ecore.cs (MemberLookupFinal): new version with all the
10469 parameters customizable.
10471 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
10472 constructors. Return if the result value is null (as the error
10473 would have been flagged already by MemberLookupFinal)
10475 Do not allow instances of abstract classes or interfaces to be
10478 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
10479 We have to compare the assembly property here when dealing with
10480 FamANDAssem and Assembly access modifiers, because we might be
10481 creating an assembly from *modules* (that means that we are not
10482 getting TypeBuilders for types defined in other modules that are
10483 part of this assembly).
10485 (Method.Emit): If the method is marked abstract and has a body,
10488 (TypeContainer.DefineMembers): If both the defined member and the
10489 parent name match are methods, then do not emit any warnings: let
10490 the Method.Define routine take care of flagging warnings. But if
10491 there is a mismatch (method overrides something else, or method is
10492 overriwritten by something, then emit warning).
10494 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
10495 set to null, this means `do not check for the return type on the
10498 (Method.Define): set the return type for the method signature to
10499 null, so that we get methods with the same name and parameters and
10500 different return types. This is used to flag warning 114 (you are
10501 hiding a method, and you probably want to use the new/override
10504 * typemanager.cs (MemberLookup): Implemented proper access
10505 control, closing a long standing set of bug reports. The problem
10506 was that the Framework only has two bits: Public and NonPublic,
10507 and NonPublic includes private and protected methods, but we need
10508 to enforce the FamANDAssem, FamOrAssem and Family.
10510 2002-05-11 Miguel de Icaza <miguel@ximian.com>
10512 * statement.cs (GotoCase): Return true: Ammounts to giving up
10513 knowledge on whether we return or not, and letting the other case
10514 be responsible for it.
10516 2002-05-10 Miguel de Icaza <miguel@ximian.com>
10518 * driver.cs: Do not load directories for each file processed, only
10519 do it if there is a pattern.
10521 * ecore.cs: Report readonly assigns here as well, as we might have
10522 been resolved only by MemberAccess.
10524 (SimpleName.SimpleNameResolve): Also be useful for LValue
10525 resolution. We need this to propagate assign to local readonly variables
10527 * typemanager.cs: Use a ptrhashtable for the criteria, because we
10528 do not want to reuse potential criteria memory.
10530 * class.cs (MyEventBuilder): Set reflected_type;
10532 * ecore.cs (Constantify): Added support for constifying bools.
10534 (RootContext.LookupType): Added a cache for values looked up in
10535 the declaration space.
10537 * typemanager.cs (FindMembers): Now is a front-end to
10538 RealFindMembers, and provides a two-level hashtable-based cache to
10541 15% performance improvement: from 22.5 to 19.2 seconds.
10543 * expression.cs (IsParamsMethodApplicable): use foreach.
10544 (Invocation.DoResolve): ditto.
10545 (New.DoResolve): ditto.
10546 (ArrayCreation.DoResolve): ditto.
10548 * ecore.cs (FindMostEncompassingType): use foreach.
10550 * delegate.cs (NewDelegate.DoResolve): Use foreach
10552 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
10553 (RemoveMethods): use foreach.
10555 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
10556 nested foreach statements instead of for, and also break out of
10557 the inner loop once a match is found.
10559 (Invocation.OverloadResolve): Use foreach, simplify the code.
10561 2002-05-08 Miguel de Icaza <miguel@ximian.com>
10563 * cfold.cs (BinaryFold): During an enumeration evaluation context,
10564 we actually unwrap the expression to allow for extra information
10567 * expression.cs: Use Shr_Un on unsigned operations.
10569 2002-05-08 Ravi Pratap <ravi@ximian.com>
10571 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
10572 applicable operators was not being considered correctly. This closes
10573 the bug Miguel reported.
10575 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
10577 * attribute.cs: check that the type derives from System.Attribute
10578 and report the correct error in that case (moved the duplicate code to
10579 its own method, too).
10581 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
10583 * attribute.cs: lookup attribute type name as the spec says: first the
10584 bare attribute name and then name + "Attribute" (nant compiles with
10585 mcs after this fix).
10587 2002-05-07 Miguel de Icaza <miguel@ximian.com>
10589 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
10590 Because of the way we parse things, we should try to see if a
10591 UIntConstant can fit in an integer.
10593 2002-05-07 Ravi Pratap <ravi@ximian.com>
10595 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
10596 when we are in an explicit context.
10598 (ConvertReferenceExplicit): When converting from Iface type S to Class
10599 T make sure the rules are implemented as an OR.
10601 * parameter.cs (ParameterType): Make it a property for now although the
10602 purpose really isn't anything immediate.
10604 * expression.cs (Is*Applicable): Do better checking on the parameter type
10605 of a ref/out parameter. The ones from the system assemblies are already
10606 marked with the correct type so we don't need to do any correction.
10608 * ecore.cs (StandardConversionExists): Conversion from Interface types to
10609 the object type is standard too so include that.
10611 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10613 * ecore.cs (StandardConversionExists): Augment with missing code:
10614 deal with IntConstant, LongConstants and Enumerations.
10616 * assign.cs: Report the error, instead of failing silently
10618 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
10619 typecontainer that they are declared, because the
10620 typecontainer/namespace will have the list of using clauses that
10621 need to be applied.
10623 Assembly Attributes were escaping the normal registration
10626 (EmitCode): Apply attributes within an EmitContext that represents
10627 the container they were declared on.
10629 * cs-parser.jay: Track bases for structs. How did I get this wrong?
10631 2002-05-06 Ravi Pratap <ravi@ximian.com>
10633 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
10634 Revamp completely - make much cleaner as we now operate only
10637 (FindMostSpecificSource, FindMostSpecificTarget): New methods
10638 to implement the logic detailed in the spec more correctly.
10640 (UserDefinedConversion): Update accordingly.
10642 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10644 * statement.cs: Return flow analysis information up.
10646 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
10649 (token): Do not consume an extra character before calling
10652 2002-05-06 Piers Haken <piersh@friskit.com>
10654 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
10656 2002-05-06 Miguel de Icaza <miguel@ximian.com>
10658 * class.cs (Constructor.Emit): Set the IsStatic flag in the
10659 EmitContext during the instance constructor initializer
10660 resolution, to stop access to instance variables.
10662 This is mandated by the spec, last paragraph of the `constructor
10663 initializers' section.
10665 2002-05-05 Miguel de Icaza <miguel@ximian.com>
10667 * cs-parser.jay, class.cs (Accessor): new class used to represent
10668 an accessor (get or set). In the past we used `null' to represent
10669 a missing accessor. But this is ambiguous because there was no
10670 way to tell in abstract indexers/properties if one of them was
10673 Now there is a way of addressing that.
10675 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
10676 instead of FindMembers.
10678 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
10679 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
10681 * attribute.cs: Treat indexers and properties as the same in terms
10682 of applying attributes
10684 * ecore.cs (FindMostEncompassedType): Use statically initialized
10685 EmptyExpressions()s like we do elsewhere to avoid creating useless
10686 objects (and we take this out of the tight loop).
10688 (GetConversionOperators): Move the code to extract the actual
10689 operators to a separate routine to clean things up.
10691 2002-05-04 Miguel de Icaza <miguel@ximian.com>
10693 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
10694 events are always registered FieldBuilders.
10696 * class.cs (FieldBase): New class shared by Fields
10698 * delegate.cs: If we are a toplevel delegate, use our full name.
10699 If we are a nested delegate, then only use our tail name.
10701 2002-05-02 Ravi Pratap <ravi@ximian.com>
10703 * expression.cs (IsApplicable): Ensure that we add the "&" to
10704 ref/out types before comparing it with the type of the argument.
10706 (IsParamsMethodApplicable): Ditto.
10708 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
10711 * delegate.cs : Handle the case when we have more than one applicable
10712 method. Flag an error only when we finish checking all.
10714 2002-05-02 Miguel de Icaza <miguel@ximian.com>
10716 * expression.cs: Add support for boolean static initializers.
10718 2002-05-01 Miguel de Icaza <miguel@ximian.com>
10720 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
10722 * parameter.cs (ComputeParameterTypes,
10723 ComputeAndDefineParameterTypes): Better error handling: now we
10724 clear the `types' cache if we fail during any of the type lookups.
10725 We also return the status code correctly to our caller
10727 * delegate.cs: If we fail to define a delegate, abort the extra
10730 * expression.cs (Binary.ResolveOperator): for
10731 operator==(object,object) and operator !=(object, object) we also
10732 have to verify that there is an implicit conversion from one to
10735 (ArrayAccess.DoResolve): Array Access can operate on
10738 2002-04-30 Miguel de Icaza <miguel@ximian.com>
10740 * assign.cs (CompoundAssign): A new class used as a "flag" that
10741 the assignment actually is happening as part of a compound
10742 assignment operator.
10744 During compound assignment, a few new rules exist to enable things
10751 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
10752 to the type of x) if y is implicitly convertible to the type of x,
10753 and the operator is a builtin operator and the return type of the
10754 operator is explicitly convertible to the type of x.
10756 * rootcontext.cs: Reset warning level to 2. 4 catches various
10757 "interesting" features in mcs, we must clean this up at some
10758 point, but currently am trying to kill other bugs ;-)
10760 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
10761 in container classes as well.
10763 * expression.cs (Binary.ResolveOperator): Handle string case
10764 before anything else (as operator overloading does emit an error
10765 before doing anything else).
10767 This code could go away when we move to a table driven model, but
10768 i could not come up with a good plan last night.
10770 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
10772 * typemanager.cs (CSharpName): reimplementation using regex.
10773 * class.cs: added null check for fields in Emit
10774 * rootcontext.cs: set warninglevel to 4
10776 2002-04-29 Miguel de Icaza <miguel@ximian.com>
10778 * typemanager.cs (CSharpName): reimplemented with Lupus
10781 2002-04-28 Miguel de Icaza <miguel@ximian.com>
10783 * statement.cs (If): correclty implement Resolve, because we were
10784 not catching sem errors in there. The same process is needed
10786 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
10789 (Statement.Warning_DeadCodeFound): Factorize code.
10790 (While): Report dead code here too.
10792 (Statement): Added Resolve virtual method to allow
10793 for resolution split from the emit code.
10795 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10797 * statement.cs (EmitBoolExpression): No longer try to resolve the
10799 (MakeBoolean): New utility function that resolve, implicitly
10800 converts to boolean and tags the expression.
10803 (If, Do): Implement dead code elimination.
10804 (While): Implement loop inversion
10806 (Do, While, For, If): Resolve the expression prior to calling our
10809 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
10812 - added method Report28 (warning: program has more than one entry point)
10813 - added method IsEntryPoint, implements paragraph 10.1 of the spec
10814 - modified method Method.Define, the part at the end of the method
10816 * rootcontext.cs: added static public Location EntryPointLocation;
10818 * ../errors/cs0028.cs : Add test case for the above warning.
10821 - modified method CSharpName to allow arrays of primitive type to
10822 be printed nicely (e.g. instead of System.Int32[][] it now prints
10824 - added method CSharpSignature: returns the signature of a method
10825 in string format to be used in reporting errors, warnings, etc.
10827 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
10830 2002-04-26 Ravi Pratap <ravi@ximian.com>
10832 * delegate.cs (Define): Fix extremely silly bug where I was
10833 setting the type of the 'object' parameter of the BeginInvoke
10834 method to System.IAsyncResult instead of System.Object ;-)
10836 2002-04-26 Miguel de Icaza <miguel@ximian.com>
10838 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
10841 (Constructor.Emit): return if we fail to initialize the
10842 constructor. Another door closed!
10844 * expression.cs (New.DoResolve): Improve error message (from -6 to
10845 1501). Use DeclaredOnly lookup to find the exact constructor.
10847 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
10848 loop. This is useful.
10850 * cs-parser.jay: Adjust the default parameters so that destructors
10851 have the proper signature.
10853 2002-04-26 Martin Baulig <martin@gnome.org>
10855 * driver.cs (LoadAssembly): If `assembly' contains any characters
10856 which are only valid in path names and not in assembly names
10857 (currently slash, backslash and point), use Assembly.LoadFrom ()
10858 instead of Assembly.Load () on the `assembly' (before iteration
10859 over the link_paths).
10861 2002-04-26 Martin Baulig <martin@gnome.org>
10863 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
10865 2002-04-25 Miguel de Icaza <miguel@ximian.com>
10867 * class.cs (Property): use the new typemanager.MemberLookup
10869 (TypeContainer.MemberLookup): Implement using the
10870 TypeManager.MemberLookup now.
10872 * typemanager.cs: Make MemberLookup a function of the TypeManager,
10873 and return MemberInfos, so that these can be used without an
10874 EmitContext (what we had before).
10876 2002-04-24 Miguel de Icaza <miguel@ximian.com>
10878 * expression.cs: Fix the case where the argument to params if the
10879 type of the params. I omitted handling this before. Fixed
10881 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10883 * driver.cs: Call BootCorlib_PopulateCoreType
10885 * class.cs (Property.CheckBase): Check for properties only, not
10888 * interface.cs: Temporary hack: try/catch around the
10889 CustomAttributeBuilder, because I am getting an exception that I
10892 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
10893 types whose definitions are required to be there (attributes are
10894 defined before standard types).
10896 Compute definitions as we boot the various types, as they are used
10897 immediately (value_type class will need object_type, but if we do
10898 not initialize object_type, we will pass a null, which will let
10899 the runtime pick the System.Object from the existing corlib, which
10900 is not what we want).
10902 2002-04-22 Patrik Torstensson <totte@labs2.com>
10904 * cs-tokenizer.cs: fixed a number of trim() issues.
10906 2002-04-22 Ravi Pratap <ravi@ximian.com>
10908 * expression.cs (Argument.Type): Ensure that we return the correct
10909 type when we have out or ref parameters [in which case we
10912 2002-04-22 Miguel de Icaza <miguel@ximian.com>
10914 * class.cs (Property, Indexer): Allow extern modifier in there.
10916 * typemanager.cs (InitBaseTypes): Initializes object_type and
10917 value_type, since those will be used early on during the bootstrap
10918 process to compile corlib.
10920 (InitCoreTypes): Move code from here to InitBaseTypes.
10922 2002-04-21 Miguel de Icaza <miguel@ximian.com>
10924 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
10925 single-dimension arrays as using the ldlen opcode.
10927 Daniel Lewis discovered this optimization.
10929 * typemanager.cs: Add signature for System.Array::get_Length
10931 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10933 * statement.cs: report the error when the foreach does not apply to an
10934 array nor a collection.
10936 2002-04-19 Miguel de Icaza <miguel@ximian.com>
10938 * expression.cs: Add implicit conversions to the operator ~.
10940 * constant.cs (DecimalConstant.Emit): Emit decimal value.
10942 * typemanager.cs: Locate the decimal constructor.
10944 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
10946 * attribute.cs: use the new property of TypeOf.
10947 * expression.cs: added 'get' property around typearg.
10949 These changes fix a build breaker reported by NickD. Is this the
10950 correct way to fix? If not, please, revert my changes and make it
10953 2002-04-17 Miguel de Icaza <miguel@ximian.com>
10955 * attribute.cs: Add support for typeof in attribute invocations.
10956 I am not sure that this is right though.
10958 2002-04-14 Duncan Mak <duncan@ximian.com>
10960 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
10961 Binary.Operator.Division case.
10963 2002-04-13 Ravi Pratap <ravi@ximian.com>
10965 * class.cs (DefineType): Ensure that we do a proper check on
10966 attribute types and also register it with the TypeManager.
10968 (TypeContainer.Targets): The default for attribute types is
10969 AttributeTargets.All.
10971 * attribute.cs (ApplyAttributes): Registering the attribute type
10972 is done elsewhere, not when we discover we have a Usage attribute.
10974 2002-04-12 Ravi Pratap <ravi@ximian.com>
10976 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
10977 and get rid of is_delegate parameter.
10979 * everywhere : update.
10981 2002-04-12 Ravi Pratap <ravi@ximian.com>
10983 * cs-parser.jay (compilation_unit): Revamp completely to use
10984 some new ideas that I got from Rhys' grammar to solve the problems
10985 with assembly level attributes.
10987 (outer_declaration): New grammar production.
10989 (attribute_sections): Add.
10991 (opt_attributes): Base on attribute_sections
10993 (namespace_declaration): Allow opt_attributes to tackle the case
10994 when we have assembly level attributes - we are clever in this
10997 * attribute.cs (ApplyAttributes): Do not worry about assembly
10998 attributes in the non-global context.
11000 * rootcontext.cs (AddGlobalAttributes): Go back to using this
11001 instead of SetGlobalAttributes.
11003 * class.cs, rootcontext.cs : Ensure we define and generate
11004 attribute types before anything else.
11006 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
11007 and flag the new error -20 for the case when the attribute type
11008 does not have valid targets specified. csc does not catch this.
11010 * ../errors/errors.txt : update for error # -20
11012 2002-04-11 Ravi Pratap <ravi@ximian.com>
11014 * support.cs (InternalParameters.ParameterModifier): Do some null
11015 checking and return sane values.
11017 * class.cs (Method.Define): If we are a PInvoke method, ensure
11018 that we are static and extern. Report error # 601
11020 * ../errors/cs0601.cs : Add test case for the above error.
11022 2002-04-07 Ravi Pratap <ravi@ximian.com>
11024 * rootcontext.cs (attribute_types): We need to keep type of
11025 all attribute types separately and emit code for them first.
11027 (RegisterAttribute) : Implement.
11029 * class.cs (DefineType): Check if the current Type is a custom
11030 attribute type and register it accordingly.
11032 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
11033 adding the first attribute twice and rename to
11035 (SetGlobalAttributes): this.
11037 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
11040 * attribute.cs (ApplyAttributes): Take an additional argument telling us
11041 if we are processing global arguments. Hmm, I am unsure of this.
11043 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
11045 * expression.cs: added static array of strings to avoid calling
11046 Enum.ToString () for Operator in Binary. Significant recover of
11049 2002-04-10 Miguel de Icaza <miguel@ximian.com>
11051 * class.cs (FindMembers): Allow the Builders of the various
11052 members to be null. If they are skip them. This only happens
11053 during the PInvoke declaration.
11055 2002-04-09 Miguel de Icaza <miguel@ximian.com>
11057 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
11058 failure, so we do not keep going afterwards.
11060 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
11061 wanted to pass `false' as the `is_delegate' argument. If this is
11062 the case, why not use delegate_type == null to mean `is_delegate =
11063 false' and anything else as is_delegate = true.
11065 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
11067 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
11068 code for the section, not the beginning of the tests.
11070 2002-04-08 Miguel de Icaza <miguel@ximian.com>
11072 * cfold.cs: Handle operator + (Enum x, Underlying x)
11074 * expression.cs (Binary): same. Warn about errors where we have
11075 Enum/Enum in operator + as well.
11077 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
11080 - added support for switch(bool)
11081 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
11082 - add TableSwitchEmit() to handle table-based switch statements
11084 2002-04-05 Ravi Pratap <ravi@ximian.com>
11086 * expression.cs (Invocation.OverloadResolve): Factor out code which
11087 does parameter compatibility checking with arguments so that we can
11088 re-use the code even from Delegate.VerifyApplicability
11090 (VerifyArgumentsCompat): Move above code here.
11092 * delegate.cs (VerifyApplicability): Get rid of duplicate code
11093 and instead make a call to the above method.
11095 2002-03-31 Ravi Pratap <ravi@ximian.com>
11097 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
11098 We use it to keep track of classes which are attribute types.
11100 2002-04-02 Miguel de Icaza <miguel@ximian.com>
11102 * delegate.cs (Delegate.Define): Correctly define the types in the
11103 presence of fixed and array parameters.
11105 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
11108 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
11109 include NonPublic after the first iteration.
11111 * class.cs (Indexer.CheckBase): Only check if both parents are
11114 * cs-parser.jay (accessor_body): If empty, set to null.
11116 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
11117 same code path here to resolve constants names that we did have in
11118 MemberAccess.DoResolve. There is too much code duplicated here.
11120 2002-04-01 Miguel de Icaza <miguel@ximian.com>
11122 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
11124 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
11127 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
11128 tokens, numbers and strings.
11130 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
11133 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
11134 asyncronous parameters and the regular parameters.
11136 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
11137 specify the target directory.
11139 * expression.cs: (This.DoResolve): Simplify
11140 (As.Emit): Optimize, do not generate IsInst if the expression is
11141 always of the given type.
11143 (Is.DoResolve): Bug fix, we were reporting both always/never for
11146 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
11147 creating too many unnecessary arrays.
11149 2002-03-31 Miguel de Icaza <miguel@ximian.com>
11151 * class.cs (EmitFieldInitializer): Use Assign expression to assign
11152 fields instead of rolling our own initializer. Takes care of all
11153 implicit conversions, and drops unnecessary static checks/argument.
11155 2002-03-31 Dick Porter <dick@ximian.com>
11157 * driver.cs: use the GetDirectories() return values properly, and
11158 use "/" as path separator.
11160 2002-03-30 Miguel de Icaza <miguel@ximian.com>
11162 * expression.cs (Unary): Optimize - - expr into expr.
11163 (Binary): Optimize a + (-b) into a -b.
11165 * codegen.cs (CodeGen): Made all methods static.
11167 2002-03-29 Miguel de Icaza <miguel@ximian.com>
11171 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
11172 TypeBuilder property.
11174 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
11177 * tree.cs: Removed the various RecordXXXX, and replaced with a
11178 single RecordDecl. Removed all the accessor methods, and just
11179 left a single access point Type
11181 * enum.cs: Rename DefineEnum to DefineType.
11183 * decl.cs: New abstract method `DefineType' used to unify the
11184 Defines for Enumerations, Interfaces, TypeContainers and
11187 (FindType): Moved LookupInterfaceOrClass here. Moved the
11188 LookupBaseClasses method that used to live in class.cs and
11189 interface.cs here, and renamed to FindType.
11191 * delegate.cs: Implement DefineType. Take advantage of the
11192 refactored pattern for locating the parent builder without taking
11193 the parent_builder argument (which we know does not work if we are
11194 nested, and triggering a toplevel definition).
11196 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11198 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
11199 accessibility of a member has changed during override and report
11202 * class.cs (Method.Define, Property.Define): Only complain on
11203 overrides if the method is private, any other accessibility is
11204 fine (and since we just checked the permission is the same, we are
11207 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
11208 and elif are processed always. The other pre-processing
11209 directives are only processed if we are "taking" the path
11211 2002-03-29 Martin Baulig <martin@gnome.org>
11213 * class.cs (Method.Emit): Only emit symbolic debugging info if the
11214 current location is not Null.
11216 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
11217 a separate method so we can profile it.
11219 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
11220 `span.Seconds' are just seconds, but no minutes or hours.
11221 (MainDriver): Profile the CodeGen.SaveSymbols calls.
11223 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11225 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
11226 Remove the gratuitous set of Final:
11228 // If an interface implementation, then we can set Final.
11229 if (((flags & MethodAttributes.Abstract) == 0) &&
11230 implementing.DeclaringType.IsInterface)
11231 flags |= MethodAttributes.Final;
11233 I do not know what I was smoking when I used that.
11236 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
11237 step into fixing the name resolution issues for delegates and
11238 unifying the toplevel name resolution.
11240 2002-03-28 Martin Baulig <martin@gnome.org>
11242 * class.cs (Method.Emit): If we have a symbol writer, call its
11243 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
11244 tell it about the current method.
11246 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
11247 writer that we're going to emit the first byte of IL code for a new
11248 statement (a new source line).
11249 (EmitContext.EmitTopBlock): If we have a symbol writer, call
11250 EmitContext.Mark() before emitting any code.
11252 * location.cs (SymbolDocument): Return null when we're Null.
11254 * statement.cs (Statement): Moved the `Location loc' variable here.
11255 (Statement.EmitBoolExpression): If we have a symbol writer, call
11256 ec.Mark() before emitting any code to tell it that we're at the
11257 beginning of a new statement.
11258 (StatementExpression): Added `Location' argument to the constructor.
11259 (Block): Added public readonly variable `StartLocation' and public
11260 variable `EndLocation'. The latter is to be set using SetEndLocation().
11261 (Block): Added constructor which takes a start and end location.
11262 (Block.SetEndLocation): New method. This sets the end location.
11263 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
11264 local variables we create.
11265 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
11266 each statement and do also mark the begin and end of the block.
11268 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
11269 tell it the current lexer.Location, use Location.Null for the end of the
11271 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
11272 current block, set its end location using SetEndLocation().
11273 (statement_expression): StatementExpression constructor now takes the
11274 lexer.Location as additional argument.
11275 (for_statement, declare_local_variables): Likewise.
11276 (declare_local_variables): When creating a new implicit block, use the
11277 new Block constructor and pass it the lexer.Location.
11279 2002-03-28 Miguel de Icaza <miguel@ximian.com>
11281 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
11282 members also on the parent interfaces recursively.
11284 2002-03-27 Miguel de Icaza <miguel@ximian.com>
11286 * report.cs: Use new formats, since Gonzalo finished the missing
11289 * expression.cs (Binary.ResolveOperator): added missing operator|
11290 operator& and operator^ for bool/bool.
11292 * cs-parser.jay: CheckDef now takes a Location argument that is
11293 used to report errors more precisly (instead of reporting the end
11294 of a definition, we try to track something which is a lot closer
11295 to the source of the problem).
11297 * cs-tokenizer.cs: Track global token use, so we can properly flag
11298 the use of #define/#undef after the first token has been seen.
11300 Also, rename the reportXXXX to Error_DescriptiveName
11302 * decl.cs (DeclSpace.IsTopLevel): Move property here from
11303 TypeContainer, so that Enum and Interface can use this too.
11305 * class.cs (TypeContainer.LookupInterfaceOrClass,
11306 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
11307 `builder' argument. Typically this was used to pass the parent
11308 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
11311 The problem is that a nested class could trigger the definition of
11312 a toplevel class, and the builder would be obviously wrong in that
11315 So we drop this argument, and we compute dynamically the
11316 TypeBuilder/ModuleBuilder (the correct information was available
11317 to us anyways from DeclSpace.Parent)
11319 * interface.cs (Interface.DefineInterface): Drop builder
11320 parameter cleanup like class.cs
11322 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
11325 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
11328 (Try.Emit): Propagate the returns value from the statement.
11330 (Return.Emit): Even if we are leavning
11332 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
11334 * modifiers.cs: Fix the computation of MethodAttributes flags.
11336 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
11338 * driver.cs: allow compilation of files that start with '/'.
11339 Add a default case when checking the argument of --target.
11341 2002-03-25 Miguel de Icaza <miguel@ximian.com>
11343 * interface.cs: Implement the same search algorithm for types in
11344 the interface code.
11346 * delegate.cs: Do not allow multiple definition.
11348 * Recovered ChangeLog that got accidentally amputated
11350 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
11352 * rootcontext.cs: Load manually enum to allow core classes to
11353 contain enumerations.
11355 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
11356 Update to new static methods in TypeManager.
11358 * typemanager.cs (GetMethod, GetConstructor): Use our
11359 implementation of FindMembers to find the members, since during
11360 corlib compilation, the types are TypeBuilders and GetMethod and
11361 GetConstructor do not work.
11363 Make all methods in TypeManager static.
11365 (InitCodeHelpers): Split the functionality from
11366 the InitCodeTypes function.
11368 * driver.cs: Call InitCodeHelpers after we have populated the
11371 * cs-parser.jay (delegate_declaration): we did not used to compute
11372 the delegate name correctly for void delegates.
11374 2002-03-24 Miguel de Icaza <miguel@ximian.com>
11376 * rootcontext.cs (RootContext): Init the interface_resolve_order
11377 and type_container_resolve_order always.
11379 (ResolveCore, BootstrapCorlib_ResolveClass,
11380 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
11381 compiler when compiling with --nostdlib
11383 * class.cs (TypeContainer.DefineType): Check that our parent is
11384 not null. This test is most important when we are bootstraping
11387 * codegen.cs: Split out the symbol writing code.
11389 2002-03-25 Martin Baulig <martin@gnome.org>
11391 * driver.cs (-g): Made -g an alias for --debug.
11393 2002-03-24 Martin Baulig <martin@gnome.org>
11395 * codegen.cs (SymbolWriter): New public variable. Returns the
11396 current symbol writer.
11397 (CodeGen): Added `bool want_debugging_support' argument to the
11398 constructor. If true, tell the ModuleBuild that we want debugging
11399 support and ask it for the ISymbolWriter.
11400 (Save): If we have a symbol writer, call it's Close() method after
11401 saving the assembly.
11403 * driver.c (--debug): New command line argument to create a
11404 debugger information file.
11406 * location.cs (SymbolDocument): New public property. Returns an
11407 ISymbolDocumentWriter object for the current source file or null
11408 if we don't have a symbol writer.
11410 2002-03-21 Miguel de Icaza <miguel@ximian.com>
11412 * driver.cs (LoadAssembly): Correctly return when all the paths
11413 have been tried and not before.
11415 * statement.cs (Switch.Emit): return the actual coverage for this
11416 statement (returns/not-returns)
11418 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
11419 switch of the statement if we are the last switch section. That
11420 kills two problems: try/catch problems (we used to emit an empty
11421 nop at the end) and switch statements where all branches would
11424 2002-03-19 Miguel de Icaza <miguel@ximian.com>
11426 * driver.cs: Add default assemblies (the equivalent to the
11427 Microsoft CSC.RSP file)
11429 * cs-tokenizer.cs: When updating `cols and setting it to zero,
11430 also update tokens_seen and set it to false.
11432 * driver.cs: Implement --recurse for Mike.
11434 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
11435 correctly splitting out the paths.
11437 2002-03-18 Miguel de Icaza <miguel@ximian.com>
11439 * interface.cs (Interface.PopulateProperty): Instead of using
11440 `parent' as the declaration space for the set parameters, use
11443 * support.cs (InternalParameters): InternalParameters constructor
11444 takes a DeclSpace instead of a TypeContainer.
11446 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
11447 types are being initialized, load the address of it before calling
11450 (New): Provide a mechanism to disable the generation of local
11451 value type temporaries when the caller will be providing us with
11452 an address to store it.
11454 (ArrayCreation.EmitDynamicInitializers): Use it.
11456 2002-03-17 Miguel de Icaza <miguel@ximian.com>
11458 * expression.cs (Invocation.EmitArguments): Only probe for array
11459 property if there is more than one argument. Sorry about that.
11461 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
11462 empty param arrays.
11464 * class.cs (Method.LabelParameters): Fix incorrect code path that
11465 prevented the `ParamArrayAttribute' from being applied to the
11468 2002-03-16 Miguel de Icaza <miguel@ximian.com>
11470 * support.cs (ReflectionParameters): Correctly compute whether the
11471 last argument is a params array. Fixes the problem with
11474 * typemanager.cs: Make the assemblies array always be non-null
11475 (empty, but non-null)
11477 * tree.cs (RecordDecl): New function that abstracts the recording
11478 of names. This reports error 101, and provides a pointer to the
11479 previous declaration. Fixes a crash in the compiler.
11481 * cs-parser.jay (constructor_declaration): Update to new grammar,
11482 and provide a constructor_body that can be empty.
11484 2002-03-15 Miguel de Icaza <miguel@ximian.com>
11486 * driver.cs: Add support for --resources.
11488 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
11489 Make all types for the various array helper methods be integer.
11491 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
11492 CheckState to ConvCast.
11494 (ConvCast): Now it takes a `checked' state argument, to avoid
11495 depending on the emit context for the conversion, and just using
11496 the resolve time setting.
11498 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
11499 instead of Invocation.EmitArguments. We do not emit the original
11500 arguments, instead we emit those which have been converted to
11501 unsigned int expressions.
11503 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
11505 * codegen.cs: ditto.
11507 * expression.cs (LocalVariableReference): Drop the use of the
11508 Store function that depended on the variable index.
11510 * statement.cs (VariableInfo): Drop the `Idx' property from this
11511 class, as this is not taking into account the indexes for
11512 temporaries tat we generate during the execution, getting the
11515 * class.cs: First emit class initializers, then call the parent
11518 * expression.cs (Binary): Fix opcode emision.
11519 (UnaryMutator.EmitCode): Support checked code generation
11521 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
11522 matches for events for both the Static and Instance scans,
11523 pointing to the same element. Fix that.
11525 2002-03-14 Miguel de Icaza <miguel@ximian.com>
11527 * rootcontext.cs (ResolveTree): Always set the
11528 interface_resolve_order, because nested interfaces will be calling
11531 * class.cs (GetInterfaceOrClass): Track the same resolution
11532 process used by TypeManager.LookupType. This fixes the nested
11533 type lookups in class declarations (separate path from
11536 (TypeContainer.DefineType): Also define nested interfaces.
11537 (TypeContainer.RegisterOrder): New public function used to
11538 register the order in which child interfaces need to be closed.
11540 Nested interfaces need to be closed after their parents have been
11543 * interface.cs (InterfaceAttr): Put all the logic for computing
11544 the interface attribute here.
11546 (DefineInterface): Register our interface order with the
11547 RootContext or with the TypeContainer depending on the case.
11549 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11551 * cs-parser.jay: rework foreach statement to work with the new
11552 changes to the policy on SimpleNames.
11554 * report.cs: support Stacktrace on warnings as well.
11556 * makefile: drop --unsafe and /unsafe from the compile.
11558 2002-03-13 Ravi Pratap <ravi@ximian.com>
11560 * ecore.cs (StandardConversionExists): Modify to take an Expression
11561 as the first parameter. Ensure we do null -> reference type conversion
11564 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
11565 temporary Expression objects.
11567 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
11569 * interface.cs: workaround bug in method overloading resolution
11570 (there is already a bugzilla bug for it).
11572 2002-03-12 Miguel de Icaza <miguel@ximian.com>
11574 We could also solve this problem by having a separate path for
11575 performing type lookups, instead of DoResolve, we could have a
11576 ResolveType entry point, and only participating pieces of the
11577 production (simplename, deref, array) would implement this.
11579 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
11580 signal SimpleName to only resolve type names and not attempt to
11581 resolve anything else.
11583 * expression.cs (Cast): Set the flag.
11585 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
11587 * class.cs: Only report 108 if there is no `new' modifier.
11589 * cs-parser.jay: rework foreach statement to work with the new
11590 changes to the policy on SimpleNames.
11592 * report.cs: support Stacktrace on warnings as well.
11594 * makefile: drop --unsafe and /unsafe from the compile.
11596 2002-03-11 Miguel de Icaza <miguel@ximian.com>
11598 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11599 lookups here, instead of doing that at parse time. This means
11600 that our grammar will not introduce `LocalVariableReferences' as
11601 expressions at this point. That solves the problem of code like
11605 static void Main ()
11609 This is only half the fix. The full fix requires parameters to
11610 also be handled in this way.
11612 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
11613 makes the use more obvious of the DeclSpace. The
11614 ec.TypeContainer.TypeBuilder is now only used to pull the
11615 TypeBuilder for it.
11617 My theory is that I can get rid of the TypeBuilder completely from
11618 the EmitContext, and have typecasts where it is used (from
11619 DeclSpace to where it matters).
11621 The only pending problem is that the code that implements Aliases
11622 is on TypeContainer, and probably should go in DeclSpace.
11624 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
11625 lookups here, instead of doing that at parse time. This means
11626 that our grammar will not introduce `LocalVariableReferences' as
11627 expressions at this point. That solves the problem of code like
11631 static void Main ()
11635 This is only half the fix. The full fix requires parameters to
11636 also be handled in this way.
11638 * class.cs (Property.DefineMethod): When implementing an interface
11639 method, set newslot, when implementing an abstract method, do not
11640 set the flag (before we tried never setting it, or always setting
11641 it, which is the difference).
11642 (Indexer.DefineMethod): same.
11643 (Method.DefineMethod): same.
11645 * ecore.cs: Only set the status used flag if we get back a Field.
11647 * attribute.cs: Temporary hack, so Paolo can keep working.
11649 2002-03-08 Ravi Pratap <ravi@ximian.com>
11651 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
11652 the unmanaged type in the case we have a MarshalAs attribute.
11654 (Resolve): Handle the case when we are parsing the special MarshalAs
11655 attribute [we need to store the unmanaged type to use later]
11657 * typemanager.cs (marshal_as_attr_type): Built in type for the
11658 MarshalAs Attribute.
11660 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
11661 on parameters and accordingly set the marshalling info.
11663 2002-03-09 Miguel de Icaza <miguel@ximian.com>
11665 * class.cs: Optimizing slightly by removing redundant code after
11666 we switched to the `NoTypes' return value.
11667 (Property.DefineMethod): use NoTypes here too.
11669 This fixes the bug I introduced in my last batch of changes.
11671 2002-03-05 Ravi Pratap <ravi@ximian.com>
11673 * tree.cs (RecordEnum): Add. We now keep track of enums too.
11675 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
11676 Enums since those are types too.
11678 * cs-parser.jay (enum_declaration): Record enums as we parse them.
11680 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
11681 thanks to a call during the lookup process.
11683 2002-03-07 Miguel de Icaza <miguel@ximian.com>
11685 * statement.cs (Foreach): Lots of work to accomodate a particular
11686 kind of foreach statement that I had not kept in mind. It is
11687 possible to have foreachs on classes that provide a GetEnumerator
11688 method that return objects that implement the "pattern" for using
11689 a foreach, there is no need to support GetEnumerator
11692 This is needed to compile nant.
11694 * decl.cs: Only report 114 if the member is not `Finalize' and if
11695 the warning level is at least 2.
11697 * class.cs: Moved the compare function from Method to
11700 (MethodSignature.InheritableMemberSignatureCompare): Add new
11701 filter function that is used to extract inheritable methods from a
11704 (Method.Define): Use the new `inheritable_method_signature_filter'
11707 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
11710 2002-03-06 Miguel de Icaza <miguel@ximian.com>
11712 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
11714 * cs-parser.jay: Add opt_semicolon to the interface declaration.
11716 * expression.cs: Pass location information to
11717 ConvertImplicitStandard.
11719 * class.cs: Added debugging code to track return values from
11722 2002-03-05 Miguel de Icaza <miguel@ximian.com>
11724 * expression.cs (Is.DoResolve): If either side of the `is' is an
11725 interface, do not flag the warning.
11727 * ecore.cs (ImplicitReferenceConversion): We need a separate test
11730 * report.cs: Allow for --fatal to be used with --probe.
11732 * typemanager.cs (NoTypes): Move the definition for the empty Type
11735 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
11737 (TypeContainer.DefineProxy): New function used to proxy to parent
11738 implementations when implementing interfaces.
11739 (TypeContainer.ParentImplements): used to lookup if our parent
11740 implements a public function that is required by an interface.
11741 (TypeContainer.VerifyPendingMethods): Hook this up.
11743 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
11744 `modules' and `assemblies' arraylists into arrays. We only grow
11745 these are the very early start up of the program, so this improves
11746 the speedof LookupType (nicely measured).
11748 * expression.cs (MakeByteBlob): Replaced unsafe code with
11749 BitConverter, as suggested by Paolo.
11751 * cfold.cs (ConstantFold.Binary): Special case: perform constant
11752 folding of string concatenation, but if either side is a string,
11753 and the other is not, then return null, and let the runtime use
11754 the concatenation on the string plus the object (using
11755 `Object.ToString').
11757 2002-03-04 Miguel de Icaza <miguel@ximian.com>
11759 Constant Folding has been implemented now.
11761 * expression.cs (Unary.Reduce): Do not throw an exception, catch
11762 the error instead on types that are not supported in one's
11765 * constant.cs (Constant and all children): New set of functions to
11766 perform implict and explicit conversions.
11768 * ecore.cs (EnumConstant): Implement the new functions to perform
11769 conversion by proxying to the child expression.
11771 * codegen.cs: (ConstantCheckState): Constant evaluation has its
11772 own separate setting that can not be turned off from the command
11773 line using --unchecked or --checked and is only controlled using
11774 the checked/unchecked statements and expressions. This setting is
11775 used by the constant folder to flag errors.
11777 * expression.cs (CheckedExpr, UncheckedExpr): Set the
11778 ConstantCheckState as well.
11780 During Resolve, they also have to flag the state, because the
11781 constant folder runs completely in the Resolve phase.
11783 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
11786 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11788 * cfold.cs: New file, this file contains the constant folder.
11790 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
11791 argument to track whether we are using the resulting address to
11792 load or store a value and provide better error messages.
11794 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
11795 new AddressOf arguments.
11797 * statement.cs (Foreach.EmitCollectionForeach): Update
11799 * expression.cs (Argument.Emit): Call AddressOf with proper
11800 arguments to track usage.
11802 (New.DoEmit): Call AddressOf with new arguments.
11804 (Unary.Emit): Adjust AddressOf call.
11806 2002-03-01 Ravi Pratap <ravi@ximian.com>
11808 * cs-parser.jay (member_access): Change the case for pre-defined types
11809 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
11812 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
11815 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
11816 essentially like methods and apply attributes like MethodImplOptions to them too.
11818 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
11821 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
11822 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
11825 * Update code everywhere accordingly.
11827 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
11829 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
11831 2002-02-28 Ravi Pratap <ravi@ximian.com>
11833 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
11834 try performing lookups against those instead of jumping straight into using
11835 the 'using' clauses.
11837 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
11839 (LookupType): Perform lookups in implicit parents too.
11841 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
11842 sequence as RootContext.LookupType.
11844 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
11845 the various cases of namespace lookups into this method.
11847 2002-03-01 Miguel de Icaza <miguel@ximian.com>
11849 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
11850 in positional arguments)
11852 * class.cs (Operator): Update the AllowedModifiers to contain
11855 * cs-parser.jay: Update operator declaration to allow for the
11856 operator body to be empty.
11858 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
11861 2002-02-27 Miguel de Icaza <miguel@ximian.com>
11863 * class.cs (Method.Emit): Label parameters.
11865 * driver.cs: Return 1 or 0 as the program exit code.
11867 2002-02-26 Miguel de Icaza <miguel@ximian.com>
11869 * expression.cs: Special case the `null' object when trying to
11870 auto-compute the type, as anything can be explicitly converted to
11873 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
11874 spotting this Paolo.
11876 (Expression.ImplicitNumericConversion): Perform comparissions of
11877 the type using the underlying type in the case of an enumeration
11878 rather than using the enumeration type for the compare.
11880 Cope with the underlying == type case, which is not possible to
11883 (Expression.ConvertNumericExplicit): Perform comparissions of
11884 the type using the underlying type in the case of an enumeration
11885 rather than using the enumeration type for the compare.
11887 * driver.cs: If the user does not supply an extension, assume .exe
11889 * cs-parser.jay (if_statement): Rewrote so that we can track the
11890 location for the if statement.
11892 * expression.cs (Binary.ConstantFold): Only concat strings when
11893 the operation is "+", not everything ;-)
11895 * statement.cs (Statement.EmitBoolExpression): Take a location
11897 (If, While, Do): Track location.
11899 * expression.cs (Binary.ResolveOperator): In the object + string
11900 case, I was missing a call to ConvertImplicit
11902 2002-02-25 Ravi Pratap <ravi@ximian.com>
11904 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
11905 Location arguments. Ensure we use RootContext.LookupType to do our work
11906 and not try to do a direct Type.GetType and ModuleBuilder.GetType
11908 * interface.cs (PopulateMethod): Handle the type of the parameter being
11911 * expression.cs (Invocation.BetterFunction): Handle the case when we
11912 have a params method with no fixed arguments and a call is made with no
11915 2002-02-25 Miguel de Icaza <miguel@ximian.com>
11917 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
11918 the verbatim-string-literal
11920 * support.cs (InternalParameters.ParameterModifier): handle null
11922 (InternalParameters.ParameterType): ditto.
11924 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
11925 duplicating the name of the variable parameter.
11926 (GetParameterByName): Fix bug where we were not looking up array
11927 paramters if they were the only present (thanks Paolo!).
11928 (GetParameterInfo): We only have an empty set of types if both
11929 fixed and array are set to null.
11930 (GetParameterInfo-idx): Handle FixedParameter == null
11932 * cs-parser.jay: Handle the case where there is no catch
11933 statements (missing null test).
11935 2002-02-22 Miguel de Icaza <miguel@ximian.com>
11937 * driver.cs (MainDriver): Be conservative on our command line
11940 Catch DirectoryNotFoundException when calling GetFiles.
11942 (SplitPathAndPattern): Used to split the input specification into
11943 a path and a pattern that we can feed to Directory.GetFiles.
11945 2002-02-21 Miguel de Icaza <miguel@ximian.com>
11947 * statement.cs (Fixed): Implement the last case of the Fixed
11948 statement (string handling).
11950 * expression.cs (StringPtr): New class used to return a char * to
11951 a string; Used by the Fixed statement.
11953 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
11955 * expression.cs (Binary.ResolveOperator): Remove redundant
11956 MemberLookup pn parent type.
11957 Optimize union call, we do not need a union if the types are the same.
11958 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
11961 Specialize the use of MemberLookup everywhere, instead of using
11962 the default settings.
11964 (StackAlloc): Implement stackalloc keyword.
11966 * cs-parser.jay: Add rule to parse stackalloc.
11968 * driver.cs: Handle /h, /help, /?
11970 * expression.cs (MakeByteBlob): Removed the hacks we had in place
11971 before we supported unsafe code.
11973 * makefile: add --unsafe to the self compilation of mcs.
11975 2002-02-20 Miguel de Icaza <miguel@ximian.com>
11977 * expression.cs (PointerArithmetic): New class that is used to
11978 perform pointer arithmetic.
11979 (Binary.Resolve): Handle pointer arithmetic
11980 Handle pointer comparission.
11981 (ArrayPtr): Utility expression class that is used to take the
11982 address of an array.
11984 (ElementAccess): Implement array access for pointers
11986 * statement.cs (Fixed): Implement fixed statement for arrays, we
11987 are missing one more case before we are done.
11989 * expression.cs (Indirection): Implement EmitAssign and set the
11990 ExprClass to Variable. This allows pointer dereferences to be
11991 treated as variables, and to have values assigned to them.
11993 * ecore.cs (Expression.StoreFromPtr): New utility function to
11994 store values dereferencing.
11996 2002-02-20 Ravi Pratap <ravi@ximian.com>
11998 * expression.cs (Binary.ResolveOperator): Ensure that we are
11999 not trying to operate on a void type - this fixes the reported
12002 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
12003 the parent implementation is sealed.
12005 * ../errors/cs0239.cs : Add.
12007 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
12009 * typemanager.cs (unverifiable_code_type): Corresponds to
12010 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
12011 which have unsafe code in them.
12013 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
12016 2002-02-19 Miguel de Icaza <miguel@ximian.com>
12018 * cs-tokenizer.cs: Add support for @"litreal strings"
12020 Make tokenizer accept pre-processor directives
12021 on any column (remove the old C-like limitation).
12023 * rootcontext.cs (EmitCode): Emit any global attributes.
12024 (AddGlobalAttributes): Used to keep track of assembly attributes.
12026 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
12028 * cs-parser.jay: Add support for global attributes.
12030 2002-02-17 Miguel de Icaza <miguel@ximian.com>
12032 * expression.cs (Indirection): New helper class. Unary will
12033 create Indirection classes to be able to implement the
12034 IMemoryLocation interface on it.
12036 2002-02-16 Miguel de Icaza <miguel@ximian.com>
12038 * cs-parser.jay (fixed_statement): reference the right statement.
12040 * statement.cs (Fixed.Emit): Finish implementing the fixed
12041 statement for the &x case.
12043 2002-02-14 Miguel de Icaza <miguel@ximian.com>
12045 * class.cs (Property.Define, Method.Define): Remove newslot when
12048 * modifiers.cs: My use of NewSlot when `Abstract' was set was
12049 wrong. NewSlot should only be used if the `new' keyword is present.
12051 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
12052 locating our system dir. Sorry about this.
12054 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12056 * driver.cs (GetSystemDir): Compute correctly the location of our
12057 system assemblies. I was using the compiler directory instead of
12058 the library directory.
12060 2002-02-13 Ravi Pratap <ravi@ximian.com>
12062 * expression.cs (BetterFunction): Put back in what Miguel commented out
12063 since it is the correct fix. The problem is elsewhere ;-)
12065 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
12066 parameters of the parms method are themselves compatible or not !
12068 (StandardConversionExists): Fix very dangerous bug where we were forgetting
12069 to check that a class implements an interface before saying that an implicit
12070 conversion was allowed. Use ImplementsInterface to do the checking.
12072 2002-02-13 Miguel de Icaza <miguel@ximian.com>
12074 * class.cs (Method.Define): Track whether we are an explicit
12075 implementation or not. And only call DefineMethodOverride if we
12076 are an explicit implementation.
12078 (Property.DefineMethod): Ditto.
12080 2002-02-11 Ravi Pratap <ravi@ximian.com>
12082 * expression.cs (BetterFunction): Catch hideous bug which was
12083 preventing us from detecting ambiguous calls due to implicit casts i.e
12086 2002-01-29 Miguel de Icaza <miguel@ximian.com>
12088 * support.cs (Pair): Remove un-needed method. I figured why I was
12089 getting the error in cs-parser.jay, the variable in a foreach loop
12090 is readonly, and the compiler does not really treat this as a variable.
12092 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
12093 instead of EQUALS in grammar.
12095 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
12097 * expression.cs (Unary.DoResolve): Check whether the argument is
12100 2002-01-28 Miguel de Icaza <miguel@ximian.com>
12102 * support.cs: Api for Pair to set a value. Despite the fact that
12103 the variables are public the MS C# compiler refuses to compile
12104 code that accesses the field if the variable is part of a foreach
12107 * statement.cs (Fixed): Begin implementation of the fixed
12110 (Block.AddVariable): Return the VariableInfo on success and null
12111 on failure instead of true/false.
12113 * cs-parser.jay (foreach): Catch errors on variables already
12114 defined (we were ignoring this value before) and properly unwind
12115 the block hierarchy
12117 (fixed_statement): grammar for the fixed statement.
12119 2002-01-25 Miguel de Icaza <miguel@ximian.com>
12121 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
12122 pointer types to be incretemented.
12124 (SizeOf): Implement.
12126 * cs-parser.jay (pointer_member_access): Implement
12127 expr->IDENTIFIER production.
12129 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
12130 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
12133 (Unary): Implement indirection.
12135 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
12136 use in non-unsafe context).
12138 (SimpleName.DoResolve): Check for pointers in field access on safe
12141 (Expression.LoadFromPtr): Factor the load-indirect code in this
12142 function. This was duplicated in UnboxCast and ParameterReference
12144 2002-01-24 Miguel de Icaza <miguel@ximian.com>
12146 * expression.cs (ComposedCast): report an error if a pointer cast
12147 is used in a safe region.
12149 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
12150 pointer type casts in unsafe context.
12152 * codegen.cs (EmitContext): Set up IsUnsafe.
12154 * cs-parser.jay (non_expression_type): Add productions for pointer
12157 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
12158 code. We should not use force into static mode if the method is
12159 not virtual. Fixes bug in MIS
12161 * statement.cs (Do.Emit, While.Emit, For.Emit,
12162 Statement.EmitBoolExpression): Add support to Do and While to
12163 propagate infinite loop as `I do return' semantics.
12165 Improve the For case to also test for boolean constants.
12167 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
12168 to the list of attributes we can add.
12170 Remove `EmitContext' argument.
12172 * class.cs (Method.Define): Apply parameter attributes.
12173 (Constructor.Define): Apply parameter attributes.
12174 (MethodCore.LabelParameters): Move here the core of labeling
12177 * support.cs (ReflectionParameters.ParameterModifier,
12178 InternalParameters.ParameterModifier): Use IsByRef on the type and
12179 only return the OUT bit for these parameters instead of in/out/ref
12182 This is because I miss-understood things. The ParameterInfo.IsIn
12183 and IsOut represent whether the parameter has the [In] and [Out]
12186 2002-01-22 Miguel de Icaza <miguel@ximian.com>
12188 * ecore.cs (FieldExpr.Emit): Release temporaries.
12190 * assign.cs (LocalTemporary.Release): new function.
12192 * codegen.cs (EmitContext.GetTemporaryStorage,
12193 EmitContext.FreeTemporaryStorage): Rework the way we deal with
12194 temporary storage. Now we can "put back" localbuilders when we
12197 2002-01-21 Miguel de Icaza <miguel@ximian.com>
12199 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
12200 need to make a copy of the variable to generate verifiable code.
12202 2002-01-19 Miguel de Icaza <miguel@ximian.com>
12204 * driver.cs: Compute dynamically the system directory.
12206 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
12207 Slower, but more generally useful. Used by the abstract
12208 registering implementation.
12210 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
12211 the rules for the special rule on Type/instances. First check if
12212 we have the same name, and if so, try that special static path
12213 rather than the instance path.
12215 2002-01-18 Miguel de Icaza <miguel@ximian.com>
12217 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
12220 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
12221 Enum, ValueType, Delegate or Array for non-corlib compiles.
12223 * cs-tokenizer.cs: Catch long identifiers (645)
12225 * typemanager.cs (IndexerPropetyName): Ravi never tested this
12228 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
12229 fix, we were returning too early, so we were not registering
12230 pending methods from abstract classes.
12232 Do not register pending methods if the class is abstract.
12234 * expression.cs (Conditional.DoResolve): Report circular implicit
12235 conversions when we neecd to compute it for conditional
12238 (Is.DoResolve): If the expression is always of the provided type,
12239 flag warning 183. If the expression can not ever be of the
12240 provided type flag warning 184.
12242 * class.cs: Catch 169 as well.
12244 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
12247 2002-01-18 Nick Drochak <ndrochak@gol.com>
12249 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
12251 2002-01-17 Miguel de Icaza <miguel@ximian.com>
12253 * interface.cs: (PopulateMethod): Check for pointers being defined
12254 only if the unsafe context is active.
12255 (PopulateProperty): ditto.
12256 (PopulateIndexer): ditto.
12258 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
12259 specified. If pointers are present, make sure that they are
12260 present in an unsafe context.
12261 (Constructor, Constructor.Define): ditto.
12262 (Field, Field.Define): ditto.
12263 (Property, Property.Define): ditto.
12264 (Event, Event.Define): ditto.
12266 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
12267 hashtable if there are classes or structs defined.
12269 * expression.cs (LocalVariableReference.DoResolve): Simplify this
12270 code, as the constant resolution moved.
12272 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
12273 the metadata, so we can flag error 133.
12275 * decl.cs (MemberCore.UnsafeOK): New function to test that a
12276 pointer is being declared in an unsafe context.
12278 2002-01-16 Miguel de Icaza <miguel@ximian.com>
12280 * modifiers.cs (Modifiers.Check): Require a Location argument.
12281 Report error 227 for Unsafe use.
12283 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
12285 * statement.cs (For.Emit): If the test is null, then report that
12286 we do `return', as we wont reach anything afterwards.
12288 (Switch.SwitchGoverningType): Track the expression that matched
12291 * driver.cs: Allow negative numbers as an error code to flag.
12293 * cs-parser.jay: Handle 1551.
12295 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
12297 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12299 * cs-parser.jay: Report 1518 (type declaration can only contain
12300 class, struct, interface, enum or delegate)
12302 (switch_label): Report 1523 (keywords `case' or `default' must
12305 (opt_switch_sections): Report 1522 (empty switch)
12307 * driver.cs: Report 1515 (response file specified multiple times)
12308 Report 1516 (Source file specified multiple times).
12310 * expression.cs (Argument.Resolve): Signal 1510
12312 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
12313 access not allowed in static code)
12315 2002-01-11 Ravi Pratap <ravi@ximian.com>
12317 * typemanager.cs (IsPointerType): Utility method which we are going
12320 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
12321 the object type, so we take care of that.
12323 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
12325 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
12326 added to non-params parameters :-)
12328 * typemanager.cs (CSharpName): Include 'void' type too.
12330 (void_ptr_type): Include in the set of core types.
12332 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
12335 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
12338 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
12339 completely forgotten about it.
12341 2002-01-10 Ravi Pratap <ravi@ximian.com>
12343 * cs-parser.jay (pointer_type): Add. This begins our implementation
12344 of parsing rules for unsafe code.
12346 (unsafe_statement): Implement.
12348 (embedded_statement): Modify to include the above.
12350 * statement.cs (Unsafe): Implement new class for unsafe blocks.
12352 * codegen.cs (EmitContext.InUnsafe): Add. This determines
12353 if the current context is an unsafe one.
12355 * cs-parser.jay (local_variable_pointer_type): Since local variable types
12356 are handled differently, we need separate rules for them.
12358 (local_variable_declaration): Update to use local_variable_pointer_type
12359 to allow variable declarations of unmanaged pointer types.
12361 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
12362 in unsafe contexts.
12364 * ../errors/cs0214.cs : Add.
12366 2002-01-16 Nick Drochak <ndrochak@gol.com>
12368 * makefile: remove 'response' file when cleaning.
12370 2002-01-15 Miguel de Icaza <miguel@ximian.com>
12372 * cs-parser.jay: Report 1524.
12374 2002-01-14 Miguel de Icaza <miguel@ximian.com>
12376 * typemanager.cs (RegisterMethod): drop checking if we have
12377 registered this from here
12379 2002-01-12 Miguel de Icaza <miguel@ximian.com>
12381 * class.cs (Method.EmitDestructor): Implement calling our base
12384 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
12385 value of InFinally.
12387 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
12388 this routine and will wrap the call in a try/catch block. Deal
12391 2002-01-11 Miguel de Icaza <miguel@ximian.com>
12393 * ecore.cs (Expression.MemberLookup): instead of taking a
12394 parameter `same_type' that was used to tell whether we could
12395 access private members we compute our containing type from the
12398 (FieldExpr): Added partial support for volatile fields. This does
12399 not work for volatile fields exposed from assemblies, as I can not
12400 figure out how to extract the modreq from it.
12402 Updated all the source files to use this.
12404 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
12405 because it is referenced by MemberLookup very often.
12407 2002-01-09 Ravi Pratap <ravi@ximian.com>
12409 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
12410 TypeBuilder.GetCustomAttributes to retrieve what we need.
12412 Get rid of redundant default_member_attr_type as this is the same as
12413 default_member_type which already exists.
12415 * interface.cs, attribute.cs : Update accordingly.
12417 2002-01-08 Miguel de Icaza <miguel@ximian.com>
12419 * typemanager.cs: Enable IndexerPropertyName again. It does not
12420 work for TYpeBuilders though. Ravi, can you please fix this?
12422 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
12424 * expression.cs (Argument.Emit): Handle the case of ref objects
12425 being passed to ref functions;
12427 (ParameterReference.EmitLoad): Loads the content of the pointer
12428 without dereferencing.
12430 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12432 * cs-tokenizer.cs: Implemented the pre-processing expressions.
12434 2002-01-08 Ravi Pratap <ravi@ximian.com>
12436 * class.cs (Indexer.DefineMethod): Incorporate the interface
12437 type in the name of the method if we are doing explicit interface
12440 * expression.cs (ConversionExists): Remove as it is completely obsolete.
12442 (BetterConversion): Fix extremely trivial bug where we were referring to
12443 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
12446 * ../errors/bug16.cs : Add although we have fixed it.
12448 2002-01-07 Miguel de Icaza <miguel@ximian.com>
12450 * expression.cs (BaseIndexer): Begin implementation.
12452 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
12454 * cs-parser.jay (indexer_declarator): Use qualified_identifier
12455 production directly to remove a shift/reduce, and implement
12456 explicit interface implementation.
12458 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
12459 after a floating point suffix.
12461 * expression.cs (DoNumericPromotions): Improved the conversion for
12462 uint/uint. If we have a constant, we avoid doing a typecast to a
12465 * class.cs (Indexer): Implement explicit interface implementation
12468 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
12470 * class.cs: make the default instance constructor public and hidebysig.
12472 2001-01-03 Ravi Pratap <ravi@ximian.com>
12474 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
12475 so we can call it from elsewhere.
12477 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
12478 we emit it internally if the class has a defined indexer; otherwise the user
12479 emits it by decorating the class definition with the DefaultMemberAttribute.
12481 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
12482 attribute is not used on a type which defines an indexer.
12484 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
12485 character when we skip whitespace.
12487 * ../errors/cs0646.cs : Add.
12489 2002-01-03 Miguel de Icaza <miguel@ximian.com>
12491 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
12494 * makefile: Add practical target `mcs3.exe' which builds the third
12495 generation compiler.
12497 * expression.cs (New): Fix structures constructor calling.
12499 * class.cs (Property, Method, Indexer): Emit Final flag on the
12500 method if we are an interface implementation and we are not
12503 * ecore.cs (PropertyExpr): New public field `IsBase', tells
12504 whether this property is referencing a `base' method.
12506 * expression.cs (Invocation.EmitCall): take an extra argument:
12507 is_base, this is used to determine whether the `call' or
12508 `callvirt' opcode should be used.
12511 * delegate.cs: update EmitCall.
12513 * class.cs (Method.Define): Set NewSlot for the cases where we are
12514 not implementing an interface method.
12516 (Property.Define): ditto.
12518 2002-01-02 Miguel de Icaza <miguel@ximian.com>
12520 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
12521 'r'. Allows mcs to parse itself fully.
12523 2002-01-02 Ravi Pratap <ravi@ximian.com>
12525 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
12526 of the number of initializers that require the InitializeArray method.
12528 (CheckIndices): Store the Expression in all cases - not the plain value. Also
12529 update the above field where necessary.
12531 (MakeByteBlob): Update accordingly.
12533 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
12536 (EmitDynamicInitializers): Update in accordance with the new optimization.
12538 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
12539 same OpCode applies.
12541 * cs-parser.jay : Fix some glaring errors I introduced.
12543 2002-01-01 Ravi Pratap <ravi@ximian.com>
12545 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
12546 so that we can check for name clashes there too.
12548 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
12549 for interface indexers.
12551 * interfaces.cs (Define): Emit the default member attribute.
12553 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
12554 variable was being referred to while setting the value ;-)
12556 2002-01-01 Miguel de Icaza <miguel@ximian.com>
12558 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
12559 byte-by-byte information when we know the data is zero.
12561 Make the block always a multiple of 4, because
12562 DefineInitializedData has a bug.
12564 * assign.cs: Fix, we should assign from the temporary, not from
12567 * expression.cs (MakeByteBlob): Fix my incorrect code.
12569 2001-12-31 Miguel de Icaza <miguel@ximian.com>
12571 * typemanager.cs (EnumToUnderlying): This function is used to get
12572 the underlying type from an enumeration, because it does not
12575 * constant.cs: Use the I4_S form for values between -128 and 127.
12577 * statement.cs (Block.LookupLabel): Looks up a label.
12578 (Block): Drop support for labeled blocks.
12580 (LabeledStatement): New kind of statement that represents a label
12583 (Goto): Finally implement this bad boy.
12585 * cs-parser.jay: Update to reflect new mechanism to implement
12588 2001-12-30 Miguel de Icaza <miguel@ximian.com>
12590 * codegen.cs (EmitContext.This): a codegen property that keeps the
12591 a single instance of this instead of creating many different this
12594 * delegate.cs (Delegate.DoResolve): Update to use the property;
12596 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
12598 * expression.cs (BaseAccess.DoResolve): Ditto.
12600 2001-12-29 Ravi Pratap <ravi@ximian.com>
12602 * typemanager.cs (methodimpl_attr_type): Add to hold the type
12603 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
12605 (InitCoreTypes): Update accordingly.
12607 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
12608 so we can quickly store the state.
12610 (ApplyAttributes): Set the correct implementation flags
12611 for InternalCall methods.
12613 2001-12-29 Miguel de Icaza <miguel@ximian.com>
12615 * expression.cs (EmitCall): if a method is not virtual, then do
12616 not use callvirt on it.
12618 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
12619 user defined stuff) requires the use of stobj, which takes an
12620 address on the stack instead of an array and an index. So emit
12621 the Ldelema operation for it.
12623 (EmitStoreOpcode): Use stobj for valuetypes.
12625 (UnaryMutator.EmitCode): Use the right 1 value depending on
12626 whether we are dealing with int64/uint64, float or doubles.
12628 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
12629 constructors that I implemented last night.
12631 (Constructor.IsDefault): Fix to work properly for static
12634 * cs-parser.jay (CheckDef): report method signature errors.
12635 Update error number 103 to be 132.
12637 * decl.cs: New AdditionResult enumeration value: MethodExists.
12638 Although we do this check for methods later on in the semantic
12639 analysis, catching repeated default constructors is so easy that
12640 we catch these here.
12642 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
12645 (ParameterReference.EmitAssign, Emit): handle
12648 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
12649 (ArrayAccess.EmitStoreOpcode): ditto.
12651 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
12653 * expression.cs (MakeByteBlob): Complete all the missing types
12654 (uint, short, ushort, byte, sbyte)
12656 * class.cs: Only init instance field initializers on instance
12659 Rename `constructors' to instance_constructors.
12661 (TypeContainer.AddConstructor): Only add constructors to the list
12662 if it is not static.
12664 Make sure that we handle default_static_constructor independently
12665 everywhere where we handle instance_constructors
12667 2001-12-28 Miguel de Icaza <miguel@ximian.com>
12669 * class.cs: Do not lookup or create a base initializer for a
12670 static constructor.
12672 (ConstructorInitializer.Resolve): use the proper type to lookup
12675 * cs-parser.jay: Report error 1585 (modifiers between type and name).
12677 * enum.cs, interface.cs: Remove CloseType, this is taken care by
12680 * decl.cs: CloseType is now an virtual method, the default
12681 implementation just closes this type.
12683 2001-12-28 Ravi Pratap <ravi@ximian.com>
12685 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
12686 to PreserveSig by default. Also emit HideBySig on such methods.
12688 Basically, set the defaults to standard values.
12690 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
12691 argument, if candidate is better, it can't be worse than the best !
12693 (Invocation): Re-write bits to differentiate between methods being
12694 applicable in their expanded form and their normal form - for params
12697 Get rid of use_standard everywhere as only standard conversions are allowed
12698 in overload resolution.
12700 More spec conformance.
12702 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12704 * driver.cs: Add --timestamp, to see where the compiler spends
12707 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
12708 `this' in static code.
12710 (SimpleName.DoResolve): Implement in terms of a helper function
12711 that allows static-references to be passed upstream to
12714 (Expression.ResolveWithSimpleName): Resolve specially simple
12715 names when called by MemberAccess to implement the special
12718 (Expression.ImplicitReferenceConversion): Handle conversions from
12719 Null to reference types before others, as Null's type is
12722 * expression.cs (Invocation.EmitCall): Handle the special case of
12723 calling methods declared on a reference type from a ValueType
12724 (Base classes System.Object and System.Enum)
12726 (MemberAccess.Resolve): Only perform lookups on Enumerations if
12727 the left hand side is a TypeExpr, not on every enumeration.
12729 (Binary.Resolve): If types are reference types, then do a cast to
12730 object on operators != and == of both arguments.
12732 * typemanager.cs (FindMembers): Extract instance and static
12733 members if requested.
12735 * interface.cs (PopulateProperty): Use void_type instead of null
12736 as the return type for the setter method.
12738 (PopulateIndexer): ditto.
12740 2001-12-27 Ravi Pratap <ravi@ximian.com>
12742 * support.cs (ReflectionParameters): Fix minor bug where we
12743 were examining the wrong parameter for the ParamArray attribute.
12745 Cope with requests for the type of the parameter at position
12746 greater than the params parameter's. We now return the element
12747 type of the params array as that makes more sense.
12749 * expression.cs (Invocation.IsParamsMethodApplicable): Update
12750 accordingly as we no longer have to extract the element type
12753 (Invocation.OverloadResolve): Update.
12755 2001-12-27 Miguel de Icaza <miguel@ximian.com>
12757 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
12758 against IEnumerator, test whether the return value is a descendant
12759 of the IEnumerator interface.
12761 * class.cs (Indexer.Define): Use an auxiliary method to implement
12762 the other bits of the method definition. Begin support for
12763 explicit interface implementation.
12765 (Property.DefineMethod): Use TypeManager.void_type instead of null
12766 for an empty return value.
12768 2001-12-26 Miguel de Icaza <miguel@ximian.com>
12770 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
12771 dealing with a FieldExpr which is composed of a FieldBuilder, in
12772 the code path we did extract the constant, but we should have
12773 obtained the underlying value to be able to cast it (otherwise we
12774 end up in an infinite loop, this is what Ravi was running into).
12776 (ArrayCreation.UpdateIndices): Arrays might be empty.
12778 (MemberAccess.ResolveMemberAccess): Add support for section
12779 14.5.4.1 that deals with the special case of E.I when E is a type
12780 and something else, that I can be a reference to a static member.
12782 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
12783 handle a particular array type to create byte blobs, it is just
12784 something we dont generate byteblobs for.
12786 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
12789 * location.cs (Push): remove the key from the hashtable that we
12790 are about to add. This happens for empty files.
12792 * driver.cs: Dispose files after we have parsed them.
12794 (tokenize): new function that only runs the tokenizer on its
12795 input, for speed testing.
12797 2001-12-26 Ravi Pratap <ravi@ximian.com>
12799 * class.cs (Event.Define): Define the private field only if there
12800 are no accessors defined.
12802 * expression.cs (ResolveMemberAccess): If there is no associated
12803 field with the event, that means we have an event defined with its
12804 own accessors and we should flag error cs0070 since transforming
12805 ourselves into a field is not valid in that case.
12807 * ecore.cs (SimpleName.DoResolve): Same as above.
12809 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
12810 and charset to sane values.
12812 2001-12-25 Ravi Pratap <ravi@ximian.com>
12814 * assign.cs (DoResolve): Perform check on events only if they
12815 are being accessed outside the declaring type.
12817 * cs-parser.jay (event_declarations): Update rules to correctly
12818 set the type of the implicit parameter etc.
12820 (add_accessor, remove_accessor): Set current local parameters.
12822 * expression.cs (Binary): For delegate addition and subtraction,
12823 cast the return value from the method into the appropriate delegate
12826 2001-12-24 Ravi Pratap <ravi@ximian.com>
12828 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
12829 of these as the workaround is unnecessary.
12831 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
12832 delegate data - none of that is needed at all.
12834 Re-write bits to extract the instance expression and the delegate method
12837 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
12840 * attribute.cs (ApplyAttributes): New method to take care of common tasks
12841 of attaching attributes instead of duplicating code everywhere.
12843 * everywhere : Update code to do attribute emission using the above method.
12845 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12847 * expression.cs (IsParamsMethodApplicable): if there are not
12848 parameters, return immediately.
12850 * ecore.cs: The 0 literal can be implicity converted to an enum
12853 (SimpleName.DoResolve): First lookup the type, then lookup the
12856 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
12857 want to get its address. If the InstanceExpression is not
12858 addressable, store the result in a temporary variable, then get
12861 * codegen.cs: Only display 219 errors on warning level or above.
12863 * expression.cs (ArrayAccess): Make it implement the
12864 IMemoryLocation interface.
12866 (Binary.DoResolve): handle the operator == (object a, object b)
12867 and operator != (object a, object b) without incurring into a
12868 BoxedCast (because 5 != o should never be performed).
12870 Handle binary enumerator operators.
12872 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
12873 value type, otherwise use Ldelem_ref.
12875 Use precomputed names;
12877 (AddressOf): Implement address of
12879 * cs-parser.jay (labeled_statement): Fix recursive block
12880 addition by reworking the production.
12882 * expression.cs (New.DoEmit): New has a special case:
12884 If we are dealing with a ValueType, we have a few
12885 situations to deal with:
12887 * The target of New is a ValueType variable, that is
12888 easy, we just pass this as the variable reference
12890 * The target of New is being passed as an argument,
12891 to a boxing operation or a function that takes a
12894 In this case, we need to create a temporary variable
12895 that is the argument of New.
12898 2001-12-23 Ravi Pratap <ravi@ximian.com>
12900 * rootcontext.cs (LookupType): Check that current_type is not null before
12901 going about looking at nested types.
12903 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
12904 not implement the IAssignMethod interface any more.
12906 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
12907 where we tranform them into FieldExprs if they are being resolved from within
12908 the declaring type.
12910 * ecore.cs (SimpleName.DoResolve): Do the same here.
12912 * assign.cs (DoResolve, Emit): Clean up code considerably.
12914 * ../errors/bug10.cs : Add.
12916 * ../errors/cs0070.cs : Add.
12918 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
12920 * assign.cs : Get rid of EventIsLocal everywhere.
12922 2001-12-23 Miguel de Icaza <miguel@ximian.com>
12924 * ecore.cs (ConvertIntLiteral): finished the implementation.
12926 * statement.cs (SwitchLabel): Convert the value we are using as a
12927 key before looking up the table.
12929 2001-12-22 Miguel de Icaza <miguel@ximian.com>
12931 * codegen.cs (EmitTopBlock): Require a Location argument now.
12933 * cs-parser.jay (constructor_declarator): We need to setup
12934 current_local_parameters before we parse the
12935 opt_constructor_initializer, to allow the variables to be bound
12936 to the constructor arguments.
12938 * rootcontext.cs (LookupType): First lookup nested classes in our
12939 class and our parents before we go looking outside our class.
12941 * expression.cs (ConstantFold): Extract/debox the values at the
12944 * rootcontext.cs (EmitCode): Resolve the constants first before we
12945 resolve the types. This is not really needed, but it helps debugging.
12947 * statement.cs: report location.
12949 * cs-parser.jay: pass location to throw statement.
12951 * driver.cs: Small bug fix.
12953 * report.cs: Updated format to be 4-zero filled digits.
12955 2001-12-22 Ravi Pratap <ravi@ximian.com>
12957 * expression.cs (CheckIndices): Fix minor bug where the wrong
12958 variable was being referred to ;-)
12960 (DoEmit): Do not call EmitStaticInitializers when the
12961 underlying type is System.Object.
12963 2001-12-21 Ravi Pratap <ravi@ximian.com>
12965 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
12966 and do the usual workaround for SRE.
12968 * class.cs (MyEventBuilder.EventType): New member to get at the type
12969 of the event, quickly.
12971 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
12973 * assign.cs (Assign.DoResolve): Handle the case when the target
12974 is an EventExpr and perform the necessary checks.
12976 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
12979 (SimpleName.MemberStaticCheck): Include check for EventExpr.
12981 (EventExpr): Set the type in the constructor itself since we
12982 are meant to be born fully resolved.
12984 (EventExpr.Define): Revert code I wrote earlier.
12986 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
12987 instance expression is null. The instance expression is a This in that case
12988 or a null, depending on whether it is a static method or not.
12990 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
12991 refers to more than one method.
12993 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
12994 and accordingly flag errors.
12996 2001-12-21 Miguel de Icaza <miguel@ximian.com>
12998 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
13000 2001-12-22 Miguel de Icaza <miguel@ximian.com>
13002 * location.cs (ToString): Provide useful rutine.
13004 2001-12-21 Miguel de Icaza <miguel@ximian.com>
13006 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
13007 objects, return the actual integral boxed.
13009 * statement.cs (SwitchLabel): define an ILLabel for each
13012 (Switch.CheckSwitch): If the value is a Literal, extract
13013 the underlying literal.
13015 Also in the unused hashtable we had, add the SwitchLabel so we can
13016 quickly look this value up.
13018 * constant.cs: Implement a bunch of new constants. Rewrite
13019 Literal based on this. Made changes everywhere to adapt to this.
13021 * expression.cs (Expression.MakeByteBlob): Optimize routine by
13022 dereferencing array only once, and also copes with enumrations.
13024 bytes are two bytes wide, not one.
13026 (Cast): Perform constant conversions.
13028 * ecore.cs (TryImplicitIntConversion): Return literals instead of
13029 wrappers to the literals here.
13031 * expression.cs (DoNumericPromotions): long literals can converted
13032 to ulong implicity (this is taken care of elsewhere, but I was
13033 missing this spot).
13035 * ecore.cs (Expression.Literalize): Make the return type Literal,
13036 to improve type checking.
13038 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
13040 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13042 * literal.cs: Revert code from ravi that checked the bounds. The
13043 bounds are sane by the definition of the type itself.
13045 * typemanager.cs: Fix implementation of ImplementsInterface. We
13046 need to actually look up in our parent hierarchy for interfaces
13049 * const.cs: Use the underlying type for enumerations
13051 * delegate.cs: Compute the basename for the delegate creation,
13052 that should fix the delegate test case, and restore the correct
13053 Type Lookup semantics in rootcontext
13055 * rootcontext.cs: Revert Ravi's last patch. The correct way of
13056 referencing a nested type with the Reflection API is using the "+"
13059 * cs-parser.jay: Do not require EOF token at the end.
13061 2001-12-20 Ravi Pratap <ravi@ximian.com>
13063 * rootcontext.cs (LookupType): Concatenate type names with
13064 a '.' instead of a '+' The test suite passes again.
13066 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
13067 field of the enumeration.
13069 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
13070 the case when the member is an EventExpr.
13072 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
13073 static has an associated instance expression.
13075 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
13077 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
13079 * class.cs (Event.Define): Register event and perform appropriate checks
13082 We define the Add and Remove methods even if the use provides none because
13083 in that case, we provide default implementations ourselves.
13085 Define a private field of the type of the event. This is done by the CSC compiler
13086 and we should be doing it too ;-)
13088 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
13089 More methods we use in code we generate.
13091 (multicast_delegate_type, delegate_type): Two separate types since the distinction
13094 (InitCoreTypes): Update accordingly for the above.
13096 * class.cs (Event.Emit): Generate code for default accessors that we provide
13098 (EmitDefaultMethod): Do the job in the above.
13100 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
13103 2001-12-20 Miguel de Icaza <miguel@ximian.com>
13105 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
13106 builders even if we were missing one.
13108 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
13109 pass the Basename as our class name instead of the Name. The
13110 basename will be correctly composed for us.
13112 * parameter.cs (Paramters): Now takes a Location argument.
13114 * decl.cs (DeclSpace.LookupType): Removed convenience function and
13115 make all the code call directly LookupType in RootContext and take
13116 this chance to pass the Location information everywhere.
13118 * Everywhere: pass Location information.
13120 2001-12-19 Miguel de Icaza <miguel@ximian.com>
13122 * class.cs (Constructor.Define): Updated way of detecting the
13123 length of the parameters.
13125 (TypeContainer.DefineType): Use basename as the type name for
13128 (TypeContainer.Define): Do not recursively define types here, as
13129 definition is taken care in order by the RootContext.
13131 * tree.cs: Keep track of namespaces in a per-file basis.
13133 * parameter.cs (Parameter.ComputeSignature): Update to use
13136 (Parameters.GetSignature): ditto.
13138 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
13139 instead of a TypeContainer.
13141 (Interface.SemanticAnalysis): Use `this' instead of our parent to
13142 resolve names. Because we need to be resolve in our context, not
13145 * driver.cs: Implement response files.
13147 * class.cs (TypeContainer.DefineType): If we are defined, do not
13148 redefine ourselves.
13150 (Event.Emit): Emit the code for add/remove handlers.
13151 (Event.Define): Save the MethodBuilders for add/remove.
13153 * typemanager.cs: Use pair here too.
13155 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
13156 DictionaryEntry requires the first argument to be non-null.
13158 (enum_declaration): Compute full name for registering the
13161 (delegate_declaration): Instead of using
13162 formal_parameter_list, use opt_formal_parameter_list as the list
13165 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
13166 (EventParsing): New property that controls whether `add' and
13167 `remove' are returned as tokens or identifiers (for events);
13169 2001-12-19 Ravi Pratap <ravi@ximian.com>
13171 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
13172 use MyEventBuilder only and let it wrap the real builder for us.
13174 (MyEventBuilder): Revamp constructor etc.
13176 Implement all operations that we perform on EventBuilder in precisely the same
13179 (FindMembers): Update to use the EventBuilder member.
13181 (Event.Emit): Update accordingly.
13183 2001-12-18 Ravi Pratap <ravi@ximian.com>
13185 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
13186 by calling the appropriate methods.
13188 (GetCustomAttributes): Make stubs as they cannot possibly do anything
13191 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
13193 2001-12-17 Ravi Pratap <ravi@ximian.com>
13195 * delegate.cs (Delegate.Populate): Check that the return type
13196 and various parameters types are indeed accessible.
13198 * class.cs (Constructor.Define): Same here.
13200 (Field.Define): Ditto.
13202 (Event.Define): Ditto.
13204 (Operator.Define): Check that the underlying Method defined itself
13205 correctly - so it's MethodBuilder should not be null.
13207 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
13208 expression happens to be null.
13210 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
13211 members but as of now we don't seem to be able to do anything really useful with it.
13213 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
13214 not the EventBuilder.
13216 2001-12-18 Miguel de Icaza <miguel@ximian.com>
13218 * cs-tokenizer.cs: Add support for defines.
13219 Add support for #if, #elif, #else, #endif
13221 (eval_var): evaluates a variable.
13222 (eval): stubbed for evaluating functions.
13224 * cs-parser.jay: Pass the defines information
13226 * driver.cs: Add --define command line option.
13228 * decl.cs: Move MemberCore here.
13230 Make it the base class for DeclSpace. This allows us to catch and
13231 report 108 and 109 for everything now.
13233 * class.cs (TypeContainer.Define): Extract all the members
13234 before populating and emit the warning 108 (new keyword required
13235 to override) instead of having each member implement this.
13237 (MemberCore.Define): New abstract method, we will be using this in
13238 the warning reporting engine in Populate.
13240 (Operator.Define): Adjust to new MemberCore protocol.
13242 * const.cs (Const): This does not derive from Expression, it is a
13243 temporary object we use to create fields, it is a MemberCore.
13245 * class.cs (Method.Define): Allow the entry point to be in a
13248 * driver.cs: Rewrite the argument handler to clean it up a bit.
13250 * rootcontext.cs: Made it just an auxiliary namespace feature by
13251 making everything static.
13253 * driver.cs: Adapt code to use RootContext type name instead of
13256 * delegate.cs: Remove RootContext argument.
13258 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
13261 * class.cs (Event.Define): The lookup can fail.
13263 * cs-tokenizer.cs: Begin implementation of pre-procesor.
13265 * expression.cs: Resolve the this instance before invoking the code.
13267 2001-12-17 Miguel de Icaza <miguel@ximian.com>
13269 * cs-parser.jay: Add a production in element_access that allows
13270 the thing to become a "type" reference. This way we can parse
13271 things like "(string [])" as a type.
13273 Note that this still does not handle the more complex rules of
13277 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
13279 * ecore.cs: (CopyNewMethods): new utility function used to
13280 assemble the list of methods from running FindMembers.
13282 (MemberLookup): Rework FindMembers so that
13284 2001-12-16 Miguel de Icaza <miguel@ximian.com>
13286 * class.cs (TypeContainer): Remove Delegates who fail to be
13289 * delegate.cs (Populate): Verify that we dont get null return
13290 values. TODO: Check for AsAccessible.
13292 * cs-parser.jay: Use basename to emit error 574 (destructor should
13293 have the same name as container class), not the full name.
13295 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
13296 possible representation.
13298 Also implements integer type suffixes U and L.
13300 2001-12-15 Miguel de Icaza <miguel@ximian.com>
13302 * expression.cs (ArrayCreation.DoResolve): We need to do the
13303 argument resolution *always*.
13305 * decl.cs: Make this hold the namespace. Hold the root context as
13307 (LookupType): Move here.
13309 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
13311 * location.cs (Row, Name): Fixed the code, it was always returning
13312 references to the first file.
13314 * interface.cs: Register properties defined through interfaces.
13316 * driver.cs: Add support for globbing on the command line
13318 * class.cs (Field): Make it derive from MemberCore as well.
13321 2001-12-15 Ravi Pratap <ravi@ximian.com>
13323 * class.cs (Event::Define): Check that the type of the event is a delegate
13324 type else flag error #66.
13326 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
13329 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
13330 values of EntryPoint, CharSet etc etc.
13332 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
13334 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
13335 be null and we should ignore this. I am not sure if this is really clean. Apparently,
13336 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
13337 which needs this to do its work.
13339 * ../errors/cs0066.cs : Add.
13341 2001-12-14 Miguel de Icaza <miguel@ximian.com>
13343 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
13346 * class.cs: (MethodSignature.MethodSignature): Removed hack that
13347 clears out the parameters field.
13348 (MemberSignatureCompare): Cleanup
13350 (MemberCore): New base class used to share code between MethodCore
13353 (RegisterRequiredImplementations) BindingFlags.Public requires
13354 either BindingFlags.Instace or Static. Use instance here.
13356 (Property): Refactored code to cope better with the full spec.
13358 * parameter.cs (GetParameterInfo): Return an empty array instead
13361 * class.cs (Property): Abstract or extern properties have no bodies.
13363 * parameter.cs (GetParameterInfo): return a zero-sized array.
13365 * class.cs (TypeContainer.MethodModifiersValid): Move all the
13366 method modifier validation to the typecontainer so we can reuse
13367 this on properties.
13369 (MethodCore.ParameterTypes): return an empty sized array of types.
13371 (Property.Define): Test property modifier validity.
13373 Add tests for sealed/override too.
13375 (Method.Emit): abstract or extern methods have no bodies.
13377 2001-12-14 Ravi Pratap <ravi@ximian.com>
13379 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
13382 (Method::Define, ::Emit): Modify accordingly.
13384 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
13386 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
13388 * makefile: Pass in /unsafe.
13390 2001-12-13 Miguel de Icaza <miguel@ximian.com>
13392 * class.cs (MakeKey): Kill routine.
13394 * class.cs (TypeContainer.Define): Correctly define explicit
13395 method implementations (they require the full interface name plus
13398 * typemanager.cs: Deply the PtrHashtable here and stop using the
13399 lame keys. Things work so much better.
13401 This of course broke everyone who depended on `RegisterMethod' to
13402 do the `test for existance' test. This has to be done elsewhere.
13404 * support.cs (PtrHashtable): A hashtable that avoid comparing with
13405 the object stupid Equals method (because, that like fails all over
13406 the place). We still do not use it.
13408 * class.cs (TypeContainer.SetRequiredInterface,
13409 TypeContainer.RequireMethods): Killed these two routines and moved
13410 all the functionality to RegisterRequiredImplementations.
13412 (TypeContainer.RegisterRequiredImplementations): This routine now
13413 registers all the implementations required in an array for the
13414 interfaces and abstract methods. We use an array of structures
13415 which can be computed ahead of time to reduce memory usage and we
13416 also assume that lookups are cheap as most classes will not
13417 implement too many interfaces.
13419 We also avoid creating too many MethodSignatures.
13421 (TypeContainer.IsInterfaceMethod): Update and optionally does not
13422 clear the "pending" bit if we find that there are problems with
13425 (TypeContainer.VerifyPendingMethods): Update to report errors of
13426 methods that look like implementations but are not.
13428 (TypeContainer.Define): Add support for explicit interface method
13431 2001-12-12 Miguel de Icaza <miguel@ximian.com>
13433 * typemanager.cs: Keep track of the parameters here instead of
13434 being a feature of the TypeContainer.
13436 * class.cs: Drop the registration of parameters here, as
13437 InterfaceMethods are also interface declarations.
13439 * delegate.cs: Register methods with the TypeManager not only with
13440 the TypeContainer. This code was buggy.
13442 * interface.cs: Full registation here.
13444 2001-12-11 Miguel de Icaza <miguel@ximian.com>
13446 * expression.cs: Remove reducer for binary expressions, it can not
13449 * const.cs: Put here the code that used to go into constant.cs
13451 * constant.cs: Put here the code for constants, this is a new base
13452 class for Literals.
13454 * literal.cs: Make Literal derive from Constant.
13456 2001-12-09 Miguel de Icaza <miguel@ximian.com>
13458 * statement.cs (Return.Emit): Report error 157 if the user
13459 attempts to return from a finally block.
13461 (Return.Emit): Instead of emitting a return, jump to the end of
13464 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
13465 LocalBuilder to store the result of the function. ReturnLabel is
13466 the target where we jump.
13469 2001-12-09 Radek Doulik <rodo@ximian.com>
13471 * cs-parser.jay: remember alias in current namespace
13473 * ecore.cs (SimpleName::DoResolve): use aliases for types or
13476 * class.cs (LookupAlias): lookup alias in my_namespace
13478 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
13480 (LookupAlias): lookup alias in this and if needed in parent
13483 2001-12-08 Miguel de Icaza <miguel@ximian.com>
13487 * rootcontext.cs: (ModuleBuilder) Made static, first step into
13488 making things static. I need this to avoid passing the
13489 TypeContainer when calling ParameterType.
13491 * support.cs (InternalParameters.ParameterType): Remove ugly hack
13492 that did string manipulation to compute the type and then call
13493 GetType. Use Parameter.ParameterType instead.
13495 * cs-tokenizer.cs: Consume the suffix for floating values.
13497 * expression.cs (ParameterReference): figure out whether this is a
13498 reference parameter or not. Kill an extra variable by computing
13499 the arg_idx during emission.
13501 * parameter.cs (Parameters.GetParameterInfo): New overloaded
13502 function that returns whether a parameter is an out/ref value or not.
13504 (Parameter.ParameterType): The type of the parameter (base,
13505 without ref/out applied).
13507 (Parameter.Resolve): Perform resolution here.
13508 (Parameter.ExternalType): The full type (with ref/out applied).
13510 * statement.cs (Using.Emit, Using.EmitExpression): Implement
13511 support for expressions on the using statement.
13513 2001-12-07 Miguel de Icaza <miguel@ximian.com>
13515 * statement.cs (Using.EmitLocalVariableDecls): Split the
13516 localvariable handling of the using statement.
13518 (Block.EmitMeta): Keep track of variable count across blocks. We
13519 were reusing slots on separate branches of blocks.
13521 (Try.Emit): Emit the general code block, we were not emitting it.
13523 Check the type of the declaration to be an IDisposable or
13524 something that can be implicity converted to it.
13526 Emit conversions if required.
13528 * ecore.cs (EmptyExpression): New utility class.
13529 (Expression.ImplicitConversionExists): New utility function.
13531 2001-12-06 Miguel de Icaza <miguel@ximian.com>
13533 * statement.cs (Using): Implement.
13535 * expression.cs (LocalVariableReference): Support read only variables.
13537 * statement.cs: Remove the explicit emit for the Leave opcode.
13538 (VariableInfo): Add a readonly field.
13540 2001-12-05 Miguel de Icaza <miguel@ximian.com>
13542 * ecore.cs (ConvCast): new class used to encapsulate the various
13543 explicit integer conversions that works in both checked and
13544 unchecked contexts.
13546 (Expression.ConvertNumericExplicit): Use new ConvCast class to
13547 properly generate the overflow opcodes.
13549 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13551 * statement.cs: The correct type for the EmptyExpression is the
13552 element_type, not the variable type. Ravi pointed this out.
13554 2001-12-04 Ravi Pratap <ravi@ximian.com>
13556 * class.cs (Method::Define): Handle PInvoke methods specially
13557 by using DefinePInvokeMethod instead of the usual one.
13559 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
13560 above to do the task of extracting information and defining the method.
13562 2001-12-04 Ravi Pratap <ravi@ximian.com>
13564 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
13565 of the condition for string type.
13567 (Emit): Move that here.
13569 (ArrayCreation::CheckIndices): Keep string literals in their expression
13572 (EmitDynamicInitializers): Handle strings appropriately.
13574 2001-12-04 Miguel de Icaza <miguel@ximian.com>
13576 * codegen.cs (EmitContext): Replace multiple variables with a
13577 single pointer to the current Switch statement.
13579 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
13582 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13586 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
13589 (Foreach.Emit): Foreach on arrays was not setting
13590 up the loop variables (for break/continue).
13592 (GotoCase): Semi-implented.
13594 2001-12-03 Ravi Pratap <ravi@ximian.com>
13596 * attribute.cs (CheckAttribute): Handle system attributes by using
13597 Attribute.GetAttributes to examine information we need.
13599 (GetValidPlaces): Same here.
13601 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
13603 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
13605 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
13607 (Method::Define): Set appropriate flags if we have a DllImport attribute.
13609 (Method::Emit): Handle the case when we are a PInvoke method.
13611 2001-12-03 Miguel de Icaza <miguel@ximian.com>
13613 * expression.cs: Use ResolveWithSimpleName on compound names.
13615 2001-12-02 Ravi Pratap <ravi@ximian.com>
13617 * constant.cs (EmitConstant): Make sure we resolve the associated expression
13618 before trying to reduce it.
13620 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
13622 * constant.cs (LookupConstantValue): Implement.
13624 (EmitConstant): Use the above in emitting the constant.
13626 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
13627 that are user-defined by doing a LookupConstantValue on them.
13629 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
13632 2001-11-29 Miguel de Icaza <miguel@ximian.com>
13634 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
13636 (BaseAccess.DoResolve): Implement.
13638 (MemberAccess.DoResolve): Split this routine into a
13639 ResolveMemberAccess routine that can be used independently
13641 2001-11-28 Miguel de Icaza <miguel@ximian.com>
13643 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
13644 As that share bits of the implementation. Is returns a boolean,
13645 while As returns the Type that is being probed.
13647 2001-12-01 Ravi Pratap <ravi@ximian.com>
13649 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
13650 instead of a Literal - much easier.
13652 (EnumInTransit): Remove - utterly useless :-)
13654 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
13656 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
13658 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
13659 chain when we have no associated expression.
13661 2001-11-30 Ravi Pratap <ravi@ximian.com>
13663 * constant.cs (Define): Use Location while reporting the errror.
13665 Also emit a warning when 'new' is used and there is no inherited
13668 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
13671 (LookupEnumValue): Implement to lookup an enum member's value and define it
13674 (Populate): Re-write accordingly to use the above routine.
13676 2001-11-27 Miguel de Icaza <miguel@ximian.com>
13678 * expression.cs (This): Fix prototype for DoResolveLValue to
13679 override the base class DoResolveLValue.
13681 * cs-parser.cs: Report errors cs574 and cs575 (destructor
13684 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
13685 (we need to load the address of the field here). This fixes
13688 (FieldExpr.DoResolveLValue): Call the DoResolve
13689 function to initialize the Instance expression.
13691 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
13692 correctly the GetEnumerator operation on a value type.
13694 * cs-parser.jay: Add more simple parsing error catches.
13696 * statement.cs (Switch): Add support for string switches.
13697 Handle null specially.
13699 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
13701 2001-11-28 Ravi Pratap <ravi@ximian.com>
13703 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
13705 (declare_local_constant): New helper function.
13707 * statement.cs (AddConstant): Keep a separate record of constants
13709 (IsConstant): Implement to determine if a variable is a constant.
13711 (GetConstantExpression): Implement.
13713 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
13715 * statement.cs (IsVariableDefined): Re-write.
13717 2001-11-27 Ravi Pratap <ravi@ximian.com>
13719 * class.cs (TypeContainer::FindMembers): Look for constants
13720 in the case when we are looking for MemberTypes.Field
13722 * expression.cs (MemberAccess::DoResolve): Check that in the
13723 case we are a FieldExpr and a Literal, we are not being accessed
13724 by an instance reference.
13726 * cs-parser.jay (local_constant_declaration): Implement.
13728 (declaration_statement): Implement for constant declarations.
13730 2001-11-26 Miguel de Icaza <miguel@ximian.com>
13732 * statement.cs (Switch): Catch double defaults.
13734 (Switch): More work on the switch() statement
13735 implementation. It works for integral values now, need to finish
13739 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13741 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
13742 integer literals into other integer literals. To be used by
13745 2001-11-24 Ravi Pratap <ravi@ximian.com>
13747 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
13750 (EmitDynamicInitializers): Cope with the above since we extract data
13751 directly from ArrayData now.
13753 (ExpectInitializers): Keep track of whether initializers are mandatory
13756 (Bounds): Make it a hashtable to prevent the same dimension being
13757 recorded for every element in that dimension.
13759 (EmitDynamicInitializers): Fix bug which prevented the Set array method
13762 Also fix bug which was causing the indices to be emitted in the reverse
13765 2001-11-24 Miguel de Icaza <miguel@ximian.com>
13767 * expression.cs (ArrayCreation): Implement the bits that Ravi left
13768 unfinished. They do not work, because the underlying code is
13771 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13773 * cs-parser.jay: Remove bogus fixme.
13775 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
13776 on Switch statement.
13778 2001-11-23 Ravi Pratap <ravi@ximian.com>
13780 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
13783 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
13784 parameter. Apparently, any expression is allowed.
13786 (ValidateInitializers): Update accordingly.
13788 (CheckIndices): Fix some tricky bugs thanks to recursion.
13790 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
13791 I was being completely brain-dead.
13793 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
13794 and re-write acordingly.
13796 (DelegateInvocation): Re-write accordingly.
13798 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
13800 (MakeByteBlob): Handle types more correctly.
13802 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
13803 initialization from expressions but it is incomplete because I am a complete
13806 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13808 * statement.cs (If.Emit): Fix a bug that generated incorrect code
13809 on If. Basically, we have to return `true' (ie, we do return to
13810 our caller) only if both branches of the if return.
13812 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
13813 short-circuit operators, handle them as short circuit operators.
13815 (Cast.DoResolve): Resolve type.
13816 (Cast.Cast): Take an expression as the target type.
13818 * cs-parser.jay (cast_expression): Remove old hack that only
13819 allowed a limited set of types to be handled. Now we take a
13820 unary_expression and we resolve to a type during semantic
13823 Use the grammar productions from Rhys to handle casts (this is
13824 not complete like Rhys syntax yet, we fail to handle that corner
13825 case that C# has regarding (-x), but we will get there.
13827 2001-11-22 Ravi Pratap <ravi@ximian.com>
13829 * class.cs (EmitFieldInitializer): Take care of the case when we have a
13830 field which is an array type.
13832 * cs-parser.jay (declare_local_variables): Support array initialization too.
13834 * typemanager.cs (MakeKey): Implement.
13836 (everywhere): Use the above appropriately.
13838 * cs-parser.jay (for_statement): Update for array initialization while
13839 declaring variables.
13841 * ecore.cs : The error message was correct, it's the variable's names that
13842 were misleading ;-) Make the code more readable.
13844 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
13845 the correct type etc.
13847 (ConvertExplicit): Handle Enum types by examining the underlying type.
13849 2001-11-21 Ravi Pratap <ravi@ximian.com>
13851 * parameter.cs (GetCallingConvention): Always return
13852 CallingConventions.Standard for now.
13854 2001-11-22 Miguel de Icaza <miguel@ximian.com>
13856 * expression.cs (Binary.ResolveOperator): Update the values of `l'
13857 and `r' after calling DoNumericPromotions.
13859 * ecore.cs: Fix error message (the types were in the wrong order).
13861 * statement.cs (Foreach.ProbeCollectionType): Need to pass
13862 BindingFlags.Instance as well
13864 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
13865 implicit int literal conversion in an empty cast so that we
13866 propagate the right type upstream.
13868 (UnboxCast): new class used to unbox value types.
13869 (Expression.ConvertExplicit): Add explicit type conversions done
13872 (Expression.ImplicitNumericConversion): Oops, forgot to test for
13873 the target type before applying the implicit LongLiterals to ULong
13876 2001-11-21 Miguel de Icaza <miguel@ximian.com>
13878 * cs-parser.jay (for_statement): Reworked the way For works: now
13879 we declare manually any variables that are introduced in
13880 for_initializer to solve the problem of having out-of-band code
13881 emition (that is what got for broken).
13883 (declaration_statement): Perform the actual variable declaration
13884 that used to be done in local_variable_declaration here.
13886 (local_variable_declaration): Do not declare anything, just pass
13887 the information on a DictionaryEntry
13889 2001-11-20 Ravi Pratap <ravi@ximian.com>
13891 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
13892 re-write of the logic to now make it recursive.
13894 (UpdateIndices): Re-write accordingly.
13896 Store element data in a separate ArrayData list in the above methods.
13898 (MakeByteBlob): Implement to dump the array data into a byte array.
13900 2001-11-19 Ravi Pratap <ravi@ximian.com>
13902 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
13905 * constant.cs (Define): Implement.
13907 (EmitConstant): Re-write fully.
13909 Pass in location info.
13911 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
13914 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
13915 DictionaryEntry since we need location info too.
13917 (constant_declaration): Update accordingly.
13919 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
13920 code into another method : UpdateIndices.
13922 2001-11-18 Ravi Pratap <ravi@ximian.com>
13924 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
13925 some type checking etc.
13927 2001-11-17 Ravi Pratap <ravi@ximian.com>
13929 * expression.cs (ArrayCreation::ValidateInitializers): Implement
13930 bits to provide dimension info if the user skips doing that.
13932 Update second constructor to store the rank correctly.
13934 2001-11-16 Ravi Pratap <ravi@ximian.com>
13936 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
13937 and try to implement.
13939 * ../errors/cs0150.cs : Add.
13941 * ../errors/cs0178.cs : Add.
13943 2001-11-16 Miguel de Icaza <miguel@ximian.com>
13945 * statement.cs: Implement foreach on multi-dimensional arrays.
13947 * parameter.cs (Parameters.GetParameterByName): Also lookup the
13948 name of the params argument.
13950 * expression.cs: Use EmitStoreOpcode to get the right opcode while
13951 initializing the array.
13953 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
13954 we can use this elsewhere.
13956 * statement.cs: Finish implementation of foreach for single
13959 * cs-parser.jay: Use an out-of-band stack to pass information
13960 around, I wonder why I need this.
13962 foreach_block: Make the new foreach_block the current_block.
13964 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
13965 function used to return a static Parameters structure. Used for
13966 empty parameters, as those are created very frequently.
13968 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
13970 2001-11-15 Ravi Pratap <ravi@ximian.com>
13972 * interface.cs : Default modifier is private, not public. The
13973 make verify test passes again.
13975 2001-11-15 Ravi Pratap <ravi@ximian.com>
13977 * support.cs (ReflectionParameters): Fix logic to determine
13978 whether the last parameter is a params one. Test 9 passes again.
13980 * delegate.cs (Populate): Register the builders we define with
13981 RegisterParameterForBuilder. Test 19 passes again.
13983 * cs-parser.jay (property_declaration): Reference $6 instead
13984 of $$ to get at the location.
13986 (indexer_declaration): Similar stuff.
13988 (attribute): Ditto.
13990 * class.cs (Property): Register parameters for the Get and Set methods
13991 if they exist. Test 23 passes again.
13993 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
13994 call to EmitArguments as we are sure there aren't any params arguments.
13995 Test 32 passes again.
13997 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
13998 IndexOutOfRangeException.
14000 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
14001 Test 33 now passes again.
14003 2001-11-15 Miguel de Icaza <miguel@ximian.com>
14005 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
14006 broke a bunch of things. Will have to come up with a better way
14007 of tracking locations.
14009 * statement.cs: Implemented foreach for single dimension arrays.
14011 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14013 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
14014 an error. This removes the lookup from the critical path.
14016 * cs-parser.jay: Removed use of temporary_loc, which is completely
14019 2001-11-14 Miguel de Icaza <miguel@ximian.com>
14021 * support.cs (ReflectionParameters.ParameterModifier): Report
14022 whether the argument is a PARAMS argument or not.
14024 * class.cs: Set the attribute `ParamArrayAttribute' on the
14025 parameter argument.
14027 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
14028 and cons_param_array_attribute (ConstructorInfo for
14029 ParamArrayAttribute).,
14031 * codegen.cs: Emit the return using the `Return' statement, that
14032 way we can report the error correctly for missing return values.
14034 * class.cs (Method.Emit): Clean up.
14036 * expression.cs (Argument.Resolve): Take another argument: the
14037 location where this argument is used. Notice that this is not
14038 part of the "Argument" class as to reduce the size of the
14039 structure (we know the approximate location anyways).
14041 Test if the argument is a variable-reference, if not, then
14042 complain with a 206.
14044 (Argument.Emit): Emit addresses of variables.
14046 (Argument.FullDesc): Simplify.
14048 (Invocation.DoResolve): Update for Argument.Resolve.
14050 (ElementAccess.DoResolve): ditto.
14052 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
14053 method should be virtual, as this method is always virtual.
14055 (NewDelegate.DoResolve): Update for Argument.Resolve.
14057 * class.cs (ConstructorInitializer.DoResolve): ditto.
14059 * attribute.cs (Attribute.Resolve): ditto.
14061 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14063 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
14065 * expression.cs (ParameterReference): Drop IStackStorage and implement
14066 IAssignMethod instead.
14068 (LocalVariableReference): ditto.
14070 * ecore.cs (FieldExpr): Drop IStackStorage and implement
14071 IAssignMethod instead.
14073 2001-11-13 Miguel de Icaza <miguel@ximian.com>
14075 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
14076 enumerations that are used in heavily used structures derive from
14077 byte in a laughable and pathetic attempt to reduce memory usage.
14078 This is the kind of pre-optimzations that you should not do at
14079 home without adult supervision.
14081 * expression.cs (UnaryMutator): New class, used to handle ++ and
14082 -- separatedly from the other unary operators. Cleans up the
14083 code, and kills the ExpressionStatement dependency in Unary.
14085 (Unary): Removed `method' and `Arguments' from this class, making
14086 it smaller, and moving it all to SimpleCall, so I can reuse this
14087 code in other locations and avoid creating a lot of transient data
14088 strucutres when not required.
14090 * cs-parser.jay: Adjust for new changes.
14092 2001-11-11 Miguel de Icaza <miguel@ximian.com>
14094 * enum.cs (Enum.Populate): If there is a failure during
14097 * cs-parser.jay (opt_enum_base): we used to catch type errors
14098 here, but this is really incorrect. The type error should be
14099 catched during semantic analysis.
14101 2001-12-11 Ravi Pratap <ravi@ximian.com>
14103 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
14104 current_local_parameters as expected since I, in my stupidity, had forgotten
14107 * attribute.cs (GetValidPlaces): Fix stupid bug.
14109 * class.cs (Method::Emit): Perform check on applicability of attributes.
14111 (Constructor::Emit): Ditto.
14113 (Field::Emit): Ditto.
14115 (Field.Location): Store location information.
14117 (Property, Event, Indexer, Operator): Ditto.
14119 * cs-parser.jay (field_declaration): Pass in location for each field.
14121 * ../errors/cs0592.cs : Add.
14123 2001-11-12 Ravi Pratap <ravi@ximian.com>
14125 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
14127 (InitCoreTypes): Update accordingly.
14129 (RegisterAttrType, LookupAttr): Implement.
14131 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
14132 info about the same.
14134 (Resolve): Update to populate the above as necessary.
14136 (Error592): Helper.
14138 (GetValidPlaces): Helper to the above.
14140 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
14142 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
14144 2001-11-12 Ravi Pratap <ravi@ximian.com>
14146 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
14148 * ../errors/cs0617.cs : Add.
14150 2001-11-11 Ravi Pratap <ravi@ximian.com>
14152 * enum.cs (Emit): Rename to Populate to be more consistent with what
14153 we expect it to do and when exactly it is called.
14155 * class.cs, rootcontext.cs : Update accordingly.
14157 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
14158 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
14160 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
14162 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
14163 of a fieldinfo using the above, when dealing with a FieldBuilder.
14165 2001-11-10 Ravi Pratap <ravi@ximian.com>
14167 * ../errors/cs0031.cs : Add.
14169 * ../errors/cs1008.cs : Add.
14171 * ../errrors/cs0543.cs : Add.
14173 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
14176 (FindMembers): Implement.
14178 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
14179 enums and delegates too.
14181 (enum_types): Rename to builder_to_enum.
14183 (delegate_types): Rename to builder_to_delegate.
14185 * delegate.cs (FindMembers): Implement.
14187 2001-11-09 Ravi Pratap <ravi@ximian.com>
14189 * typemanager.cs (IsEnumType): Implement.
14191 * enum.cs (Emit): Re-write parts to account for the underlying type
14192 better and perform checking etc.
14194 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
14195 of the underlying type.
14197 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
14200 * enum.cs (error31): Helper to report error #31.
14202 * cs-parser.jay (enum_declaration): Store location of each member too.
14204 * enum.cs (member_to_location): New hashtable.
14206 (AddEnumMember): Update location hashtable.
14208 (Emit): Use the location of each member while reporting errors.
14210 2001-11-09 Miguel de Icaza <miguel@ximian.com>
14212 * cs-parser.jay: A for_initializer if is a
14213 local_variable_declaration really ammount to have an implicit
14214 block with the variable declaration and no initializer for for.
14216 * statement.cs (For.Emit): Cope with null initializers.
14218 This fixes the infinite loop on for initializers.
14220 2001-11-08 Miguel de Icaza <miguel@ximian.com>
14222 * enum.cs: More cleanup.
14224 * ecore.cs: Remove dead code.
14226 * class.cs (Property.Emit): More simplification.
14227 (Event.Emit): ditto.
14229 Reworked to have less levels of indentation.
14231 2001-11-08 Ravi Pratap <ravi@ximian.com>
14233 * class.cs (Property): Emit attributes.
14243 * enum.cs (Emit): Ditto.
14245 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
14248 * class.cs (Field, Event, etc.): Move attribute generation into the
14249 Emit method everywhere.
14251 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
14252 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
14253 as we had no way of defining nested enums !
14255 * rootcontext.cs : Adjust code accordingly.
14257 * typemanager.cs (AddEnumType): To keep track of enum types separately.
14259 2001-11-07 Ravi Pratap <ravi@ximian.com>
14261 * expression.cs (EvalConstantExpression): Move into ecore.cs
14263 * enum.cs (Enum): Rename some members and make them public and readonly
14264 according to our convention.
14266 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
14269 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
14271 (Enum::Emit): Write a simple version for now which doesn't try to compute
14272 expressions. I shall modify this to be more robust in just a while.
14274 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
14276 (TypeContainer::CloseType): Create the Enum types too.
14278 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
14280 * expression.cs (EvalConstantExpression): Get rid of completely.
14282 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
14283 user-defined values and other cases.
14285 (IsValidEnumLiteral): Helper function.
14287 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
14288 out there in the case we had a literal FieldExpr.
14290 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
14292 (Literalize): Revamp a bit to take two arguments.
14294 (EnumLiteral): New class which derives from Literal to wrap enum literals.
14296 2001-11-06 Ravi Pratap <ravi@ximian.com>
14298 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
14300 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
14302 (Resolve): Use the above to ensure we have proper initializers.
14304 2001-11-05 Ravi Pratap <ravi@ximian.com>
14306 * expression.cs (Expression::EvalConstantExpression): New method to
14307 evaluate constant expressions.
14309 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
14311 2001-11-07 Miguel de Icaza <miguel@ximian.com>
14313 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
14316 (Binary.ResolveOperator): Handle operator != (object a, object b)
14317 and operator == (object a, object b);
14319 (Binary.DoNumericPromotions): Indicate whether the numeric
14320 promotion was possible.
14322 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
14325 Made the ArrayAccess implement interface IAssignMethod instead of
14326 IStackStore as the order in which arguments are passed reflects
14329 * assign.cs: Instead of using expr.ExprClass to select the way of
14330 assinging, probe for the IStackStore/IAssignMethod interfaces.
14332 * typemanager.cs: Load InitializeArray definition.
14334 * rootcontext.cs (RootContext.MakeStaticData): Used to define
14335 static data that can be used to initialize arrays.
14337 2001-11-05 Miguel de Icaza <miguel@ximian.com>
14339 * expression.cs: Handle operator== and operator!= for booleans.
14341 (Conditioal.Reduce): Implement reducer for the ?: operator.
14343 (Conditional.Resolve): Implement dead code elimination.
14345 (Binary.Resolve): Catch string literals and return a new
14346 concatenated string.
14348 (Unary.Reduce): Implement reduction of unary expressions.
14350 * ecore.cs: Split out the expression core handling here.
14352 (Expression.Reduce): New method used to perform constant folding
14353 and CSE. This is needed to support constant-expressions.
14355 * statement.cs (Statement.EmitBoolExpression): Pass true and false
14356 targets, and optimize for !x.
14358 2001-11-04 Ravi Pratap <ravi@ximian.com>
14360 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
14361 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
14362 set custom atttributes.
14364 * literal.cs (Literal::GetValue): New abstract method to return the actual
14365 value of the literal, cast as an object.
14367 (*Literal): Implement GetValue method.
14369 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
14370 expressions to the arraylist but objects of type Argument.
14372 * class.cs (TypeContainer::Emit): Emit our attributes too.
14374 (Method::Emit, Constructor::Emit): Ditto.
14376 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
14377 to be ignoring earlier.
14379 2001-11-03 Ravi Pratap <ravi@ximian.com>
14381 * attribute.cs (AttributeSection::Define): Implement to do the business
14382 of constructing a CustomAttributeBuilder.
14384 (Attribute): New trivial class. Increases readability of code.
14386 * cs-parser.jay : Update accordingly.
14388 (positional_argument_list, named_argument_list, named_argument): New rules
14390 (attribute_arguments): Use the above so that we are more correct.
14392 2001-11-02 Ravi Pratap <ravi@ximian.com>
14394 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
14395 to perform all checks for a method with a params parameter.
14397 (Invocation::OverloadResolve): Update to use the above method and therefore
14398 cope correctly with params method invocations.
14400 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
14403 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
14404 constructors in our parent too because we can't afford to miss out on
14407 * attribute.cs (AttributeSection): New name for the class Attribute
14409 Other trivial changes to improve readability.
14411 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
14412 use the new class names.
14414 2001-11-01 Ravi Pratap <ravi@ximian.com>
14416 * class.cs (Method::Define): Complete definition for params types too
14418 (Indexer::Define): Ditto.
14420 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
14421 Cope everywhere with a request for info about the array parameter.
14423 2001-11-01 Ravi Pratap <ravi@ximian.com>
14425 * tree.cs (RecordNamespace): Fix up to check for the correct key.
14427 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
14428 local_variable_type to extract the string corresponding to the type.
14430 (local_variable_type): Fixup the action to use the new helper method.
14432 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
14435 * expression.cs : Clean out code which uses the above.
14437 2001-10-31 Ravi Pratap <ravi@ximian.com>
14439 * typemanager.cs (RegisterMethod): Check if we already have an existing key
14440 and bale out if necessary by returning a false.
14442 (RegisterProperty): Ditto.
14444 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
14445 and print out appropriate error messages.
14447 * interface.cs (everywhere): Ditto.
14449 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
14450 location to constructor.
14452 * class.cs (Property, Event, Indexer): Update accordingly.
14454 * ../errors/cs111.cs : Added.
14456 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
14457 of a method, as laid down by the spec.
14459 (Invocation::OverloadResolve): Use the above method.
14461 2001-10-31 Ravi Pratap <ravi@ximian.com>
14463 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
14464 now take a TypeContainer and a Parameters object.
14466 (ParameterData): Modify return type of ParameterModifier method to be
14467 Parameter.Modifier and not a string.
14469 (ReflectionParameters, InternalParameters): Update accordingly.
14471 * expression.cs (Argument::GetParameterModifier): Same here.
14473 * support.cs (InternalParameters::ParameterType): Find a better way of determining
14474 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
14475 symbol in it at all so maybe this is only for now.
14477 2001-10-30 Ravi Pratap <ravi@ximian.com>
14479 * support.cs (InternalParameters): Constructor now takes an extra argument
14480 which is the actual Parameters class.
14482 (ParameterDesc): Update to provide info on ref/out modifiers.
14484 * class.cs (everywhere): Update call to InternalParameters to pass in
14485 the second argument too.
14487 * support.cs (ParameterData): Add ParameterModifier, which is a method
14488 to return the modifier info [ref/out etc]
14490 (InternalParameters, ReflectionParameters): Implement the above.
14492 * expression.cs (Argument::ParameterModifier): Similar function to return
14493 info about the argument's modifiers.
14495 (Invocation::OverloadResolve): Update to take into account matching modifiers
14498 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
14499 a new SetFormalParameters object which we pass to InternalParameters.
14501 2001-10-30 Ravi Pratap <ravi@ximian.com>
14503 * expression.cs (NewArray): Merge into the ArrayCreation class.
14505 2001-10-29 Ravi Pratap <ravi@ximian.com>
14507 * expression.cs (NewArray): Merge classes NewBuiltinArray and
14508 NewUserdefinedArray into one as there wasn't much of a use in having
14511 * expression.cs (Argument): Change field's name to ArgType from Type.
14513 (Type): New readonly property which returns the proper type, taking into
14514 account ref/out modifiers.
14516 (everywhere): Adjust code accordingly for the above.
14518 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
14519 whether we are emitting for a ref or out parameter.
14521 * expression.cs (Argument::Emit): Use the above field to set the state.
14523 (LocalVariableReference::Emit): Update to honour the flag and emit the
14526 * parameter.cs (Attributes): Set the correct flags for ref parameters.
14528 * expression.cs (Argument::FullDesc): New function to provide a full desc.
14530 * support.cs (ParameterData): Add method ParameterDesc to the interface.
14532 (ReflectionParameters, InternalParameters): Implement the above method.
14534 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
14537 (Invocation::FullMethodDesc): Ditto.
14539 2001-10-29 Miguel de Icaza <miguel@ximian.com>
14541 * cs-parser.jay: Add extra production for the second form of array
14544 * expression.cs (ArrayCreation): Update to reflect the above
14547 * Small changes to prepare for Array initialization.
14549 2001-10-28 Miguel de Icaza <miguel@ximian.com>
14551 * typemanager.cs (ImplementsInterface): interface might be null;
14552 Deal with this problem;
14554 Also, we do store negative hits on the cache (null values), so use
14555 this instead of calling t.GetInterfaces on the type everytime.
14557 2001-10-28 Ravi Pratap <ravi@ximian.com>
14559 * typemanager.cs (IsBuiltinType): New method to help determine the same.
14561 * expression.cs (New::DoResolve): Get rid of array creation code and instead
14562 split functionality out into different classes.
14564 (New::FormArrayType): Move into NewBuiltinArray.
14566 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
14569 (NewBuiltinArray): New class to handle creation of built-in arrays.
14571 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
14572 account creation of one-dimensional arrays.
14574 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
14576 (NewUserdefinedArray::DoResolve): Implement.
14578 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
14580 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
14581 we maintain inside the TypeManager. This is necessary to perform lookups on the
14584 (LookupType): Update to perform GetType on the module builders too.
14586 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
14588 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
14590 2001-10-23 Ravi Pratap <ravi@ximian.com>
14592 * expression.cs (New::DoResolve): Implement guts of array creation.
14594 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
14596 2001-10-27 Miguel de Icaza <miguel@ximian.com>
14598 * expression.cs: Fix bug I introduced lsat night that broke
14601 (Expression.Resolve): Report a 246 error (can not resolve name)
14602 if we find a SimpleName in the stream.
14604 (Expression.ResolveLValue): Ditto.
14606 (Expression.ResolveWithSimpleName): This function is a variant of
14607 ResolveName, this one allows SimpleNames to be returned without a
14608 warning. The only consumer of SimpleNames is MemberAccess
14610 2001-10-26 Miguel de Icaza <miguel@ximian.com>
14612 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
14613 might arrive here. I have my doubts that this is correct.
14615 * statement.cs (Lock): Implement lock statement.
14617 * cs-parser.jay: Small fixes to support `lock' and `using'
14619 * cs-tokenizer.cs: Remove extra space
14621 * driver.cs: New flag --checked, allows to turn on integer math
14624 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
14625 Threading.Monitor.Exit
14627 2001-10-23 Miguel de Icaza <miguel@ximian.com>
14629 * expression.cs (IndexerAccess::DoResolveLValue): Set the
14630 Expression Class to be IndexerAccess.
14632 Notice that Indexer::DoResolve sets the eclass to Value.
14634 2001-10-22 Miguel de Icaza <miguel@ximian.com>
14636 * class.cs (TypeContainer::Emit): Emit code for indexers.
14638 * assign.cs (IAssignMethod): New interface implemented by Indexers
14639 and Properties for handling assignment.
14641 (Assign::Emit): Simplify and reuse code.
14643 * expression.cs (IndexerAccess, PropertyExpr): Implement
14644 IAssignMethod, clean up old code.
14646 2001-10-22 Ravi Pratap <ravi@ximian.com>
14648 * typemanager.cs (ImplementsInterface): New method to determine if a type
14649 implements a given interface. Provides a nice cache too.
14651 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
14654 (ConvertReferenceExplicit): Ditto.
14656 * delegate.cs (Delegate::Populate): Update to define the parameters on the
14657 various methods, with correct names etc.
14659 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
14660 Operator.UnaryNegation.
14662 * cs-parser.jay (operator_declarator): Be a little clever in the case where
14663 we have a unary plus or minus operator.
14665 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
14668 * everywhere : update accordingly.
14670 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
14673 * class.cs (Method::Define): For the case where we are implementing a method
14674 inherited from an interface, we need to set the MethodAttributes.Final flag too.
14675 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
14677 2001-10-21 Ravi Pratap <ravi@ximian.com>
14679 * interface.cs (FindMembers): Implement to work around S.R.E
14682 * typemanager.cs (IsInterfaceType): Implement.
14684 (FindMembers): Update to handle interface types too.
14686 * expression.cs (ImplicitReferenceConversion): Re-write bits which
14687 use IsAssignableFrom as that is not correct - it doesn't work.
14689 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
14690 and accordingly override EmitStatement.
14692 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
14693 using the correct logic :-)
14695 2001-10-19 Ravi Pratap <ravi@ximian.com>
14697 * ../errors/cs-11.cs : Add to demonstrate error -11
14699 2001-10-17 Miguel de Icaza <miguel@ximian.com>
14701 * assign.cs (Assign::Resolve): Resolve right hand side first, and
14702 then pass this as a hint to ResolveLValue.
14704 * expression.cs (FieldExpr): Add Location information
14706 (FieldExpr::LValueResolve): Report assignment to readonly
14709 (Expression::ExprClassFromMemberInfo): Pass location information.
14711 (Expression::ResolveLValue): Add new method that resolves an
14714 (Expression::DoResolveLValue): Default invocation calls
14717 (Indexers): New class used to keep track of indexers in a given
14720 (IStackStore): Renamed from LValue, as it did not really describe
14721 what this did. Also ResolveLValue is gone from this interface and
14722 now is part of Expression.
14724 (ElementAccess): Depending on the element access type
14726 * typemanager.cs: Add `indexer_name_type' as a Core type
14727 (System.Runtime.CompilerServices.IndexerNameAttribute)
14729 * statement.cs (Goto): Take a location.
14731 2001-10-18 Ravi Pratap <ravi@ximian.com>
14733 * delegate.cs (Delegate::VerifyDelegate): New method to verify
14734 if two delegates are compatible.
14736 (NewDelegate::DoResolve): Update to take care of the case when
14737 we instantiate a delegate from another delegate.
14739 * typemanager.cs (FindMembers): Don't even try to look up members
14740 of Delegate types for now.
14742 2001-10-18 Ravi Pratap <ravi@ximian.com>
14744 * delegate.cs (NewDelegate): New class to take care of delegate
14747 * expression.cs (New): Split the delegate related code out into
14748 the NewDelegate class.
14750 * delegate.cs (DelegateInvocation): New class to handle delegate
14753 * expression.cs (Invocation): Split out delegate related code into
14754 the DelegateInvocation class.
14756 2001-10-17 Ravi Pratap <ravi@ximian.com>
14758 * expression.cs (New::DoResolve): Implement delegate creation fully
14759 and according to the spec.
14761 (New::DoEmit): Update to handle delegates differently.
14763 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
14764 because of which we were printing out arguments in reverse order !
14766 * delegate.cs (VerifyMethod): Implement to check if the given method
14767 matches the delegate.
14769 (FullDelegateDesc): Implement.
14771 (VerifyApplicability): Implement.
14773 * expression.cs (Invocation::DoResolve): Update to accordingly handle
14774 delegate invocations too.
14776 (Invocation::Emit): Ditto.
14778 * ../errors/cs1593.cs : Added.
14780 * ../errors/cs1594.cs : Added.
14782 * delegate.cs (InstanceExpression, TargetMethod): New properties.
14784 2001-10-16 Ravi Pratap <ravi@ximian.com>
14786 * typemanager.cs (intptr_type): Core type for System.IntPtr
14788 (InitCoreTypes): Update for the same.
14790 (iasyncresult_type, asynccallback_type): Ditto.
14792 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
14795 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
14798 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
14799 the builders for the 4 members of a delegate type :-)
14801 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
14804 * expression.cs (New::DoResolve): Implement guts for delegate creation.
14806 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
14808 2001-10-15 Miguel de Icaza <miguel@ximian.com>
14810 * statement.cs (Break::Emit): Implement.
14811 (Continue::Emit): Implement.
14813 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
14814 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
14815 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
14816 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
14819 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
14820 properties that track the label for the current loop (begin of the
14821 loop and end of the loop).
14823 2001-10-15 Ravi Pratap <ravi@ximian.com>
14825 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
14826 use of emitting anything at all.
14828 * class.cs, rootcontext.cs : Get rid of calls to the same.
14830 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
14832 (Populate): Define the constructor correctly and set the implementation
14835 * typemanager.cs (delegate_types): New hashtable to hold delegates that
14838 (AddDelegateType): Implement.
14840 (IsDelegateType): Implement helper method.
14842 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
14844 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
14845 and accordingly handle it.
14847 * delegate.cs (Populate): Take TypeContainer argument.
14848 Implement bits to define the Invoke method. However, I still haven't figured out
14849 how to take care of the native int bit :-(
14851 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
14852 Qualify the name of the delegate, not its return type !
14854 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
14857 (StandardConversionExists): Checking for array types turns out to be recursive.
14859 (ConvertReferenceExplicit): Implement array conversion.
14861 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
14863 2001-10-12 Ravi Pratap <ravi@ximian.com>
14865 * cs-parser.jay (delegate_declaration): Store the fully qualified
14866 name as it is a type declaration.
14868 * delegate.cs (ReturnType, Name): Rename members to these. Make them
14871 (DefineDelegate): Renamed from Define. Does the same thing essentially,
14872 as TypeContainer::DefineType.
14874 (Populate): Method in which all the definition of the various methods (Invoke)
14877 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
14880 (CloseDelegate): Finally creates the delegate.
14882 * class.cs (TypeContainer::DefineType): Update to define delegates.
14883 (Populate, Emit and CloseType): Do the same thing here too.
14885 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
14886 delegates in all these operations.
14888 2001-10-14 Miguel de Icaza <miguel@ximian.com>
14890 * expression.cs: LocalTemporary: a new expression used to
14891 reference a temporary that has been created.
14893 * assign.cs: Handle PropertyAccess back here, so that we can
14894 provide the proper semantic access to properties.
14896 * expression.cs (Expression::ConvertReferenceExplicit): Implement
14897 a few more explicit conversions.
14899 * modifiers.cs: `NEW' modifier maps to HideBySig.
14901 * expression.cs (PropertyExpr): Make this into an
14902 ExpressionStatement, and support the EmitStatement code path.
14904 Perform get/set error checking, clean up the interface.
14906 * assign.cs: recognize PropertyExprs as targets, and if so, turn
14907 them into toplevel access objects.
14909 2001-10-12 Miguel de Icaza <miguel@ximian.com>
14911 * expression.cs: PropertyExpr::PropertyExpr: use work around the
14914 * typemanager.cs: Keep track here of our PropertyBuilders again to
14915 work around lameness in SRE.
14917 2001-10-11 Miguel de Icaza <miguel@ximian.com>
14919 * expression.cs (LValue::LValueResolve): New method in the
14920 interface, used to perform a second resolution pass for LValues.
14922 (This::DoResolve): Catch the use of this in static methods.
14924 (This::LValueResolve): Implement.
14926 (This::Store): Remove warning, assigning to `this' in structures
14929 (Invocation::Emit): Deal with invocation of
14930 methods on value types. We need to pass the address to structure
14931 methods rather than the object itself. (The equivalent code to
14932 emit "this" for structures leaves the entire structure on the
14933 stack instead of a pointer to it).
14935 (ParameterReference::DoResolve): Compute the real index for the
14936 argument based on whether the method takes or not a `this' pointer
14937 (ie, the method is static).
14939 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
14940 value types returned from functions when we need to invoke a
14941 method on the sturcture.
14944 2001-10-11 Ravi Pratap <ravi@ximian.com>
14946 * class.cs (TypeContainer::DefineType): Method to actually do the business of
14947 defining the type in the Modulebuilder or Typebuilder. This is to take
14948 care of nested types which need to be defined on the TypeBuilder using
14949 DefineNestedMethod.
14951 (TypeContainer::GetClassBases): Implement. Essentially the code from the
14952 methods in RootContext, only ported to be part of TypeContainer.
14954 (TypeContainer::GetInterfaceOrClass): Ditto.
14956 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
14958 * interface.cs (Interface::DefineInterface): New method. Does exactly
14959 what RootContext.CreateInterface did earlier, only it takes care of nested types
14962 (Interface::GetInterfaces): Move from RootContext here and port.
14964 (Interface::GetInterfaceByName): Same here.
14966 * rootcontext.cs (ResolveTree): Re-write.
14968 (PopulateTypes): Re-write.
14970 * class.cs (TypeContainer::Populate): Populate nested types too.
14971 (TypeContainer::Emit): Emit nested members too.
14973 * typemanager.cs (AddUserType): Do not make use of the FullName property,
14974 instead just use the name argument passed in as it is already fully
14977 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
14978 to TypeContainer mapping to see if a type is user-defined.
14980 * class.cs (TypeContainer::CloseType): Implement.
14982 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
14983 the default constructor.
14985 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
14988 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
14990 * interface.cs (CloseType): Create the type here.
14992 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
14995 Remove all the methods which are now in TypeContainer.
14997 2001-10-10 Ravi Pratap <ravi@ximian.com>
14999 * delegate.cs (Define): Re-write bits to define the delegate
15002 2001-10-10 Miguel de Icaza <miguel@ximian.com>
15004 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
15006 * expression.cs (ImplicitReferenceConversion): handle null as well
15007 as a source to convert to any reference type.
15009 * statement.cs (Return): Perform any implicit conversions to
15010 expected return type.
15012 Validate use of return statement.
15014 * codegen.cs (EmitContext): Pass the expected return type here.
15016 * class.cs (Method, Constructor, Property): Pass expected return
15017 type to EmitContext.
15019 2001-10-09 Miguel de Icaza <miguel@ximian.com>
15021 * expression.cs: Make DoResolve take an EmitContext instead of a
15024 Replaced `l' and `location' for `loc', for consistency.
15026 (Error, Warning): Remove unneeded Tc argument.
15028 * assign.cs, literal.cs, constant.cs: Update to new calling
15031 * codegen.cs: EmitContext now contains a flag indicating whether
15032 code is being generated in a static method or not.
15034 * cs-parser.jay: DecomposeQI, new function that replaces the old
15035 QualifiedIdentifier. Now we always decompose the assembled
15036 strings from qualified_identifier productions into a group of
15039 2001-10-08 Miguel de Icaza <miguel@ximian.com>
15041 * rootcontext.cs: Deal with field-less struct types correctly now
15042 by passing the size option to Define Type.
15044 * class.cs: Removed hack that created one static field.
15046 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15048 * statement.cs: Moved most of the code generation here.
15050 2001-10-09 Ravi Pratap <ravi@ximian.com>
15052 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
15055 (ElementAccess): Remove useless bits for now - keep checks as the spec
15058 2001-10-08 Ravi Pratap <ravi@ximian.com>
15060 * expression.cs (ElementAccess::DoResolve): Remove my crap code
15061 and start performing checks according to the spec.
15063 2001-10-07 Ravi Pratap <ravi@ximian.com>
15065 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
15066 rank_specifiers instead.
15068 (rank_specifiers): Change the order in which the rank specifiers are stored
15070 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
15072 * expression.cs (ElementAccess): Implement the LValue interface too.
15074 2001-10-06 Ravi Pratap <ravi@ximian.com>
15076 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
15077 except that user defined conversions are not included.
15079 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
15080 perform the conversion of the return type, if necessary.
15082 (New::DoResolve): Check whether we are creating an array or an object
15083 and accordingly do the needful.
15085 (New::Emit): Same here.
15087 (New::DoResolve): Implement guts of array creation.
15089 (New::FormLookupType): Helper function.
15091 2001-10-07 Miguel de Icaza <miguel@ximian.com>
15093 * codegen.cs: Removed most of the code generation here, and move the
15094 corresponding code generation bits to the statement classes.
15096 Added support for try/catch/finalize and throw.
15098 * cs-parser.jay: Added support for try/catch/finalize.
15100 * class.cs: Catch static methods having the flags override,
15101 virtual or abstract.
15103 * expression.cs (UserCast): This user cast was not really doing
15104 what it was supposed to do. Which is to be born in fully resolved
15105 state. Parts of the resolution were being performed at Emit time!
15109 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15111 * expression.cs: Implicity convert the result from UserCast.
15113 2001-10-05 Ravi Pratap <ravi@ximian.com>
15115 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
15116 prevented it from working correctly.
15118 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
15119 merely ConvertImplicit.
15121 2001-10-05 Miguel de Icaza <miguel@ximian.com>
15123 * typemanager.cs: Make the LookupTypeContainer function static,
15124 and not per-instance.
15126 * class.cs: Make static FindMembers (the one that takes a Type
15129 * codegen.cs: Add EmitForeach here.
15131 * cs-parser.jay: Make foreach a toplevel object instead of the
15132 inline expansion, as we need to perform semantic analysis on it.
15134 2001-10-05 Ravi Pratap <ravi@ximian.com>
15136 * expression.cs (Expression::ImplicitUserConversion): Rename to
15137 UserDefinedConversion.
15139 (Expression::UserDefinedConversion): Take an extra argument specifying
15140 whether we look for explicit user conversions too.
15142 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
15144 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
15146 (ExplicitUserConversion): Make it a call to UserDefinedConversion
15147 with the appropriate arguments.
15149 * cs-parser.jay (cast_expression): Record location too.
15151 * expression.cs (Cast): Record location info.
15153 (Expression::ConvertExplicit): Take location argument.
15155 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
15156 to determine if we are doing explicit conversions.
15158 (UserCast::Emit): Update accordingly.
15160 (Expression::ConvertExplicit): Report an error if everything fails.
15162 * ../errors/cs0030.cs : Add.
15164 2001-10-04 Miguel de Icaza <miguel@ximian.com>
15166 * modifiers.cs: If the ABSTRACT keyword is present, also set the
15167 virtual and newslot bits.
15169 * class.cs (TypeContainer::RegisterRequiredImplementations):
15170 Record methods we need.
15172 (TypeContainer::MakeKey): Helper function to make keys for
15173 MethodBases, since the Methodbase key is useless.
15175 (TypeContainer::Populate): Call RegisterRequiredImplementations
15176 before defining the methods.
15178 Create a mapping for method_builders_to_methods ahead of time
15179 instead of inside a tight loop.
15181 (::RequireMethods): Accept an object as the data to set into the
15182 hashtable so we can report interface vs abstract method mismatch.
15184 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15186 * report.cs: Make all of it static.
15188 * rootcontext.cs: Drop object_type and value_type computations, as
15189 we have those in the TypeManager anyways.
15191 Drop report instance variable too, now it is a global.
15193 * driver.cs: Use try/catch on command line handling.
15195 Add --probe option to debug the error reporting system with a test
15198 * report.cs: Add support for exiting program when a probe
15199 condition is reached.
15201 2001-10-03 Ravi Pratap <ravi@ximian.com>
15203 * expression.cs (Binary::DoNumericPromotions): Fix the case when
15204 we do a forcible conversion regardless of type, to check if
15205 ForceConversion returns a null.
15207 (Binary::error19): Use location to report error.
15209 (Unary::error23): Use location here too.
15211 * ../errors/cs0019.cs : Check in.
15213 * ../errors/cs0023.cs : Check in.
15215 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
15216 case of a non-null MethodInfo object with a length of 0 !
15218 (Binary::ResolveOperator): Flag error if overload resolution fails to find
15219 an applicable member - according to the spec :-)
15220 Also fix logic to find members in base types.
15222 (Unary::ResolveOperator): Same here.
15224 (Unary::report23): Change name to error23 and make first argument a TypeContainer
15225 as I was getting thoroughly confused between this and error19 :-)
15227 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
15228 (::FindMostEncompassedType): Implement.
15229 (::FindMostEncompassingType): Implement.
15230 (::StandardConversionExists): Implement.
15232 (UserImplicitCast): Re-vamp. We now need info about most specific
15233 source and target types so that we can do the necessary conversions.
15235 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
15236 mathematical union with no duplicates.
15238 2001-10-03 Miguel de Icaza <miguel@ximian.com>
15240 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
15241 in order from base classes to child classes, so that we can in
15242 child classes look up in our parent for method names and
15243 attributes (required for handling abstract, virtual, new, override
15244 constructs: we need to instrospect our base class, and if we dont
15245 populate the classes in order, the introspection might be
15246 incorrect. For example, a method could query its parent before
15247 the parent has any methods and would determine that the parent has
15248 no abstract methods (while it could have had them)).
15250 (RootContext::CreateType): Record the order in which we define the
15253 2001-10-02 Miguel de Icaza <miguel@ximian.com>
15255 * class.cs (TypeContainer::Populate): Also method definitions can
15256 fail now, keep track of this.
15258 (TypeContainer::FindMembers): Implement support for
15259 DeclaredOnly/noDeclaredOnly flag.
15261 (Constructor::Emit) Return the ConstructorBuilder.
15263 (Method::Emit) Return the MethodBuilder.
15264 Check for abstract or virtual methods to be public.
15266 * rootcontext.cs (RootContext::CreateType): Register all the
15267 abstract methods required for the class to be complete and the
15268 interface methods that must be implemented.
15270 * cs-parser.jay: Report error 501 (method requires body if it is
15271 not marked abstract or extern).
15273 * expression.cs (TypeOf::Emit): Implement.
15275 * typemanager.cs: runtime_handle_type, new global type.
15277 * class.cs (Property::Emit): Generate code for properties.
15279 2001-10-02 Ravi Pratap <ravi@ximian.com>
15281 * expression.cs (Unary::ResolveOperator): Find operators on base type
15282 too - we now conform exactly to the spec.
15284 (Binary::ResolveOperator): Same here.
15286 * class.cs (Operator::Define): Fix minor quirk in the tests.
15288 * ../errors/cs0215.cs : Added.
15290 * ../errors/cs0556.cs : Added.
15292 * ../errors/cs0555.cs : Added.
15294 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15296 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
15297 single integer which is really efficient
15299 2001-10-01 Ravi Pratap <ravi@ximian.com>
15301 * expression.cs (Expression::ImplicitUserConversion): Use location
15302 even in the case when we are examining True operators.
15304 * class.cs (Operator::Define): Perform extensive checks to conform
15305 with the rules for operator overloading in the spec.
15307 * expression.cs (Expression::ImplicitReferenceConversion): Implement
15308 some of the other conversions mentioned in the spec.
15310 * typemanager.cs (array_type): New static member for the System.Array built-in
15313 (cloneable_interface): For System.ICloneable interface.
15315 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
15316 we start resolving the tree and populating types.
15318 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
15320 2001-10-01 Miguel de Icaza <miguel@ximian.com>
15322 * expression.cs (Expression::ExprClassFromMemberInfo,
15323 Expression::Literalize): Create literal expressions from
15324 FieldInfos which are literals.
15326 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
15327 type casts, because they were wrong. The test suite in tests
15330 (ImplicitNumericConversion): ushort to ulong requires a widening
15333 Int32 constant to long requires widening cast as well.
15335 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
15336 for integers because the type on the stack is not i4.
15338 2001-09-30 Miguel de Icaza <miguel@ximian.com>
15340 * expression.cs (report118): require location argument.
15342 * parameter.cs: Do not dereference potential null value.
15344 * class.cs: Catch methods that lack the `new' keyword when
15345 overriding a name. Report warnings when `new' is used without
15346 anything being there to override.
15348 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
15350 * class.cs: Only add constructor to hashtable if it is non-null
15351 (as now constructors can fail on define).
15353 (TypeManager, Class, Struct): Take location arguments.
15355 Catch field instance initialization in structs as errors.
15357 accepting_filter: a new filter for FindMembers that is static so
15358 that we dont create an instance per invocation.
15360 (Constructor::Define): Catch errors where a struct constructor is
15363 * cs-parser.jay: Pass location information for various new
15366 * delegate.cs (Delegate): take a location argument.
15368 * driver.cs: Do not call EmitCode if there were problesm in the
15369 Definition of the types, as many Builders wont be there.
15371 * decl.cs (Decl::Decl): Require a location argument.
15373 * cs-tokenizer.cs: Handle properly hex constants that can not fit
15374 into integers, and find the most appropiate integer for it.
15376 * literal.cs: Implement ULongLiteral.
15378 * rootcontext.cs: Provide better information about the location of
15379 failure when CreateType fails.
15381 2001-09-29 Miguel de Icaza <miguel@ximian.com>
15383 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
15386 * expression.cs (Binary::CheckShiftArguments): Add missing type
15388 (Binary::ResolveOperator): Add type to the logical and and logical
15389 or, Bitwise And/Or and Exclusive Or code paths, it was missing
15392 (Binary::DoNumericPromotions): In the case where either argument
15393 is ulong (and most signed types combined with ulong cause an
15394 error) perform implicit integer constant conversions as well.
15396 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15398 * expression.cs (UserImplicitCast): Method should always be
15400 (Invocation::BetterConversion): Simplified test for IntLiteral.
15402 (Expression::ImplicitNumericConversion): Split this routine out.
15403 Put the code that performs implicit constant integer conversions
15406 (Expression::Resolve): Become a wrapper around DoResolve so we can
15407 check eclass and type being set after resolve.
15409 (Invocation::Badness): Remove this dead function
15411 (Binary::ResolveOperator): Do not compute the expensive argumnets
15412 unless we have a union for it.
15414 (Probe::Emit): Is needs to do an isinst and then
15415 compare against null.
15417 (::CanConvert): Added Location argument. If the Location argument
15418 is null (Location.Null), then we do not report errors. This is
15419 used by the `probe' mechanism of the Explicit conversion. We do
15420 not want to generate an error for something that the user
15421 explicitly requested to be casted. But the pipeline for an
15422 explicit cast first tests for potential implicit casts.
15424 So for now, if the Location is null, it means `Probe only' to
15425 avoid adding another argument. Might have to revise this
15428 (ClassCast): New class used to type cast objects into arbitrary
15429 classes (used in Explicit Reference Conversions).
15431 Implement `as' as well.
15433 Reverted all the patches from Ravi below: they were broken:
15435 * The use of `level' as a mechanism to stop recursive
15436 invocations is wrong. That was there just to catch the
15437 bug with a strack trace but not as a way of addressing
15440 To fix the problem we have to *understand* what is going
15441 on and the interactions and come up with a plan, not
15442 just get things going.
15444 * The use of the type conversion cache that I proposed
15445 last night had an open topic: How does this work across
15446 protection domains. A user defined conversion might not
15447 be public in the location where we are applying the
15448 conversion, a different conversion might be selected
15449 (ie, private A->B (better) but public B->A (worse),
15450 inside A, A->B applies, but outside it, B->A will
15453 * On top of that (ie, even if the above is solved),
15454 conversions in a cache need to be abstract. Ie, `To
15455 convert from an Int to a Short use an OpcodeCast', not
15456 `To convert from an Int to a Short use the OpcodeCast on
15457 the variable 5' (which is what this patch was doing).
15459 2001-09-28 Ravi Pratap <ravi@ximian.com>
15461 * expression.cs (Invocation::ConversionExists): Re-write to use
15462 the conversion cache
15464 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
15465 cache all conversions done, not just user-defined ones.
15467 (Invocation::BetterConversion): The real culprit. Use ConversionExists
15468 to determine if a conversion exists instead of acutually trying to
15469 perform the conversion. It's faster too.
15471 (Expression::ConvertExplicit): Modify to use ConversionExists to check
15472 and only then attempt the implicit conversion.
15474 2001-09-28 Ravi Pratap <ravi@ximian.com>
15476 * expression.cs (ConvertImplicit): Use a cache for conversions
15477 already found. Check level of recursion and bail out if necessary.
15479 2001-09-28 Miguel de Icaza <miguel@ximian.com>
15481 * typemanager.cs (string_concat_string_string, string_concat_object_object):
15482 Export standard methods that we expect for string operations.
15484 * statement.cs (Block::UsageWarning): Track usage of variables and
15485 report the errors for not used variables.
15487 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
15490 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15492 * codegen.cs: remove unnneded code
15494 * expression.cs: Removed BuiltinTypeAccess class
15496 Fix the order in which implicit conversions are
15499 The previous fixed dropped support for boxed conversions (adding a
15500 test to the test suite now)
15502 (UserImplicitCast::CanConvert): Remove test for source being null,
15503 that code is broken. We should not feed a null to begin with, if
15504 we do, then we should track the bug where the problem originates
15505 and not try to cover it up here.
15507 Return a resolved expression of type UserImplicitCast on success
15508 rather than true/false. Ravi: this is what I was talking about,
15509 the pattern is to use a static method as a "constructor" for
15512 Also, do not create arguments until the very last minute,
15513 otherwise we always create the arguments even for lookups that
15514 will never be performed.
15516 (UserImplicitCast::Resolve): Eliminate, objects of type
15517 UserImplicitCast are born in a fully resolved state.
15519 * typemanager.cs (InitCoreTypes): Init also value_type
15520 (System.ValueType).
15522 * expression.cs (Cast::Resolve): First resolve the child expression.
15524 (LValue): Add new method AddressOf to be used by
15527 Change the argument of Store to take an EmitContext instead of an
15528 ILGenerator, because things like FieldExpr need to be able to call
15529 their children expression to generate the instance code.
15531 (Expression::Error, Expression::Warning): Sugar functions for
15534 (Expression::MemberLookup): Accept a TypeContainer instead of a
15535 Report as the first argument.
15537 (Expression::ResolvePrimary): Killed. I still want to improve
15538 this as currently the code is just not right.
15540 (Expression::ResolveMemberAccess): Simplify, but it is still
15543 (Unary::Resolve): Catch errors in AddressOf operators.
15545 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
15546 index to a byte for the short-version, or the compiler will choose
15547 the wrong Emit call, which generates the wrong data.
15549 (ParameterReference::Emit, ::Store): same.
15551 (FieldExpr::AddressOf): Implement.
15553 * typemanager.cs: TypeManager: made public variable instead of
15556 * driver.cs: document --fatal.
15558 * report.cs (ErrorMessage, WarningMessage): new names for the old
15559 Error and Warning classes.
15561 * cs-parser.jay (member_access): Turn built-in access to types
15562 into a normal simplename
15564 2001-09-27 Ravi Pratap <ravi@ximian.com>
15566 * expression.cs (Invocation::BetterConversion): Fix to cope
15567 with q being null, since this was introducing a bug.
15569 * expression.cs (ConvertImplicit): Do built-in conversions first.
15571 2001-09-27 Ravi Pratap <ravi@ximian.com>
15573 * expression.cs (UserImplicitCast::Resolve): Fix bug.
15575 2001-09-27 Ravi Pratap <ravi@ximian.com>
15577 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
15578 I had introduced long ago (what's new ?).
15580 * expression.cs (UserImplicitCast::CanConvert): Static method to do
15581 the work of all the checking.
15582 (ConvertImplicit): Call CanConvert and only then create object if necessary.
15583 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
15585 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
15586 that is the right way.
15588 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
15589 overloading resolution. Use everywhere instead of cutting and pasting code.
15591 (Binary::ResolveOperator): Use MakeUnionSet.
15593 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
15594 we have to convert to bool types. Not complete yet.
15596 2001-09-27 Miguel de Icaza <miguel@ximian.com>
15598 * typemanager.cs (TypeManager::CSharpName): support ushort.
15600 * expression.cs (Expression::TryImplicitIntConversion): Attempts
15601 to provide an expression that performsn an implicit constant int
15602 conversion (section 6.1.6).
15603 (Expression::ConvertImplicitRequired): Reworked to include
15604 implicit constant expression conversions.
15606 (Expression::ConvertNumericExplicit): Finished.
15608 (Invocation::Emit): If InstanceExpression is null, then it means
15609 that we perform a call on this.
15611 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15613 * expression.cs (Unary::Emit): Remove some dead code.
15614 (Probe): Implement Resolve and Emit for `is'.
15615 (Expression::ConvertImplicitRequired): Attempt to do constant
15616 expression conversions here. Maybe should be moved to
15617 ConvertImplicit, but I am not sure.
15618 (Expression::ImplicitLongConstantConversionPossible,
15619 Expression::ImplicitIntConstantConversionPossible): New functions
15620 that tell whether is it possible to apply an implicit constant
15621 expression conversion.
15623 (ConvertNumericExplicit): Started work on explicit numeric
15626 * cs-parser.jay: Update operator constants.
15628 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
15629 (Parameters::GetSignature): Hook up VerifyArgs here.
15630 (Parameters::VerifyArgs): Verifies that no two arguments have the
15633 * class.cs (Operator): Update the operator names to reflect the
15634 ones that the spec expects (as we are just stringizing the
15637 * expression.cs (Unary::ResolveOperator): Fix bug: Use
15638 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
15639 previous usage did only work for our methods.
15640 (Expression::ConvertImplicit): Handle decimal implicit numeric
15641 conversions as well.
15642 (Expression::InternalTypeConstructor): Used to invoke constructors
15643 on internal types for default promotions.
15645 (Unary::Emit): Implement special handling for the pre/post
15646 increment/decrement for overloaded operators, as they need to have
15647 the same semantics as the other operators.
15649 (Binary::ResolveOperator): ditto.
15650 (Invocation::ConversionExists): ditto.
15651 (UserImplicitCast::Resolve): ditto.
15653 2001-09-26 Ravi Pratap <ravi@ximian.com>
15655 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
15656 operator, return after emitting body. Regression tests pass again !
15658 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
15659 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
15660 (Invocation::OverloadResolve): Ditto.
15661 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
15663 * everywhere : update calls to the above methods accordingly.
15665 2001-09-26 Miguel de Icaza <miguel@ximian.com>
15667 * assign.cs (Assign): Make it inherit from ExpressionStatement.
15669 * expression.cs (ExpressionStatement): New base class used for
15670 expressions that can appear in statements, so that we can provide
15671 an alternate path to generate expression that do not leave a value
15674 (Expression::Emit, and all the derivatives): We no longer return
15675 whether a value is left on the stack or not. Every expression
15676 after being emitted leaves a single value on the stack.
15678 * codegen.cs (EmitContext::EmitStatementExpression): Use the
15679 facilties of ExpressionStatement if possible.
15681 * cs-parser.jay: Update statement_expression.
15683 2001-09-25 Miguel de Icaza <miguel@ximian.com>
15685 * driver.cs: Change the wording of message
15687 2001-09-25 Ravi Pratap <ravi@ximian.com>
15689 * expression.cs (Binary::ResolveOperator): Had forgottten to set
15690 the type of the expression to the return type of the method if
15691 we have an overloaded operator match ! The regression tests pass again !
15692 (Unary::ResolveOperator): Ditto.
15694 * expression.cs (Invocation::ConversionExists): Correct the member lookup
15695 to find "op_Implicit", not "implicit" ;-)
15696 (UserImplicitCast): New class to take care of user-defined implicit conversions.
15697 (ConvertImplicit, ForceConversion): Take TypeContainer argument
15699 * everywhere : Correct calls to the above accordingly.
15701 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
15702 (ConvertImplicit): Do user-defined conversion if it exists.
15704 2001-09-24 Miguel de Icaza <miguel@ximian.com>
15706 * assign.cs: track location.
15707 (Resolve): Use implicit conversions on assignment.
15709 * literal.cs: Oops. Not good, Emit of short access values should
15710 pass (Bytes) or the wrong argument will be selected.
15712 * expression.cs (Unary::Emit): Emit code for -expr.
15714 (Unary::ResolveOperator): Handle `Substract' for non-constants
15715 (substract from zero from the non-constants).
15716 Deal with Doubles as well.
15718 (Expression::ConvertImplicitRequired): New routine that reports an
15719 error if no implicit conversion exists.
15721 (Invocation::OverloadResolve): Store the converted implicit
15722 expressions if we make them
15724 2001-09-24 Ravi Pratap <ravi@ximian.com>
15726 * class.cs (ConstructorInitializer): Take a Location argument.
15727 (ConstructorBaseInitializer): Same here.
15728 (ConstructorThisInitializer): Same here.
15730 * cs-parser.jay : Update all calls accordingly.
15732 * expression.cs (Unary, Binary, New): Take location argument.
15733 Update accordingly everywhere.
15735 * cs-parser.jay : Update all calls to the above to take a location
15738 * class.cs : Ditto.
15740 2001-09-24 Ravi Pratap <ravi@ximian.com>
15742 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
15743 (Invocation::BetterConversion): Same here
15744 (Invocation::ConversionExists): Ditto.
15746 (Invocation::ConversionExists): Implement.
15748 2001-09-22 Ravi Pratap <ravi@ximian.com>
15750 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
15751 Also take an additional TypeContainer argument.
15753 * All over : Pass in TypeContainer as argument to OverloadResolve.
15755 * typemanager.cs (CSharpName): Update to check for the string type and return
15758 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
15761 2001-09-21 Ravi Pratap <ravi@ximian.com>
15763 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
15764 (Invocation::BetterFunction): Implement.
15765 (Invocation::BetterConversion): Implement.
15766 (Invocation::ConversionExists): Skeleton, no implementation yet.
15768 Okay, things work fine !
15770 2001-09-21 Miguel de Icaza <miguel@ximian.com>
15772 * typemanager.cs: declare and load enum_type, delegate_type and
15775 * expression.cs (Expression::Emit): Now emit returns a value that
15776 tells whether a value is left on the stack or not. This strategy
15777 might be reveted tomorrow with a mechanism that would address
15778 multiple assignments.
15779 (Expression::report118): Utility routine to report mismatches on
15782 (Unary::Report23): Report impossible type/operator combination
15785 (Unary::IsIncrementableNumber): Whether the type can be
15786 incremented or decremented with add.
15787 (Unary::ResolveOperator): Also allow enumerations to be bitwise
15789 (Unary::ResolveOperator): Implement ++, !, ~,
15791 (Invocation::Emit): Deal with new Emit convetion.
15793 * All Expression derivatives: Updated their Emit method to return
15794 whether they leave values on the stack or not.
15796 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
15797 stack for expressions that are statements.
15799 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15801 * expression.cs (LValue): New interface. Must be implemented by
15803 (LocalVariableReference, ParameterReference, FieldExpr): Implement
15806 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
15807 interface for generating code, simplifies the code.
15809 2001-09-20 Ravi Pratap <ravi@ximian.com>
15811 * expression.cs (everywhere): Comment out return statements in ::Resolve
15812 methods to avoid the warnings.
15814 2001-09-20 Miguel de Icaza <miguel@ximian.com>
15816 * driver.cs (parse): Report error 2001 if we can not open the
15819 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
15822 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
15825 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
15826 otherwise nested blocks end up with the same index.
15828 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
15830 * expression.cs: Instead of having FIXMEs in the Resolve
15831 functions, throw exceptions so it is obvious that we are facing a
15834 * cs-parser.jay (invocation_expression): Pass Location information.
15836 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
15837 Use a basename for those routines because .NET does not like paths
15840 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
15843 2001-09-19 Miguel de Icaza <miguel@ximian.com>
15845 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
15846 are loading the correct data types (throws an exception if not).
15847 (TypeManager::InitCoreTypes): Use CoreLookupType
15849 * expression.cs (Unary::ResolveOperator): return the child
15850 expression for expressions which are just +expr.
15851 (Unary::ResolveOperator): Return negative literals for -LITERAL
15852 expressions (otherwise they are Unary {Literal}).
15853 (Invocation::Badness): Take into account `Implicit constant
15854 expression conversions'.
15856 * literal.cs (LongLiteral): Implement long literal class.
15857 (IntLiteral): export the `Value' of the intliteral.
15859 2001-09-19 Ravi Pratap <ravi@ximian.com>
15861 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
15863 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
15864 instead of 'Operator'
15866 * expression.cs (Binary::ResolveOperator): Update accordingly.
15867 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
15870 * cs-parser.jay (unary_expression): Update to use the new names.
15872 * gen-treedump.cs (GetUnary): Same here.
15874 * expression.cs (Unary::Resolve): Implement.
15875 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
15876 operators are found instead of making noise ;-)
15877 (Unary::ResolveOperator): New method to do precisely the same thing which
15878 Binary::ResolveOperator does for Binary expressions.
15879 (Unary.method, .Arguments): Add.
15880 (Unary::OperName): Implement.
15881 (Unary::ForceConversion): Copy and Paste !
15883 * class.cs (Operator::Define): Fix a small bug for the case when we have
15886 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
15887 for the inbuilt operators. Only overloading works for now ;-)
15889 2001-09-18 Miguel de Icaza <miguel@ximian.com>
15891 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
15892 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
15894 * expression.cs (This::Emit): Implement.
15895 (This::Resolve): Implement.
15896 (TypeOf:Resolve): Implement.
15897 (Expression::ResolveSimpleName): Add an implicit this to instance
15899 (MemberAccess::Resolve): Deal with Parameters and Fields.
15900 Bind instance variable to Field expressions.
15901 (FieldExpr::Instance): New field used to track the expression that
15902 represents the object instance.
15903 (FieldExpr::Resolve): Track potential errors from MemberLookup not
15905 (FieldExpr::Emit): Implement.
15907 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
15908 the last instruction contains a return opcode to avoid generating
15909 the last `ret' instruction (this generates correct code, and it is
15910 nice to pass the peverify output).
15912 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
15913 initializer for static and instance variables.
15914 (Constructor::Emit): Allow initializer to be null in the case of
15915 static constructors. Only emit initializer for instance
15918 (TypeContainer::FindMembers): Return a null array if there are no
15921 Also fix the code for the MemberTypes.Method branch, as it was not
15922 scanning that for operators (or tried to access null variables before).
15924 * assign.cs (Assign::Emit): Handle instance and static fields.
15928 * driver.cs: Stop compilation if there are parse errors.
15930 * cs-parser.jay (constructor_declaration): Provide default base
15931 initializer for non-static constructors.
15932 (constructor_declarator): Do not provide a default base
15933 initializers if none was specified.
15934 Catch the fact that constructors should not have parameters.
15936 * class.cs: Do not emit parent class initializers for static
15937 constructors, that should be flagged as an error.
15939 2001-09-18 Ravi Pratap <ravi@ximian.com>
15941 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
15942 Move back code into TypeContainer::Populate.
15944 2001-09-18 Ravi Pratap <ravi@ximian.com>
15946 * class.cs (TypeContainer::AddConstructor): Fix the check to
15947 compare against Name, not Basename.
15948 (Operator::OpType): Change Plus and Minus to Add and Subtract.
15950 * cs-parser.jay : Update accordingly.
15952 * class.cs (TypeContainer::FindMembers): For the case where we are searching
15953 for methods, don't forget to look into the operators too.
15954 (RegisterMethodBuilder): Helper method to take care of this for
15955 methods, constructors and operators.
15956 (Operator::Define): Completely revamp.
15957 (Operator.OperatorMethod, MethodName): New fields.
15958 (TypeContainer::Populate): Move the registering of builders into
15959 RegisterMethodBuilder.
15960 (Operator::Emit): Re-write.
15962 * expression.cs (Binary::Emit): Comment out code path to emit method
15963 invocation stuff for the case when we have a user defined operator. I am
15964 just not able to get it right !
15966 2001-09-17 Miguel de Icaza <miguel@ximian.com>
15968 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
15971 (Expression::MemberLookup): Provide a version that allows to
15972 specify the MemberTypes and BindingFlags.
15974 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
15975 so it was not fetching variable information from outer blocks.
15977 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
15978 Beforefieldinit as it was buggy.
15980 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
15981 that Ravi put here.
15983 * class.cs (Constructor::Emit): Only emit if block is not null.
15984 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
15985 deal with this by semantically definining it as if the user had
15988 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
15989 constructors as we now "emit" them at a higher level.
15991 (TypeContainer::DefineDefaultConstructor): Used to define the
15992 default constructors if none was provided.
15994 (ConstructorInitializer): Add methods Resolve and Emit.
15996 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
15998 2001-09-17 Ravi Pratap <ravi@ximian.com>
16000 * class.cs (TypeContainer::EmitDefaultConstructor): Register
16001 the default constructor builder with our hashtable for methodbuilders
16004 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
16005 and argument_count is 0 in which case we have a match.
16006 (Binary::ResolveOperator): More null checking and miscellaneous coding
16009 2001-09-17 Ravi Pratap <ravi@ximian.com>
16011 * rootcontext.cs (IsNameSpace): Compare against null.
16013 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
16015 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
16016 and Unary::Operator.
16018 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
16021 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
16022 we have overloaded operators.
16023 (Binary::ResolveOperator): Implement the part which does the operator overload
16026 * class.cs (Operator::Emit): Implement.
16027 (TypeContainer::Emit): Emit the operators we have too.
16029 * expression.cs (Binary::Emit): Update to emit the appropriate code for
16030 the case when we have a user-defined operator.
16032 2001-09-17 Miguel de Icaza <miguel@ximian.com>
16034 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
16036 2001-09-16 Ravi Pratap <ravi@ximian.com>
16038 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
16039 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
16040 (Constructor::Emit): Implement.
16041 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
16042 if we have no work to do.
16043 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
16046 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
16047 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
16049 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
16052 2001-09-15 Ravi Pratap <ravi@ximian.com>
16054 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
16056 (Tree::RecordNamespace): Method to do what the name says ;-)
16057 (Tree::Namespaces): Property to get at the namespaces hashtable.
16059 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
16062 * rootcontext.cs (IsNamespace): Fixed it :-)
16064 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16066 * class.cs (TypeContainer::FindMembers): Add support for
16068 (MethodCore): New class that encapsulates both the shared aspects
16069 of a Constructor and a Method.
16070 (Method, Constructor): Factored pieces into MethodCore.
16072 * driver.cs: Added --fatal which makes errors throw exceptions.
16073 Load System assembly as well as part of the standard library.
16075 * report.cs: Allow throwing exceptions on errors for debugging.
16077 * modifiers.cs: Do not use `parent', instead use the real type
16078 container to evaluate permission settings.
16080 * class.cs: Put Ravi's patch back in. He is right, and we will
16081 have to cope with the
16083 2001-09-14 Ravi Pratap <ravi@ximian.com>
16085 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
16086 FamORAssem, not FamANDAssem.
16088 2001-09-14 Miguel de Icaza <miguel@ximian.com>
16090 * driver.cs: Added --parse option that only parses its input files
16093 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
16094 incorrect. IsTopLevel is not used to tell whether an object is
16095 root_types or not (that can be achieved by testing this ==
16096 root_types). But to see if this is a top-level *class* (not
16097 necessarly our "toplevel" container).
16099 2001-09-14 Ravi Pratap <ravi@ximian.com>
16101 * enum.cs (Enum::Define): Modify to call the Lookup method on the
16102 parent instead of a direct call to GetType.
16104 2001-09-14 Ravi Pratap <ravi@ximian.com>
16106 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
16107 Modifiers.TypeAttr. This should just be a call to that method.
16109 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
16110 object so that we can determine if we are top-level or not.
16112 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
16115 * enum.cs (Enum::Define): Ditto.
16117 * modifiers.cs (FieldAttr): Re-write.
16119 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
16120 (TypeContainer::HaveStaticConstructor): New property to provide access
16121 to precisely that info.
16123 * modifiers.cs (MethodAttr): Re-write.
16124 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
16126 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
16127 of top-level types as claimed.
16129 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16131 * expression.cs (MemberLookup): Fruitless attempt to lookup
16132 constructors. Maybe I need to emit default constructors? That
16133 might be it (currently .NET emits this for me automatically).
16134 (Invocation::OverloadResolve): Cope with Arguments == null.
16135 (Invocation::EmitArguments): new function, shared by the new
16136 constructor and us.
16137 (Invocation::Emit): Handle static and instance methods. Emit
16138 proper call instruction for virtual or non-virtual invocations.
16139 (New::Emit): Implement.
16140 (New::Resolve): Implement.
16141 (MemberAccess:Resolve): Implement.
16142 (MethodGroupExpr::InstanceExpression): used conforming to the spec
16143 to track instances.
16144 (FieldExpr::Resolve): Set type.
16146 * support.cs: Handle empty arguments.
16148 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
16149 SimpleLookup): Auxiliary routines to help parse a qualifier
16152 Update qualifier_identifier rule.
16154 * codegen.cs: Removed debugging messages.
16156 * class.cs: Make this a global thing, this acts just as a "key" to
16157 objects that we might have around.
16159 (Populate): Only initialize method_builders_to_methods once.
16161 * expression.cs (PropertyExpr): Initialize type from the
16164 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
16165 Resolve pattern. Attempt to implicitly convert value to boolean.
16168 * expression.cs: Set the type for the int32/int32 argument case.
16169 (Binary::ResolveOperator): Set the return type to boolean for
16170 comparission operators
16172 * typemanager.cs: Remove debugging print code.
16174 (Invocation::Resolve): resolve type.
16176 * class.cs: Allocate a MemberInfo of the correct size, as the code
16177 elsewhere depends on the test to reflect the correct contents.
16179 (Method::) Keep track of parameters, due to System.Reflection holes
16181 (TypeContainer::Populate): Keep track of MethodBuilders to Method
16184 (TypeContainer::FindMembers): Use ArrayList and then copy an array
16185 of the exact size and return that.
16187 (Class::LookupMethodByBuilder): New function that maps
16188 MethodBuilders to its methods. Required to locate the information
16189 on methods because System.Reflection bit us again.
16191 * support.cs: New file, contains an interface ParameterData and
16192 two implementations: ReflectionParameters and InternalParameters
16193 used to access Parameter information. We will need to grow this
16196 * expression.cs (Invocation::GetParameterData): implement a cache
16197 and a wrapper around the ParameterData creation for methods.
16198 (Invocation::OverloadResolve): Use new code.
16200 2001-09-13 Ravi Pratap <ravi@ximian.com>
16202 * class.cs (TypeContainer::EmitField): Remove and move into
16203 (Field::Define): here and modify accordingly.
16204 (Field.FieldBuilder): New member.
16205 (TypeContainer::Populate): Update accordingly.
16206 (TypeContainer::FindMembers): Implement.
16208 2001-09-13 Miguel de Icaza <miguel@ximian.com>
16210 * statement.cs: (VariableInfo::VariableType): New field to be
16211 initialized with the full type once it is resolved.
16213 2001-09-12 Miguel de Icaza <miguel@ximian.com>
16215 * parameter.cs (GetParameterInfo): Use a type cache to compute
16216 things only once, and to reuse this information
16218 * expression.cs (LocalVariableReference::Emit): Implement.
16219 (OpcodeCast::Emit): fix.
16221 (ParameterReference::Resolve): Implement.
16222 (ParameterReference::Emit): Implement.
16224 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
16225 that are expressions need to stay as Expressions.
16227 * typemanager.cs (CSharpName): Returns the C# name of a type if
16230 * expression.cs (Expression::ConvertImplicit): New function that
16231 implements implicit type conversions.
16233 (Expression::ImplicitReferenceConversion): Implements implicit
16234 reference conversions.
16236 (EmptyCast): New type for transparent casts.
16238 (OpcodeCast): New type for casts of types that are performed with
16239 a sequence of bytecodes.
16241 (BoxedCast): New type used for casting value types into reference
16242 types. Emits a box opcode.
16244 (Binary::DoNumericPromotions): Implements numeric promotions of
16245 and computation of the Binary::Type.
16247 (Binary::EmitBranchable): Optimization.
16249 (Binary::Emit): Implement code emission for expressions.
16251 * typemanager.cs (TypeManager): Added two new core types: sbyte
16254 2001-09-12 Ravi Pratap <ravi@ximian.com>
16256 * class.cs (TypeContainer::FindMembers): Method which does exactly
16257 what Type.FindMembers does, only we don't have to use reflection. No
16258 implementation yet.
16260 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
16261 typecontainer objects as we need to get at them.
16262 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
16264 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
16265 typecontainer object.
16267 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
16268 of just a Report object.
16270 2001-09-11 Ravi Pratap <ravi@ximian.com>
16272 * class.cs (Event::Define): Go back to using the prefixes "add_" and
16274 (TypeContainer::Populate): Now define the delegates of the type too.
16275 (TypeContainer.Delegates): Property to access the list of delegates defined
16278 * delegates.cs (Delegate::Define): Implement partially.
16280 * modifiers.cs (TypeAttr): Handle more flags.
16282 2001-09-11 Ravi Pratap <ravi@ximian.com>
16284 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
16286 (Operator::Define): Re-write logic to get types by using the LookupType method
16287 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
16288 (Indexer::Define): Ditto.
16289 (Event::Define): Ditto.
16290 (Property::Define): Ditto.
16292 2001-09-10 Ravi Pratap <ravi@ximian.com>
16294 * class.cs (TypeContainer::Populate): Now define operators too.
16295 (TypeContainer.Operators): New property to access the list of operators
16297 (Operator.OperatorMethodBuilder): New member to hold the method builder
16298 for the operator we are defining.
16299 (Operator::Define): Implement.
16301 2001-09-10 Ravi Pratap <ravi@ximian.com>
16303 * class.cs (Event::Define): Make the prefixes of the accessor methods
16304 addOn_ and removeOn_
16306 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
16307 of the location being passed in too. Ideally, this should go later since all
16308 error reporting should be done through the Report object.
16310 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
16311 (Populate): Iterate thru the indexers we have and define them too.
16312 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
16313 for the get and set accessors.
16314 (Indexer::Define): Implement.
16316 2001-09-09 Miguel de Icaza <miguel@ximian.com>
16318 * expression.cs (Binary::Resolve): Beginning of it. I scratched
16319 my previous implementation, did not work.
16321 * typemanager.cs: Add a couple of missing types (the longs).
16323 * literal.cs: Use TypeManager.bool_type instead of getting it.
16325 * expression.cs (EventExpr): New kind of expressions.
16326 (Expressio::ExprClassFromMemberInfo): finish
16328 2001-09-08 Miguel de Icaza <miguel@ximian.com>
16330 * assign.cs: Emit stores to static fields differently.
16332 2001-09-08 Ravi Pratap <ravi@ximian.com>
16334 * Merge in changes and adjust code to tackle conflicts. Backed out my
16335 code in Assign::Resolve ;-)
16337 2001-09-08 Ravi Pratap <ravi@ximian.com>
16339 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
16340 instead Report.Error and also pass in the location.
16341 (CSharpParser::Lexer): New readonly property to return the reference
16342 to the Tokenizer object.
16343 (declare_local_variables): Use Report.Error with location instead of plain
16347 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
16348 (Operator.CheckBinaryOperator): Ditto.
16350 * cs-parser.jay (operator_declarator): Update accordingly.
16352 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
16353 (CheckBinaryOperator): Same here.
16355 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
16356 on the name without any prefixes of namespace names etc. This is because we
16357 already might have something already fully qualified like
16358 'System.Console.WriteLine'
16360 * assign.cs (Resolve): Begin implementation. Stuck ;-)
16362 2001-09-07 Ravi Pratap <ravi@ximian.com>
16364 * cs-tokenizer.cs (location): Return a string which also contains
16367 * expression.cs (ElementAccess): New class for expressions of the
16368 type 'element access.'
16369 (BaseAccess): New class for expressions of the type 'base access.'
16370 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
16373 * cs-parser.jay (element_access): Implement action.
16374 (base_access): Implement actions.
16375 (checked_expression, unchecked_expression): Implement.
16377 * cs-parser.jay (local_variable_type): Correct and implement.
16378 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
16380 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
16382 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
16383 name and the specifiers.
16385 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
16387 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
16388 making them all public ;-)
16390 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
16393 2001-09-07 Miguel de Icaza <miguel@ximian.com>
16395 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
16397 (FieldExpr, PropertyExprs): New resolved expressions.
16398 (SimpleName::MemberStaticCheck): Perform static checks for access
16399 to non-static fields on static methods. Maybe this should be
16400 generalized for MemberAccesses.
16401 (SimpleName::ResolveSimpleName): More work on simple name
16404 * cs-parser.jay (primary_expression/qualified_identifier): track
16405 the parameter index.
16407 * codegen.cs (CodeGen::Save): Catch save exception, report error.
16408 (EmitContext::EmitBoolExpression): Chain to expression generation
16409 instead of temporary hack.
16410 (::EmitStatementExpression): Put generic expression code generation.
16412 * assign.cs (Assign::Emit): Implement variable assignments to
16413 local variables, parameters and fields.
16415 2001-09-06 Miguel de Icaza <miguel@ximian.com>
16417 * statement.cs (Block::GetVariableInfo): New method, returns the
16418 VariableInfo for a variable name in a block.
16419 (Block::GetVariableType): Implement in terms of GetVariableInfo
16421 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
16422 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
16424 2001-09-06 Ravi Pratap <ravi@ximian.com>
16426 * cs-parser.jay (operator_declaration): Continue on my quest : update
16427 to take attributes argument.
16428 (event_declaration): Ditto.
16429 (enum_declaration): Ditto.
16430 (indexer_declaration): Ditto.
16432 * class.cs (Operator::Operator): Update constructor accordingly.
16433 (Event::Event): Ditto.
16435 * delegate.cs (Delegate::Delegate): Same here.
16437 * enum.cs (Enum::Enum): Same here.
16439 2001-09-05 Ravi Pratap <ravi@ximian.com>
16441 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
16443 * ../tests/cs0658.cs : New file to demonstrate error 0658.
16445 * attribute.cs (Attributes): New class to encapsulate all attributes which were
16446 being passed around as an arraylist.
16447 (Attributes::AddAttribute): Method to add attribute sections.
16449 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
16450 (struct_declaration): Update accordingly.
16451 (constant_declaration): Update.
16452 (field_declaration): Update.
16453 (method_header): Update.
16454 (fixed_parameter): Update.
16455 (parameter_array): Ditto.
16456 (property_declaration): Ditto.
16457 (destructor_declaration): Ditto.
16459 * class.cs (Struct::Struct): Update constructors accordingly.
16460 (Class::Class): Ditto.
16461 (Field::Field): Ditto.
16462 (Method::Method): Ditto.
16463 (Property::Property): Ditto.
16464 (TypeContainer::OptAttribute): update property's return type.
16466 * interface.cs (Interface.opt_attributes): New member.
16467 (Interface::Interface): Update to take the extra Attributes argument.
16469 * parameter.cs (Parameter::Parameter): Ditto.
16471 * constant.cs (Constant::Constant): Ditto.
16473 * interface.cs (InterfaceMemberBase): New OptAttributes field.
16474 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
16475 the attributes as a parameter.
16476 (InterfaceProperty): Update constructor call.
16477 (InterfaceEvent): Ditto.
16478 (InterfaceMethod): Ditto.
16479 (InterfaceIndexer): Ditto.
16481 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
16482 pass the attributes too.
16483 (interface_event_declaration): Ditto.
16484 (interface_property_declaration): Ditto.
16485 (interface_method_declaration): Ditto.
16486 (interface_declaration): Ditto.
16488 2001-09-05 Miguel de Icaza <miguel@ximian.com>
16490 * class.cs (Method::Define): Track the "static Main" definition to
16491 create an entry point.
16493 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
16494 EntryPoint if we find it.
16496 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
16497 (EmitContext::ig): Make this variable public.
16499 * driver.cs: Make the default output file be the first file name
16500 with the .exe extension.
16502 Detect empty compilations
16504 Handle various kinds of output targets. Handle --target and
16505 rename -t to --dumper.
16507 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
16508 methods inherited from Expression return now an Expression. This
16509 will is used during the tree rewriting as we resolve them during
16512 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
16513 the spec. Missing entirely is the information about
16514 accessability of elements of it.
16516 (Expression::ExprClassFromMemberInfo): New constructor for
16517 Expressions that creates a fully initialized Expression based on
16518 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
16521 (Invocation::Resolve): Begin implementing resolution of invocations.
16523 * literal.cs (StringLiteral): Implement Emit.
16525 2001-09-05 Ravi Pratap <ravi@ximian.com>
16527 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
16530 2001-09-04 Ravi Pratap <ravi@ximian.com>
16532 * cs-parser.jay (attribute_arguments): Implement actions.
16533 (attribute): Fix bug in production. Implement action.
16534 (attribute_list): Implement.
16535 (attribute_target): Implement.
16536 (attribute_target_specifier, opt_target_specifier): Implement
16537 (CheckAttributeTarget): New method to check if the attribute target
16539 (attribute_section): Implement.
16540 (opt_attributes): Implement.
16542 * attribute.cs : New file to handle attributes.
16543 (Attribute): Class to hold attribute info.
16545 * cs-parser.jay (opt_attribute_target_specifier): Remove production
16546 (attribute_section): Modify production to use 2 different rules to
16547 achieve the same thing. 1 s/r conflict down !
16548 Clean out commented, useless, non-reducing dimension_separator rules.
16550 * class.cs (TypeContainer.attributes): New member to hold list
16551 of attributes for a type.
16552 (Struct::Struct): Modify to take one more argument, the attribute list.
16553 (Class::Class): Ditto.
16554 (Field::Field): Ditto.
16555 (Method::Method): Ditto.
16556 (Property::Property): Ditto.
16558 * cs-parser.jay (struct_declaration): Update constructor call to
16559 pass in the attributes too.
16560 (class_declaration): Ditto.
16561 (constant_declaration): Ditto.
16562 (field_declaration): Ditto.
16563 (method_header): Ditto.
16564 (fixed_parameter): Ditto.
16565 (parameter_array): Ditto.
16566 (property_declaration): Ditto.
16568 * constant.cs (Constant::Constant): Update constructor similarly.
16569 Use System.Collections.
16571 * parameter.cs (Parameter::Parameter): Update as above.
16573 2001-09-02 Ravi Pratap <ravi@ximian.com>
16575 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
16576 (TypeContainer.delegates): New member to hold list of delegates.
16578 * cs-parser.jay (delegate_declaration): Implement the action correctly
16579 this time as I seem to be on crack ;-)
16581 2001-09-02 Miguel de Icaza <miguel@ximian.com>
16583 * rootcontext.cs (RootContext::IsNamespace): new function, used to
16584 tell whether an identifier represents a namespace.
16586 * expression.cs (NamespaceExpr): A namespace expression, used only
16587 temporarly during expression resolution.
16588 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
16589 utility functions to resolve names on expressions.
16591 2001-09-01 Miguel de Icaza <miguel@ximian.com>
16593 * codegen.cs: Add hook for StatementExpressions.
16595 * class.cs: Fix inverted test for static flag in methods.
16597 2001-09-02 Ravi Pratap <ravi@ximian.com>
16599 * class.cs (Operator::CheckUnaryOperator): Correct error number used
16600 to make it coincide with MS' number.
16601 (Operator::CheckBinaryOperator): Ditto.
16603 * ../errors/errors.txt : Remove error numbers added earlier.
16605 * ../errors/cs1019.cs : Test case for error # 1019
16607 * ../errros/cs1020.cs : Test case for error # 1020
16609 * cs-parser.jay : Clean out commented cruft.
16610 (dimension_separators, dimension_separator): Comment out. Ostensibly not
16611 used anywhere - non-reducing rule.
16612 (namespace_declarations): Non-reducing rule - comment out.
16614 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
16615 with TypeContainer::AddEnum.
16617 * delegate.cs : New file for delegate handling classes.
16618 (Delegate): Class for declaring delegates.
16620 * makefile : Update.
16622 * cs-parser.jay (delegate_declaration): Implement.
16624 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
16626 * class.cs (Event::Define): Implement.
16627 (Event.EventBuilder): New member.
16629 * class.cs (TypeContainer::Populate): Update to define all enums and events
16631 (Events): New property for the events arraylist we hold. Shouldn't we move to using
16632 readonly fields for all these cases ?
16634 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16636 * class.cs (Property): Revamp to use the convention of making fields readonly.
16637 Accordingly modify code elsewhere.
16639 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
16640 the Define method of the Property class.
16642 * class.cs : Clean up applied patch and update references to variables etc. Fix
16644 (TypeContainer::Populate): Update to define all the properties we have. Also
16645 define all enumerations.
16647 * enum.cs (Define): Implement.
16649 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
16651 * cs-parser.jay (overloadable_operator): The semantic value is an
16652 enum of the Operator class.
16653 (operator_declarator): Implement actions.
16654 (operator_declaration): Implement.
16656 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
16657 validity of definitions.
16658 (Operator::CheckBinaryOperator): Static method to check for binary operators
16659 (TypeContainer::AddOperator): New method to add an operator to a type.
16661 * cs-parser.jay (indexer_declaration): Added line to actually call the
16662 AddIndexer method so it gets added ;-)
16664 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
16665 already taken care of by the MS compiler ?
16667 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16669 * class.cs (Operator): New class for operator declarations.
16670 (Operator::OpType): Enum for the various operators.
16672 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
16674 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
16675 ostensibly handle this in semantic analysis.
16677 * cs-parser.jay (general_catch_clause): Comment out
16678 (specific_catch_clauses, specific_catch_clause): Ditto.
16679 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
16680 (catch_args, opt_catch_args): New productions.
16681 (catch_clause): Rewrite to use the new productions above
16682 (catch_clauses): Modify accordingly.
16683 (opt_catch_clauses): New production to use in try_statement
16684 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
16685 and re-write the code in the actions to extract the specific and
16686 general catch clauses by being a little smart ;-)
16688 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
16689 Hooray, try and catch statements parse fine !
16691 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16693 * statement.cs (Block::GetVariableType): Fix logic to extract the type
16694 string from the hashtable of variables.
16696 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
16697 I end up making that mistake ;-)
16698 (catch_clauses): Fixed gross error which made Key and Value of the
16699 DictionaryEntry the same : $1 !!
16701 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16703 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
16705 * cs-parser.jay (event_declaration): Correct to remove the semicolon
16706 when the add and remove accessors are specified.
16708 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
16710 * cs-parser.jay (IndexerDeclaration): New helper class to hold
16711 information about indexer_declarator.
16712 (indexer_declarator): Implement actions.
16713 (parsing_indexer): New local boolean used to keep track of whether
16714 we are parsing indexers or properties. This is necessary because
16715 implicit_parameters come into picture even for the get accessor in the
16716 case of an indexer.
16717 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
16719 * class.cs (Indexer): New class for indexer declarations.
16720 (TypeContainer::AddIndexer): New method to add an indexer to a type.
16721 (TypeContainer::indexers): New member to hold list of indexers for the
16724 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16726 * cs-parser.jay (add_accessor_declaration): Implement action.
16727 (remove_accessor_declaration): Implement action.
16728 (event_accessors_declaration): Implement
16729 (variable_declarators): swap statements for first rule - trivial.
16731 * class.cs (Event): New class to hold information about event
16733 (TypeContainer::AddEvent): New method to add an event to a type
16734 (TypeContainer::events): New member to hold list of events.
16736 * cs-parser.jay (event_declaration): Implement actions.
16738 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
16740 * cs-parser.jay (dim_separators): Implement. Make it a string
16741 concatenating all the commas together, just as they appear.
16742 (opt_dim_separators): Modify accordingly
16743 (rank_specifiers): Update accordingly. Basically do the same
16744 thing - instead, collect the brackets here.
16745 (opt_rank_sepcifiers): Modify accordingly.
16746 (array_type): Modify to actually return the complete type string
16747 instead of ignoring the rank_specifiers.
16748 (expression_list): Implement to collect the expressions
16749 (variable_initializer): Implement. We make it a list of expressions
16750 essentially so that we can handle the array_initializer case neatly too.
16751 (variable_initializer_list): Implement.
16752 (array_initializer): Make it a list of variable_initializers
16753 (opt_array_initializer): Modify accordingly.
16755 * expression.cs (New::NType): Add enumeration to help us
16756 keep track of whether we have an object/delegate creation
16757 or an array creation.
16758 (New:NewType, New::Rank, New::Indices, New::Initializers): New
16759 members to hold data about array creation.
16760 (New:New): Modify to update NewType
16761 (New:New): New Overloaded contructor for the array creation
16764 * cs-parser.jay (array_creation_expression): Implement to call
16765 the overloaded New constructor.
16767 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
16769 * class.cs (TypeContainer::Constructors): Return member
16770 constructors instead of returning null.
16772 2001-08-26 Miguel de Icaza <miguel@ximian.com>
16774 * typemanager.cs (InitCoreTypes): Initialize the various core
16775 types after we have populated the type manager with the user
16776 defined types (this distinction will be important later while
16777 compiling corlib.dll)
16779 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
16780 on Expression Classification. Now all expressions have a method
16781 `Resolve' and a method `Emit'.
16783 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
16784 generation from working. Also add some temporary debugging
16787 2001-08-24 Miguel de Icaza <miguel@ximian.com>
16789 * codegen.cs: Lots of code generation pieces. This is only the
16790 beginning, will continue tomorrow with more touches of polish. We
16791 handle the fundamentals of if, while, do, for, return. Others are
16792 trickier and I need to start working on invocations soon.
16794 * gen-treedump.cs: Bug fix, use s.Increment here instead of
16797 * codegen.cs (EmitContext): New struct, used during code
16798 emission to keep a context. Most of the code generation will be
16801 * cs-parser.jay: Add embedded blocks to the list of statements of
16802 this block. So code generation proceeds in a top down fashion.
16804 2001-08-23 Miguel de Icaza <miguel@ximian.com>
16806 * statement.cs: Add support for multiple child blocks.
16808 2001-08-22 Miguel de Icaza <miguel@ximian.com>
16810 * codegen.cs (EmitCode): New function, will emit the code for a
16811 Block of code given a TypeContainer and its ILGenerator.
16813 * statement.cs (Block): Standard public readonly optimization.
16814 (Block::Block constructors): Link children.
16815 (Block::Child): Child Linker.
16816 (Block::EmitVariables): Emits IL variable declarations.
16818 * class.cs: Drop support for MethodGroups here, delay until
16820 (Method::): Applied the same simplification that I did before, and
16821 move from Properties to public readonly fields.
16822 (Method::ParameterTypes): Returns the parameter types for the
16823 function, and implements a cache that will be useful later when I
16824 do error checking and the semantic analysis on the methods is
16826 (Constructor::GetCallingConvention): Renamed from CallingConvetion
16827 and made a method, optional argument tells whether this is a class
16828 or a structure to apply the `has-this' bit.
16829 (Method::GetCallingConvention): Implement, returns the calling
16831 (Method::Define): Defines the type, a second pass is performed
16832 later to populate the methods.
16834 (Constructor::ParameterTypes): implement a cache similar to the
16835 one on Method::ParameterTypes, useful later when we do semantic
16838 (TypeContainer::EmitMethod): New method. Emits methods.
16840 * expression.cs: Removed MethodGroup class from here.
16842 * parameter.cs (Parameters::GetCallingConvention): new method.
16844 2001-08-21 Miguel de Icaza <miguel@ximian.com>
16846 * class.cs (TypeContainer::Populate): Drop RootContext from the
16849 (Constructor::CallingConvention): Returns the calling convention.
16850 (Constructor::ParameterTypes): Returns the constructor parameter
16853 (TypeContainer::AddConstructor): Keep track of default constructor
16854 and the default static constructor.
16856 (Constructor::) Another class that starts using `public readonly'
16857 instead of properties.
16859 (Constructor::IsDefault): Whether this is a default constructor.
16861 (Field::) use readonly public fields instead of properties also.
16863 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
16864 track of static constructors; If none is used, turn on
16865 BeforeFieldInit in the TypeAttributes.
16867 * cs-parser.jay (opt_argument_list): now the return can be null
16868 for the cases where there are no arguments.
16870 (constructor_declarator): If there is no implicit `base' or
16871 `this', then invoke the default parent constructor.
16873 * modifiers.cs (MethodAttr): New static function maps a set of
16874 modifiers flags into a MethodAttributes enum
16875 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
16876 MethodAttr, TypeAttr to represent the various mappings where the
16877 modifiers are used.
16878 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
16880 2001-08-19 Miguel de Icaza <miguel@ximian.com>
16882 * parameter.cs (GetParameterInfo): Fix bug where there would be no
16885 * interface.cs (PopulateIndexer): Implemented the code generator
16886 for interface indexers.
16888 2001-08-17 Miguel de Icaza <miguel@ximian.com>
16890 * interface.cs (InterfaceMemberBase): Now we track the new status
16893 (PopulateProperty): Implement property population. Woohoo! Got
16894 Methods and Properties going today.
16896 Removed all the properties for interfaces, and replaced them with
16897 `public readonly' fields.
16899 2001-08-16 Miguel de Icaza <miguel@ximian.com>
16901 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
16902 initialize their hashtables/arraylists only when they are needed
16903 instead of doing this always.
16905 * parameter.cs: Handle refs and out parameters.
16907 * cs-parser.jay: Use an ArrayList to construct the arguments
16908 instead of the ParameterCollection, and then cast that to a
16911 * parameter.cs: Drop the use of ParameterCollection and use
16912 instead arrays of Parameters.
16914 (GetParameterInfo): Use the Type, not the Name when resolving
16917 2001-08-13 Miguel de Icaza <miguel@ximian.com>
16919 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
16920 and instead use public readonly fields.
16922 * class.cs: Put back walking code for type containers.
16924 2001-08-11 Miguel de Icaza <miguel@ximian.com>
16926 * class.cs (MakeConstant): Code to define constants.
16928 * rootcontext.cs (LookupType): New function. Used to locate types
16931 2001-08-08 Miguel de Icaza <miguel@ximian.com>
16933 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
16934 this System.Reflection code is. Kudos to Microsoft
16936 * typemanager.cs: Implement a type cache and avoid loading all
16937 types at boot time. Wrap in LookupType the internals. This made
16938 the compiler so much faster. Wow. I rule!
16940 * driver.cs: Make sure we always load mscorlib first (for
16941 debugging purposes, nothing really important).
16943 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
16944 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
16946 * rootcontext.cs: Lookup types on their namespace; Lookup types
16947 on namespaces that have been imported using the `using' keyword.
16949 * class.cs (TypeContainer::TypeAttr): Virtualize.
16950 (Class::TypeAttr): Return attributes suitable for this bad boy.
16951 (Struct::TypeAttr): ditto.
16952 Handle nested classes.
16953 (TypeContainer::) Remove all the type visiting code, it is now
16954 replaced with the rootcontext.cs code
16956 * rootcontext.cs (GetClassBases): Added support for structs.
16958 2001-08-06 Miguel de Icaza <miguel@ximian.com>
16960 * interface.cs, statement.cs, class.cs, parameter.cs,
16961 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
16962 Drop use of TypeRefs, and use strings instead.
16964 2001-08-04 Miguel de Icaza <miguel@ximian.com>
16968 * class.cs (Struct::Struct): set the SEALED flags after
16969 checking the modifiers.
16970 (TypeContainer::TypeAttr): new property, returns the
16971 TypeAttributes for a class.
16973 * cs-parser.jay (type_list): Oops, list production was creating a
16974 new list of base types.
16976 * rootcontext.cs (StdLib): New property.
16977 (GetInterfaceTypeByName): returns an interface by type name, and
16978 encapsulates error handling here.
16979 (GetInterfaces): simplified.
16980 (ResolveTree): Encapsulated all the tree resolution here.
16981 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
16984 * driver.cs: Add support for --nostdlib, to avoid loading the
16985 default assemblies.
16986 (Main): Do not put tree resolution here.
16988 * rootcontext.cs: Beginning of the class resolution.
16990 2001-08-03 Miguel de Icaza <miguel@ximian.com>
16992 * rootcontext.cs: Provide better error reporting.
16994 * cs-parser.jay (interface_base): set our $$ to be interfaces.
16996 * rootcontext.cs (CreateInterface): Handle the case where there
16997 are no parent interfaces.
16999 (CloseTypes): Routine to flush types at the end.
17000 (CreateInterface): Track types.
17001 (GetInterfaces): Returns an array of Types from the list of
17002 defined interfaces.
17004 * typemanager.c (AddUserType): Mechanism to track user types (puts
17005 the type on the global type hash, and allows us to close it at the
17008 2001-08-02 Miguel de Icaza <miguel@ximian.com>
17010 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
17011 RecordInterface instead.
17013 * cs-parser.jay: Updated to reflect changes above.
17015 * decl.cs (Definition): Keep track of the TypeBuilder type that
17016 represents this type here. Not sure we will use it in the long
17017 run, but wont hurt for now.
17019 * driver.cs: Smaller changes to accomodate the new code.
17021 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
17024 * rootcontext.cs (CreateInterface): New method, used to create
17025 the System.TypeBuilder type for interfaces.
17026 (ResolveInterfaces): new entry point to resolve the interface
17028 (CodeGen): Property, used to keep track of the code generator.
17030 2001-07-26 Miguel de Icaza <miguel@ximian.com>
17032 * cs-parser.jay: Add a second production for delegate_declaration
17035 (enum_body): Put an opt_comma here instead of putting it on
17036 enum_body or enum_member_declarations so we can handle trailing
17037 commas on enumeration members. Gets rid of a shift/reduce.
17039 (type_list): Need a COMMA in the middle.
17041 (indexer_declaration): Tell tokenizer to recognize get/set
17043 * Remove old targets.
17045 * Re-add the parser target.
17047 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17049 * cs-parser.jay: Add precendence rules for a number of operators
17050 ot reduce the number of shift/reduce conflicts in the grammar.
17052 2001-07-17 Miguel de Icaza <miguel@ximian.com>
17054 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
17057 Get rid of old crufty code.
17059 * rootcontext.cs: Use this to keep track of the parsed
17060 representation and the defined types available to the program.
17062 * gen-treedump.cs: adjust for new convention.
17064 * type.cs: Split out the type manager, and the assembly builder
17067 * typemanager.cs: the type manager will live here now.
17069 * cil-codegen.cs: And the code generator here.
17071 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
17073 * makefile: Fixed up for easy making.
17075 2001-07-13 Simon Cozens <simon@simon-cozens.org>
17077 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
17080 (unary_expression): Expand pre_increment_expression and
17081 post_decrement_expression to reduce a shift/reduce.
17083 2001-07-11 Simon Cozens
17085 * cs-tokenizer.cs: Hex numbers should begin with a 0.
17087 Improve allow_keyword_as_indent name.
17089 2001-06-19 Miguel de Icaza <miguel@ximian.com>
17091 * Adjustments for Beta2.
17093 2001-06-13 Miguel de Icaza <miguel@ximian.com>
17095 * decl.cs: Added `Define' abstract method.
17096 (InTransit): new property, used to catch recursive definitions.
17098 * interface.cs: Implement `Define'.
17100 * modifiers.cs: Map Modifiers.constants to
17101 System.Reflection.TypeAttribute flags.
17103 * class.cs: Keep track of types and user-defined types.
17104 (BuilderInit): New method for creating an assembly
17105 (ResolveType): New function to launch the resolution process, only
17106 used by interfaces for now.
17108 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
17109 that are inserted into the name space.
17111 2001-06-08 Miguel de Icaza <miguel@ximian.com>
17113 * ARGH. I have screwed up my tree so many times due to the use of
17114 rsync rather than using CVS. Going to fix this at once.
17116 * driver.cs: Objetify driver. Load assemblies, use assemblies to
17119 2001-06-07 Miguel de Icaza <miguel@ximian.com>
17121 * Experiment successful: Use System.Type rather that our own
17124 2001-05-25 Miguel de Icaza <miguel@ximian.com>
17126 * cs-parser.jay: Removed nsAliases from here.
17128 Use new namespaces, handle `using XXX;'
17130 * namespace.cs: Reimplemented namespace handling, use a recursive
17131 definition of the class. Now we can keep track of using clauses
17132 and catch invalid using clauses.
17134 2001-05-24 Miguel de Icaza <miguel@ximian.com>
17136 * gen-treedump.cs: Adapted for all the renaming.
17138 * expression.cs (Expression): this class now has a Type property
17139 which returns an expression Type.
17141 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
17142 `Type', as this has a different meaning now in the base
17144 2001-05-22 Miguel de Icaza <miguel@ximian.com>
17146 * interface.cs, class.cs: Removed from all the sources the
17147 references to signature computation, as we can not do method
17148 signature computation during the parsing time, as we are not
17149 trying to solve at that point distinguishing:
17153 void a (NS.Blah x) {}
17156 Which depending on the context might be valid or not, as we do not
17157 know if Blah is the same thing as NS.Blah at that point.
17159 * Redid everything so the code uses TypeRefs now instead of
17160 Types. TypeRefs are just temporary type placeholders, that need
17161 to be resolved. They initially have a pointer to a string and the
17162 current scope in which they are used. This is used later by the
17163 compiler to resolve the reference to an actual Type.
17165 * DeclSpace is no longer a CIR.Type, and neither are
17166 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
17167 are all DeclSpaces, but no Types.
17169 * type.cs (TypeRefManager): This implements the TypeRef manager,
17170 which keeps track of all the types that need to be resolved after
17171 the parsing has finished.
17173 2001-05-13 Miguel de Icaza <miguel@ximian.com>
17175 * ARGH. We are going to have to store `foreach' as a class rather
17176 than resolving it, as we need to verify error 1579 after name
17177 resolution. *OR* we could keep a flag that says `This request to
17178 IEnumerator comes from a foreach statement' which we can then use
17179 to generate the error.
17181 2001-05-10 Miguel de Icaza <miguel@ximian.com>
17183 * class.cs (TypeContainer.AddMethod): we now add methods to the
17184 MethodGroup instead of the method hashtable.
17186 * expression.cs: Add MethodGroup abstraction, which gets us one
17187 step closer to the specification in the way we handle method
17190 * cs-parser.jay (primary_expression): qualified_identifier now
17191 tried to match up an identifier to a local variable reference or
17192 to a parameter reference.
17194 current_local_parameters is now a parser global variable that
17195 points to the current parameters for the block, used during name
17198 (property_declaration): Now creates an implicit `value' argument to
17201 2001-05-09 Miguel de Icaza <miguel@ximian.com>
17203 * parameter.cs: Do not use `param' arguments as part of the
17204 signature, per the spec.
17206 2001-05-08 Miguel de Icaza <miguel@ximian.com>
17208 * decl.cs: Base class for classes, structs and interfaces. This
17209 is the "Declaration Space"
17211 * cs-parser.jay: Use CheckDef for checking declaration errors
17212 instead of having one on each function.
17214 * class.cs: Factor out some code for handling error handling in
17215 accordance to the "Declarations" section in the "Basic Concepts"
17216 chapter in the ECMA C# spec.
17218 * interface.cs: Make all interface member classes derive from
17219 InterfaceMemberBase.
17221 2001-05-07 Miguel de Icaza <miguel@ximian.com>
17223 * Many things: all interfaces are parsed and generated in
17224 gen-treedump. Support for member variables, constructors,
17225 destructors, properties, constants is there.
17227 Beginning of the IL backend, but very little done, just there for
17230 2001-04-29 Miguel de Icaza <miguel@ximian.com>
17232 * cs-parser.jay: Fix labeled statement.
17234 * cs-tokenizer.cs (escape): Escape " and ' always.
17235 ref_line, ref_name: keep track of the line/filename as instructed
17236 by #line by the compiler.
17239 2001-04-27 Miguel de Icaza <miguel@ximian.com>
17241 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
17242 to match the values in System.CodeDOM.
17244 Divid renamed to Divide.
17246 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
17248 (Statements.set): remove.
17250 * System.CodeDOM/CodeCatchClause.cs: always have a valid
17253 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
17254 falseStatements always have valid values.
17256 * cs-parser.jay: Use System.CodeDOM now.