1 2003-12-11 Martin Baulig <martin@ximian.com>
3 Reworked flow analyis and made it more precise and bug-free. The
4 most important change is that we're now using a special `Reachability'
5 class instead of having "magic" meanings of `FlowReturns'. I'll
6 do some more cleanups and optimizations and also add some more
7 documentation this week.
9 * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
10 largely reworked this class.
11 (FlowReturns): Removed `Unreachable' and `Exception'; we now use
12 the new `Reachability' class instead of having "magic" values here.
13 (FlowBranching): We're now using an instance of `Reachability'
14 instead of having separate `Returns', `Breaks' etc. fields.
16 * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
17 based on flow analysis; ignore the return value of block.Emit ().
19 2003-12-10 Zoltan Varga <vargaz@freemail.hu>
21 * driver.cs typemanager.cs: Find the mono extensions to corlib even
24 2003-12-09 Martin Baulig <martin@ximian.com>
26 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
27 call them directly on the UsageVector.
29 2003-12-09 Martin Baulig <martin@ximian.com>
31 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
32 Changed return type from `FlowReturns' to `Reachability'.
34 2003-12-09 Martin Baulig <martin@ximian.com>
36 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
37 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
38 `Reachable' fields with a single `Reachability' one.
40 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
42 * class.cs (FindMembers): Remove foreach's.
55 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
60 This patch does a few things:
61 1. EmptyStatement is now a singleton, so it is never reallocated.
62 2. All blah is EmptyStatement constructs have been changed to
63 blah == EmptyStatement.Value, which is much faster and valid
64 now that EmptyStatement is a singleton.
65 3. When resolving a block, rather than allocating a new array for
66 the non-empty statements, empty statements are replaced with
68 4. Some recursive functions have been made non-recursive.
69 Mainly the performance impact is from (3), however (1) and (2) are needed for
70 this to work. (4) does not make a big difference in normal situations, however
71 it makes the profile look saner.
76 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
77 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
78 Total memory allocated: 56397 KB
81 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
82 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
83 Total memory allocated: 55666 KB
85 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
87 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
88 than the hashtable in a hashtable version
90 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
91 we always end up concating a string. This results in a huge perf
92 loss, because many strings have to be tracked by the GC. In this
93 patch, we first use a hashtable that works with two keys, so that
94 the strings do not need to be concat'ed.
105 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
107 * Makefile: Add a new target `do-time' that does a quick and simple
108 profile, leaving easy to parse output.
110 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
112 * codegen.cs (Init): Create the dynamic assembly with
113 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
115 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
117 * support.cs: Make the PtrHashtable use only one
118 instance of its comparer.
120 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
122 * typemanager.cs: Fix lookup of GetNamespaces.
124 2003-11-29 Miguel de Icaza <miguel@ximian.com>
126 * expression.cs: Removed redundant line.
128 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
129 ArrayLists, use for loops with bounds.
131 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
134 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
135 arraylists, use for loop with bounds.
137 The above three changes give us a 0.071 second performance
138 improvement out of 3.294 seconds down to 3.223. On my machine
139 the above changes reduced the memory usage by 1,387 KB during
142 * cs-parser.jay (QualifiedIdentifier): New class used to represent
143 QualifiedIdentifiers. Before we created a new string through
144 concatenation, and mostly later on, the result would be
145 manipulated by DecomposeQI through string manipulation.
147 This reduced the compiler memory usage for bootstrapping from
148 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
149 compile times in 0.05 seconds.
151 2003-11-28 Dick Porter <dick@ximian.com>
153 * support.cs: Do string compares with the Invariant culture.
161 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
162 the comparison is done with the Invariant culture.
164 2003-11-27 Miguel de Icaza <miguel@ximian.com>
166 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
167 GetEnumerator method.
169 (ProbeCollectionType): Iterate starting at the most specific type
170 upwards looking for a GetEnumerator
172 * expression.cs: Shift count can be up to 31 for int/uint and 63
175 2003-11-26 Miguel de Icaza <miguel@ximian.com>
177 * statement.cs (Block.LookupLabel): Also look for the label on the
178 children blocks. Use a hash table to keep track of visited
181 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
182 we actually did transform the other operand, otherwise fall back
183 to the common codepath that casts to long.
185 * cs-tokenizer.cs: Use the same code pattern as the int case.
186 Maybe I should do the parsing myself, and avoid depending on the
187 Parse routines to get this done.
189 2003-11-25 Miguel de Icaza <miguel@ximian.com>
191 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
192 which fixes bug 51347. This time test it.
194 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
195 attributes for example can not tell the difference between these.
196 The difference was only a syntax feature of the language.
198 * attribute.cs: Apply attributes to delegates.
200 * delegate.cs: Call the apply attributes method.
202 2003-11-24 Miguel de Icaza <miguel@ximian.com>
204 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
205 comparing 0 vs Byte.MinValue, not the value
207 (ImplicitConversionRequired): When reporting a conversion error,
208 use error 31 to print out the constant error instead of the
211 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
212 which fixes bug 51347.
214 2003-11-22 Miguel de Icaza <miguel@ximian.com>
216 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
217 which fixes the -warnaserror command line option.
219 2003-11-21 Miguel de Icaza <miguel@ximian.com>
221 * cfold.cs (DoNumericPromotions): During constant folding of
222 additions on UIntConstant, special case intconstants with
223 IntConstants like we do on the expression binary operator.
225 2003-11-12 Miguel de Icaza <miguel@ximian.com>
227 * convert.cs (ImplicitReferenceConversion): We were missing a case
228 (System.Enum are not value types or class types, so we need to
229 classify them separatedly).
231 * driver.cs: We do not support error 2007.
233 2003-11-12 Jackson Harper <jackson@ximian.com>
235 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
236 system directory. Also use the full file name so users can
237 libraries names mscorlib-o-tron.dll in a non system dir.
239 2003-11-10 Martin Baulig <martin@ximian.com>
241 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
242 (TypeManager.InitCoreTypes): Initialize them here, but instead of
243 calling `ResolveType()' on them, directly assign their `Type'.
245 2003-11-08 Martin Baulig <martin@ximian.com>
247 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
248 return value and the `out parent' parameter.
249 (TypeContainer.DefineType): Moved the CS0644 check into
250 GetClassBases(). Don't pass the interface types to the
251 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
252 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
254 * ecore.cs (TypeExpr.IsAttribute): New property.
255 (TypeExpr.GetInterfaces): New method.
257 * interface.cs (Interface.GetInterfaceTypeByName): Return a
258 TypeExpr instead of a Type.
259 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
260 (Interface.DefineType): Don't pass the interface types to the
261 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
262 them later and then call `TypeBulider.AddInterfaceImplementation()'.
264 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
265 instead of a `Type[]'.
266 (TypeManager.RegisterBuilder): Likewise.
267 (TypeManager.AddUserInterface): Likewise.
268 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
269 `Type[]' and also return a `TypeExpr[]'.
270 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
272 2003-11-08 Martin Baulig <martin@ximian.com>
274 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
277 2003-11-08 Martin Baulig <martin@ximian.com>
279 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
280 TypeManager.ResolveExpressionTypes().
282 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
283 instead of an Expression.
284 (TypeExpr): This is now an abstract base class for `TypeExpression'.
285 (TypeExpression): New public class; formerly known as `TypeExpr'.
287 * expression.cs (ComposedCast): Derive from TypeExpr.
289 * typemanager.cs (TypeManager.system_*_expr): These are now
290 TypExpr's instead of Expression's.
291 (TypeManager.ResolveExpressionTypes): New public static function;
292 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
295 2003-11-06 Miguel de Icaza <miguel@ximian.com>
297 * expression.cs (New.DoResolve): Do not dereference value that
298 might be a null return.
300 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
301 sure that the constant value has the right type. Fixes an
302 unreported bug, similar to 50425.
304 * const.cs (Const.LookupConstantValue): Call
305 ImplicitStandardConversionExists before doing a conversion to
306 avoid havng the TypeManager.ChangeType do conversions.
308 Reduced the number of casts used
310 (Const.ChangeType): New routine to enable reuse of the constant
311 type changing code from statement.
313 * typemanager.cs (ChangeType): Move common initialization to
314 static global variables.
318 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
319 every value type to go through, even if it was void. Fix that.
321 * cs-tokenizer.cs: Use is_identifier_start_character on the start
322 character of the define, and the is_identifier_part_character for
323 the rest of the string.
325 2003-11-05 Miguel de Icaza <miguel@ximian.com>
327 * expression.cs (UnaryMutator.EmitCode): When I updated
328 LocalVariableReference.DoResolve, I overdid it, and dropped an
329 optimization done on local variable references.
331 2003-11-04 Miguel de Icaza <miguel@ximian.com>
333 * ecore.cs: Convert the return from Ldlen into an int.
335 2003-10-20 Miguel de Icaza <miguel@ximian.com>
337 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
338 the accessibility, this is a special case for toplevel non-public
339 classes (internal for instance).
341 2003-10-20 Nick Drochak <ndrochak@gol.com>
343 * ecore.cs: Fix typo and build. Needed another right paren.
345 2003-10-19 Miguel de Icaza <miguel@ximian.com>
347 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
348 `internal' case regular and protected, but not allowing protected
349 to be evaluated later. Bug 49840
351 2003-10-15 Miguel de Icaza <miguel@ximian.com>
353 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
354 to kb.Nlast, and not the kb.nFirst to isolate the switch
357 Extract the underlying type, so enumerations of long/ulong are
358 treated like long/ulong.
360 2003-10-14 Miguel de Icaza <miguel@ximian.com>
362 * expression.cs (New): Overload the meaning of RequestedType to
363 track the possible creation of the NewDelegate type, since
364 DoResolve is invoked more than once for new constructors on field
367 See bugs: #48800 and #37014
369 * cs-parser.jay (declare_local_constants): Take an arraylist
370 instead of a single constant.
372 (local_constant_declaration): It should take a
373 constant_declarators, not a constant_declarator. Fixes 49487
375 * convert.cs: Fix error report.
377 2003-10-13 Jackson Harper <jackson@ximian.com>
379 * typemanager.cs (TypeToCoreType): Add float and double this fixes
382 2003-10-09 Martin Baulig <martin@ximian.com>
384 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
386 (MethodCore.DoDefineParameters): Removed the TypeContainer
387 argument; use the DeclSpace which was passed to the .ctor instead.
388 (MethodCore.CheckParameter): Take a DeclSpace instead of a
389 TypeContainer; we only need a DeclSpace here.
391 2003-10-09 Martin Baulig <martin@ximian.com>
393 * class.cs (MethodData): Added additional `DeclSpace ds' argument
395 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
398 2003-10-09 Martin Baulig <martin@ximian.com>
400 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
401 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
402 AsAccessible(), moved them as well.
404 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
406 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
408 * cs-parser.jay : Renamed yyName to yyNames related to jay.
410 2003-10-07 Miguel de Icaza <miguel@ximian.com>
412 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
413 generation for >=, as spotted by Paolo, bug 48679.
414 Patch from David Waite.
416 * cs-tokenizer.cs: Add handling for #pragma.
418 * cs-parser.jay: Allow for both yield and yield return in the
419 syntax. The anti-cobolization of C# fight will go on!
421 * class.cs (TypeBuilder.DefineType): Catch error condition here
422 (Parent.DefineType erroring out and returning null).
424 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
425 coping with enumerations variables, we were mistakenly processing
426 them as a regular value type instead of built-in types. Fixes the
429 * typemanager.cs (IsBuiltinOrEnum): New method.
431 2003-09-30 Miguel de Icaza <miguel@ximian.com>
433 * cs-parser.jay: Upgrade: yield now needs the return clause.
435 2003-09-19 Martin Baulig <martin@ximian.com>
437 * decl.cs (MemberCache.SetupCacheForInterface): Take a
438 `MemberCache parent' argument. Normally, an interface doesn't
439 have a parent type except System.Object, but we use this in gmcs
440 for generic type parameters.
442 2003-09-18 Martin Baulig <martin@ximian.com>
444 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
445 on `type.IsInterface'; don't check whether the type has a parent
446 to determine whether it's an interface.
448 2003-09-15 Martin Baulig <martin@ximian.com>
450 * class.cs (TypeContainer.DefineType): Added an error flag to
451 avoid reporting duplicate CS0146's ("class definition is
454 * driver.cs (Driver.MainDriver): Abort if
455 RootContext.ResolveTree() reported any errors.
457 2003-09-07 Martin Baulig <martin@ximian.com>
459 * report.cs (Error, Warning): Added overloaded versions which take
460 a `params object[] args' and call String.Format().
462 2003-09-07 Martin Baulig <martin@ximian.com>
464 * decl.cs (DeclSpace..ctor): Don't call
465 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
466 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
467 (DeclSpace.RecordDecl): New method.
469 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
471 2003-09-02 Ravi Pratap <ravi@ximian.com>
473 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
474 value attributes to be applied to ParameterBuilders.
476 * class.cs (MethodCore.LabelParameters): Make static and more
477 generic so that it can be used from other places - like interface
478 methods, for instance.
480 * interface.cs (Interface.Emit): Call LabelParameters before
481 emitting attributes on the InterfaceMethod.
483 2003-08-26 Martin Baulig <martin@ximian.com>
485 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
486 resolving aliases; fixes #47927.
488 2003-08-26 Martin Baulig <martin@ximian.com>
490 * statement.cs (Using.DoResolve): This is internally emitting a
491 try/finally clause, so we need to set ec.NeedExplicitReturn if we
492 do not always return. Fixes #47681.
494 2003-08-26 Martin Baulig <martin@ximian.com>
496 * decl.cs (MemberCore): Moved WarningNotHiding(),
497 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
499 (AdditionResult): Make this nested in DeclSpace.
500 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
501 argument; call NamespaceEntry.Define() unless we're nested in a
504 * namespace.cs (Namespace.DefineName): New public function. This
505 is called from DeclSpace's .ctor to add
506 (Namespace.Lookup): Include DeclSpaces in the lookup.
508 * class.cs (Operator): Derive from MemberBase, not MemberCore.
510 * const.cs (Const): Derive from MemberBase, not MemberCore.
512 2003-08-25 Martin Baulig <martin@ximian.com>
514 * convert.cs (Convert.ExplicitReferenceConversion): When
515 converting from an interface type to a class, unbox if the target
516 type is a struct type. Fixes #47822.
518 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
520 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
523 2003-08-22 Martin Baulig <martin@ximian.com>
525 * class.cs (TypeManager.DefineType): When defining a nested type,
526 call DefineType() on our parent; fixes #47801.
528 2003-08-22 Martin Baulig <martin@ximian.com>
530 * class.cs (MethodData.Define): While checking if a method is an
531 interface implementation, improve the test a bit more to fix #47654.
533 2003-08-22 Martin Baulig <martin@ximian.com>
535 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
536 correctly; fixes #47722.
538 2003-08-22 Martin Baulig <martin@ximian.com>
540 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
541 LocalVariableReference, ensure it's not read-only. Fixes #47536.
543 * statement.cs (Fixed.DoResolve): Make all variables read-only.
545 2003-08-22 Martin Baulig <martin@ximian.com>
547 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
548 can only be assigned in static constructors. Fixes #47161.
550 2003-08-22 Martin Baulig <martin@ximian.com>
552 Rewrote and improved the flow analysis code.
554 * flowbranching.cs (FlowBranching): Make this class abstract.
555 (FlowBranching.CreateBranching): New static function to create a
557 (FlowBranchingBlock, FlowBranchingException): New classes.
558 (FlowBranching.UsageVector.Type): New public readonly field.
559 (FlowBranching.UsageVector.Breaks): Removed the setter.
560 (FlowBranching.UsageVector.Returns): Removed the setter.
561 (FlowBranching.UsageVector): Added Break(), Return(),
562 NeverReachable() and Throw() methods to modify the reachability.
563 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
564 done by FlowBranching.Merge().
565 (FlowBranching.UsageVector.MergeChild): New method; merges the
566 merge result into the current vector.
567 (FlowBranching.Merge): New abstract method to merge a branching.
569 2003-08-12 Martin Baulig <martin@ximian.com>
571 * expression.cs (Indirection.CacheTemporaries): Create the
572 LocalTemporary with the pointer type, not its element type.
574 2003-08-10 Miguel de Icaza <miguel@ximian.com>
576 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
577 token was a keyword or not.
579 Add `error' options where an IDENTIFIER was expected; Provide
580 CheckToken and CheckIdentifierToken convenience error reporting
583 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
585 * decl.cs: Rename `NamespaceEntry Namespace' public field into
586 NameSpaceEntry NameSpaceEntry.
588 (LookupInterfaceOrClass): Avoid creating a full qualified name
589 from namespace and name: avoid doing lookups when we know the
590 namespace is non-existant. Use new Tree.LookupByNamespace which
591 looks up DeclSpaces based on their namespace, name pair.
593 * driver.cs: Provide a new `parser verbose' to display the
594 exception thrown during parsing. This is turned off by default
595 now, so the output of a failure from mcs is more graceful.
597 * namespace.cs: Track all the namespaces defined in a hashtable
600 (IsNamespace): New method
602 2003-08-09 Miguel de Icaza <miguel@ximian.com>
604 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
605 we know that we need to concatenate (full typename can never be
610 * statement.cs: Use a bitfield; Do not initialize to null things
611 which are done by the constructor by default.
613 * cs-parser.jay: bug fix, parameter was 4, not 3.
615 * expression.cs: Just use the property;
617 * statement.cs: No need for GetVariableInfo method.
619 2003-08-08 Martin Baulig <martin@ximian.com>
621 * flowanalysis.cs (FlowReturns): This is now nested in the
622 `FlowBranching' class.
623 (MyBitVector): Moved this here from statement.cs.
624 (FlowBranching.SiblingType): New enum type.
625 (FlowBranching.CreateSibling): Added `SiblingType' argument.
627 2003-08-07 Martin Baulig <martin@ximian.com>
629 * flowanalysis.cs (FlowBranchingType): This is now nested in the
630 `FlowBranching' class and called `BranchingType'.
632 2003-08-07 Martin Baulig <martin@ximian.com>
634 * flowanalysis.cs: Moved all the control flow analysis code into
637 2003-08-07 Martin Baulig <martin@ximian.com>
639 * assign.cs (Assign.DoResolve): `target' must either be an
640 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
643 2003-08-07 Miguel de Icaza <miguel@ximian.com>
645 * expression.cs (BinaryMethod): This kind of expression is created by the
646 Binary class if it determines that the operator has to be handled
649 (BinaryDelegate): This kind of expression is created if we are
650 dealing with a + or - operator on delegates.
652 (Binary): remove method, argumetns, and DelegateOperator: when
653 dealing with methods,
655 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
657 * statement.cs (Block): use bitfields for the three extra booleans
658 we had in use. Remove unused topblock parameter.
660 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
662 * assign.cs: Drop extra unneeded tests.
664 2003-08-06 Miguel de Icaza <miguel@ximian.com>
666 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
668 * statement.cs (Foreach): Use VariableStorage instead of
671 * codegen.cs (VariableStorage): New class used by clients that
672 require a variable stored: locals or fields for variables that
673 need to live across yield.
675 Maybe provide a convenience api for EmitThis+EmitLoad?
677 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
680 2003-08-05 Miguel de Icaza <miguel@ximian.com>
682 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
683 RemapParameterLValue): New methods that are used to turn a
684 precomputed FieldInfo into an expression like this:
688 The idea is to use this instead of making LocalVariableReference
689 have more than one meaning.
691 * cs-parser.jay: Add error production to BASE.
693 * ecore.cs: Deal with TypeManager.GetField returning null, which
694 is now a valid return value.
696 (FieldExprNoAddress): New expression for Fields whose address can
699 * expression.cs (LocalVariableReference): During the resolve
700 phases, create new expressions if we are in a remapping context.
701 Remove code that dealt with remapping here.
703 (ParameterReference): same.
705 (ProxyInstance): New expression, like the `This' expression, but
706 it is born fully resolved. We know what we are doing, so remove
707 the errors that are targeted to user-provided uses of `this'.
709 * statement.cs (Foreach): our variable is now stored as an
710 Expression; During resolution, follow the protocol, dont just
711 assume it will return this.
713 2003-08-06 Martin Baulig <martin@ximian.com>
715 * support.cs (SeekableStreamReader.cs): New public class.
717 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
718 SeekableStreamReader instead of the normal StreamReader.
720 2003-08-04 Martin Baulig <martin@ximian.com>
722 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
723 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
724 deambiguate casts and delegate invocations.
725 (parenthesized_expression): Use the new tokens to ensure this is
726 not a cast of method invocation.
728 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
729 when reading a `)' and Deambiguate_CloseParens () was previously
732 * expression.cs (ParenthesizedExpression): New class. This is
733 just used for the CS0075 test.
734 (Binary.DoResolve): Check for CS0075.
736 2003-07-29 Ravi Pratap <ravi@ximian.com>
738 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
739 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
740 reference comparison.
742 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
743 examine the ReturnType for equality - this is necessary in the
744 cases of implicit and explicit operators whose signature also
745 includes the return type.
747 2003-07-26 Miguel de Icaza <miguel@ximian.com>
749 * namespace.cs: Cache the result of the namespace computation,
750 instead of computing it every time.
752 2003-07-24 Miguel de Icaza <miguel@ximian.com>
754 * decl.cs: Use a global arraylist that we reuse over invocations
755 to avoid excesive memory consumption. Reduces memory usage on an
756 mcs compile by one meg (45 average).
758 * typemanager.cs (LookupTypeReflection): In .NET pointers are
759 private, work around that.
761 2003-07-23 Miguel de Icaza <miguel@ximian.com>
763 * literal.cs (IntLiteral): Define Zero and One static literals.
765 * cs-parser.jay (integer_literal): use static literals to reduce
766 memory usage for the most used literals (0, 1 and -1). 211kb
767 reduced in memory usage.
769 Replace all calls to `new ArrayList' with `new
770 ArrayList(4)' which is a good average number for most allocations,
771 and also requires only 16 bytes of memory for its buffer by
774 This reduced MCS memory usage in seven megabytes for the RSS after
777 2003-07-28 Ravi Pratap <ravi@ximian.com>
779 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
780 handle params methods the correct way by forming only one
781 applicable set with params and normal methods in them. Earlier we
782 were looking at params methods only if we found no normal methods
783 which was not the correct thing to do.
785 (Invocation.BetterFunction): Take separate arguments indicating
786 when candidate and the best method are params methods in their
789 This fixes bugs #43367 and #46199.
791 * attribute.cs: Documentation updates.
793 (CheckAttribute): Rename to CheckAttributeTarget.
794 (GetValidPlaces): Rename to GetValidTargets.
796 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
797 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
801 2003-07-28 Martin Baulig <martin@ximian.com>
803 * class.cs (TypeContainer.DefineMembers): Use the base type's full
804 name when looking up the base class of a nested class. Fixes #46977.
806 2003-07-26 Martin Baulig <martin@ximian.com>
808 * expression.cs (Indexers.Indexer): New nested struct; contains
809 getter, setter and the indexer's type.
810 (Indexers.Properties): This is now an ArrayList of
812 (IndexerAccess.DoResolveLValue): Correctly set the type if the
813 indexer doesn't have any getters.
815 * assign.cs (Assign.DoResolve): Also do the implicit conversions
816 for embedded property and indexer assignments.
818 2003-07-26 Martin Baulig <martin@ximian.com>
820 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
821 preprocessor directive is not the first non-whitespace character
824 2003-07-26 Martin Baulig <martin@ximian.com>
826 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
827 namespace parsing, follow the spec more closely.
829 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
830 NamespaceEntry.Lookup().
832 2003-07-25 Martin Baulig <martin@ximian.com>
834 * MethodCore.cs (OverridesSomething): New public field; it's set
835 from TypeContainer.DefineMembers if this method overrides
836 something (which doesn't need to be a method). Fix #39462.
838 2003-07-25 Ravi Pratap <ravi@ximian.com>
840 * typemanager.cs (GetMembers): Ensure that the list of members is
841 reversed. This keeps things in sync.
843 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
844 find an AttributeUsage attribute.
846 * expression.cs (Invocation.OverloadResolve): Perform the check
847 which disallows Invoke to be directly called on a Delegate.
849 (Error_InvokeOnDelegate): Report error cs1533.
851 2003-07-25 Martin Baulig <martin@ximian.com>
853 * expression.cs (Indexers.GetIndexersForType): Only look in the
854 interface hierarchy if the requested type is already an
855 interface. Fixes #46788 while keeping #46502 fixed.
857 2003-07-25 Martin Baulig <martin@ximian.com>
859 * class.cs (TypeContainer.DefineMembers): Check whether all
860 readonly fields have been assigned and report warning CS0649 if
863 * statement.cs (LocalInfo.IsFixed): Always return true if this is
866 2003-07-24 Ravi Pratap <ravi@ximian.com>
868 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
869 returned from GetMethods to make things consistent with the
870 assumptions MCS makes about ordering of methods.
872 This should comprehensively fix bug #45127 and it does :-)
874 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
875 ordering is actually reverse.
877 * Clean up some debug messages I left lying around.
879 * interface.cs (Populate*): Get rid of code which emits attributes
880 since the stage in which we emit attributes is the 'Emit' stage,
881 not the define stage.
883 (Emit): Move attribute emission for interface members here.
885 2003-07-22 Ravi Pratap <ravi@ximian.com>
887 * expression.cs (Invocation.OverloadResolve): Follow the spec more
888 closely: we eliminate methods in base types when we have an
889 applicable method in a top-level type.
891 Please see section 14.5.5.1 for an exact description of what goes
894 This fixes bug #45127 and a host of other related to corlib compilation.
896 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
897 array is the method corresponding to the top-level type (this is
898 because of the changes made to icall.c) so we change this
901 (MethodGroupExpr.Name): This too.
903 * typemanager.cs (GetElementType): New method which does the right
904 thing when compiling corlib.
906 * everywhere: Make use of the above in the relevant places.
908 2003-07-22 Martin Baulig <martin@ximian.com>
910 * cs-parser.jay (invocation_expression): Moved
911 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
912 `cast_expression', but create a InvocationOrCast which later
913 resolves to either an Invocation or a Cast.
915 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
916 method; call this before EmitStatement() to make sure that this
917 expression can be used as a statement.
919 * expression.cs (InvocationOrCast): New class; resolves to either
920 an Invocation or a Cast.
922 * statement.cs (StatementExpression): Call ResolveStatement() on
923 the ExpressionStatement before emitting it.
925 2003-07-21 Martin Baulig <martin@ximian.com>
927 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
928 `ref' and `out' attributes match; fixes #46220.
929 (MemberAccess.ResolveMemberAccess): You can't reference a type
930 through an expression; fixes #33180.
931 (Indexers.GetIndexersForType): Don't return the indexers from
932 interfaces the class implements; fixes #46502.
934 2003-07-21 Martin Baulig <martin@ximian.com>
936 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
937 CS0661 checks; fixes bug #30442.
939 2003-07-21 Martin Baulig <martin@ximian.com>
941 * decl.cs (AdditionResult): Added `Error'.
943 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
945 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
946 makes cs0031.cs actually work.
948 2003-07-20 Martin Baulig <martin@ximian.com>
950 * namespace.cs: Fixed that bug which caused a crash when compiling
953 2003-07-20 Miguel de Icaza <miguel@ximian.com>
955 * typemanager.cs (LookupTypeReflection): Never expose types which
956 are NotPublic, NestedPrivate, NestedAssembly, or
957 NestedFamANDAssem. We used to return these, and later do a check
958 that would report a meaningful error, but the problem is that we
959 would not get the real match, if there was a name override.
961 2003-07-18 Miguel de Icaza <miguel@ximian.com>
963 * namespace.cs (Namespace, Name): Do not compute the namespace
964 name dynamically, compute it in the constructor. This reduced
965 memory usage by 1697 KB.
967 * driver.cs: Use --pause to pause at the end.
969 2003-07-17 Peter Williams <peter@newton.cx>
971 * Makefile: Change the name of the test target so that it doesn't
972 conflict with the recursive test target.
974 2003-07-17 Miguel de Icaza <miguel@ximian.com>
976 * expression.cs (LocalVariableReference.Emit, EmitAssign,
977 AddressOf): Do not use EmitThis, that was wrong, use the actual
980 2003-07-15 Miguel de Icaza <miguel@ximian.com>
982 * class.cs (MethodData.Define): While checking if a method is an
983 interface implementation, improve the test: If we are not public
984 (use new test here: use the computed MethodAttributes directly,
985 instead of the parsed modifier flags) check if the `implementing'
986 method comes from an interface or not.
988 * pending.cs (VerifyPendingMethods): Slightly better error
991 * makefile: add test target that does the mcs bootstrap.
993 2003-07-16 Ravi Pratap <ravi@ximian.com>
995 * interface.cs (Define): Do nothing here since there are no
996 members to populate etc. Move the attribute emission out of here
997 since this was just totally the wrong place to put it. Attribute
998 application happens during the 'Emit' phase, not in the 'Define'
1001 (Emit): Add this method and move the attribute emission here
1003 * rootcontext.cs (EmitCode): Call the Emit method on interface
1006 2003-07-14 Ravi Pratap M <ravi@ximian.com>
1008 * expression.cs (OverloadResolve): Report error only if Location
1009 is not 'Null' which means that there was a probe going on.
1011 2003-07-14 Martin Baulig <martin@ximian.com>
1013 * expression.cs (ConditionalLogicalOperator): New public class to
1014 implement user defined conditional logical operators.
1015 This is section 14.11.2 in the spec and bug #40505.
1017 2003-07-14 Martin Baulig <martin@ximian.com>
1019 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
1021 2003-07-14 Martin Baulig <martin@ximian.com>
1023 * codegen.cs (EmitContext.InFixedInitializer): New public field.
1025 * ecore.cs (IVariable.VerifyFixed): New interface method.
1027 * expression.cs (Unary.ResolveOperator): When resolving the `&'
1028 operator, check whether the variable is actually fixed. Fixes bug
1029 #36055. Set a variable definitely assigned when taking its
1030 address as required by the spec.
1032 * statement.cs (LocalInfo.IsFixed): New field.
1033 (LocalInfo.MakePinned): Set `IsFixed' to true.
1035 2003-07-14 Ravi Pratap M <ravi@ximian.com>
1037 * attribute.cs (Attribute.Resolve): While doing a Member lookup
1038 for .ctors, ensure that we only ask for members declared in the
1039 attribute type (BindingFlags.DeclaredOnly).
1043 * expression.cs (Error_WrongNumArguments): Report error 1501
1044 correctly the way CSC does.
1046 2003-07-13 Martin Baulig <martin@ximian.com>
1048 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1049 lookup on the fully qualified name, to make things like "X.X" work
1050 where "X.X" is a fully qualified type name, but we also have a
1051 namespace "X" in the using list. Fixes #41975.
1053 2003-07-13 Martin Baulig <martin@ximian.com>
1055 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1056 function. If we're a CompoundAssign, we need to create an embedded
1057 CompoundAssign, not an embedded Assign.
1058 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1061 2003-07-13 Martin Baulig <martin@ximian.com>
1063 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1064 work to fix bug #46088.
1066 2003-07-13 Ravi Pratap <ravi@ximian.com>
1068 * class.cs (Operator.Emit): Do not emit attributes here - it is
1069 taken care of by the Method class that we delegate too. This takes
1072 2003-07-10 Martin Baulig <martin@ximian.com>
1074 * expression.cs (TypeOfVoid): New class.
1075 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
1077 2003-07-10 Martin Baulig <martin@ximian.com>
1079 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
1082 2003-07-10 Martin Baulig <martin@ximian.com>
1084 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
1085 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
1087 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
1089 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
1091 2003-07-10 Martin Baulig <martin@ximian.com>
1093 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
1094 of decimal. Fixes #42850.
1096 NOTE: I also fixed the created byte blob, but this doesn't work on
1097 the MS runtime and csc never produces any byte blobs for decimal
1100 2003-07-10 Martin Baulig <martin@ximian.com>
1102 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
1103 structs; fixes #32068.
1104 (Block.AddChildVariableNames): Fixed #44302.
1106 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1108 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1110 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1112 * attribute.cs: And this test is onger needed.
1114 2003-07-08 Martin Baulig <martin@ximian.com>
1116 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1117 inaccessible types. Fixes #36313.
1119 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1121 * namespace.cs (NamespaceEntry): Create implicit entries for all
1122 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1123 implicit entries for N1.N2 and N1.
1125 2003-07-08 Martin Baulig <martin@ximian.com>
1127 Rewrote the handling of namespaces to fix a lot of the issues
1128 wrt. `using' aliases etc.
1130 * namespace.cs (Namespace): Splitted this class into a
1131 per-assembly `Namespace' and a per-file `NamespaceEntry'.
1133 * typemanager.cs (TypeManager.IsNamespace): Removed.
1134 (TypeManager.ComputeNamespaces): Only compute namespaces from
1135 loaded assemblies here, not the namespaces from the assembly we're
1136 currently compiling.
1138 2003-07-08 Martin Baulig <martin@ximian.com>
1140 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1142 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1144 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1147 I thought about the memory savings here, but LookupTypeReflection
1148 is used under already very constrained scenarios. Compiling
1149 corlib or mcs only exposes one hit, so it would not really reduce
1150 any memory consumption.
1152 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1154 * typemanager.cs: fixes bug #45889 by only adding public types from
1155 other assemblies to the list of known types.
1157 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1159 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1160 on the type we resolved.
1162 2003-07-05 Martin Baulig <martin@ximian.com>
1164 * pending.cs (PendingImplementation.ParentImplements): Don't
1165 create the proxy if the parent is abstract.
1167 * class.cs (TypeContainer.DefineIndexers): Process explicit
1168 interface implementations first. Fixes #37714.
1170 2003-07-04 Miguel de Icaza <miguel@ximian.com>
1172 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1173 defined recursively; but since we modify the input parameters
1174 (left is set to `this' temporarily), we reset this value if the
1175 left_is_explicit is false, which gives the original semantics to
1178 * literal.cs (NullPointer): new class used to represent a null
1179 literal in a pointer context.
1181 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1182 type is a pointer, use a NullPointer object instead of a
1183 NullLiteral. Closes 43687
1185 (ExplicitConversion): Convert pointer values using
1186 the conv opcode to the proper type.
1188 * ecore.cs (New): change ValueTypeVariable property into a method,
1189 that returns whether the valuetype is suitable for being used.
1191 * expression.cs (Binary.DoNumericPromotions): Only return if we
1192 the int constant was a valid uint, and we can return both left and
1193 right as uints. If not, we continue processing, to trigger the
1194 type conversion. This fixes 39018.
1196 * statement.cs (Block.EmitMeta): During constant resolution, set
1197 the CurrentBlock property on the emitcontext, so that we resolve
1198 constants propertly.
1200 2003-07-02 Martin Baulig <martin@ximian.com>
1202 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1203 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1205 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1206 than emitting it here.
1208 * statement.cs: Fixed some more flow analysis bugs.
1210 2003-07-02 Martin Baulig <martin@ximian.com>
1212 * class.cs (MethodData.Define): When implementing interface
1213 methods, set Final unless we're Virtual.
1215 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1216 check work for interface methods.
1218 2003-07-01 Martin Baulig <martin@ximian.com>
1220 * ecore.cs (EmitContext.This): Replaced this property with a
1221 GetThis() method which takes a Location argument. This ensures
1222 that we get the correct error location for a CS0188.
1224 2003-07-01 Miguel de Icaza <miguel@ximian.com>
1226 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1227 ImplicitStandardConversion.
1229 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1231 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
1233 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1236 2003-06-30 Miguel de Icaza <miguel@ximian.com>
1238 * class.cs (Constructor.Define): Turn off initlocals for unsafe
1241 (MethodData.Define): Turn off initlocals for unsafe methods.
1243 2003-06-29 Miguel de Icaza <miguel@ximian.com>
1245 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1246 complete; Fixes #37521.
1248 * delegate.cs: Use Modifiers.TypeAttr to compute the
1249 TypeAttributes, instead of rolling our own. This makes the flags
1250 correct for the delegates.
1252 2003-06-28 Miguel de Icaza <miguel@ximian.com>
1254 * class.cs (Constructor.Define): Set the private flag for static
1255 constructors as well.
1257 * cs-parser.jay (statement_expression): Set the return value to
1258 null, to avoid a crash when we catch an error.
1260 2003-06-24 Miguel de Icaza <miguel@ximian.com>
1262 * cs-parser.jay: Applied patch from Jackson that adds support for
1263 extern and unsafe modifiers to destructor declarations.
1265 * expression.cs: Report error 21 if the user is trying to index a
1268 * driver.cs: Add an error message, suggested by the bug report.
1270 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1271 if we do not have a ": this ()" constructor initializer. Fixes 45149
1273 2003-06-14 Miguel de Icaza <miguel@ximian.com>
1275 * namespace.cs: Add some information to reduce FAQs.
1277 2003-06-13 Miguel de Icaza <miguel@ximian.com>
1279 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1280 underlying enumeration types. Fixes #43915.
1282 * expression.cs: Treat ushort/short as legal values to be used in
1285 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1287 * delegate.cs: transfer custom attributes for paramenters from
1288 the delegate declaration to Invoke and BeginInvoke.
1290 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1292 * attribute.cs: handle custom marshalers and emit marshal info
1295 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
1297 * makefile.gnu: Added anonymous.cs to the compiler sources.
1299 2003-05-28 Miguel de Icaza <miguel@ximian.com>
1301 * iterators.cs: Change the name of the proxy class to include two
1304 * cs-parser.jay: Update grammar to include anonymous methods.
1306 * anonymous.cs: new file.
1308 2003-05-27 Miguel de Icaza <miguel@ximian.com>
1310 * class.cs (Field.Define): Add missing test for pointers and
1313 2003-05-27 Ravi Pratap <ravi@ximian.com>
1315 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1316 we use the stobj opcode.
1318 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1319 since it wasn't the correct fix.
1321 It still is puzzling that we are required to use stobj for IntPtr
1322 which seems to be a ValueType.
1324 2003-05-26 Miguel de Icaza <miguel@ximian.com>
1326 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1327 during regular simple name resolution. Now, the trick is that
1328 instead of returning for processing the simplename, we do a
1329 TypeManager.LookupType (ie, a rooted lookup as opposed to a
1330 contextual lookup type). If a match is found, return that, if
1331 not, return for further composition.
1333 This fixes long-standing 30485.
1335 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1336 using the address to initialize an object, do an Stobj instead of
1337 using the regular Stelem.
1339 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1340 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1341 Because if we are a BaseIndexerAccess that value will be true.
1344 * statement.cs (GotoCase.Resolve): Return after reporting an
1345 error, do not attempt to continue.
1347 * expression.cs (PointerArithmetic.Emit): If our operand is a
1348 long, convert our constants to match the operand before
1349 multiplying. Convert to I type before adding. Fixes 43670.
1351 2003-05-14 Ravi Pratap <ravi@ximian.com>
1353 * enum.cs (ImplicitConversionExists) : Rename to
1354 ImplicitEnumConversionExists to remove ambiguity.
1356 * ecore.cs (NullCast): New type of cast expression class which
1357 basically is very similar to EmptyCast with the difference being
1358 it still is a constant since it is used only to cast a null to
1362 * convert.cs (ImplicitReferenceConversion): When casting a null
1363 literal, we return a NullCast.
1365 * literal.cs (NullLiteralTyped): Remove - I don't see why this
1366 should be around anymore.
1368 The renaming (reported was slightly wrong). Corrections:
1370 ConvertImplicitStandard -> ImplicitConversionStandard
1371 ConvertExplicitStandard -> ExplicitConversionStandard
1373 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1374 before passing them in !
1376 * convert.cs (ImplicitConversionStandard): When comparing for
1377 equal expr and target types, ensure that expr is not a
1380 In general, we must not be checking (expr_type ==
1381 target_type) in the top level conversion methods
1382 (ImplicitConversion, ExplicitConversion etc). This checking is
1383 done in the methods that they delegate to.
1385 2003-05-20 Miguel de Icaza <miguel@ximian.com>
1387 * convert.cs: Move Error_CannotConvertType,
1388 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1389 ImplicitNumericConversion, ImplicitConversionExists,
1390 ImplicitUserConversionExists, StandardConversionExists,
1391 FindMostEncompassedType, FindMostSpecificSource,
1392 FindMostSpecificTarget, ImplicitUserConversion,
1393 ExplicitUserConversion, GetConversionOperators,
1394 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1395 TryImplicitIntConversion, Error_CannotConvertImplicit,
1396 ConvertImplicitRequired, ConvertNumericExplicit,
1397 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1398 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1401 Perform the following renames:
1403 StandardConversionExists -> ImplicitStandardConversionExists
1404 ConvertImplicit -> ImplicitConversion
1405 ConvertImplicitStandard -> ImplicitStandardConversion
1406 TryImplicitIntConversion -> ImplicitIntConversion
1407 ConvertImplicitRequired -> ImplicitConversionRequired
1408 ConvertNumericExplicit -> ExplicitNumericConversion
1409 ConvertReferenceExplicit -> ExplicitReferenceConversion
1410 ConvertExplicit -> ExplicitConversion
1411 ConvertExplicitStandard -> ExplicitStandardConversion
1413 2003-05-19 Martin Baulig <martin@ximian.com>
1415 * statement.cs (TypeInfo.StructInfo): Made this type protected.
1416 (TypeInfo): Added support for structs having structs as fields.
1418 * ecore.cs (FieldExpr): Implement IVariable.
1419 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1420 VariableInfo for the field.
1422 2003-05-18 Martin Baulig <martin@ximian.com>
1424 * expression.cs (This.DoResolve): Report a CS0027 if we're
1425 emitting a field initializer.
1427 2003-05-18 Martin Baulig <martin@ximian.com>
1429 * expression.cs (This.ResolveBase): New public function.
1430 (This.DoResolve): Check for CS0188.
1432 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1435 * ecore.cs (MethodGroupExpr.DoResolve): Set the
1436 `instance_expression' to null if we don't have any non-static
1439 2003-05-18 Martin Baulig <martin@ximian.com>
1441 Reworked the way how local variables and parameters are handled by
1442 the flow analysis code.
1444 * statement.cs (TypeInfo, VariableMap): New public classes.
1445 (VariableInfo): New public class. This is now responsible for
1446 checking whether a variable has been assigned. It is used for
1447 parameters and local variables.
1448 (Block.EmitMeta): Take the InternalParameters as argument; compute
1449 the layout of the flow vectors here.
1450 (Block.LocalMap, Block.ParameterMap): New public properties.
1451 (FlowBranching): The .ctor doesn't get the InternalParameters
1452 anymore since Block.EmitMeta() now computes the layout of the flow
1454 (MyStructInfo): This class is now known as `StructInfo' and nested
1455 in `TypeInfo'; we don't access this directly anymore.
1457 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1458 property and removed IsAssigned(), IsFieldAssigned(),
1459 SetAssigned() and SetFieldAssigned(); we now call them on the
1460 VariableInfo so we don't need to duplicate this code everywhere.
1462 * expression.cs (ParameterReference): Added `Block block' argument
1464 (LocalVariableReference, ParameterReference, This): The new
1465 VariableInfo class is now responsible for all the definite
1468 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1469 IsParameterAssigned, SetParameterAssigned): Removed.
1471 2003-05-18 Martin Baulig <martin@ximian.com>
1473 * typemanager.cs (InitCoreTypes): Try calling
1474 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1475 the 3-args-version. Corlib now also needs our `void_type'.
1476 (GetMethod): Added overloaded version which takes an optional
1477 `bool report_errors' to allow lookups of optional methods.
1479 2003-05-12 Martin Baulig <martin@ximian.com>
1481 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1482 only used for locals and not for parameters.
1484 2003-05-12 Miguel de Icaza <miguel@ximian.com>
1486 * support.cs (InternalParameters.ParameterType): Return the
1487 ExternalType of the parameter.
1489 * parameter.cs (Parameter.ExternalType): drop the two arguments,
1492 2003-05-11 Miguel de Icaza <miguel@ximian.com>
1494 * class.cs (MethodData.Define): Do not set the `newslot' on
1495 interface members, if they are also flagged as "override".
1497 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1498 better code for ++i and i++. This only works for static fields
1499 and local variables.
1501 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1502 want to pull the DeclSpace out of the builder_to_declspace instead
1503 of the TypeBuilder (like in TypeContainer.FindMembers).
1505 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1506 instead of LookupTypeContainer. Fixes the crash on .NET for
1507 looking up interface members.
1509 * const.cs: Create our own emit context during the Definition
1510 stage, so that constants are evaluated in the proper context, when
1511 a recursive definition happens.
1513 2003-05-11 Martin Baulig <martin@ximian.com>
1515 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
1516 new block for a switch section.
1517 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1518 the adding/lookup in the switch block. Fixes #39828.
1520 2003-05-09 Miguel de Icaza <miguel@ximian.com>
1522 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1523 functionality: I needed to convert the data after I had performed
1524 the add/sub operation into the operands type size.
1526 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1527 pass the type for the box operation, otherwise the resulting
1528 object would have been of type object.
1530 (BoxedCast): Add constructor to specify the type to box as.
1532 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1534 * iterators.cs: I was reusing the `count' variable inadvertently,
1535 take steps to not allow this to happen.
1537 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1539 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1540 by creating an array at the point where the params starts and
1541 putting all those arguments there, then adjusting the size of the
1544 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1546 * expression.cs (New.AddressOf): Implement interface
1547 IMemoryLocation. This is used when the `new' operator is used in
1548 the context of an invocation to a method on a value type.
1550 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1553 * namespace.cs: Also check the using aliases here.
1555 * driver.cs: Move the test for using validity after the types have
1556 been entered, so we do a single pass that also includes the using
1559 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1560 in the regular case. CreateSiblingForFinally is doing extra
1563 * attribute.cs (GetAttributeArgumentExpression): Store the result
1564 on an out value, and use the return value to indicate failure
1565 instead of using null (which is a valid return for Constant.GetValue).
1567 * statement.cs: Perform the analysis flow for the increment
1568 portion after the statement, because this will be the real flow of
1569 execution. Fixes #42385
1571 * codegen.cs (EmitContext.EmitArgument,
1572 EmitContext.EmitStoreArgument): New helper functions when the
1573 RemapToProxy flag is set.
1575 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1578 Add support for remapping parameters.
1580 * iterators.cs: Propagate parameter values; Store parameter
1581 values in the proxy classes.
1583 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1585 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1586 need a proxy reference; I do not know what I was thinking
1588 * cs-parser.jay (constructor_initializer): catch another error,
1589 and display nice message.
1591 (field_declaration): catch void field declaration
1592 to flag a better error.
1594 * class.cs (MemberBase.CheckBase): Report an error instead of a
1595 warning if a new protected member is declared in a struct.
1596 (Field.Define): catch the error of readonly/volatile.
1598 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1600 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1601 volatile variable is taken
1603 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1605 * statement.cs (Fixed.Resolve): Report an error if we are not in
1608 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1610 * typemanager.cs: reuse the code that handles type clashes for
1611 delegates and enumerations.
1613 * class.cs (Report28): Always report.
1615 * expression.cs (EncodeAsAttribute): Allow nulls here.
1617 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1619 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1620 the functionality for testing whether an expression is valid for
1621 an attribute here. Also handle the case of arrays of elements
1624 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1625 encoding a linear array into an array of objects that are suitable
1626 to be passed to an CustomAttributeBuilder.
1628 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1630 * ecore.cs: (FieldExpr): Handle field remapping here.
1632 * iteratators.cs: Pass the instance variable (if the method is an
1633 instance method) to the constructors, so we can access the field
1634 variables on the class.
1636 TODO: Test this with structs. I think the THIS variable on
1637 structs might have to be a pointer, and not a refenrece
1639 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1641 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1642 local variables to fields in a proxy class.
1644 * iterators.cs (PopulateProxy): Rename our internal fields to
1646 Create a <THIS> field if we are an instance method, so we can
1647 reference our parent container variables.
1648 (MapVariable): Called back from the EmitContext code to enter a
1649 new variable to field mapping into the proxy class (we just create
1653 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1654 for using the remapped locals to fields.
1656 I placed the code here, because that gives the same semantics to
1657 local variables, and only changes the Emit code.
1659 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1660 statements inside iterators.
1661 (VariableInfo): Add a FieldBuilder for the cases when we are
1662 remapping local variables to fields in a proxy class
1664 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1665 current_block != null.
1667 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1668 not cope with strings, as it has been moved to the
1669 TableSwitchEmit. Fixed bug in switch generation.
1671 * expression.cs (New.DoResolve): Provide more context for the user
1672 when reporting an error.
1674 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1677 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1678 check the permissions for it. Note than in a type-resolution
1679 context the check was already present in DeclSpace.ResolveType,
1680 but was missing from the MemberAccess.
1682 (ArrayCreation.CheckIndices): warn if the user has
1683 more nested levels of expressions, but there are no more
1684 dimensions specified. Avoids crash on bug 41906.
1686 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1688 * statement.cs (Block): replace Implicit bool, for a generic
1690 New flag: `Unchecked'. This is used during the EmitMeta phase
1691 (which is out-of-line with the regular Resolve/Emit process for a
1692 statement, as this is done ahead of time, but still gets a chance
1693 to call constant resolve).
1695 (Block.Flags): new enum for adding a new flag.
1697 (Block.EmitMeta): track the state of unchecked.
1699 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1700 to enable constant resolution to work there as well.
1702 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1704 * typemanager.cs (ienumerable_type): Also look up
1705 System.Collections.IEnumerable.
1707 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1709 TODO: Test more than one conditional per method.
1711 * class.cs (Indexer.Define): Report the location where the user is
1712 referencing the unsupported feature.
1714 (MethodData): Overload the use of `conditionals' to
1715 minimize the creation of needless ArrayLists. This saves roughly
1716 212kb on my machine.
1718 (Method): Implement the new IIteratorContainer interface.
1719 (Method.SetYields): Implement the method by setting the ModFlags
1720 to contain METHOD_YIELDS.
1722 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1723 which just got set to null.
1725 * iterators.cs: New file.
1727 (Yield, YieldBreak): New statements.
1729 * statement.cs (Return.Resolve): Flag an error if we are used in
1732 * codegen.cs (InIterator): New flag set if the code is being
1733 compiled in an iterator method.
1735 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1736 internal modifier, and we just use it to avoid adding extra
1737 fields, as this is seldom used.
1739 * cs-parser.jay: Add yield_statement (yield and yield break).
1741 * driver.cs: New flag -v2 to turn on version 2 features.
1743 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1744 hashtable when v2 is enabled.
1746 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1748 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1749 there is already a namespace defined with this name.
1751 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1752 people upgraded their corlibs.
1754 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1755 always use fully qualified types, no need to use the compiler
1758 (TypeManager.IsNamespace): Use binarysearch.
1760 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1761 AddDelegate): I did not quite use the new IsValid API properly: I
1762 have to pass the short-name and the fullname. I was passing only
1763 the basename instead of the fullname sometimes.
1765 (TypeContainer.DefineType): call NamespaceClash.
1767 * interface.cs (Interface.DefineType): use NamespaceClash before
1770 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1773 * enum.cs: (Enum.DefineType): use NamespaceClash before
1776 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1777 speed increase. First, use the negative_hits cache when we get a
1778 negative. Second, add the type with its full original name
1779 instead of the new . and + encoded name (reflection uses + to
1780 separate type from a nested type). Use LookupTypeReflection
1781 directly which bypasses the type->name hashtable (that we already
1782 know does not contain the type.
1784 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1785 location/container type.
1787 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1789 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1791 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1793 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1794 method is being referenced in the method group from a static
1795 context, and report error 120 if so.
1797 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1800 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1801 is created, we create the A namespace).
1803 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1806 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1808 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1809 invocation to ModuleBuilder.GetType with the same values will
1810 return a new type instance, so we need to cache its return
1813 * expression.cs (Binary.ResolveOperator): Only allow the compare
1814 operators on enums if they are of the same type.
1816 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1817 types of ValueType on their own case. Before we were giving them
1818 the same treatment as objects.
1820 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1821 fullname. Short name is used to compare against container name.
1822 Fullname is used to check against defined namespace names.
1824 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1825 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1827 (Method.CheckBase): Call parent.
1828 (MemberBase.CheckBase): Check for protected members on sealed
1830 (PropertyBase.CheckBase): Call parent.
1831 (Field.Define): Call parent.
1833 * report.cs: Negative error codes are now mapped to 8000 - code,
1834 so that the display is render more nicely.
1836 * typemanager.cs: Do not use try/catch, instead report a regular
1839 (GetPointerType, GetReferenceType): These methods provide
1840 mechanisms to obtain the T* and T& from a T. We had the code
1841 previously scattered around the code base, and it also used
1842 TypeManager.LookupType that would go through plenty of caches.
1843 This one goes directly to the type source.
1845 In some places we did the Type.GetType followed by
1846 ModuleBuilder.GetType, but not in others, so this unifies the
1849 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1850 statements now that we have namespace information.
1852 * typemanager.cs (IsNamespace): New method, returns whether the
1853 string presented is a namespace or not.
1855 (ComputeNamespaces): New public entry point, computes the list of
1856 available namespaces, using the GetNamespaces API call in Mono, or
1857 the slower version in MS.NET.
1859 Now before we start the semantic analysis phase, we have a
1860 complete list of namespaces including everything that the user has
1863 Deleted old code to cache namespaces in .nsc files.
1865 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1867 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1868 class/struct location definition Location for the implicit
1869 constructor location.
1871 (Operator.Define): Use the location of the operator for the
1872 implicit Method definition.
1874 (Constructor.Emit): use the constructor location for the implicit
1875 base initializer constructor.
1877 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1878 and the Expression class now contains two new methods:
1880 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1881 isolate type lookup from the rest of the resolution process.
1883 Since we use Expressions to hold type definitions due to the way
1884 we parse the input we have historically overloaded Resolve to
1885 perform the Type lookups if a special flag is passed. Now this is
1886 eliminated and two methods take their place.
1888 The differences in the two methods between xStep and xTerminal is
1889 that xStep is involved in our current lookup system that uses
1890 SimpleNames to compose a name, while xTerminal is used just to
1891 catch the case where the simplename lookup failed.
1893 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1895 * expression.cs (ResolveMemberAccess): Remove redundant code.
1896 TypeExpr expressions are always born fully resolved.
1898 * interface.cs (PopulateMethod): Do not lookup the types twice.
1899 We were doing it once during SemanticAnalysis and once during
1902 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1903 in local variable type definitions, were being returned as a
1904 SimpleName (we decomposed everything into a string), that is
1905 because primary_expression was being used instead of a type in the
1906 grammar (reduce/reduce conflicts).
1908 The part that was wrong is that we converted the expression into a
1909 string (an oversimplification in one hand, compounded with primary
1910 expressions doing string concatenation).
1916 Would return "A.B.C[]" as a SimpleName. This stopped things like
1917 using clauses from working on this particular context. And a type
1918 was being matched directly against "A.B.C[]".
1920 We now use the correct approach, and allow for ComposedCast to be
1921 part of the unary expression. So the "A.B.C []" become a composed
1922 cast of "A.B.C" (as a nested group of MemberAccess with a
1923 SimpleName at the end) plus the rank composition "[]".
1927 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1929 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1930 for the access level checking.
1932 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1933 `TypeContainer container', because I kept getting confused when I
1934 was debugging this code.
1936 * expression.cs (Indexers): Instead of tracking getters/setters,
1937 we now track them in parallel. We create one arraylist less, but
1938 most importantly it is possible now for the LValue code to find a
1939 matching get for a set.
1941 (IndexerAccess.DoResolveLValue): Update the code.
1942 GetIndexersForType has been modified already to extract all the
1943 indexers from a type. The code assumed it did not.
1945 Also make the code set the correct return type for the indexer.
1946 This was fixed a long time ago for properties, but was missing for
1947 indexers. It used to be void_type.
1949 (Binary.Emit): Test first for doubles instead of
1950 floats, as they are more common.
1952 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1953 when dealing with floats and the <=, >= operators. This fixes bug
1956 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1957 to load the array value by emitting a load on the foreach variable
1958 type. This was incorrect.
1960 We now emit the code to load an element using the the array
1961 variable type, and then we emit the conversion operator.
1965 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1967 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1969 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1971 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1972 test for protection before we test for signatures.
1974 (MethodSignature.ToString): implement.
1976 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1977 to the case where we reduced into a LongConstant.
1979 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1980 depend on whether the information is acurrate, because the
1981 Microsoft runtime will always claim that the array type is public,
1982 regardless of the real state.
1984 If the type is a pointer, another problem happens: the type is
1985 reported as non-public in Microsoft.
1987 In both cases we have to call CheckAccessLevel recursively with
1988 the underlying type as the argument to be tested.
1990 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1992 * assign.cs (Assign.Emit): If we are dealing with a compound
1993 assignment expression, we should use the code path that stores the
1994 intermediate result in a temporary value. This fixes #40903.
1996 *expression.cs (Indirection.ToString): Provide ToString method for
1999 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
2001 * class.cs: Null out fields holding references to Block objects so
2002 they can be garbage collected.
2004 * expression.cs (OverloadResolve): Remove unused local.
2006 2003-04-07 Martin Baulig <martin@ximian.com>
2008 * codegen.cs (EmitContext.CurrentFile): New public field.
2009 (EmitContext.Mark): Use the CurrentFile to check whether the
2010 location is in the correct file.
2011 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
2013 2003-04-07 Martin Baulig <martin@ximian.com>
2015 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
2017 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
2018 location. [FIXME: The location argument which gets passed to this
2019 method is sometimes wrong!]
2021 2003-04-07 Nick Drochak <ndrochak@gol.com>
2023 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2025 2003-04-07 Miguel de Icaza <miguel@ximian.com>
2027 * expression.cs (Indirection.EmitAssign): We were using the
2028 temporary, but returning immediately instead of continuing the
2031 2003-04-06 Martin Baulig <martin@ximian.com>
2033 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2034 if it's a nested child, but also deriving from the outer class.
2037 * typemanager.cs (IsNestedChildOf): Make this work if it's a
2038 nested child, but also deriving from the outer class. See
2040 (FilterWithClosure): We may access private members of the outer
2041 class if we're a nested child and deriving from the outer class.
2042 (RealMemberLookup): Only set `closure_private_ok' if the
2043 `original_bf' contained BindingFlags.NonPublic.
2045 2003-04-05 Martin Baulig <martin@ximian.com>
2047 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
2049 2003-04-02 Miguel de Icaza <miguel@ximian.com>
2051 * class.cs (Event.Define): Do not allow abstract events to have
2054 2003-04-01 Miguel de Icaza <miguel@ximian.com>
2056 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
2057 block in event declarations.
2059 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
2060 value type, get its address.
2062 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
2063 leaving a class on the stack instead of a boolean value (int
2064 0/1). Change the code so we compare against null, and then the
2065 result against zero.
2067 * class.cs (TypeContainer.GetClassBases): We were checking for the
2068 parent class being sealed too late.
2070 * expression.cs (Binary.Emit): For <= and >= when dealing with
2071 floating point values, use cgt.un and clt.un instead of cgt and
2074 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
2076 * statement.cs: Apply the same optimization as MS: skip the
2077 GetEnumerator returning an IEnumerator, and use the one returning a
2078 CharEnumerator instead. This allows us to avoid the try-finally block
2081 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
2083 * cs-parser.jay: Attributes cannot be applied to
2084 namespaces. Fixes #40473
2086 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2089 (Add*): check if the name is valid using the full name for constants,
2090 fields, properties and events.
2092 2003-03-28 Miguel de Icaza <miguel@ximian.com>
2094 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
2095 char constants to be part of the enumeration.
2097 * expression.cs (Conditional.DoResolve): Add support for operator
2098 true. Implements the missing functionality from 14.12
2100 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
2101 operator true/false as required by the spec.
2103 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
2104 implicit conversion to boolean.
2106 * statement.cs (Statement.ResolveBoolean): A boolean expression is
2107 also one where the type implements `operator true'.
2109 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2110 get an expression that will invoke operator true based on an
2113 (GetConversionOperators): Removed the hack that called op_True
2116 (Expression.ResolveBoolean): Move this from Statement.
2118 2003-03-17 Miguel de Icaza <miguel@ximian.com>
2120 * ecore.cs (FieldExpr): do not allow initialization of initonly
2121 fields on derived classes
2123 2003-03-13 Martin Baulig <martin@ximian.com>
2125 * statement.cs (Block.Emit): Call ig.BeginScope() and
2126 ig.EndScope() when compiling with debugging info; call
2127 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2129 2003-03-08 Miguel de Icaza <miguel@ximian.com>
2131 * expression.cs (Indexers): Do not construct immediately, allow
2132 for new members to be appended as we go. Fixes 38143
2134 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2136 * expression.cs: save/restore context when resolving an unchecked
2139 2003-03-05 Miguel de Icaza <miguel@ximian.com>
2141 * cfold.cs: Catch division by zero in modulus operator during
2144 2003-03-03 Miguel de Icaza <miguel@ximian.com>
2146 * interface.cs (Interface.DefineMembers): Avoid defining members
2149 2003-02-27 Miguel de Icaza <miguel@ximian.com>
2151 * driver.cs: handle the +/- options for -noconfig
2153 * statement.cs (Unckeched.Resolve): Also track the state of
2154 unchecked in the Resolve phase.
2156 2003-02-27 Martin Baulig <martin@ximian.com>
2158 * ecore.cs (Expression.MemberLookup): Don't create a
2159 MethodGroupExpr for something which is not a method. Fixes #38291.
2161 2003-02-25 Miguel de Icaza <miguel@ximian.com>
2163 * class.cs (MemberBase.CheckParameters): Also check that the type
2164 is unmanaged if it is a pointer.
2166 * expression.cs (SizeOf.Resolve): Add location information.
2168 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2169 a managed type is declared.
2171 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2172 parameter modifiers as well. Fixes bug 38606
2174 * class.cs: Very sad. Am backing out the speed up changes
2175 introduced by the ArrayList -> Array in the TypeContainer, as they
2176 were not actually that much faster, and introduced a bug (no error
2177 reports on duplicated methods).
2179 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2180 source first, this will guarantee that we have a valid expression
2181 before calling in lower levels functions that will require a
2182 resolved object. Then use this original_source in the
2183 target.ResolveLValue instead of the original source that was
2186 Another change. Use target.Resolve instead of LValueResolve.
2187 Although we are resolving for LValues, we will let the Assign code
2188 take care of that (it will be called again from Resolve). This
2189 basically allows code like this:
2191 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2192 class Y { void A (X x) { x [0] += o; }
2194 The problem was that the indexer was trying to resolve for
2195 set_Item (idx, object o) and never finding one. The real set_Item
2196 was set_Item (idx, X). By delaying the process we get the right
2201 2003-02-23 Martin Baulig <martin@ximian.com>
2203 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2204 while calling DoEmit ().
2206 * codegen.cs (EmitContext.Mark): Don't mark locations in other
2207 source files; if you use the #line directive inside a method, the
2208 compiler stops emitting line numbers for the debugger until it
2209 reaches the end of the method or another #line directive which
2210 restores the original file.
2212 2003-02-23 Martin Baulig <martin@ximian.com>
2214 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2216 2003-02-23 Martin Baulig <martin@ximian.com>
2218 * statement.cs (Block.AddChildVariableNames): We need to call this
2219 recursively, not just for our immediate children.
2221 2003-02-23 Martin Baulig <martin@ximian.com>
2223 * class.cs (Event.Define): Always make the field private, like csc does.
2225 * typemanager.cs (TypeManager.RealMemberLookup): Make events
2226 actually work, fixes bug #37521.
2228 2003-02-23 Miguel de Icaza <miguel@ximian.com>
2230 * delegate.cs: When creating the various temporary "Parameters"
2231 classes, make sure that we call the ComputeAndDefineParameterTypes
2232 on those new parameters (just like we do with the formal ones), to
2233 allow them to be resolved in the context of the DeclSpace.
2235 This fixes the bug that Dick observed in Bugzilla #38530.
2237 2003-02-22 Miguel de Icaza <miguel@ximian.com>
2239 * expression.cs (ResolveMemberAccess): When resolving a constant,
2240 do not attempt to pull a constant if the value was not able to
2241 generate a valid constant.
2243 * const.cs (LookupConstantValue): Do not report more errors than required.
2245 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2247 * expression.cs: fixes bug #38328.
2249 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2251 * class.cs: Changed all the various members that can be part of a
2252 class from being an ArrayList to be an Array of the right type.
2253 During the DefineType type_list, interface_list, delegate_list and
2254 enum_list are turned into types, interfaces, delegates and enums
2257 And during the member population, indexer_list, event_list,
2258 constant_list, field_list, instance_constructor_list, method_list,
2259 operator_list and property_list are turned into their real arrays.
2261 Although we could probably perform this operation earlier, for
2262 good error reporting we need to keep the lists and remove the
2263 lists for longer than required.
2265 This optimization was triggered by Paolo profiling the compiler
2266 speed on the output of `gen-sample-program.pl' perl script.
2268 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2269 not crash in methods like MemberLookupFailed that use this field.
2271 This problem arises when the compiler fails to resolve a type
2272 during interface type definition for example.
2274 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2276 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2277 inherit from System.Object, so we have to stop at null, not only
2278 when reaching System.Object.
2280 2003-02-17 Miguel de Icaza <miguel@ximian.com>
2282 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2283 DeclaredOnly because the parent indexer might have had a different
2284 name, but did not loop until the top of the hierarchy was reached.
2286 The problem this one fixes is 35492: when a class implemented an
2287 indexer from an interface, we were getting the interface method
2288 (which was abstract) and we were flagging an error (can not invoke
2291 This also keeps bug 33089 functioning, and test-148 functioning.
2293 * typemanager.cs (IsSpecialMethod): The correct way of figuring
2294 out if a method is special is to see if it is declared in a
2295 property or event, or whether it is one of the predefined operator
2296 names. This should fix correctly #36804.
2298 2003-02-15 Miguel de Icaza <miguel@ximian.com>
2300 The goal here is to remove the dependency on EmptyCast.Peel ().
2301 Killing it completely.
2303 The problem is that currently in a number of places where
2304 constants are expected, we have to "probe" for an EmptyCast, and
2305 Peel, which is not the correct thing to do, as this will be
2306 repetitive and will likely lead to errors.
2308 The idea is to remove any EmptyCasts that are used in casts that
2309 can be reduced to constants, so we only have to cope with
2312 This bug hunt was triggered by Bug 37363 and the desire to remove
2313 the duplicate pattern where we were "peeling" emptycasts to check
2314 whether they were constants. Now constants will always be
2317 * ecore.cs: Use an enumconstant here instead of wrapping with
2320 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2321 throwing me off. By handling this we can get rid of a few hacks.
2323 * statement.cs (Switch): Removed Peel() code.
2325 2003-02-14 Miguel de Icaza <miguel@ximian.com>
2327 * class.cs: Location information for error 508
2329 * expression.cs (New.DoResolve): Add a guard against double
2330 resolution of an expression.
2332 The New DoResolve might be called twice when initializing field
2333 expressions (see EmitFieldInitializers, the call to
2334 GetInitializerExpression will perform a resolve on the expression,
2335 and later the assign will trigger another resolution
2337 This leads to bugs (#37014)
2339 * delegate.cs: The signature for EndInvoke should contain any ref
2340 or out parameters as well. We were not doing this in the past.
2342 * class.cs (Field.Define): Do not overwrite the type definition
2343 inside the `volatile' group. Turns out that volatile enumerations
2344 were changing the type here to perform a validity test, which
2347 2003-02-12 Miguel de Icaza <miguel@ximian.com>
2349 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2350 and structs, we do not want to load the instance variable
2352 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2353 enum_type has to be handled like an object reference (implicit
2354 conversions exists from this to object), but the regular IsClass
2355 and IsValueType tests will never return true for this one.
2357 Also we use TypeManager.IsValueType instead of type.IsValueType,
2358 just for consistency with the rest of the code (this is only
2359 needed if we ever use the construct exposed by test-180.cs inside
2360 corlib, which we dont today).
2362 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
2364 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2367 2003-02-09 Martin Baulig <martin@ximian.com>
2369 * namespace.cs (Namespace..ctor): Added SourceFile argument.
2370 (Namespace.DefineNamespaces): New static public method; this is
2371 called when we're compiling with debugging to add all namespaces
2374 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2375 pass it to the Namespace's .ctor.
2377 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2378 and MethodBase arguments; pass the namespace ID to the symwriter;
2379 pass the MethodBase instead of the token to the symwriter.
2380 (SymbolWriter.DefineNamespace): New method to add a namespace to
2383 2003-02-09 Martin Baulig <martin@ximian.com>
2385 * symbolwriter.cs: New file. This is a wrapper around
2386 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
2387 methods here in near future.
2389 2003-02-09 Martin Baulig <martin@ximian.com>
2391 * codegen.cs (EmitContext.Mark): Just pass the arguments to
2392 ILGenerator.MarkSequencePoint() which are actually used by the
2395 2003-02-09 Martin Baulig <martin@ximian.com>
2397 * location.cs (SourceFile): New public sealed class. This
2398 contains the name and an index which is used in the location's token.
2399 (Location): Reserve an appropriate number of bits in the token for
2400 the source file instead of walking over that list, this gives us a
2401 really huge performance improvement when compiling with debugging.
2403 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2404 `SourceFile' argument instead of a string.
2405 (Driver.ProcessFile): Add all the files via Location.AddFile(),
2406 but don't parse/tokenize here, we need to generate the list of all
2407 source files before we do that.
2408 (Driver.ProcessFiles): New static function. Parses/tokenizes all
2411 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2412 instead of a string.
2414 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2417 2003-02-09 Martin Baulig <martin@ximian.com>
2419 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2420 filename on `#line default'.
2422 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2424 * statement.cs: don't clear the pinned var when the fixed statement
2425 returns from the method (fixes bug#37752).
2427 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2429 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
2432 2003-02-07 Martin Baulig <martin@ximian.com>
2434 * driver.cs: Removed the `--debug-args' command line argument.
2436 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2437 automatically by the AsssemblyBuilder.
2438 (CodeGen.InitializeSymbolWriter): We don't need to call any
2439 initialization function on the symbol writer anymore. This method
2440 doesn't take any arguments.
2442 2003-02-03 Miguel de Icaza <miguel@ximian.com>
2444 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2445 from referenced assemblies as well.
2447 2003-02-02 Martin Baulig <martin@ximian.com>
2449 * class.cs (MethodData.Emit): Generate debugging info for external methods.
2451 2003-02-02 Martin Baulig <martin@ximian.com>
2453 * class.cs (Constructor.Emit): Open the symbol writer before
2454 emitting the constructor initializer.
2455 (ConstructorInitializer.Emit): Call ec.Mark() to allow
2456 single-stepping through constructor initializers.
2458 2003-01-30 Miguel de Icaza <miguel@ximian.com>
2460 * class.cs: Handle error 549: do not allow virtual methods in
2463 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2465 * decl.cs: Check access levels when resolving types
2467 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2469 * statement.cs: Add parameters and locals set in catch blocks that might
2470 return to set vector
2472 2003-01-29 Miguel de Icaza <miguel@ximian.com>
2474 * class.cs (Operator): Set the SpecialName flags for operators.
2476 * expression.cs (Invocation.DoResolve): Only block calls to
2477 accessors and operators on SpecialName methods.
2479 (Cast.TryReduce): Handle conversions from char constants.
2482 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2484 * statement.cs: small memory and time optimization in FlowBranching.
2486 2003-01-28 Pedro Mart <yoros@wanadoo.es>
2488 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2489 problem that the last fix but in the other sid (Set).
2491 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2492 access when there is no indexer in the hierarchy.
2494 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2496 * class.cs: Combine some if statements.
2498 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2500 * driver.cs: fixed bug #37187.
2502 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
2504 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2505 any indexer, it's needed to build a list with all the indexers in the
2506 hierarchy (AllGetters), else we have problems. Fixes #35653.
2508 2003-01-23 Miguel de Icaza <miguel@ximian.com>
2510 * class.cs (MethodData.Define): It is wrong for an interface
2511 implementation to be static in both cases: explicit and implicit.
2512 We were only handling this in one case.
2514 Improve the if situation there to not have negations.
2516 * class.cs (Field.Define): Turns out that we do not need to check
2517 the unsafe bit on field definition, only on usage. Remove the test.
2519 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2521 * driver.cs: use assembly.Location instead of Codebase (the latest
2522 patch made mcs fail when using MS assemblies).
2524 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
2526 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2527 get the path to *corlib.dll.
2529 2003-01-21 Nick Drochak <ndrochak@gol.com>
2533 * typemanager.cs: Remove compiler warnings
2535 2003-01-20 Duncan Mak <duncan@ximian.com>
2537 * AssemblyInfo.cs: Bump the version number to 0.19.
2539 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2541 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2543 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2545 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2547 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2549 * cs-parser.jay: Small fix: we were not comparing the constructor
2550 name correctly. Thanks to Zoltan for the initial pointer.
2552 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2554 * cs-tokenizer.cs: Set file name when specified with #line
2556 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2558 * cs-parser.jay: Only perform the constructor checks here if we
2559 are named like the class; This will help provider a better
2560 error. The constructor path is taken when a type definition is
2561 not found, but most likely the user forgot to add the type, so
2562 report that rather than the constructor error.
2564 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2566 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2569 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2571 * cs-parser.jay: Add cleanup call.
2573 2003-01-13 Duncan Mak <duncan@ximian.com>
2575 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2576 consistent with other methods.
2578 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2580 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2582 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2584 * attribute.cs: only set GuidAttr to true when we have a
2587 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2591 * typemanager.cs: fixes to allow mcs compile corlib with the new
2592 Type.IsSubclassOf fix.
2594 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2596 * expression.cs (LocalVariableReference.DoResolve): Classify a
2597 constant as a value, not as a variable. Also, set the type for
2600 * cs-parser.jay (fixed_statement): take a type instead of a
2601 pointer_type, so we can produce a better error message later.
2603 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2606 (For.DoEmit): Make inifinite loops have a
2607 non-conditional branch back.
2609 (Fixed.DoEmit): First populate the pinned variables, then emit the
2610 statement, then clear the variables. Before I was emitting the
2611 code once for each fixed piece.
2614 2003-01-08 Martin Baulig <martin@ximian.com>
2616 * statement.cs (FlowBranching.MergeChild): A break in a
2617 SWITCH_SECTION does not leave a loop. Fixes #36155.
2619 2003-01-08 Martin Baulig <martin@ximian.com>
2621 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2622 lives in the same number space than `param_map'. Fixes #36154.
2624 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2626 * cs-parser.jay (constructor_declaration): Set the
2627 Constructor.ModFlags before probing for it. This makes the
2628 compiler report 514, 515 and 132 (the code was there, but got
2631 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2632 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2633 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2635 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2637 * enum.cs: create the enum static fields using the enum type.
2639 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2641 * class.cs: don't try to create the ParamBuilder for the return
2642 type if it's not needed (and handle it breaking for the ms runtime
2645 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2647 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2649 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2651 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2652 the command. This showed up while compiling the JANET source
2653 code, which used \r as its only newline separator.
2655 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2657 * class.cs (Method.Define): If we are an operator (because it
2658 reuses our code), then set the SpecialName and HideBySig. #36128
2660 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2662 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2663 exception, report error 120 `object reference required'.
2665 * driver.cs: Add --pause option, used during to measure the size
2666 of the process as it goes with --timestamp.
2668 * expression.cs (Invocation.DoResolve): Do not allow methods with
2669 SpecialName to be invoked.
2671 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2673 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2674 number before adding it.
2676 2002-12-21 Ravi Pratap <ravi@ximian.com>
2678 * ecore.cs (StandardImplicitConversion): When in an unsafe
2679 context, we allow conversion between void * to any other pointer
2680 type. This fixes bug #35973.
2682 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2684 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2685 is not thrown when extensionless outputs are used
2687 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2689 * rootcontext.cs: fixed compilation of corlib.
2691 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2693 * attribute.cs (Attributes.Contains): Add new method.
2695 * class.cs (MethodCore.LabelParameters): if the parameter is an
2696 `out' parameter, check that no attribute `[In]' has been passed.
2698 * enum.cs: Handle the `value__' name in an enumeration.
2700 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2702 * decl.cs: Added special case to allow overrides on "protected
2705 2002-12-18 Ravi Pratap <ravi@ximian.com>
2707 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2708 since it makes much more sense.
2710 (Attributes.ctor): Don't require a Location parameter.
2712 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2714 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2715 since we already have that information per attribute.
2717 * everywhere : make appropriate changes.
2719 * class.cs (LabelParameters): Write the code which actually
2720 applies attributes to the return type. We can't do this on the MS
2721 .NET runtime so we flag a warning in the case an exception is
2724 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2726 * const.cs: Handle implicit null conversions here too.
2728 2002-12-17 Ravi Pratap <ravi@ximian.com>
2730 * class.cs (MethodCore.LabelParameters): Remove the extra
2731 Type [] parameter since it is completely unnecessary. Instead
2732 pass in the method's attributes so that we can extract
2733 the "return" attribute.
2735 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2737 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2738 of ignoring it and letting the compile continue.
2740 * typemanager.cs (ChangeType): use an extra argument to return an
2741 error condition instead of throwing an exception.
2743 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2745 * expression.cs (Unary.TryReduce): mimic the code for the regular
2746 code path. Perform an implicit cast in the cases where we can
2747 implicitly convert to one of the integral types, and then reduce
2748 based on that constant. This fixes bug #35483.
2750 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2752 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2754 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2756 * namespace.cs: fixed bug #35489.
2758 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2760 * class.cs: Remove some dead code.
2762 * cs-parser.jay: Estimate the number of methods needed
2763 (RootContext.MethodCount);
2765 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2766 numbers instead of StringBuilders.
2768 * support.cs (PtrHashtable): Add constructor with initial size;
2769 We can now reduce reallocations of the method table.
2771 2002-12-10 Ravi Pratap <ravi@ximian.com>
2773 * attribute.cs (ApplyAttributes): Keep track of the emitted
2774 attributes on a per-target basis. This fixes bug #35413.
2776 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2778 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2779 default to the Windows 1252 encoding.
2781 (UnixParseOption): Support version, thanks to Alp for the missing
2784 * AssemblyInfo.cs: Add nice assembly information.
2786 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2789 * cs-parser.jay: Allow a trailing comma before the close bracked
2790 in the attribute_section production.
2792 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2793 address of the instance was being taken, I will take this out,
2794 because we take the address of the object immediately here.
2796 2002-12-09 Ravi Pratap <ravi@ximian.com>
2798 * typemanager.cs (AreMultipleAllowed): Take care of the most
2799 obvious case where attribute type is not in the current assembly -
2802 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2804 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2805 definitions, instead of doing that afterwards.
2807 Also we use a nice little hack, depending on the constructor, we
2808 know if we are a "composed" name or a simple name. Hence, we
2809 avoid the IndexOf test, and we avoid
2811 * codegen.cs: Add code to assist in a bug reporter to track down
2812 the source of a compiler crash.
2814 2002-12-07 Ravi Pratap <ravi@ximian.com>
2816 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2817 types have been emitted for a given element and flag an error
2818 if something which does not have AllowMultiple set is used more
2821 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2822 attribute types and their corresponding AllowMultiple properties
2824 (AreMultipleAllowed): Check the property for a given type.
2826 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2827 property in the case we have a TypeContainer.
2829 (Attributes.AddAttribute): Detect duplicates and just skip on
2830 adding them. This trivial fix catches a pretty gross error in our
2831 attribute emission - global attributes were being emitted twice!
2833 Bugzilla bug #33187 is now fixed.
2835 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2837 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2840 * expression.cs (Binary.ResolveOperator): I can only use the
2841 Concat (string, string, string) and Concat (string, string,
2842 string, string) if the child is actually a concatenation of
2845 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2847 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2848 context where we need a 2-character lookahead.
2850 * pending.cs (PendingImplementation): Rework so we can keep track
2851 of interface types all the time, and flag those which were
2852 implemented by parents as optional.
2854 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2856 * expression.cs (Binary.ResolveOperator): Use
2857 String.Concat(string,string,string) or
2858 String.Concat(string,string,string,string) when possible.
2860 * typemanager: More helper methods.
2863 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2865 * pending.cs: remove the bogus return from GetMissingInterfaces()
2866 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2868 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2870 * namespace.cs: avoid duplicated 'using xxx' being added to
2871 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2872 when we get more than one 'using' statement for the same namespace.
2873 Report a CS0105 warning for it.
2875 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2877 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2878 of calling getChar/putback, uses internal knowledge of it.
2880 (xtoken): Reorder tokenizer so most common patterns are checked
2881 first. This reduces the compilation time in another 5% (from 8.11s
2882 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2884 The parsing time is 22% of the compilation in mcs, and from that
2885 64% is spent on the tokenization process.
2887 I tried using a binary search for keywords, but this is slower
2888 than the hashtable. Another option would be to do a couple of
2891 * Not use a StringBuilder, instead use an array of chars,
2892 with a set value. Notice that this way we could catch
2893 the 645 error without having to do it *afterwards*.
2895 * We could write a hand-parser to avoid the hashtable
2896 compares altogether.
2898 The identifier consumption process takes 37% of the tokenization
2899 time. Another 15% is spent on is_number. 56% of the time spent
2900 on is_number is spent on Int64.Parse:
2902 * We could probably choose based on the string length to
2903 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2906 Another 3% is spend on wrapping `xtoken' in the `token' function.
2908 Handle 0xa0 as whitespace (#34752)
2910 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2912 * typemanager.cs (IsCLRType): New routine to tell whether a type
2913 is one of the builtin types.
2915 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2916 typecode in more places instead of doing pointer comparissions.
2917 We could leverage some knowledge about the way the typecodes are
2920 New code to cache namespaces in assemblies, it is currently not
2921 invoked, to be used soon.
2923 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2925 * expression.cs (Binary.ResolveOperator): specially handle
2926 strings, and do not perform user-defined operator overloading for
2929 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2931 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2932 internalcall as it is a pretty simple operation; Avoid whenever
2933 possible to call Char.IsLetter.
2935 (consume_identifier): Cut by half the number of
2936 hashtable calls by merging the is_keyword and GetKeyword behavior.
2938 Do not short-circuit, because if we do, we
2939 report errors (ie, #if false && true would produce an invalid
2943 2002-11-24 Martin Baulig <martin@ximian.com>
2945 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2946 check constant ranges and report a CS0221. Fixes #33186.
2948 2002-11-24 Martin Baulig <martin@ximian.com>
2950 * cs-parser.jay: Make this work for uninitialized variable
2951 declarations in the `for' initializer. Fixes #32416.
2953 2002-11-24 Martin Baulig <martin@ximian.com>
2955 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2956 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2958 2002-11-24 Martin Baulig <martin@ximian.com>
2960 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2961 argument; if true, we also check for user-defined conversions.
2962 This is only needed if both arguments are of a user-defined type.
2963 Fixes #30443, added test-175.cs.
2964 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2966 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2968 2002-11-24 Martin Baulig <martin@ximian.com>
2970 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2971 function to get the store opcode.
2972 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2973 only emit the Ldelema if the store opcode is Stobj. You must run
2974 both test-34 and test-167 to test this. Fixes #34529.
2976 2002-11-23 Martin Baulig <martin@ximian.com>
2978 * ecore.cs (Expression.MemberLookup): Added additional
2979 `qualifier_type' argument which is used when we're being called
2980 from MemberAccess.DoResolve() and null if we're called from a
2982 (Expression.MemberLookupFailed): New method to report errors; this
2983 does the CS1540 check and reports the correct error message.
2985 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2986 argument for the CS1540 check and redone the way how we're dealing
2987 with private members. See the comment in the source code for details.
2988 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2989 `closure_start_type' to `closure_qualifier_type' and check whether
2990 it's not null. It was not this filter being broken, it was just
2991 being called with the wrong arguments.
2993 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2994 and pass it the correct `qualifier_type'; this also does the error
2997 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2999 * expression.cs (Invocation.EmitParams): If the we are dealing
3000 with a non-built-in value type, load its address as well.
3002 (ArrayCreation): Use a a pretty constant instead
3003 of the hardcoded value 2. Use 6 instead of 2 for the number of
3004 static initializers.
3006 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
3007 because they are not really value types, just glorified integers.
3009 * driver.cs: Do not append .exe, the CSC compiler does not do it.
3011 * ecore.cs: Remove redundant code for enumerations, make them use
3012 the same code path as everything else, fixes the casting issue
3013 with enumerations in Windows.Forms.
3015 * attribute.cs: Do only cast to string if it is a string, the
3016 validation happens later.
3018 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
3019 people upgrade their corlibs.
3021 * ecore.cs: Oops, enumerations were not following the entire code path
3023 2002-11-21 Miguel de Icaza <miguel@ximian.com>
3025 * typemanager.cs (FilterWithClosure): Commented out the test for
3026 1540 in typemanager.cs, as it has problems when accessing
3027 protected methods from a parent class (see test-174.cs).
3029 * attribute.cs (Attribute.ValidateGuid): new method.
3030 (Attribute.Resolve): Use above.
3032 2002-11-19 Miguel de Icaza <miguel@ximian.com>
3034 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3036 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3037 handling for enumerations, as we only needed the TypeContainer
3038 functionality to begin with (this is required for the fix below to
3039 work for enums that reference constants in a container class for
3042 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3044 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3045 a valid TypeBuilder to perform lookups on.o
3047 * class.cs (InheritableMemberSignatureCompare): Use true in the
3048 call to GetGetMethod and GetSetMethod, because we are comparing
3049 the signature, and we need to get the methods *even* if they are
3052 (PropertyBase.CheckBase): ditto.
3054 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
3055 GotoCase.Resolve): Use Peel on EmpytCasts.
3057 * ecore.cs (EmptyCast): drop child, add Peel method.
3059 2002-11-17 Martin Baulig <martin@ximian.com>
3061 * ecore.cs (EmptyCast.Child): New public property.
3063 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
3064 label resolved to an EmptyCast. Fixes #34162.
3065 (GotoCase.Resolve): Likewise.
3066 (Block.EmitMeta): Likewise.
3068 2002-11-17 Martin Baulig <martin@ximian.com>
3070 * expression.cs (Invocation.BetterConversion): Prefer int over
3071 uint; short over ushort; long over ulong for integer literals.
3072 Use ImplicitConversionExists instead of StandardConversionExists
3073 since we also need to check for user-defined implicit conversions.
3074 Fixes #34165. Added test-173.cs.
3076 2002-11-16 Martin Baulig <martin@ximian.com>
3078 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
3079 with the `true' and `false' literals. Fixes #33151.
3081 2002-11-16 Martin Baulig <martin@ximian.com>
3083 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
3084 October 22nd; don't do the cs1540 check for static members.
3086 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
3087 now using our own filter here and doing the cs1540 check again.
3089 2002-11-16 Martin Baulig <martin@ximian.com>
3091 * support.cs (InternalParameters): Don't crash if we don't have
3092 any fixed parameters. Fixes #33532.
3094 2002-11-16 Martin Baulig <martin@ximian.com>
3096 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
3097 when looking up static methods to make this work on Windows.
3100 2002-11-16 Martin Baulig <martin@ximian.com>
3102 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
3103 a setter rather than using PropertyInfo.CanWrite.
3105 2002-11-15 Nick Drochak <ndrochak@gol.com>
3107 * class.cs: Allow acces to block member by subclasses. Fixes build
3110 2002-11-14 Martin Baulig <martin@ximian.com>
3112 * class.cs (Constructor.Emit): Added the extern/block check.
3115 2002-11-14 Martin Baulig <martin@ximian.com>
3117 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3118 iteration while looking for indexers, this is needed because the
3119 indexer may have a different name in our base classes. Fixed the
3120 error reporting (no indexers at all, not get accessor, no
3121 overloaded match). Fixes bug #33089.
3122 (IndexerAccess.DoResolveLValue): Likewise.
3124 2002-11-14 Martin Baulig <martin@ximian.com>
3126 * class.cs (PropertyBase.CheckBase): Make this work for multiple
3127 indexers. Fixes the first part of bug #33089.
3128 (MethodSignature.InheritableMemberSignatureCompare): Added support
3131 2002-11-13 Ravi Pratap <ravi@ximian.com>
3133 * attribute.cs (Attribute.Resolve): Catch the
3134 NullReferenceException and report it since it isn't supposed to
3137 2002-11-12 Miguel de Icaza <miguel@ximian.com>
3139 * expression.cs (Binary.EmitBranchable): Also handle the cases for
3140 LogicalOr and LogicalAnd that can benefit from recursively
3141 handling EmitBranchable. The code now should be nice for Paolo.
3143 2002-11-08 Miguel de Icaza <miguel@ximian.com>
3145 * typemanager.cs (LookupType): Added a negative-hit hashtable for
3146 the Type lookups, as we perform quite a number of lookups on
3147 non-Types. This can be removed once we can deterministically tell
3148 whether we have a type or a namespace in advance.
3150 But this might require special hacks from our corlib.
3154 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3155 and double which avoids a conversion from an integer to a double.
3157 * expression.cs: tiny optimization, avoid calling IsConstant,
3158 because it effectively performs the lookup twice.
3160 2002-11-06 Miguel de Icaza <miguel@ximian.com>
3162 But a bogus return here to keep the semantics of the old code
3163 until the Mono runtime is fixed.
3165 * pending.cs (GetMissingInterfaces): New method used to remove all
3166 the interfaces that are already implemented by our parent
3167 classes from the list of pending methods.
3169 * interface.cs: Add checks for calls after ResolveTypeExpr.
3171 2002-11-05 Miguel de Icaza <miguel@ximian.com>
3173 * class.cs (Class.Emit): Report warning 67: event not used if the
3174 warning level is beyond 3.
3176 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3177 being a NullLiteral.
3179 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3182 * class.cs (TypeContainer.GetClassBases): Cover a missing code
3183 path that might fail if a type can not be resolved.
3185 * expression.cs (Binary.Emit): Emit unsigned versions of the
3188 * driver.cs: use error 5.
3190 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3192 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3194 2002-11-01 Miguel de Icaza <miguel@ximian.com>
3196 * cs-parser.jay (switch_section): A beautiful patch from Martin
3197 Baulig that fixed 33094.
3199 2002-10-31 Miguel de Icaza <miguel@ximian.com>
3201 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3202 Check whether the base is abstract and report an error if so.
3204 * expression.cs (IndexerAccess.DoResolveLValue,
3205 IndexerAccess.DoResolve): ditto.
3207 (Invocation.DoResolve): ditto.
3209 (Invocation.FullMethodDesc): Improve the report string.
3211 * statement.cs (Block): Eliminate IsVariableDefined as it is
3212 basically just a wrapper for GetVariableInfo.
3214 * ecore.cs (SimpleName): Use new
3216 * support.cs (ReflectionParamter.ParameterType): We unwrap the
3217 type, as we return the actual parameter ref/unref state on a
3220 2002-10-30 Miguel de Icaza <miguel@ximian.com>
3222 * support.cs: Return proper flags REF/OUT fixing the previous
3225 * expression.cs: Reverted last patch, that was wrong. Is_ref is
3226 not used to mean `ref' but `ref or out' in ParameterReference
3228 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3229 full type signature instead of calling TypeManger.CSharpName
3232 * support.cs (InternalParameters.ParameterDesc): Do not compare
3233 directly to the modflags, because REF/OUT will actually be bitsets
3236 * delegate.cs (VerifyMethod): Check also the modifiers.
3238 * cs-tokenizer.cs: Fix bug where floating point values with an
3239 exponent where a sign was missing was ignored.
3241 * driver.cs: Allow multiple assemblies to be specified in a single
3244 2002-10-28 Miguel de Icaza <miguel@ximian.com>
3246 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
3247 because identifiers after a parenthesis would end up in this kind
3248 of production, and we needed to desamiguate it for having casts
3251 (UserDefinedType *) xxx
3253 2002-10-24 Miguel de Icaza <miguel@ximian.com>
3255 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3256 we should set on the Bindingflags.NonPublic, but not turn on
3257 private_ok. private_ok controls whether a Private member is
3258 returned (this is chekced on the filter routine), while the
3259 BindingFlags.NonPublic just controls whether private/protected
3260 will be allowed. This fixes the problem part of the problem of
3261 private properties being allowed to be used in derived classes.
3263 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3264 so we can call the children DoResolveLValue method (this will
3265 properly signal errors on lvalue assignments to base properties)
3267 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3268 getter are null, and we have a property info, we know that this
3269 happened because the lookup failed, so we report an error 122 for
3270 protection level violation.
3272 We also silently return if setter and getter are null in the
3273 resolve functions, this condition only happens if we have flagged
3274 the error before. This is the other half of the problem.
3276 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3277 not have accessibility information, that is why we were returning
3278 true in the filter function in typemanager.cs.
3280 To properly report 122 (property is inaccessible because of its
3281 protection level) correctly, we report this error in ResolveAccess
3282 by failing if both the setter and the getter are lacking (ie, the
3285 DoResolve and DoLResolve have been modified to check for both
3286 setter/getter being null and returning silently, the reason being
3287 that I did not want to put the knowledge about this error in upper
3290 int old = Report.Errors;
3291 x = new PropertyExpr (...);
3292 if (old != Report.Errors)
3297 So the property expr is returned, but it is invalid, so the error
3298 will be flagged during the resolve process.
3300 * class.cs: Remove InheritablePropertySignatureCompare from the
3301 class, as we no longer depend on the property signature to compute
3302 whether it is possible to implement a method or not.
3304 The reason is that calling PropertyInfo.GetGetMethod will return
3305 null (in .NET, in Mono it works, and we should change this), in
3306 cases where the Get Method does not exist in that particular
3311 class X { public virtual int A { get { return 1; } } }
3313 class Z : Y { public override int A { get { return 2; } } }
3315 Would fail in Z because the parent (Y) would not have the property
3316 defined. So we avoid this completely now (because the alternative
3317 fix was ugly and slow), and we now depend exclusively on the
3320 (PropertyBase.CheckBase): Use a method-base mechanism to find our
3321 reference method, instead of using the property.
3323 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3324 routines are gone now.
3326 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3327 names, they were incorrectly named.
3329 * cs-tokenizer.cs: Return are more gentle token on failure.
3331 * pending.cs (PendingImplementation.InterfaceMethod): This routine
3332 had an out-of-sync index variable, which caused it to remove from
3333 the list of pending methods the wrong method sometimes.
3335 2002-10-22 Miguel de Icaza <miguel@ximian.com>
3337 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3338 CanWrite, because those refer to this particular instance of the
3339 property, and do not take into account the fact that we can
3340 override single members of a property.
3342 Constructor requires an EmitContext. The resolution process does
3343 not happen here, but we need to compute the accessors before,
3344 because the resolution does not always happen for properties.
3346 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3347 subclass, before we did not update this flag, but we did update
3350 (GetAccessors): Drop this routine, as it did not work in the
3351 presence of partially overwritten set/get methods.
3353 Notice that this broke the cs1540 detection, but that will require
3356 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3360 * driver.cs: issue a warning instead of an error if we don't support
3361 debugging for the platform. Also ignore a couple of errors that may
3362 arise when trying to write the symbols. Undo my previous patch.
3364 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3366 * driver.cs: ignore /debug switch except for Unix platforms.
3368 2002-10-23 Nick Drochak <ndrochak@gol.com>
3370 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3372 2002-10-21 Miguel de Icaza <miguel@ximian.com>
3374 * driver.cs: Do not make mcs-debug conditional, so we do not break
3377 * statement.cs (UsageVector.MergeChildren): I would like Martin to
3378 review this patch. But basically after all the children variables
3379 have been merged, the value of "Breaks" was not being set to
3380 new_breaks for Switch blocks. I think that it should be set after
3381 it has executed. Currently I set this to the value of new_breaks,
3382 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3383 conservative, but I do not understand this code very well.
3385 I did not break anything in the build, so that is good ;-)
3387 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3389 2002-10-20 Mark Crichton <crichton@gimp.org>
3391 * cfold.cs: Fixed compile blocker. Really fixed it this time.
3393 2002-10-20 Nick Drochak <ndrochak@gol.com>
3395 * cfold.cs: Fixed compile blocker.
3397 2002-10-20 Miguel de Icaza <miguel@ximian.com>
3399 * driver.cs: I was chekcing the key, not the file.
3401 2002-10-19 Ravi Pratap <ravi@ximian.com>
3403 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3404 message that we were generating - we just need to silently return
3407 2002-10-19 Miguel de Icaza <miguel@ximian.com>
3409 * class.cs (Event.Define): Change my previous commit, as this
3410 breaks the debugger. This is a temporary hack, as it seems like
3411 the compiler is generating events incorrectly to begin with.
3413 * expression.cs (Binary.ResolveOperator): Added support for
3414 "U operator - (E x, E y)"
3416 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3419 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3420 init-only variables, but this path did not take into account that
3421 there might be also instance readonly variables. Correct this
3424 This fixes bug 32253
3426 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3429 * driver.cs: Change the extension for modules to `netmodule'
3431 * cs-parser.jay: Improved slightly the location tracking for
3432 the debugger symbols.
3434 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3435 modifiers that were specified instead of the hardcoded value
3436 (FamAndAssem). This was basically ignoring the static modifier,
3437 and others. Fixes 32429.
3439 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3440 fixed a bug in the process (32476)
3442 * expression.cs (ArrayAccess.EmitAssign): Patch from
3443 hwang_rob@yahoo.ca that fixes bug 31834.3
3445 2002-10-18 Miguel de Icaza <miguel@ximian.com>
3447 * driver.cs: Make the module extension .netmodule.
3449 2002-10-16 Miguel de Icaza <miguel@ximian.com>
3451 * driver.cs: Report an error if the resource file is not found
3452 instead of crashing.
3454 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3455 false, like Emit does.
3457 2002-10-16 Nick Drochak <ndrochak@gol.com>
3459 * typemanager.cs: Remove unused private member. Also reported mcs
3460 bug to report this as a warning like csc.
3462 2002-10-15 Martin Baulig <martin@gnome.org>
3464 * statement.cs (Statement.Emit): Made this a virtual method; emits
3465 the line number info and calls DoEmit().
3466 (Statement.DoEmit): New protected abstract method, formerly knows
3467 as Statement.Emit().
3469 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3471 2002-10-11 Miguel de Icaza <miguel@ximian.com>
3473 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3474 have fixed a remaining problem: not every AddXXXX was adding a
3475 fully qualified name.
3477 Now everyone registers a fully qualified name in the DeclSpace as
3478 being defined instead of the partial name.
3480 Downsides: we are slower than we need to be due to the excess
3481 copies and the names being registered this way.
3483 The reason for this is that we currently depend (on the corlib
3484 bootstrap for instance) that types are fully qualified, because
3485 we dump all the types in the namespace, and we should really have
3486 types inserted into the proper namespace, so we can only store the
3487 basenames in the defined_names array.
3489 2002-10-10 Martin Baulig <martin@gnome.org>
3491 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3492 from bug #31834, see the bug report for a testcase which is
3495 2002-10-10 Martin Baulig <martin@gnome.org>
3497 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3498 flow analysis code for this.
3500 * statement.cs (Do, While, For): Tell the flow analysis code about
3502 (FlowBranching.UsageVector): Added support for infinite loops.
3503 (Block.Resolve): Moved the dead code elimination here and use flow
3506 2002-10-09 Miguel de Icaza <miguel@ximian.com>
3508 * class.cs (Field.Define): Catch cycles on struct type
3511 * typemanager.cs (IsUnmanagedtype): Do not recursively check
3512 fields if the fields are static. We only need to check instance
3515 * expression.cs (As.DoResolve): Test for reference type.
3517 * statement.cs (Using.ResolveExpression): Use
3518 ConvertImplicitRequired, not ConvertImplicit which reports an
3520 (Using.ResolveLocalVariableDecls): ditto.
3522 * expression.cs (Binary.ResolveOperator): Report errors in a few
3523 places where we had to.
3525 * typemanager.cs (IsUnmanagedtype): Finish implementation.
3527 2002-10-08 Miguel de Icaza <miguel@ximian.com>
3529 * expression.cs: Use StoreFromPtr instead of extracting the type
3530 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3532 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3533 an enumeration value to a System.Enum, but System.Enum is not a
3534 value type, but an class type, so we need to box.
3536 (Expression.ConvertExplicit): One codepath could return
3537 errors but not flag them. Fix this. Fixes #31853
3539 * parameter.cs (Resolve): Do not allow void as a parameter type.
3541 2002-10-06 Martin Baulig <martin@gnome.org>
3543 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3544 if it's a class type and not a struct. Fixes #31815.
3546 2002-10-06 Martin Baulig <martin@gnome.org>
3548 * statement.cs: Reworked the flow analysis code a bit to make it
3549 usable for dead code elimination.
3551 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3553 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3555 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3557 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3558 to fix the test 165, will investigate deeper.
3560 2002-10-04 Martin Baulig <martin@gnome.org>
3562 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3563 finally blocks actually work.
3564 (Try.Resolve): We don't need to create a sibling for `finally' if
3565 there is no finally block.
3567 2002-10-04 Martin Baulig <martin@gnome.org>
3569 * class.cs (Constructor.Define): The default accessibility for a
3570 non-default constructor is private, not public.
3572 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3574 * class.cs (Constructor): Make AllowedModifiers public, add
3577 * cs-parser.jay: Perform the modifiers test here, as the
3578 constructor for the Constructor class usually receives a zero
3579 because of the way we create it (first we create, later we
3580 customize, and we were never checking the modifiers).
3582 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3583 is a version of LookupTypeReflection that includes the type-name
3584 cache. This can be used as a fast path for functions that know
3585 the fully qualified name and are only calling into *.GetType() to
3586 obtain a composed type.
3588 This is also used by TypeManager.LookupType during its type
3591 (LookupType): We now also track the real type name, as sometimes
3592 we can get a quey for the real type name from things like
3593 ComposedCast. This fixes bug 31422.
3595 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3596 complete type fullname, it does not have to go through the type
3597 resolution system to obtain the composed version of the type (for
3598 obtaining arrays or pointers).
3600 (Conditional.Emit): Use the EmitBoolExpression to
3601 generate nicer code, as requested by Paolo.
3603 (ArrayCreation.CheckIndices): Use the patch from
3604 hwang_rob@yahoo.ca to validate the array initializers.
3606 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3608 * class.cs (ConstructorInitializer.Emit): simplify code by using
3609 Invocation.EmitCall, and at the same time, fix the bugs in calling
3610 parent constructors that took variable arguments.
3612 * ecore.cs (Expression.ConvertNumericExplicit,
3613 Expression.ImplicitNumericConversion): Remove the code that
3614 manually wrapped decimal (InternalTypeConstructor call is now gone
3617 * expression.cs (Cast.TryReduce): Also handle decimal types when
3618 trying to perform a constant fold on the type.
3620 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3622 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3623 that only turned off an error report, and did nothing else.
3625 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3627 * driver.cs: Handle and ignore /fullpaths
3629 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3631 * expression.cs (Binary.ResolveOperator): Catch the case where
3632 DoNumericPromotions returns true,
3634 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3636 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3638 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3641 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3643 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3644 conversion exists, but it is also required that the conversion be
3645 performed. This manifested in "(Type64Enum) 2".
3647 * class.cs (TypeManager.AddMethod): The fix is not to change
3648 AddEnum, because that one was using a fully qualified name (every
3649 DeclSpace derivative does), but to change the AddMethod routine
3650 that was using an un-namespaced name. This now correctly reports
3651 the duplicated name.
3653 Revert patch until I can properly fix it. The issue
3654 is that we have a shared Type space across all namespaces
3655 currently, which is wrong.
3657 Options include making the Namespace a DeclSpace, and merge
3658 current_namespace/current_container in the parser.
3660 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3662 * cs-parser.jay: Improve error reporting when we get a different
3663 kind of expression in local_variable_type and
3664 local_variable_pointer_type.
3666 Propagate this to avoid missleading errors being reported.
3668 * ecore.cs (ImplicitReferenceConversion): treat
3669 TypeManager.value_type as a target just like object_type. As
3674 Is valid, and needs to result in the int 1 being boxed before it
3675 is assigned to the value type v.
3677 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3678 to validate the enumeration name.
3680 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3681 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3682 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3684 * ecore.cs (TryImplicitIntConversion): When doing an
3685 implicit-enumeration-conversion, check if the type is 64-bits and
3686 perform a conversion before passing to EnumConstant.
3688 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3690 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3691 report ambiguous type references. Unlike the MS version, we
3692 report what the ambiguity is. Innovation at work ;-)
3694 (DeclSpace.FindType): Require a location argument to
3695 display when we display an ambiguous error.
3697 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3699 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3701 * expression.cs (EmitDynamicInitializers): Apply patch from
3702 hwang_rob@yahoo.ca that fixes the order in which we emit our
3705 2002-09-21 Martin Baulig <martin@gnome.org>
3707 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3708 delegate takes no arguments.
3710 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3712 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3715 * expression.cs: Extract the underlying type.
3717 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3719 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3721 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3723 * class.cs (TypeContainer.DefineType): We can not use the nice
3724 PackingSize with the size set to 1 DefineType method, because it
3725 will not allow us to define the interfaces that the struct
3728 This completes the fixing of bug 27287
3730 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3731 means also structs. This fixes part of the problem.
3732 (Expresion.ImplicitReferenceConversionExists): ditto.
3734 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3735 error if there were no errors reported during the type lookup
3736 process, to avoid duplicates or redundant errors. Without this
3737 you would get an ambiguous errors plus a type not found. We have
3738 beaten the user enough with the first error.
3740 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3743 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3744 during the resolution process, stop the lookup, this avoids
3745 repeated error reports (same error twice).
3747 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3749 * typemanager.cs (LookupType): Redo the type lookup code to match
3750 the needs of System.Reflection.
3752 The issue is that System.Reflection requires references to nested
3753 types to begin with a "+" sign instead of a dot. So toplevel
3754 types look like: "NameSpace.TopLevelClass", and nested ones look
3755 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3758 2002-09-19 Martin Baulig <martin@gnome.org>
3760 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3761 says that a method always returns or always throws an exception,
3762 don't report the CS0161.
3764 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3765 set `Returns = new_returns'.
3767 2002-09-19 Martin Baulig <martin@gnome.org>
3769 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3770 to an enum constant, check for a CS0176.
3772 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3774 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3775 for operators that must be in pairs and report errors.
3777 * ecore.cs (SimpleName.DoResolveType): During the initial type
3778 resolution process, when we define types recursively, we must
3779 check first for types in our current scope before we perform
3780 lookups in the enclosing scopes.
3782 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3784 (Invocation.VerifyArgumentsCompat): Call
3785 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3786 I thought we were supposed to always call this, but there are a
3787 few places in the code where we dont do it.
3789 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3791 * driver.cs: Add support in -linkres and -resource to specify the
3792 name of the identifier.
3794 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3796 * ecore.cs (StandardConversionExists): Sync with the conversion
3797 code: allow anything-* to void* conversions.
3799 (FindMostSpecificSource): Use an Expression argument
3800 instead of a Type, because we might be handed over a Literal which
3801 gets a few more implicit conversions that plain types do not. So
3802 this information was being lost.
3804 Also, we drop the temporary type-holder expression when not
3807 2002-09-17 Martin Baulig <martin@gnome.org>
3809 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3810 this is an explicit interface implementation.
3812 2002-09-17 Martin Baulig <martin@gnome.org>
3814 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3815 different `IndexerName' attributes.
3817 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3818 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3819 virtual CommonResolve().
3821 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3823 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3824 and convert that to the UnderlyingType.
3826 * statement.cs (Foreach.Resolve): Indexers are just like variables
3827 or PropertyAccesses.
3829 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3830 inside quoted strings, we were not doing this before.
3832 2002-09-16 Martin Baulig <martin@gnome.org>
3834 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3835 resolve it. This is needed for the definite assignment check of the
3836 instance expression, fixes bug #29846.
3837 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3839 2002-09-16 Nick Drochak <ndrochak@gol.com>
3841 * parameter.cs: Fix compile error. Cannot reference static member
3842 from an instance object. Is this an mcs bug?
3844 2002-09-14 Martin Baulig <martin@gnome.org>
3846 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3847 multiple times. Fixes bug #30295, added test-166.cs.
3849 2002-09-14 Martin Baulig <martin@gnome.org>
3851 * statement.cs (Block.Emit): Don't emit unreachable code.
3852 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3854 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3856 2002-09-14 Martin Baulig <martin@gnome.org>
3858 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3861 2002-09-14 Martin Baulig <martin@gnome.org>
3863 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3864 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3865 be false on the ms runtime.
3867 2002-09-13 Martin Baulig <martin@gnome.org>
3869 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3870 the CS0038 error message.
3872 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3874 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3875 constant inside, return it.
3877 2002-09-12 Martin Baulig <martin@gnome.org>
3879 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3880 implicit conversion can be done between enum types.
3882 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3883 check whether an implicit conversion to the current enum's UnderlyingType
3884 exists and report an error if not.
3886 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3887 without debugging support.
3889 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3890 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3892 2002-09-12 Martin Baulig <martin@gnome.org>
3894 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3896 * ecore.cs (IMemberExpr.DeclaringType): New property.
3897 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3898 nonstatic member of an outer type (CS0038).
3900 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3902 * driver.cs: Activate the using-error detector at warning level
3903 4 (at least for MS-compatible APIs).
3905 * namespace.cs (VerifyUsing): Small buglett fix.
3907 * pending.cs (PendingImplementation): pass the container pointer.
3909 * interface.cs (GetMethods): Allow for recursive definition. Long
3910 term, I would like to move every type to support recursive
3911 definitions, not the current ordering mechanism that we have right
3914 The situation is this: Attributes are handled before interfaces,
3915 so we can apply attributes to interfaces. But some attributes
3916 implement interfaces, we will now handle the simple cases
3917 (recursive definitions will just get an error).
3919 * parameter.cs: Only invalidate types at the end if we fail to
3922 2002-09-09 Martin Baulig <martin@gnome.org>
3924 * ecore.cs (PropertyExpr.Emit): Also check for
3925 TypeManager.system_int_array_get_length so this'll also work when
3926 compiling corlib. Fixes #30003.
3928 2002-09-09 Martin Baulig <martin@gnome.org>
3930 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3931 and throw an exception if we can't get the type's size. Fixed #30040,
3934 2002-09-09 Martin Baulig <martin@gnome.org>
3936 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3938 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3939 context. Fixes bug #30027.
3941 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3942 virtual functions. Fixes bug #30043, added test-164.cs.
3944 2002-09-08 Ravi Pratap <ravi@ximian.com>
3946 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3948 2002-09-08 Nick Drochak <ndrochak@gol.com>
3950 * driver.cs: Use an object to get the windows codepage since it's not a
3953 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3955 * statement.cs (For.Emit): for infinite loops (test == null)
3956 return whether there is a break inside, not always "true".
3958 * namespace.cs (UsingEntry): New struct to hold the name of the
3959 using definition, the location where it is defined, and whether it
3960 has been used in a successful type lookup.
3962 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3967 2002-09-06 Ravi Pratap <ravi@ximian.com>
3969 * attribute.cs : Fix incorrect code which relied on catching
3970 a NullReferenceException to detect a null being passed in
3971 where an object was expected.
3973 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3975 * statement.cs (Try): flag the catch variable as assigned
3977 * expression.cs (Cast): Simplified by using ResolveType instead of
3980 * statement.cs (Catch): Fix bug by using ResolveType.
3982 2002-09-06 Ravi Pratap <ravi@ximian.com>
3984 * expression.cs (BetterConversion): Special case for when we have
3985 a NullLiteral as the argument and we have to choose between string
3986 and object types - we choose string the way csc does.
3988 * attribute.cs (Attribute.Resolve): Catch the
3989 NullReferenceException and report error #182 since the Mono
3990 runtime no more has the bug and having this exception raised means
3991 we tried to select a constructor which takes an object and is
3994 2002-09-05 Ravi Pratap <ravi@ximian.com>
3996 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3997 message (1502, 1503) when we can't locate a method after overload
3998 resolution. This is much more informative and closes the bug
4001 * interface.cs (PopulateMethod): Return if there are no argument
4002 types. Fixes a NullReferenceException bug.
4004 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
4005 expressions too. Previously we were checking only in one place for
4006 positional arguments leaving out named arguments.
4008 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
4009 type to the enum type is not allowed. Remove code corresponding to
4012 (ConvertNumericExplicit): Allow explicit conversions from
4013 the underlying type to enum type. This precisely follows the spec
4014 and closes a bug filed by Gonzalo.
4016 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4019 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
4021 2002-09-03 Miguel de Icaza <miguel@ximian.com>
4023 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4024 it was important that we stored the right value after the
4025 reduction in `converted'.
4027 2002-09-04 Martin Baulig <martin@gnome.org>
4029 * location.cs (Location.SymbolDocument): Use full pathnames for the
4032 2002-08-30 Miguel de Icaza <miguel@ximian.com>
4034 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4035 of the expression resolve mechanism, because that will catch the
4036 SimpleName error failures.
4038 (Conditional): If we can not resolve the
4039 expression, return, do not crash.
4041 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4044 (location): display token name instead of its number.
4046 2002-08-28 Martin Baulig <martin@gnome.org>
4048 * expression.cs (Binary.ResolveOperator): Don't silently return
4049 but return an error if an operator cannot be applied between two
4052 2002-08-28 Martin Baulig <martin@gnome.org>
4054 * class.cs (Constructor.Define): Set the permission attributes
4055 correctly instead of making all constructors public.
4057 2002-08-28 Martin Baulig <martin@gnome.org>
4059 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
4060 for private members before reporting a CS0103; if we find anything,
4063 2002-08-28 Martin Baulig <martin@gnome.org>
4065 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
4066 to check whether `closure_start_type == closure_invocation_type',
4067 we also need to check whether `m.DeclaringType == closure_invocation_type'
4068 before bypassing the permission checks. We might be accessing
4069 protected/private members from the base class.
4070 (TypeManager.RealMemberLookup): Only set private_ok if private
4071 members were requested via BindingFlags.NonPublic.
4073 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
4075 * expression.cs (MemberAccess.ResolveMemberAccess): Set
4076 MethodGroupExpr.IsExplicitImpl if appropriate.
4077 (Invocation.DoResolve): Don't report the CS0120 for explicit
4078 interface implementations.
4080 2002-08-27 Martin Baulig <martin@gnome.org>
4082 * expression.cs (Invocation.DoResolve): If this is a static
4083 method and we don't have an InstanceExpression, we must report
4086 2002-08-25 Martin Baulig <martin@gnome.org>
4088 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
4089 `==' between a valuetype and an object.
4091 2002-08-25 Miguel de Icaza <miguel@ximian.com>
4093 * ecore.cs (TypeExpr): Provide a ToString method.
4095 2002-08-24 Martin Baulig <martin@gnome.org>
4097 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
4098 now called proggie.dbg and it's a binary file.
4100 2002-08-23 Martin Baulig <martin@gnome.org>
4102 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
4104 2002-08-23 Martin Baulig <martin@gnome.org>
4106 * struct.cs (MyStructInfo.ctor): Make this work with empty
4107 structs; it's not allowed to use foreach() on null.
4109 2002-08-23 Martin Baulig <martin@gnome.org>
4111 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4112 writer the full pathname of the generated assembly.
4114 2002-08-23 Martin Baulig <martin@gnome.org>
4116 * statements.cs (FlowBranching.UsageVector.MergeChildren):
4117 A `finally' block never returns or breaks; improved handling of
4120 2002-08-23 Martin Baulig <martin@gnome.org>
4122 * statement.cs (Throw.Resolve): Allow `throw null'.
4124 2002-08-23 Martin Baulig <martin@gnome.org>
4126 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4127 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4128 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
4129 MemberLookup would return a wrong event if this is an explicit
4130 interface implementation and the class has an event with the same
4133 2002-08-23 Martin Baulig <martin@gnome.org>
4135 * statement.cs (Block.AddChildVariableNames): New public method.
4136 (Block.AddChildVariableName): Likewise.
4137 (Block.IsVariableNameUsedInChildBlock): Likewise.
4138 (Block.AddVariable): Check whether a variable name has already
4139 been used in a child block.
4141 * cs-parser.jay (declare_local_variables): Mark all variable names
4142 from the current block as being used in a child block in the
4145 2002-08-23 Martin Baulig <martin@gnome.org>
4147 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4148 find the symbol writer.
4150 * driver.cs: csc also allows the arguments to /define being
4151 separated by commas, not only by semicolons.
4153 2002-08-23 Martin Baulig <martin@gnome.org>
4155 * interface.cs (Interface.GetMembers): Added static check for events.
4157 2002-08-15 Martin Baulig <martin@gnome.org>
4159 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4160 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4162 * ecore.cs (Expression.MemberLookup): Added documentation and explained
4163 why the MethodData.EmitDestructor() change was necessary.
4165 2002-08-20 Martin Baulig <martin@gnome.org>
4167 * class.cs (TypeContainer.FindMembers): Added static check for events.
4169 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4171 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4172 use Type.GetEvents(), not Type.FindMembers().
4174 2002-08-20 Martin Baulig <martin@gnome.org>
4176 * decl.cs (MemberCache): Added a special method cache which will
4177 be used for method-only searched. This ensures that a method
4178 search will return a MethodInfo with the correct ReflectedType for
4181 2002-08-20 Martin Baulig <martin@gnome.org>
4183 * decl.cs (DeclSpace.FindMembers): Made this public.
4185 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4187 * delegate.cs: fixed build on windows.
4188 [FIXME: Filed as bug #29150: MCS must report these errors.]
4190 2002-08-19 Ravi Pratap <ravi@ximian.com>
4192 * ecore.cs (StandardConversionExists): Return a false
4193 if we are trying to convert the void type to anything else
4194 since that is not allowed.
4196 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4197 we flag error 70 in the event an event is trying to be accessed
4198 directly from outside the declaring type.
4200 2002-08-20 Martin Baulig <martin@gnome.org>
4202 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4203 MemberCache from typemanager.cs to decl.cs.
4205 2002-08-19 Martin Baulig <martin@gnome.org>
4207 * class.cs (TypeContainer): Implement IMemberContainer.
4208 (TypeContainer.DefineMembers): Create the MemberCache.
4209 (TypeContainer.FindMembers): Do better BindingFlags checking; only
4210 return public members if BindingFlags.Public was given, check
4211 whether members are static.
4213 2002-08-16 Martin Baulig <martin@gnome.org>
4215 * decl.cs (DeclSpace.Define): Splitted this in Define and
4216 DefineMembers. DefineMembers is called first and initializes the
4219 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
4220 DefineMembers() on all our DeclSpaces.
4222 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4223 but call DefineMembers() on all nested interfaces. We call their
4224 Define() in our new Define() function.
4226 * interface.cs (Interface): Implement IMemberContainer.
4227 (Interface.Define): Moved all code except the attribute stuf to
4229 (Interface.DefineMembers): Initialize the member cache.
4231 * typemanager.cs (IMemberFinder): Removed this interface, we don't
4232 need this anymore since we can use MemberCache.FindMembers directly.
4234 2002-08-19 Martin Baulig <martin@gnome.org>
4236 * typemanager.cs (MemberCache): When creating the cache for an
4237 interface type, add all inherited members.
4238 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4239 to `out bool used_cache' and documented it.
4240 (TypeManager.MemberLookup): If we already used the cache in the first
4241 iteration, we don't need to do the interfaces check.
4243 2002-08-19 Martin Baulig <martin@gnome.org>
4245 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
4246 here from IMemberFinder and don't implement this interface anymore.
4247 (DeclSpace.MemberCache): Moved here from IMemberFinder.
4249 * typemanager.cs (IMemberFinder): This interface is now only used by
4250 classes which actually support the member cache.
4251 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4252 since we only put DeclSpaces into this Hashtable.
4253 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4254 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4256 2002-08-16 Martin Baulig <martin@gnome.org>
4258 * typemanager.cs (ICachingMemberFinder): Removed.
4259 (IMemberFinder.MemberCache): New property.
4260 (TypeManager.FindMembers): Merged this with RealFindMembers().
4261 This function will never be called from TypeManager.MemberLookup()
4262 so we can't use the cache here, just the IMemberFinder.
4263 (TypeManager.MemberLookup_FindMembers): Check whether the
4264 IMemberFinder has a MemberCache and call the cache's FindMembers
4266 (MemberCache): Rewrote larger parts of this yet another time and
4267 cleaned it up a bit.
4269 2002-08-15 Miguel de Icaza <miguel@ximian.com>
4271 * driver.cs (LoadArgs): Support quoting.
4273 (Usage): Show the CSC-like command line arguments.
4275 Improved a few error messages.
4277 2002-08-15 Martin Baulig <martin@gnome.org>
4279 * typemanager.cs (IMemberContainer.Type): New property.
4280 (IMemberContainer.IsInterface): New property.
4282 The following changes are conditional to BROKEN_RUNTIME, which is
4283 defined at the top of the file.
4285 * typemanager.cs (MemberCache.MemberCache): Don't add the base
4286 class'es members, but add all members from TypeHandle.ObjectType
4287 if we're an interface.
4288 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4289 is the current type.
4290 (MemberCache.CacheEntry.Container): Removed this field.
4291 (TypeHandle.GetMembers): Include inherited members.
4293 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4295 * typemanager.cs: fixed compilation and added a comment on a field that
4298 2002-08-15 Martin Baulig <martin@gnome.org>
4300 * class.cs (ConstructorInitializer.Resolve): In the
4301 Expression.MemberLookup call, use the queried_type as
4304 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4305 declared' attribute, it's always true.
4306 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4307 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4308 temporary wrapper for FindMembers which tells MemberLookup whether
4309 members from the base classes are included in the return value.
4310 This will go away soon.
4311 (TypeManager.MemberLookup): Use this temporary hack here; once the
4312 new MemberCache is completed, we don't need to do the DeclaredOnly
4313 looping here anymore since the MemberCache will take care of this.
4314 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4315 (MemberCache): When creating the MemberCache for a class, get
4316 members from the current class and all its base classes.
4317 (MemberCache.CacheEntry.Container): New field. This is a
4318 temporary hack until the Mono runtime is fixed to distinguish
4319 between ReflectedType and DeclaringType. It allows us to use MCS
4320 with both the MS runtime and the unfixed Mono runtime without
4321 problems and without accecting performance.
4322 (MemberCache.SearchMembers): The DeclaredOnly looping from
4323 TypeManager.MemberLookup is now done here.
4325 2002-08-14 Martin Baulig <martin@gnome.org>
4327 * statement.cs (MyStructInfo.MyStructInfo): Don't call
4328 Type.GetFields on dynamic types but get the fields from the
4329 corresponding TypeContainer.
4330 (MyStructInfo.GetStructInfo): Added check for enum types.
4332 * typemanager.cs (MemberList.IsSynchronized): Implemented.
4333 (MemberList.SyncRoot): Implemented.
4334 (TypeManager.FilterWithClosure): No need to check permissions if
4335 closure_start_type == closure_invocation_type, don't crash if
4336 closure_invocation_type is null.
4338 2002-08-13 Martin Baulig <martin@gnome.org>
4340 Rewrote TypeContainer.FindMembers to use a member cache. This
4341 gives us a speed increase of about 35% for the self-hosting MCS
4342 build and of about 15-20% for the class libs (both on GNU/Linux).
4344 * report.cs (Timer): New class to get enhanced profiling. This
4345 whole class is "TIMER" conditional since it remarkably slows down
4348 * class.cs (MemberList): New class. This is an IList wrapper
4349 which we're now using instead of passing MemberInfo[]'s around to
4350 avoid copying this array unnecessarily.
4351 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4352 (ICachingMemberFinder, IMemberContainer): New interface.
4353 (TypeManager.FilterWithClosure): If `criteria' is null, the name
4354 has already been checked, otherwise use it for the name comparision.
4355 (TypeManager.FindMembers): Renamed to RealMemberFinder and
4356 provided wrapper which tries to use ICachingMemberFinder.FindMembers
4357 if possible. Returns a MemberList, not a MemberInfo [].
4358 (TypeHandle): New class, implements IMemberContainer. We create
4359 one instance of this class per type, it contains a MemberCache
4360 which is used to do the member lookups.
4361 (MemberCache): New class. Each instance of this class contains
4362 all members of a type and a name-based hash table.
4363 (MemberCache.FindMembers): This is our new member lookup
4364 function. First, it looks up all members of the requested name in
4365 the hash table. Then, it walks this list and sorts out all
4366 applicable members and returns them.
4368 2002-08-13 Martin Baulig <martin@gnome.org>
4370 In addition to a nice code cleanup, this gives us a performance
4371 increase of about 1.4% on GNU/Linux - not much, but it's already
4372 half a second for the self-hosting MCS compilation.
4374 * typemanager.cs (IMemberFinder): New interface. It is used by
4375 TypeManager.FindMembers to call FindMembers on a TypeContainer,
4376 Enum, Delegate or Interface.
4377 (TypeManager.finder_to_member_finder): New PtrHashtable.
4378 (TypeManager.finder_to_container): Removed.
4379 (TypeManager.finder_to_delegate): Removed.
4380 (TypeManager.finder_to_interface): Removed.
4381 (TypeManager.finder_to_enum): Removed.
4383 * interface.cs (Interface): Implement IMemberFinder.
4385 * delegate.cs (Delegate): Implement IMemberFinder.
4387 * enum.cs (Enum): Implement IMemberFinder.
4389 * class.cs (TypeContainer): Implement IMemberFinder.
4391 2002-08-12 Martin Baulig <martin@gnome.org>
4393 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4395 2002-08-12 Martin Baulig <martin@gnome.org>
4397 * ecore.cs (ITypeExpression): New interface for expressions which
4399 (TypeExpression): Renamed to TypeLookupExpression.
4400 (Expression.DoResolve): If we're doing a types-only lookup, the
4401 expression must implement the ITypeExpression interface and we
4402 call DoResolveType() on it.
4403 (SimpleName): Implement the new ITypeExpression interface.
4404 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4405 hack, the situation that we're only looking up types can't happen
4406 anymore when this method is called. Moved the type lookup code to
4407 DoResolveType() and call it.
4408 (SimpleName.DoResolveType): This ITypeExpression interface method
4409 is now doing the types-only lookup.
4410 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4411 (ResolveFlags): Added MaskExprClass.
4413 * expression.cs (MemberAccess): Implement the ITypeExpression
4415 (MemberAccess.DoResolve): Added support for a types-only lookup
4416 when we're called via ITypeExpression.DoResolveType().
4417 (ComposedCast): Implement the ITypeExpression interface.
4419 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
4420 Expression.Resolve() with ResolveFlags.Type instead.
4422 2002-08-12 Martin Baulig <martin@gnome.org>
4424 * interface.cs (Interface.Define): Apply attributes.
4426 * attribute.cs (Attribute.ApplyAttributes): Added support for
4427 interface attributes.
4429 2002-08-11 Martin Baulig <martin@gnome.org>
4431 * statement.cs (Block.Emit): Only check the "this" variable if we
4432 do not always throw an exception.
4434 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4435 whether the property has a set accessor.
4437 2002-08-11 Martin Baulig <martin@gnome.org>
4439 Added control flow analysis support for structs.
4441 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4442 with control flow analysis turned off.
4443 (IVariable): New interface.
4444 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4445 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4446 (FieldExpr.DoResolve): Resolve the instance expression with flow
4447 analysis turned off and do the definite assignment check after the
4448 resolving when we know what the expression will resolve to.
4450 * expression.cs (LocalVariableReference, ParameterReference):
4451 Implement the new IVariable interface, only call the flow analysis
4452 code if ec.DoFlowAnalysis is true.
4453 (This): Added constructor which takes a Block argument. Implement
4454 the new IVariable interface.
4455 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4456 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4457 This does the definite assignment checks for struct members.
4459 * class.cs (Constructor.Emit): If this is a non-static `struct'
4460 constructor which doesn't have any initializer, call
4461 Block.AddThisVariable() to tell the flow analysis code that all
4462 struct elements must be initialized before control returns from
4465 * statement.cs (MyStructInfo): New public class.
4466 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4467 argument to this indexer. If non-zero, check an individual struct
4468 member, not the whole struct.
4469 (FlowBranching.CheckOutParameters): Check struct members.
4470 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4471 overloaded versions of these methods which take an additional
4472 `int field_idx' argument to check struct members.
4473 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4474 overloaded versions of these methods which take an additional
4475 `string field_name' argument to check struct member.s
4476 (VariableInfo): Implement the IVariable interface.
4477 (VariableInfo.StructInfo): New public property. Returns the
4478 MyStructInfo instance of the variable if it's a struct or null.
4479 (Block.AddThisVariable): New public method. This is called from
4480 Constructor.Emit() for non-static `struct' constructor which do
4481 not have any initializer. It creates a special variable for the
4482 "this" instance variable which will be checked by the flow
4483 analysis code to ensure that all of the struct's fields are
4484 initialized before control returns from the constructor.
4485 (UsageVector): Added support for struct members. If a
4486 variable/parameter is a struct with N members, we reserve a slot
4487 in the usage vector for each member. A struct is considered fully
4488 initialized if either the struct itself (slot 0) or all its
4489 members are initialized.
4491 2002-08-08 Martin Baulig <martin@gnome.org>
4493 * driver.cs (Driver.MainDriver): Only report an error CS5001
4494 if there were no compilation errors.
4496 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4497 `UnsafeContext' property to determine whether the parent is in
4498 unsafe context rather than checking the parent's ModFlags:
4499 classes nested in an unsafe class are unsafe as well.
4501 2002-08-08 Martin Baulig <martin@gnome.org>
4503 * statement.cs (UsageVector.MergeChildren): Distinguish between
4504 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4505 we return. Added test17() and test18() to test-154.cs.
4507 2002-08-08 Martin Baulig <martin@gnome.org>
4509 * typemanager.cs (TypeManager.FilterWithClosure): If we have
4510 Family access, make sure the invoking type isn't a subclass of the
4511 queried type (that'd be a CS1540).
4513 * ecore.cs (Expression.MemberLookup): Added overloaded version of
4514 this method which takes an additional `Type invocation_type'.
4516 * expression.cs (BaseAccess.DoResolve): Use the base type as
4517 invocation and query type.
4518 (MemberAccess.DoResolve): If the lookup failed and we're about to
4519 report a CS0122, try a lookup with the ec.ContainerType - if this
4520 succeeds, we must report a CS1540.
4522 2002-08-08 Martin Baulig <martin@gnome.org>
4524 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4525 (MethodGroupExpr): Implement the IMemberExpr interface.
4527 * expression (MemberAccess.ResolveMemberAccess): No need to have
4528 any special code for MethodGroupExprs anymore, they're now
4531 2002-08-08 Martin Baulig <martin@gnome.org>
4533 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4534 Family, FamANDAssem and FamORAssem permissions.
4535 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4537 2002-08-08 Martin Baulig <martin@gnome.org>
4539 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4540 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4543 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4545 * driver.cs: implemented /resource option to embed managed resources.
4547 2002-08-07 Martin Baulig <martin@gnome.org>
4549 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4550 (FieldBase.HasFieldInitializer): New public property.
4551 (FieldBase.GetInitializerExpression): New public method. Resolves and
4552 returns the field initializer and makes sure it is only resolved once.
4553 (TypeContainer.EmitFieldInitializers): Call
4554 FieldBase.GetInitializerExpression to get the initializer, this ensures
4555 that it isn't resolved multiple times.
4557 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4558 the resolving process (SimpleName/MemberLookup) that we're currently
4559 emitting a field initializer (which must not access any instance members,
4560 this is an error CS0236).
4562 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4563 argument, if the `IsFieldInitializer' flag is set, we must report and
4564 error CS0236 and not an error CS0120.
4566 2002-08-07 Martin Baulig <martin@gnome.org>
4568 * ecore.cs (IMemberExpr): New public interface.
4569 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4570 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4571 if the expression is an IMemberExpr.
4573 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4574 to be null, implicitly default to `this' if we're non-static in
4575 this case. Simplified the code a lot by using the new IMemberExpr
4576 interface. Also fixed bug #28176 here.
4578 2002-08-06 Martin Baulig <martin@gnome.org>
4580 * cs-parser.jay (SimpleLookup): Removed. We need to create
4581 ParameterReferences during semantic analysis so that we can do a
4582 type-only search when resolving Cast, TypeOf and SizeOf.
4583 (block): Pass the `current_local_parameters' to the Block's
4586 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4587 argument to the constructor.
4588 (ConstructorInitializer.Resolve): Create a temporary implicit
4589 block with the parameters.
4591 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4592 references here if we aren't doing a type-only search.
4594 * statement.cs (Block): Added constructor which takes a
4595 `Parameters parameters' argument.
4596 (Block.Parameters): New public property.
4598 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4599 to `Parameters' and made it public readonly.
4601 2002-08-06 Martin Baulig <martin@gnome.org>
4603 * ecore.cs (Expression.Warning): Made this public as well.
4605 * report.cs (Report.Debug): Print the contents of collections.
4607 2002-08-06 Martin Baulig <martin@gnome.org>
4609 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4610 used to tell Resolve() which kinds of expressions it may return.
4611 (Expression.Resolve): Added overloaded version of this method which
4612 takes a `ResolveFlags flags' argument. This can be used to tell
4613 Resolve() which kinds of expressions it may return. Reports a
4615 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4616 ResolveFlags.SimpleName.
4617 (Expression.Error118): Added overloaded version of this method which
4618 takes a `ResolveFlags flags' argument. It uses the flags to determine
4619 which kinds of expressions are allowed.
4621 * expression.cs (Argument.ResolveMethodGroup): New public method.
4622 Resolves an argument, but allows a MethodGroup to be returned.
4623 This is used when invoking a delegate.
4625 * TODO: Updated a bit.
4627 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4629 Fixed compilation with csc.
4631 * ecore.cs: Expression.Error made public. Is this correct? Should
4632 Warning be made public too?
4634 * expression.cs: use ea.Location instead of ea.loc.
4635 [FIXME: Filed as bug #28607: MCS must report these errors.]
4637 2002-08-06 Martin Baulig <martin@gnome.org>
4639 * ecore.cs (Expression.loc): Moved the location here instead of
4640 duplicating it in all derived classes.
4641 (Expression.Location): New public property.
4642 (Expression.Error, Expression.Warning): Made them non-static and
4643 removed the location argument.
4644 (Expression.Warning): Added overloaded version which takes an
4645 `int level' argument.
4646 (Expression.Error118): Make this non-static and removed the
4647 expression and location arguments.
4648 (TypeExpr): Added location argument to the constructor.
4650 * expression.cs (StaticCallExpr): Added location argument to
4652 (Indirection, PointerArithmetic): Likewise.
4653 (CheckedExpr, UnCheckedExpr): Likewise.
4654 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4655 (StringPtr): Likewise.
4658 2002-08-05 Martin Baulig <martin@gnome.org>
4660 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4662 * assign.cs (Assign.DoResolve): Check whether the source
4663 expression is a value or variable.
4665 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4666 while resolving the corresponding blocks.
4668 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4669 an error, don't silently return null.
4671 * statement.cs (Block.AddVariable): Do the error reporting here
4672 and distinguish between CS0128 and CS0136.
4673 (Block.DoResolve): Report all unused labels (warning CS0164).
4674 (LabeledStatement): Pass the location to the constructor.
4675 (LabeledStatement.HasBeenReferenced): New property.
4676 (LabeledStatement.Resolve): Set it to true here.
4678 * statement.cs (Return.Emit): Return success even after reporting
4679 a type mismatch error (CS0126 or CS0127), this is what csc does and
4680 it avoids confusing the users with any consecutive errors.
4682 2002-08-05 Martin Baulig <martin@gnome.org>
4684 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4686 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4688 * expression.cs (MemberAccess.DoResolve): Silently return if an
4689 error has already been reported.
4691 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4692 error has already been reported.
4694 2002-08-05 Martin Baulig <martin@gnome.org>
4696 * statement.cs (UsageVector): Only initialize the `parameters'
4697 vector if we actually have any "out" parameters.
4699 2002-08-05 Martin Baulig <martin@gnome.org>
4701 * expression.cs (Binary.ResolveOperator): When combining delegates,
4702 they must have the same type.
4704 2002-08-05 Martin Baulig <martin@gnome.org>
4706 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4707 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4708 work with the ms runtime and we also don't need it: if we're a
4709 PropertyBuilder and not in the `indexer_arguments' hash, then we
4710 are a property and not an indexer.
4712 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4713 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4714 since the latter one doesn't work with the ms runtime.
4716 2002-08-03 Martin Baulig <martin@gnome.org>
4718 Fixed bugs #27998 and #22735.
4720 * class.cs (Method.IsOperator): New public field.
4721 (Method.CheckBase): Report CS0111 if there's already a method
4722 with the same parameters in the current class. Report CS0508 when
4723 attempting to change the return type of an inherited method.
4724 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4725 and it's not marked abstract or extern.
4726 (PropertyBase): New abstract base class for Property and Indexer.
4727 (PropertyBase.CheckBase): Moved here from Property and made it work
4729 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4730 the same so we can reuse it there.
4731 (Property, Indexer): Derive from PropertyBase.
4732 (MethodSignature.inheritable_property_signature_filter): New delegate
4733 to find properties and indexers.
4735 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4736 argument and improved error reporting.
4738 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4739 EmptyReadOnlyParameters and made it a property.
4741 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4742 version of this method which takes a `PropertyInfo indexer'.
4743 (TypeManager.RegisterIndexer): New method.
4745 * class.cs: Added myself as author of this file :-)
4747 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4749 * class.cs: fixed compilation on windoze.
4751 2002-08-03 Martin Baulig <martin@gnome.org>
4753 * interface.cs (Interface.GetInterfaceBases): Check whether all
4754 base interfaces are at least as accessible than the current one.
4756 * class.cs (TypeContainer.GetClassBases): Check whether base types
4757 are at least as accessible than the current type.
4758 (TypeContainer.AsAccessible): Implemented and made non-static.
4759 (MemberBase.CheckParameters): Report errors if the accessibility
4762 * delegate.cs (Delegate.Delegate): The default visibility is
4763 internal for top-level types and private for nested types.
4764 (Delegate.Define): Report errors if the accessibility checks fail.
4766 * enum.cs (Enum.Enum): The default visibility is internal for
4767 top-level types and private for nested types.
4768 (Enum.DefineType): Compute the correct visibility.
4770 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4771 function which takes a `bool is_toplevel' instead of a TypeContainer.
4773 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4776 2002-08-02 Martin Baulig <martin@gnome.org>
4778 * expression.cs (LocalVariableReferenc): Added constructor which
4779 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4780 (LocalVariableReference.IsReadOnly): New property.
4781 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4782 variable is readonly, use our own readonly flag to do this; you can
4783 use the new constructor to get a writable reference to a read-only
4786 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4787 reference to the local variable.
4789 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4791 * rootcontext.cs (ResolveCore): Also include System.Exception
4793 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4794 we reach an EmptyStatement.
4796 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4799 * expression.cs (Binary.ResolveOperator): Check error result in
4802 use brtrue/brfalse directly and avoid compares to null.
4804 2002-08-02 Martin Baulig <martin@gnome.org>
4806 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4807 Fixes bug #28407, added test-155.cs.
4809 2002-08-01 Martin Baulig <martin@gnome.org>
4811 * class.cs (Event.EmitDefaultMethod): Make this work with static
4812 events. Fixes #28311, added verify-3.cs.
4814 2002-08-01 Martin Baulig <martin@gnome.org>
4816 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4817 `is_disposable' fields.
4818 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4819 `hm.is_disposable' if we're using the collection pattern.
4820 (Foreach.EmitCollectionForeach): Use the correct type for the
4821 enumerator's local variable, only emit the try/finally block if
4822 necessary (fixes #27713).
4824 2002-08-01 Martin Baulig <martin@gnome.org>
4826 * ecore.cs (Expression.report118): Renamed to Error118 and made
4829 * statement.cs (Throw.Resolve): Check whether the expression is of
4830 the correct type (CS0118) and whether the type derives from
4831 System.Exception (CS0155).
4832 (Catch.Resolve): New method. Do the type lookup here and check
4833 whether it derives from System.Exception (CS0155).
4834 (Catch.CatchType, Catch.IsGeneral): New public properties.
4836 * typemanager.cs (TypeManager.exception_type): Added.
4838 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4840 * driver.cs: Updated About function.
4842 2002-07-31 Martin Baulig <martin@gnome.org>
4844 Implemented Control Flow Analysis.
4846 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4847 (EmitContext.CurrentBranching): Added.
4848 (EmitContext.StartFlowBranching): Added.
4849 (EmitContext.EndFlowBranching): Added.
4850 (EmitContext.KillFlowBranching): Added.
4851 (EmitContext.IsVariableAssigned): Added.
4852 (EmitContext.SetVariableAssigned): Added.
4853 (EmitContext.IsParameterAssigned): Added.
4854 (EmitContext.SetParameterAssigned): Added.
4855 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4856 Added control flow analysis stuff here.
4858 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4859 resolve the expression as lvalue.
4860 (LocalVariableReference.DoResolve): Check whether the variable has
4861 already been assigned.
4862 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4863 the parameter as assigned here.
4864 (ParameterReference.DoResolve): Check whether the parameter has already
4866 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4867 expression as lvalue.
4869 * statement.cs (FlowBranching): New class for the flow analysis code.
4870 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4871 (LabeledStatement.IsDefined): New public property.
4872 (LabeledStatement.AddUsageVector): New public method to tell flow
4873 analyis that the label may be reached via a forward jump.
4874 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4876 (VariableInfo.Number): New public field. This is used by flow analysis
4877 to number all locals of a block.
4878 (Block.CountVariables): New public property. This is the number of
4879 local variables in this block (including the locals from all parent
4881 (Block.EmitMeta): Number all the variables.
4883 * statement.cs: Added flow analysis support to all classes.
4885 2002-07-31 Martin Baulig <martin@gnome.org>
4887 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4888 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4889 then use this argument.
4891 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4893 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4894 use this to specify /define options.
4896 2002-07-29 Martin Baulig <martin@gnome.org>
4898 * statement.cs (Fixed): Moved all code that does variable lookups
4899 and resolvings from Emit to Resolve.
4901 * statement.cs (For): Moved all code that does variable lookups
4902 and resolvings from Emit to Resolve.
4904 * statement.cs (Using): Moved all code that does variable lookups
4905 and resolvings from Emit to Resolve.
4907 2002-07-29 Martin Baulig <martin@gnome.org>
4909 * attribute.cs (Attribute.Resolve): Explicitly catch a
4910 System.NullReferenceException when creating the
4911 CustromAttributeBuilder and report a different warning message.
4913 2002-07-29 Martin Baulig <martin@gnome.org>
4915 * support.cs (ParameterData.ParameterName): Added method to
4916 get the name of a parameter.
4918 * typemanager.cs (TypeManager.IsValueType): New public method.
4920 2002-07-29 Martin Baulig <martin@gnome.org>
4922 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4923 is a flag which specifies that it's either ref or out.
4924 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4925 the out parameter to `out Parameter.Modifier mod', also set the
4926 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4928 * support.cs (InternalParameters.ParameterModifier): Distinguish
4929 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4930 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4932 * expression.cs (Argument.GetParameterModifier): Distinguish
4933 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4934 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4936 2002-07-29 Martin Baulig <martin@gnome.org>
4938 * expression.cs (ParameterReference.ParameterReference): Added
4939 `Location loc' argument to the constructor.
4941 * cs-parser.jay: Pass location to ParameterReference.
4943 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4945 * statement.cs (Try): Initialize the location.
4947 * cs-parser.jay: pass location to Try.
4949 * expression.cs (Unary.Reduce): Change the prototype to return
4950 whether a constant fold could be performed or not. The result is
4951 returned in an out parameters. In the case of Indirection and
4952 AddressOf, we want to perform the full tests.
4954 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4956 * statement.cs (Statement.Emit): Flag dead code.
4958 2002-07-27 Andrew Birkett <andy@nobugs.org>
4960 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4962 2002-07-27 Martin Baulig <martin@gnome.org>
4964 * class.cs (MethodData.Define): Put back call to
4965 TypeManager.AddMethod(), accidentally commented this out.
4967 * report.cs (Debug): New public method to print debugging information,
4968 this is `[Conditional ("DEBUG")]'.
4970 2002-07-26 Martin Baulig <martin@gnome.org>
4972 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4973 (switch_statement): Push the current_block to the switch_stack and
4974 pop it again when we're done with the switch.
4975 (switch_section): The new block is a child of the current_block.
4976 Fixes bug #24007, added test-152.cs.
4978 2002-07-27 Martin Baulig <martin@gnome.org>
4980 * expression.cs (Invocation.EmitArguments): When calling a varargs
4981 function with only its fixed arguments, we need to pass an empty
4984 2002-07-27 Martin Baulig <martin@gnome.org>
4986 Mono 0.13 has been released.
4988 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4990 * driver.cs: Rename --resource to --linkres, because that is what
4991 we do currently, we dont support --resource yet.
4993 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4995 2002-07-25 Martin Baulig <martin@gnome.org>
4997 * class.cs (MethodData): New public class. This is a `method builder'
4998 class for a method or one accessor of a Property/Indexer/Event.
4999 (MethodData.GetMethodFlags): Moved here from MemberBase.
5000 (MethodData.ApplyAttributes): Likewise.
5001 (MethodData.ApplyObsoleteAttribute): Likewise.
5002 (MethodData.ApplyConditionalAttribute): Likewise.
5003 (MethodData.ApplyDllImportAttribute): Likewise.
5004 (MethodData.CheckAbstractAndExternal): Likewise.
5005 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
5006 (MethodData.Emit): Formerly known as Method.Emit().
5007 (MemberBase): Moved everything which was specific to a single
5008 accessor/method to MethodData.
5009 (Method): Create a new MethodData and call Define() and Emit() on it.
5010 (Property, Indexer, Event): Create a new MethodData objects for each
5011 accessor and call Define() and Emit() on them.
5013 2002-07-25 Martin Baulig <martin@gnome.org>
5015 Made MethodCore derive from MemberBase to reuse the code from there.
5016 MemberBase now also checks for attributes.
5018 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
5019 (MemberBase.GetMethodFlags): Moved here from class Method and marked
5021 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
5022 `CallingConventions cc' and `Attributes opt_attrs' arguments.
5023 (MemberBase.ApplyAttributes): New virtual method; applies the
5024 attributes to a method or accessor.
5025 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5026 (MemberBase.ApplyConditionalAttribute): Likewise.
5027 (MemberBase.ApplyDllImportAttribute): Likewise.
5028 (MemberBase.CheckAbstractAndExternal): Likewise.
5029 (MethodCore.ParameterTypes): This is now a property instead of a
5030 method, it's initialized from DoDefineParameters().
5031 (MethodCore.ParameterInfo): Removed the set accessor.
5032 (MethodCore.DoDefineParameters): New protected virtual method to
5033 initialize ParameterTypes and ParameterInfo.
5034 (Method.GetReturnType): We can now simply return the MemberType.
5035 (Method.GetMethodFlags): Override the MemberBase version and add
5036 the conditional flags.
5037 (Method.CheckBase): Moved some code from Define() here, call
5038 DoDefineParameters() here.
5039 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5040 here to avoid some larger code duplication.
5041 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5042 ensure that abstract and external accessors don't declare a body.
5044 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5045 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5046 lookup in the attribute's parent classes, so we need to abort as soon
5047 as we found the first match.
5048 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5049 the attribute has no arguments.
5051 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5054 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5056 * cs-parser.jay: reverted previous patch.
5058 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5060 * cs-parser.jay: fixed bug #22119.
5062 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5064 * attribute.cs: fixed compilation. The error was:
5065 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
5066 be assigned to before control leaves the current method."
5067 [FIXME: Filed as bug #28186: MCS must report this error.]
5069 2002-07-25 Martin Baulig <martin@gnome.org>
5071 * attribute.cs (Attribute.Conditional_GetConditionName): New static
5072 method to pull the condition name ouf of a Conditional attribute.
5073 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
5074 the obsolete message and error flag out of an Obsolete attribute.
5076 * class.cs (Method.GetMethodFlags): New public method to get the
5077 TypeManager.MethodFlags for this method.
5078 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
5080 (Method.Define): Get and apply the Obsolete and Conditional attributes;
5081 if we're overriding a virtual function, set the new private variable
5082 `parent_method'; call the new TypeManager.AddMethod().
5084 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
5085 the MethodBuilder and the Method in a PtrHashtable.
5086 (TypeManager.builder_to_method): Added for this purpose.
5087 (TypeManager.MethodFlags): Added IsObsoleteError.
5088 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
5089 Obsolete and Conditional arguments in MethodBuilders. If we discover
5090 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
5091 the message from the attribute.
5093 2002-07-24 Martin Baulig <martin@gnome.org>
5095 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
5096 preprocessor directives, ensure that the argument to #define/#undef is
5097 exactly one identifier and that it's actually an identifier.
5099 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
5102 2002-07-24 Martin Baulig <martin@gnome.org>
5104 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
5105 initialize it to TypeManager.object_type in the constructor.
5106 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
5107 of the `hm.get_current' method if we're using the collection pattern.
5108 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5109 for the explicit conversion to make it work when we're using the collection
5110 pattern and the `Current' property has a different return type than `object'.
5113 2002-07-24 Martin Baulig <martin@gnome.org>
5115 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5116 does not match, but don't report any errors. This method is called in
5117 order for all methods in a MethodGroupExpr until a matching method is
5118 found, so we don't want to bail out if the first method doesn't match.
5119 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5120 matches, report the 123. Fixes #28070.
5122 2002-07-24 Martin Baulig <martin@gnome.org>
5124 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5125 TypeManager.TypeToCoreType() to the top of the method so the
5126 following equality checks will work. Fixes #28107.
5128 2002-07-24 Martin Baulig <martin@gnome.org>
5130 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5131 operand is of type uint, and the other operand is of type sbyte,
5132 short or int, the operands are converted to type long." -
5133 Actually do what this comment already told us. Fixes bug #28106,
5136 2002-07-24 Martin Baulig <martin@gnome.org>
5138 * class.cs (MethodBase): New abstract class. This is now a base
5139 class for Property, Indexer and Event to avoid some code duplication
5140 in their Define() and DefineMethods() methods.
5141 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5142 generic methods for Define() and DefineMethods().
5143 (FieldBase): Derive from MemberBase, not MemberCore.
5144 (Property): Derive from MemberBase, not MemberCore.
5145 (Property.DefineMethod): Moved all the code from this method to the
5146 new MethodBase.DefineAccessor(), just call it with appropriate
5148 (Property.Define): Call the new Property.DoDefine(), this does some
5149 sanity checks and we don't need to duplicate the code everywhere.
5150 (Event): Derive from MemberBase, not MemberCore.
5151 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5152 accessors, this will also make them work with interface events.
5153 (Indexer): Derive from MemberBase, not MemberCore.
5154 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5155 (Indexer.Define): Use the new MethodBase functions.
5157 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5158 argument to the constructor.
5159 (Interface.FindMembers): Added support for interface events.
5160 (Interface.PopluateEvent): Implemented.
5162 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
5164 2002-07-22 Miguel de Icaza <miguel@ximian.com>
5166 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5167 but this is required to check for a method name being the same as
5168 the containing class.
5172 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5174 * interface.cs: initialize variable.
5176 2002-07-23 Martin Baulig <martin@gnome.org>
5178 Implemented the IndexerName attribute in interfaces.
5180 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5181 name if this is an explicit interface implementation.
5182 (Indexer.InterfaceIndexerName): New public variable. If we're
5183 implementing an interface indexer, this is the IndexerName in that
5184 interface. Otherwise, it's the IndexerName.
5185 (Indexer.DefineMethod): If we're implementing interface indexer,
5186 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
5187 and Pending.ImplementIndexer methods.
5188 (Indexer.Define): Also define the PropertyBuilder if we're
5189 implementing an interface indexer and this is neither an explicit
5190 interface implementation nor do the IndexerName match the one in
5193 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5194 If a method is defined here, then we always need to create a proxy
5195 for it. This is used when implementing interface indexers.
5196 (Pending.IsInterfaceIndexer): New public method.
5197 (Pending.ImplementIndexer): New public method.
5198 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5199 This is used when implementing interface indexers to define a proxy
5201 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5202 define a proxy if necessary.
5204 * interface.cs (Interface.IndexerName): New public variable.
5205 (Interface.PopulateIndexer): Set the IndexerName.
5206 (Interface.DefineIndexers): New private method. Populate all the
5207 indexers and make sure their IndexerNames match.
5209 * typemanager.cs (IndexerPropertyName): Added support for interface
5212 2002-07-22 Martin Baulig <martin@gnome.org>
5214 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5215 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5216 ret if HasReturnLabel.
5217 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5220 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5221 and set the ec.LoopBeginTryCatchLevel.
5222 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5223 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5224 the current ec.TryCatchLevel, the branch goes out of an exception
5225 block. In this case, we need to use Leave and not Br.
5227 2002-07-22 Martin Baulig <martin@gnome.org>
5229 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5230 block unless the block does not always return or it is contained in
5231 another try { ... } catch { ... } block. Fixes bug #26506.
5232 Added verify-1.cs to the test suite.
5234 2002-07-22 Martin Baulig <martin@gnome.org>
5236 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5237 then we do not always return. Fixes bug #24985.
5239 2002-07-22 Martin Baulig <martin@gnome.org>
5241 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5242 lookup on a per-class level; ie. walk up the class hierarchy until we
5243 found at least one applicable method, then choose the best among them.
5244 Fixes bug #24463 and test-29.cs.
5246 2002-07-22 Martin Baulig <martin@gnome.org>
5248 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5249 return types of the methods. The return type is not part of the
5250 signature and we must not check it to make the `new' modifier work.
5251 Fixes bug #27999, also added test-147.cs.
5252 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5254 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5255 on the method's return type.
5257 2002-07-21 Martin Baulig <martin@gnome.org>
5259 * assign.cs: Make this work if the rightmost source is a constant and
5260 we need to do an implicit type conversion. Also adding a few more tests
5261 to test-38.cs which should have caught this.
5263 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5264 target in the makefile for this. The makefile.gnu is primarily intended
5265 for end-users who don't want to debug the compiler.
5267 2002-07-21 Martin Baulig <martin@gnome.org>
5269 * assign.cs: Improved the Assign class so it can now handle embedded
5270 assignments (X = Y = Z = something). As a side-effect this'll now also
5271 consume less local variables. test-38.cs now passes with MCS, added
5272 a few new test cases to that test.
5274 2002-07-20 Martin Baulig <martin@gnome.org>
5276 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5277 instructions. Fixes bug #27977, also added test-146.cs.
5279 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5281 * cs-tokenizer.cs: fixed getHex ().
5283 2002-07-19 Martin Baulig <martin@gnome.org>
5285 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5286 not Type.GetType() to lookup the array type. This is needed when
5287 we're constructing an array of a user-defined type.
5288 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5289 single-dimensional arrays, but also for single-dimensial arrays of
5292 2002-07-19 Martin Baulig <martin@gnome.org>
5294 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5295 this function is called, it's not allowed to share LocalBuilders
5298 2002-07-19 Martin Baulig <martin@gnome.org>
5300 * expression.cs (Argument.Resolve): Report an error 118 when trying
5301 to pass a type as argument.
5303 2002-07-18 Martin Baulig <martin@gnome.org>
5305 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5306 Conv_R_Un for the signed `long' type.
5308 2002-07-15 Miguel de Icaza <miguel@ximian.com>
5310 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5311 `expr' for the temporary result, as that will fail if we do
5312 multiple resolves on the same expression.
5314 2002-07-05 Miguel de Icaza <miguel@ximian.com>
5316 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5317 ec.TypeContainer for looking up aliases.
5319 * class.cs (TypeContainer): Remove LookupAlias from here.
5321 * decl.cs (DeclSpace); Move here.
5323 2002-07-01 Miguel de Icaza <miguel@ximian.com>
5325 * class.cs (FindMembers): Only call filter if the constructor
5326 bulider is not null.
5328 Also handle delegates in `NestedTypes' now. Now we will perform
5329 type lookups using the standard resolution process. This also
5332 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5333 This uses Expressions (the limited kind that can be parsed by the
5334 tree) instead of strings.
5336 * expression.cs (ComposedCast.ToString): Implement, used to flag
5337 errors since now we have to render expressions.
5339 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
5342 * ecore.cs (SimpleName.ToString): ditto.
5344 * cs-parser.jay: Instead of using strings to assemble types, use
5345 Expressions to assemble the type (using SimpleName, ComposedCast,
5346 MemberAccess). This should fix the type lookups in declarations,
5347 because we were using a different code path for this.
5349 * statement.cs (Block.Resolve): Continue processing statements
5350 even when there is an error.
5352 2002-07-17 Miguel de Icaza <miguel@ximian.com>
5354 * class.cs (Event.Define): Also remove the `remove' method from
5355 the list of pending items.
5357 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5358 generate more compact code.
5360 2002-07-17 Martin Baulig <martin@gnome.org>
5362 * const.cs (Const.LookupConstantValue): Add support for constant
5363 `unchecked' and `checked' expressions.
5364 Also adding test case test-140.cs for this.
5366 2002-07-17 Martin Baulig <martin@gnome.org>
5368 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5369 check whether mi.ReturnType implements the IEnumerator interface; the
5370 `==' and the IsAssignableFrom() will fail in this situation.
5372 2002-07-16 Ravi Pratap <ravi@ximian.com>
5374 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
5377 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5379 * expression.cs: fixed bug #27811.
5381 2002-07-14 Miguel de Icaza <miguel@ximian.com>
5383 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5384 Molaro: when we are a ref, the value already contains a pointer
5385 value, do not take the address of it.
5387 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5388 * removed mb-parser.jay and mb-tokenizer.cs
5390 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5392 * expression.cs: check against the building corlib void type.
5394 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5396 * ecore.cs: fix for valuetype static readonly fields: when
5397 initializing them, we need their address, not the address of a copy.
5399 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5401 * typemanager.cs: register also enum_type in corlib.
5403 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5405 * class.cs: allow calling this (but not base) initializers in structs.
5407 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5409 * ecore.cs: make sure we compare against the building base types
5412 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5414 * typemanager.cs: fix TypeToCoreType() to handle void and object
5415 (corlib gets no more typerefs after this change).
5417 2002-07-12 Miguel de Icaza <miguel@ximian.com>
5419 * expression.cs (ArrayCreation.EmitArrayArguments): use
5420 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5422 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5423 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
5424 array indexes, the runtime actually forbids them.
5426 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5427 for array arguments here.
5429 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5430 instead of the default for ValueTypes.
5432 (New.DoEmit): Use IsValueType instead of
5433 IsSubclassOf (value_type)
5434 (New.DoResolve): ditto.
5435 (Invocation.EmitCall): ditto.
5437 * assign.cs (Assign): ditto.
5439 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5440 Statements *are* currently doing part of their resolution during
5443 Expressions do always resolve during resolve, but statements are
5444 only required to propagate resolution to their children.
5446 2002-07-11 Miguel de Icaza <miguel@ximian.com>
5448 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5450 (LoadAssembly): Do not add the dll if it is already specified
5452 (MainDriver): Add the System directory to the link path at the end,
5453 after all the other -L arguments.
5455 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5456 wrong opcode for loading bytes and bools (ldelem.i1 instead of
5457 ldelem.u1) and using the opposite for sbytes.
5459 This fixes Digger, and we can finally run it.
5461 * driver.cs (UnixParseOption): Move the option parsing here.
5462 (CSCParseOption): Implement CSC-like parsing of options.
5464 We now support both modes of operation, the old Unix way, and the
5465 new CSC-like way. This should help those who wanted to make cross
5468 The only thing broken is that /r:, /reference: and /lib: are not
5469 implemented, because I want to make those have the same semantics
5470 as the CSC compiler has, and kill once and for all the confussion
5471 around this. Will be doing this tomorrow.
5473 * statement.cs (Unsafe.Resolve): The state is checked during
5474 resolve, not emit, so we have to set the flags for IsUnsfe here.
5476 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5478 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5479 not catch the Error_ObjectRefRequired in SimpleName (as it is
5480 possible to have a class/instance variable name that later gets
5481 deambiguated), we have to check this here.
5483 2002-07-10 Ravi Pratap <ravi@ximian.com>
5485 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5486 make static and put into Expression.
5488 (Event.Define): Register the private field of the event with the
5489 TypeManager so that GetFieldFromEvent can get at it.
5491 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5492 keep track of the private field associated with an event which
5495 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5498 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5500 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5502 * expression.cs (Binary.EmitBranchable): this routine emits the
5503 Binary expression in a branchable context. This basically means:
5504 we need to branch somewhere, not just get the value on the stack.
5506 This works together with Statement.EmitBoolExpression.
5508 * statement.cs (Statement.EmitBoolExpression): Use
5511 2002-07-09 Miguel de Icaza <miguel@ximian.com>
5513 * statement.cs (For): Reduce the number of jumps in loops.
5515 (For): Implement loop inversion for the For statement.
5517 (Break): We can be breaking out of a Try/Catch controlled section
5518 (foreach might have an implicit try/catch clause), so we need to
5519 use Leave instead of Br.
5521 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5522 now). If the instace expression supports IMemoryLocation, we use
5523 the AddressOf method from the IMemoryLocation to extract the
5524 address instead of emitting the instance.
5526 This showed up with `This', as we were emitting the instance
5527 always (Emit) instead of the Address of This. Particularly
5528 interesting when This is a value type, as we dont want the Emit
5529 effect (which was to load the object).
5531 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5533 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5535 * statement.cs (Checked): Set the CheckedState during the resolve
5536 process too, as the ConvCast operations track the checked state on
5537 the resolve process, and not emit.
5539 * cs-parser.jay (namespace_member_declaration): Flag that we have
5540 found a declaration when we do. This is used to flag error 1529
5542 * driver.cs: Report ok when we display the help only.
5544 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5546 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5548 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5550 * cs-tokenizer.cs (define): We also have to track locally the
5551 defines. AllDefines is just used for the Conditional Attribute,
5552 but we also need the local defines for the current source code.
5554 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5556 * statement.cs (While, For, Do): These loops can exit through a
5557 Break statement, use this information to tell whether the
5558 statement is the last piece of code.
5560 (Break): Flag that we break.
5562 * codegen.cs (EmitContexts): New `Breaks' state variable.
5564 2002-07-03 Martin Baulig <martin@gnome.org>
5566 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5567 modifiers in method declarations in structs. Otherwise, you won't
5568 be able to override things like Object.Equals().
5570 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5572 * class.cs (Method, Property, Indexer): Do not allow the public
5573 modifier to be used in explicit interface implementations.
5575 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5576 override modifiers in method declarations in structs
5578 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5580 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5581 integer or real overflow, report an error
5583 2002-07-02 Martin Baulig <martin@gnome.org>
5585 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5586 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5587 to tell the runtime about our newly created System.Object and
5588 System.ValueType types.
5590 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5592 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5593 struct instead of Ldarg/Starg.
5595 2002-07-02 Martin Baulig <martin@gnome.org>
5597 * expression.cs (Indirection.Indirection): Call
5598 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5600 2002-07-02 Martin Baulig <martin@gnome.org>
5602 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5603 ValueType, call TypeManager.TypeToCoreType() on it.
5604 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5605 the OpCodes.Newarr argument.
5607 2002-07-02 Martin Baulig <martin@gnome.org>
5609 * expression.cs (Invocation.EmitCall): When compiling corlib,
5610 replace all calls to the system's System.Array type to calls to
5611 the newly created one.
5613 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5614 System.Array methods.
5615 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5616 from the system's System.Array type which must be replaced.
5618 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5620 * typemanager.cs: load unverifiable_code_ctor so we can build
5621 corlib using the correct type. Avoid using GetTypeCode() with
5623 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5624 TypeManager.object_type to allow building corlib.
5626 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5628 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5630 2002-07-01 Martin Baulig <martin@gnome.org>
5632 * class.cs: Make the last change actually work, we need to check
5633 whether `ifaces != null' to avoid a crash.
5635 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5637 * class.cs: when we build structs without fields that implement
5638 interfaces, we need to add the interfaces separately, since there is
5639 no API to both set the size and add the interfaces at type creation
5642 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5644 * expression.cs: the dimension arguments to the array constructors
5645 need to be converted if they are a long.
5647 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5649 * class.cs: don't emit ldarg.0 if there is no parent constructor
5650 (fixes showstopper for corlib).
5652 2002-06-29 Martin Baulig <martin@gnome.org>
5654 MCS now compiles corlib on GNU/Linux :-)
5656 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5657 ie. check for MethodImplOptions.InternalCall.
5659 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5660 and TypeManager.attribute_type are null, so we must explicitly check
5661 whether parent is not null to find out whether it's an attribute type.
5662 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5663 and SetBuilder, not only if the property is neither abstract nor external.
5664 This is necessary to set the MethodImplOptions on the accessor methods.
5665 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5666 SetBuilder, see Property.Emit().
5668 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5669 populate "System.Object", "System.ValueType" and "System.Attribute" since
5670 they've already been populated from BootCorlib_PopulateCoreTypes().
5672 2002-06-29 Martin Baulig <martin@gnome.org>
5674 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5675 is the NullLiteral, we also need to make sure that target_type is not
5678 2002-06-29 Martin Baulig <martin@gnome.org>
5680 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5681 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5682 before calling BootstrapCorlib_ResolveDelegate ().
5684 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5686 * statement.cs: fixed build-breaker. All tests passed ok.
5688 2002-06-27 Martin Baulig <martin@gnome.org>
5690 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5691 for System.Decimal when compiling corlib.
5693 2002-06-27 Martin Baulig <martin@gnome.org>
5695 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5696 switch blocks which contain nothing but a default clause.
5698 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5700 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5702 2002-06-27 Martin Baulig <martin@gnome.org>
5704 * ecore.cs (PropertyExpr.PropertyExpr): Call
5705 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5707 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5708 is already a TypeBuilder.
5710 2002-06-27 Martin Baulig <martin@gnome.org>
5712 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5713 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5714 the "from an array-type to System.Array" case. This makes it work
5715 when compiling corlib.
5717 2002-06-27 Martin Baulig <martin@gnome.org>
5719 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5720 non-static PropertyExpr, set its InstanceExpression. This makes
5721 the `ICollection.Count' property work in System/Array.cs.
5723 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5725 * driver.cs: Made error handling more consistent. Errors now
5726 tracked by Report class, so many methods which used to return int
5727 now return void. Main() now prints success/failure and
5728 errors/warnings message.
5730 Renamed '--probe' compiler argument to '--expect-error'. Removed
5731 the magic number return values (123 and 124). Now, if the
5732 expected error occurs, the compiler exits with success (exit value
5733 0). If the compilation completes without seeing that particular
5734 error, the compiler exits with failure (exit value 1). The
5735 makefile in mcs/errors has been changed to handle the new behaviour.
5737 * report.cs: Made 'expected error' number a property and renamed
5738 it from 'Probe' to 'ExpectedError'.
5740 * genericparser.cs: Removed error handling support, since it is
5741 now all done by Report class.
5743 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5744 class, so parse() no longer returns an int.
5746 * namespace.cs: Use Report.Error instead of GenericParser.error
5748 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5750 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5751 TypeContainer.AddOperator): At the front of the list put the
5752 explicit implementations, so they get resolved/defined first.
5754 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5756 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5757 interface type is implemented by this TypeContainer. Used during
5758 explicit interface implementation.
5760 (Property.Define, Indexer.Define, Method.Define): Validate that
5761 the given interface in the explicit implementation is one of the
5762 base classes for the containing type.
5764 Also if we are explicitly implementing an interface, but there is
5765 no match in the pending implementation table, report an error.
5767 (Property.Define): Only define the property if we are
5768 not explicitly implementing a property from an interface. Use the
5769 correct name also for those properties (the same CSC uses,
5770 although that is really not needed).
5772 (Property.Emit): Do not emit attributes for explicitly implemented
5773 properties, as there is no TypeBuilder.
5775 (Indexer.Emit): ditto.
5777 Hiding then means that we do not really *implement* a pending
5778 implementation, which makes code fail.
5780 2002-06-22 Martin Baulig <martin@gnome.org>
5782 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5783 the return value of Object.GetType(). [FIXME: we need to do this whenever
5784 we get a type back from the reflection library].
5786 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5788 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5790 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5792 * attribute.cs: Return null if we can not look up the type.
5794 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5795 the interface types found.
5797 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5798 interface types found.
5800 * typemanager.cs (GetInterfaces): Make this routine returns alll
5801 the interfaces and work around the lame differences between
5802 System.Type and System.Reflection.Emit.TypeBuilder in the results
5803 result for GetInterfaces.
5805 (ExpandInterfaces): Given an array of interface types, expand and
5806 eliminate repeated ocurrences of an interface. This expands in
5807 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5810 2002-06-21 Martin Baulig <martin@gnome.org>
5812 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5815 2002-06-21 Martin Baulig <martin@gnome.org>
5817 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5818 and called with one of the core types, return the corresponding typebuilder for
5821 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5824 2002-06-21 Martin Baulig <martin@gnome.org>
5826 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5827 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5828 (Expression.ConvertReferenceExplicit): Likewise.
5830 * expression.cs (ElementAccess.DoResolve): Likewise.
5831 (ElementAccess.DoResolveLValue): Likewise.
5833 2002-06-10 Martin Baulig <martin@gnome.org>
5835 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5836 add the "value" parameter to the parameter list.
5838 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5841 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5843 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5844 the argument to an int, uint, long or ulong, per the spec. Also
5845 catch negative constants in array creation.
5847 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5849 * class.cs: do not allow the same interface to appear twice in
5850 the definition list.
5852 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5854 * ecore.cs: don't use ldlen with System.Array.
5856 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5858 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5860 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5862 * modifiers.cs: produce correct field attributes for protected
5863 internal. Easy fix so miguel can work on ther harder stuff:-)
5865 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5867 * pending.cs: New file. Move the code from class.cs here.
5868 Support clearning the pending flag for all methods (when not doing
5869 explicit interface implementation).
5871 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5873 * rootcontext.cs: added a couple more types needed to bootstrap.
5875 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5877 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5878 constructor in the type, instead of any constructor in the type
5879 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5880 a bug in the Mono runtime when applying the params attribute).
5882 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5883 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5885 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5887 * expression.cs (Unary.ResolveOperator): Use TypeManager
5888 to resolve the type.
5890 2002-06-13 Ravi Pratap <ravi@ximian.com>
5892 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5895 * enum.cs (AddEnumMember): Add support to store the attributes associated
5896 with each member too.
5898 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5899 field builders too - this takes care of the enum member case.
5901 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5903 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5904 address-of operator on both value types and pointers.
5906 2002-06-10 Martin Baulig <martin@gnome.org>
5908 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5909 PropertyBuilder to the `property_builders' list.
5911 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5912 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5913 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5914 find any indexers which are inherited from an interface.
5916 2002-06-09 Martin Baulig <martin@gnome.org>
5918 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5919 the same type as the constant if necessary. There's also a test-130.cs
5922 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5924 * typemanager.cs (TypeManager.ChangeType): Previously known as
5925 Enum.ChangeEnumType().
5927 2002-06-09 Martin Baulig <martin@gnome.org>
5929 * expression.cs (Cast.TryReduce): Added support for consts.
5931 2002-06-08 Ravi Pratap <ravi@ximian.com>
5933 * class.cs (Accessor): Hold attributes information so we can pass
5936 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5937 Modify to pass in attributes attached to the methods.
5939 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5941 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5942 to handle the Accessor kind :-)
5944 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5946 2002-06-08 Martin Baulig <martin@gnome.org>
5948 * expression.cs (Unary.TryReduceNegative): Added support for
5951 2002-06-08 Martin Baulig <martin@gnome.org>
5953 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5954 name can't be found in the `defined_names' - the caller will do a
5955 MemberLookup in this case and thus find methods in System.Enum
5956 such as Enum.IsDefined().
5958 2002-06-08 Martin Baulig <martin@gnome.org>
5960 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5961 Convert.ChangeType() which works with TypeBuilder created types.
5962 (Enum.LookupEnumValue, Enum.Define): Use it here.
5964 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5965 `TypeBuilder.BaseType != null' check.
5966 (TypeContainer.FindMembers): Only lookup parent members if we
5967 actually have a parent.
5968 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5969 (ConstructorInitializer.Resolve): Likewise.
5971 * interface.cs (Interface.FindMembers): Added
5972 `TypeBuilder.BaseType != null' check.
5974 * rootcontext.cs (RootContext.ResolveCore): Added
5975 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5976 classes_second_stage.
5978 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5979 debug_type and trace_type when compiling with --nostdlib.
5981 2002-06-07 Martin Baulig <martin@gnome.org>
5983 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5984 (AddField): Set it to true when adding a non-static field.
5985 (DefineType): Use `have_nonstatic_fields' to find out whether we
5986 have non-static fields, not `Fields != null'.
5988 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5990 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5991 dereferencing a null on the static-field code path)
5993 2002-05-30 Martin Baulig <martin@gnome.org>
5995 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5996 to take command line arguments. Use reflection to call the new
5997 custom `Initialize' function on the symbol writer and pass it the
5998 command line arguments.
6000 * driver.cs (--debug-args): New command line argument to pass command
6001 line arguments to the symbol writer.
6003 2002-05-28 Miguel de Icaza <miguel@ximian.com>
6005 * assign.cs (DoResolve): Forgot to do the implicit conversion to
6006 the target type for indexers and properties. Thanks to Joe for
6009 2002-05-27 Miguel de Icaza <miguel@ximian.com>
6011 * typemanager.cs (MethodFlags): returns the method flags
6012 (Obsolete/ShouldIgnore) that control warning emission and whether
6013 the invocation should be made, or ignored.
6015 * expression.cs (Invocation.Emit): Remove previous hack, we should
6016 not do this on matching a base type, we should do this based on an attribute
6018 Only emit calls to System.Diagnostics.Debug and
6019 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
6020 on the command line.
6022 * rootcontext.cs: Global settings for tracing and debugging.
6024 * cs-tokenizer.cs (define): New utility function to track
6025 defines. Set the global settings for TRACE and DEBUG if found.
6027 2002-05-25 Ravi Pratap <ravi@ximian.com>
6029 * interface.cs (Populate*): Pass in the TypeContainer as well as
6030 the DeclSpace as parameters so that we can create EmitContexts and
6031 then use that to apply attributes etc.
6033 (PopulateMethod, PopulateEvent, PopulateProperty)
6034 (PopulateIndexer): Apply attributes everywhere.
6036 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6039 (ApplyAttributes): Update accordingly.
6041 We now apply interface attributes for all members too.
6043 2002-05-26 Miguel de Icaza <miguel@ximian.com>
6045 * class.cs (Indexer.Define); Correctly check if we are explicit
6046 implementation (instead of checking the Name for a ".", we
6047 directly look up if the InterfaceType was specified).
6049 Delay the creation of the PropertyBuilder.
6051 Only create the PropertyBuilder if we are not an explicit
6052 interface implementation. This means that explicit interface
6053 implementation members do not participate in regular function
6054 lookups, and hence fixes another major ambiguity problem in
6055 overload resolution (that was the visible effect).
6057 (DefineMethod): Return whether we are doing an interface
6060 * typemanager.cs: Temporary hack until we get attributes in
6061 interfaces (Ravi is working on that) and we get IndexerName
6062 support in interfaces.
6064 * interface.cs: Register the indexers as properties.
6066 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
6067 warning, I have verified that this is a bug in the .NET runtime
6068 (JavaScript suffers of the same problem).
6070 * typemanager.cs (MemberLookup): When looking up members for
6071 interfaces, the parent of an interface is the implicit
6072 System.Object (so we succeed in searches of Object methods in an
6073 interface method invocation. Example: IEnumerable x; x.ToString
6076 2002-05-25 Miguel de Icaza <miguel@ximian.com>
6078 * class.cs (Event): Events should also register if they do
6079 implement the methods that an interface requires.
6081 * typemanager.cs (MemberLookup); use the new GetInterfaces
6084 (GetInterfaces): The code used to lookup interfaces for a type is
6085 used in more than one place, factor it here.
6087 * driver.cs: Track the errors at the bottom of the file, we kept
6090 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
6091 instance if the method we are calling is static!
6093 2002-05-24 Miguel de Icaza <miguel@ximian.com>
6095 * attribute.cs (ApplyAttributes): Make this function filter out
6096 the IndexerName attribute (as that attribute in reality is never
6097 applied) and return the string constant for the IndexerName
6100 * class.cs (TypeContainer.Emit): Validate that all the indexers
6101 have the same IndexerName attribute, and if so, set the
6102 DefaultName attribute on the class.
6104 * typemanager.cs: The return value might contain other stuff (not
6105 only methods). For instance, consider a method with an "Item"
6106 property and an Item method.
6108 * class.cs: If there is a problem with the parameter types,
6111 2002-05-24 Ravi Pratap <ravi@ximian.com>
6113 * ecore.cs (ImplicitConversionExists): Wrapper function which also
6114 looks at user defined conversion after making a call to
6115 StandardConversionExists - we need this for overload resolution.
6117 * expression.cs : Update accordingly the various method calls.
6119 This fixes 2 bugs filed against implicit user defined conversions
6121 2002-05-22 Miguel de Icaza <miguel@ximian.com>
6123 * statement.cs: Track the result of the assignment.
6125 2002-05-21 Miguel de Icaza <miguel@ximian.com>
6127 * expression.cs (MemberAccess): Improved error reporting for
6128 inaccessible members.
6130 2002-05-22 Martin Baulig <martin@gnome.org>
6132 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
6133 itself with debugging support.
6135 2002-05-22 Martin Baulig <martin@gnome.org>
6137 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6138 Removed, this isn't needed anymore.
6140 2002-05-20 Martin Baulig <martin@gnome.org>
6142 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6143 be underlying type for an enum.
6145 2002-05-20 Miguel de Icaza <miguel@ximian.com>
6147 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6148 that splits out the loading of just the core types.
6150 * rootcontext.cs (ResolveCore): Split the struct resolution in
6151 two, so we can load the enumeration underlying types before any
6154 * expression.cs (Is): Bandaid until we fix properly Switch (see
6155 bug #24985 for details).
6157 * typemanager.cs (ImplementsInterface): The hashtable will contain
6158 a null if there are no interfaces implemented.
6160 2002-05-18 Miguel de Icaza <miguel@ximian.com>
6162 * cs-parser.jay (indexer_declarator): It is fine to have array
6165 2002-05-17 Miguel de Icaza <miguel@ximian.com>
6167 * typemanager.cs: (RegisterBuilder): New function used to register
6168 TypeBuilders that implement interfaces. Since
6169 TypeBuilder.GetInterfaces (as usual) does not work with lame
6171 (AddUserType): register interfaces.
6173 (ImplementsInterface): Use the builder_to_ifaces hash if we are
6174 dealing with TypeBuilder. Also, arrays are showing up as
6175 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6176 methods can not be invoked on them!
6178 * ecore.cs (ExplicitReferenceConversionExists): Made public.
6179 (ImplicitReferenceConversionExists): Split out from
6180 StandardConversionExists.
6182 * expression.cs (As): We were only implementing one of the three
6183 cases for the as operator. We now implement them all.
6184 (Is): Implement the various other cases for Is as well.
6186 * typemanager.cs (CACHE): New define used to control if we want or
6187 not the FindMembers cache. Seems to have a negative impact on
6188 performance currently
6190 (MemberLookup): Nested types have full acess to
6191 enclosing type members
6193 Remove code that coped with instance/static returns for events, we
6194 now catch this in RealFindMembers.
6196 (RealFindMembers): only perform static lookup if the instance
6197 lookup did not return a type or an event.
6199 2002-05-17 Miguel de Icaza <miguel@ximian.com>
6201 * assign.cs (CompoundAssign): We pass more semantic information
6202 now to Compound Assignments than we did before: now we have all
6203 the information at hand, and now we resolve the target *before* we
6204 do the expression expansion, which allows the "CacheValue" method
6205 to have the effect we intended (before, a [x] += 1 would generate
6206 two differen ArrayAccess expressions from the ElementAccess,
6207 during the resolution process).
6209 (CompoundAssign.DoResolve): Resolve target and original_source here.
6211 2002-05-16 Miguel de Icaza <miguel@ximian.com>
6213 * expression.cs (ArrayAccess): dropped debugging information.
6215 * typemanager.cs: Small bug fix: I was always returning i_members,
6216 instead of one of i_members or s_members (depending on which had
6219 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
6220 method is invoked before any code generation takes place, and it
6221 is a mechanism to inform that the expression will be invoked more
6222 than once, and that the method should use temporary values to
6223 avoid having side effects
6225 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6227 * ecore.cs (Expression.CacheTemporaries): Provide empty default
6230 * expression.cs (Indirection, ArrayAccess): Add support for
6231 CacheTemporaries in these two bad boys.
6233 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6235 (StoreFromPtr): Handle stobj as well.
6237 * expression.cs (UnaryMutator): Share more code.
6239 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6240 down: I was not tracking the Filter function as well, which
6241 was affecting the results of the cache.
6243 2002-05-15 Miguel de Icaza <miguel@ximian.com>
6245 * attribute.cs: Remove the hack to handle the CharSet property on
6248 2002-05-14 Miguel de Icaza <miguel@ximian.com>
6250 * attribute.cs (DoResolve): More uglyness, we now only try to
6251 resolve the attribute partially, to extract the CharSet
6252 information (only if we are a StructLayout attribute). Otherwise
6254 (GetExtraTypeInfo): Add some code to conditionally kill in the
6255 future this. I am more and more convinced that the .NET
6256 framework has special code to handle the attribute setting on
6259 * expression.cs (IsParamsMethodApplicable): Revert my previous
6260 foreach change here, it was wrong.
6262 2002-05-13 Miguel de Icaza <miguel@ximian.com>
6264 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6265 (pp_expr): do not abort on unknown input, just return.
6266 (eval): abort if there are pending chars.
6268 * attribute.cs (Attribute.Resolve): Positional parameters are
6269 optional. Deal with that case.
6271 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6272 the Ansi/Unicode/Auto information for the type.
6274 (TypeContainer.DefineType): instantiate the EmitContext here, as
6275 we will be using it during the type definition (to resolve
6276 attributes) and during the emit phase.
6278 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6279 to pull type information out of the attributes
6281 (Attribute.Resolve): track the constructor builder, and allow for
6282 multiple invocations (structs and classes will use this).
6284 * ecore.cs (MemberLookupFinal): new version with all the
6285 parameters customizable.
6287 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6288 constructors. Return if the result value is null (as the error
6289 would have been flagged already by MemberLookupFinal)
6291 Do not allow instances of abstract classes or interfaces to be
6294 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6295 We have to compare the assembly property here when dealing with
6296 FamANDAssem and Assembly access modifiers, because we might be
6297 creating an assembly from *modules* (that means that we are not
6298 getting TypeBuilders for types defined in other modules that are
6299 part of this assembly).
6301 (Method.Emit): If the method is marked abstract and has a body,
6304 (TypeContainer.DefineMembers): If both the defined member and the
6305 parent name match are methods, then do not emit any warnings: let
6306 the Method.Define routine take care of flagging warnings. But if
6307 there is a mismatch (method overrides something else, or method is
6308 overriwritten by something, then emit warning).
6310 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6311 set to null, this means `do not check for the return type on the
6314 (Method.Define): set the return type for the method signature to
6315 null, so that we get methods with the same name and parameters and
6316 different return types. This is used to flag warning 114 (you are
6317 hiding a method, and you probably want to use the new/override
6320 * typemanager.cs (MemberLookup): Implemented proper access
6321 control, closing a long standing set of bug reports. The problem
6322 was that the Framework only has two bits: Public and NonPublic,
6323 and NonPublic includes private and protected methods, but we need
6324 to enforce the FamANDAssem, FamOrAssem and Family.
6326 2002-05-11 Miguel de Icaza <miguel@ximian.com>
6328 * statement.cs (GotoCase): Return true: Ammounts to giving up
6329 knowledge on whether we return or not, and letting the other case
6330 be responsible for it.
6332 2002-05-10 Miguel de Icaza <miguel@ximian.com>
6334 * driver.cs: Do not load directories for each file processed, only
6335 do it if there is a pattern.
6337 * ecore.cs: Report readonly assigns here as well, as we might have
6338 been resolved only by MemberAccess.
6340 (SimpleName.SimpleNameResolve): Also be useful for LValue
6341 resolution. We need this to propagate assign to local readonly variables
6343 * typemanager.cs: Use a ptrhashtable for the criteria, because we
6344 do not want to reuse potential criteria memory.
6346 * class.cs (MyEventBuilder): Set reflected_type;
6348 * ecore.cs (Constantify): Added support for constifying bools.
6350 (RootContext.LookupType): Added a cache for values looked up in
6351 the declaration space.
6353 * typemanager.cs (FindMembers): Now is a front-end to
6354 RealFindMembers, and provides a two-level hashtable-based cache to
6357 15% performance improvement: from 22.5 to 19.2 seconds.
6359 * expression.cs (IsParamsMethodApplicable): use foreach.
6360 (Invocation.DoResolve): ditto.
6361 (New.DoResolve): ditto.
6362 (ArrayCreation.DoResolve): ditto.
6364 * ecore.cs (FindMostEncompassingType): use foreach.
6366 * delegate.cs (NewDelegate.DoResolve): Use foreach
6368 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6369 (RemoveMethods): use foreach.
6371 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6372 nested foreach statements instead of for, and also break out of
6373 the inner loop once a match is found.
6375 (Invocation.OverloadResolve): Use foreach, simplify the code.
6377 2002-05-08 Miguel de Icaza <miguel@ximian.com>
6379 * cfold.cs (BinaryFold): During an enumeration evaluation context,
6380 we actually unwrap the expression to allow for extra information
6383 * expression.cs: Use Shr_Un on unsigned operations.
6385 2002-05-08 Ravi Pratap <ravi@ximian.com>
6387 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
6388 applicable operators was not being considered correctly. This closes
6389 the bug Miguel reported.
6391 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6393 * attribute.cs: check that the type derives from System.Attribute
6394 and report the correct error in that case (moved the duplicate code to
6395 its own method, too).
6397 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6399 * attribute.cs: lookup attribute type name as the spec says: first the
6400 bare attribute name and then name + "Attribute" (nant compiles with
6401 mcs after this fix).
6403 2002-05-07 Miguel de Icaza <miguel@ximian.com>
6405 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
6406 Because of the way we parse things, we should try to see if a
6407 UIntConstant can fit in an integer.
6409 2002-05-07 Ravi Pratap <ravi@ximian.com>
6411 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6412 when we are in an explicit context.
6414 (ConvertReferenceExplicit): When converting from Iface type S to Class
6415 T make sure the rules are implemented as an OR.
6417 * parameter.cs (ParameterType): Make it a property for now although the
6418 purpose really isn't anything immediate.
6420 * expression.cs (Is*Applicable): Do better checking on the parameter type
6421 of a ref/out parameter. The ones from the system assemblies are already
6422 marked with the correct type so we don't need to do any correction.
6424 * ecore.cs (StandardConversionExists): Conversion from Interface types to
6425 the object type is standard too so include that.
6427 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6429 * ecore.cs (StandardConversionExists): Augment with missing code:
6430 deal with IntConstant, LongConstants and Enumerations.
6432 * assign.cs: Report the error, instead of failing silently
6434 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6435 typecontainer that they are declared, because the
6436 typecontainer/namespace will have the list of using clauses that
6439 Assembly Attributes were escaping the normal registration
6442 (EmitCode): Apply attributes within an EmitContext that represents
6443 the container they were declared on.
6445 * cs-parser.jay: Track bases for structs. How did I get this wrong?
6447 2002-05-06 Ravi Pratap <ravi@ximian.com>
6449 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6450 Revamp completely - make much cleaner as we now operate only
6453 (FindMostSpecificSource, FindMostSpecificTarget): New methods
6454 to implement the logic detailed in the spec more correctly.
6456 (UserDefinedConversion): Update accordingly.
6458 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6460 * statement.cs: Return flow analysis information up.
6462 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6465 (token): Do not consume an extra character before calling
6468 2002-05-06 Piers Haken <piersh@friskit.com>
6470 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6472 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6474 * class.cs (Constructor.Emit): Set the IsStatic flag in the
6475 EmitContext during the instance constructor initializer
6476 resolution, to stop access to instance variables.
6478 This is mandated by the spec, last paragraph of the `constructor
6479 initializers' section.
6481 2002-05-05 Miguel de Icaza <miguel@ximian.com>
6483 * cs-parser.jay, class.cs (Accessor): new class used to represent
6484 an accessor (get or set). In the past we used `null' to represent
6485 a missing accessor. But this is ambiguous because there was no
6486 way to tell in abstract indexers/properties if one of them was
6489 Now there is a way of addressing that.
6491 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6492 instead of FindMembers.
6494 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6495 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6497 * attribute.cs: Treat indexers and properties as the same in terms
6498 of applying attributes
6500 * ecore.cs (FindMostEncompassedType): Use statically initialized
6501 EmptyExpressions()s like we do elsewhere to avoid creating useless
6502 objects (and we take this out of the tight loop).
6504 (GetConversionOperators): Move the code to extract the actual
6505 operators to a separate routine to clean things up.
6507 2002-05-04 Miguel de Icaza <miguel@ximian.com>
6509 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6510 events are always registered FieldBuilders.
6512 * class.cs (FieldBase): New class shared by Fields
6514 * delegate.cs: If we are a toplevel delegate, use our full name.
6515 If we are a nested delegate, then only use our tail name.
6517 2002-05-02 Ravi Pratap <ravi@ximian.com>
6519 * expression.cs (IsApplicable): Ensure that we add the "&" to
6520 ref/out types before comparing it with the type of the argument.
6522 (IsParamsMethodApplicable): Ditto.
6524 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
6527 * delegate.cs : Handle the case when we have more than one applicable
6528 method. Flag an error only when we finish checking all.
6530 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6532 * expression.cs: Add support for boolean static initializers.
6534 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6536 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6538 * parameter.cs (ComputeParameterTypes,
6539 ComputeAndDefineParameterTypes): Better error handling: now we
6540 clear the `types' cache if we fail during any of the type lookups.
6541 We also return the status code correctly to our caller
6543 * delegate.cs: If we fail to define a delegate, abort the extra
6546 * expression.cs (Binary.ResolveOperator): for
6547 operator==(object,object) and operator !=(object, object) we also
6548 have to verify that there is an implicit conversion from one to
6551 (ArrayAccess.DoResolve): Array Access can operate on
6554 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6556 * assign.cs (CompoundAssign): A new class used as a "flag" that
6557 the assignment actually is happening as part of a compound
6558 assignment operator.
6560 During compound assignment, a few new rules exist to enable things
6567 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6568 to the type of x) if y is implicitly convertible to the type of x,
6569 and the operator is a builtin operator and the return type of the
6570 operator is explicitly convertible to the type of x.
6572 * rootcontext.cs: Reset warning level to 2. 4 catches various
6573 "interesting" features in mcs, we must clean this up at some
6574 point, but currently am trying to kill other bugs ;-)
6576 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6577 in container classes as well.
6579 * expression.cs (Binary.ResolveOperator): Handle string case
6580 before anything else (as operator overloading does emit an error
6581 before doing anything else).
6583 This code could go away when we move to a table driven model, but
6584 i could not come up with a good plan last night.
6586 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6588 * typemanager.cs (CSharpName): reimplementation using regex.
6589 * class.cs: added null check for fields in Emit
6590 * rootcontext.cs: set warninglevel to 4
6592 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6594 * typemanager.cs (CSharpName): reimplemented with Lupus
6597 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6599 * statement.cs (If): correclty implement Resolve, because we were
6600 not catching sem errors in there. The same process is needed
6602 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6605 (Statement.Warning_DeadCodeFound): Factorize code.
6606 (While): Report dead code here too.
6608 (Statement): Added Resolve virtual method to allow
6609 for resolution split from the emit code.
6611 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6613 * statement.cs (EmitBoolExpression): No longer try to resolve the
6615 (MakeBoolean): New utility function that resolve, implicitly
6616 converts to boolean and tags the expression.
6619 (If, Do): Implement dead code elimination.
6620 (While): Implement loop inversion
6622 (Do, While, For, If): Resolve the expression prior to calling our
6625 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6628 - added method Report28 (warning: program has more than one entry point)
6629 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6630 - modified method Method.Define, the part at the end of the method
6632 * rootcontext.cs: added static public Location EntryPointLocation;
6634 * ../errors/cs0028.cs : Add test case for the above warning.
6637 - modified method CSharpName to allow arrays of primitive type to
6638 be printed nicely (e.g. instead of System.Int32[][] it now prints
6640 - added method CSharpSignature: returns the signature of a method
6641 in string format to be used in reporting errors, warnings, etc.
6643 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6646 2002-04-26 Ravi Pratap <ravi@ximian.com>
6648 * delegate.cs (Define): Fix extremely silly bug where I was
6649 setting the type of the 'object' parameter of the BeginInvoke
6650 method to System.IAsyncResult instead of System.Object ;-)
6652 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6654 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6657 (Constructor.Emit): return if we fail to initialize the
6658 constructor. Another door closed!
6660 * expression.cs (New.DoResolve): Improve error message (from -6 to
6661 1501). Use DeclaredOnly lookup to find the exact constructor.
6663 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6664 loop. This is useful.
6666 * cs-parser.jay: Adjust the default parameters so that destructors
6667 have the proper signature.
6669 2002-04-26 Martin Baulig <martin@gnome.org>
6671 * driver.cs (LoadAssembly): If `assembly' contains any characters
6672 which are only valid in path names and not in assembly names
6673 (currently slash, backslash and point), use Assembly.LoadFrom ()
6674 instead of Assembly.Load () on the `assembly' (before iteration
6675 over the link_paths).
6677 2002-04-26 Martin Baulig <martin@gnome.org>
6679 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6681 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6683 * class.cs (Property): use the new typemanager.MemberLookup
6685 (TypeContainer.MemberLookup): Implement using the
6686 TypeManager.MemberLookup now.
6688 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6689 and return MemberInfos, so that these can be used without an
6690 EmitContext (what we had before).
6692 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6694 * expression.cs: Fix the case where the argument to params if the
6695 type of the params. I omitted handling this before. Fixed
6697 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6699 * driver.cs: Call BootCorlib_PopulateCoreType
6701 * class.cs (Property.CheckBase): Check for properties only, not
6704 * interface.cs: Temporary hack: try/catch around the
6705 CustomAttributeBuilder, because I am getting an exception that I
6708 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6709 types whose definitions are required to be there (attributes are
6710 defined before standard types).
6712 Compute definitions as we boot the various types, as they are used
6713 immediately (value_type class will need object_type, but if we do
6714 not initialize object_type, we will pass a null, which will let
6715 the runtime pick the System.Object from the existing corlib, which
6716 is not what we want).
6718 2002-04-22 Patrik Torstensson <totte@labs2.com>
6720 * cs-tokenizer.cs: fixed a number of trim() issues.
6722 2002-04-22 Ravi Pratap <ravi@ximian.com>
6724 * expression.cs (Argument.Type): Ensure that we return the correct
6725 type when we have out or ref parameters [in which case we
6728 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6730 * class.cs (Property, Indexer): Allow extern modifier in there.
6732 * typemanager.cs (InitBaseTypes): Initializes object_type and
6733 value_type, since those will be used early on during the bootstrap
6734 process to compile corlib.
6736 (InitCoreTypes): Move code from here to InitBaseTypes.
6738 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6740 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6741 single-dimension arrays as using the ldlen opcode.
6743 Daniel Lewis discovered this optimization.
6745 * typemanager.cs: Add signature for System.Array::get_Length
6747 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6749 * statement.cs: report the error when the foreach does not apply to an
6750 array nor a collection.
6752 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6754 * expression.cs: Add implicit conversions to the operator ~.
6756 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6758 * typemanager.cs: Locate the decimal constructor.
6760 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6762 * attribute.cs: use the new property of TypeOf.
6763 * expression.cs: added 'get' property around typearg.
6765 These changes fix a build breaker reported by NickD. Is this the
6766 correct way to fix? If not, please, revert my changes and make it
6769 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6771 * attribute.cs: Add support for typeof in attribute invocations.
6772 I am not sure that this is right though.
6774 2002-04-14 Duncan Mak <duncan@ximian.com>
6776 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6777 Binary.Operator.Division case.
6779 2002-04-13 Ravi Pratap <ravi@ximian.com>
6781 * class.cs (DefineType): Ensure that we do a proper check on
6782 attribute types and also register it with the TypeManager.
6784 (TypeContainer.Targets): The default for attribute types is
6785 AttributeTargets.All.
6787 * attribute.cs (ApplyAttributes): Registering the attribute type
6788 is done elsewhere, not when we discover we have a Usage attribute.
6790 2002-04-12 Ravi Pratap <ravi@ximian.com>
6792 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6793 and get rid of is_delegate parameter.
6795 * everywhere : update.
6797 2002-04-12 Ravi Pratap <ravi@ximian.com>
6799 * cs-parser.jay (compilation_unit): Revamp completely to use
6800 some new ideas that I got from Rhys' grammar to solve the problems
6801 with assembly level attributes.
6803 (outer_declaration): New grammar production.
6805 (attribute_sections): Add.
6807 (opt_attributes): Base on attribute_sections
6809 (namespace_declaration): Allow opt_attributes to tackle the case
6810 when we have assembly level attributes - we are clever in this
6813 * attribute.cs (ApplyAttributes): Do not worry about assembly
6814 attributes in the non-global context.
6816 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6817 instead of SetGlobalAttributes.
6819 * class.cs, rootcontext.cs : Ensure we define and generate
6820 attribute types before anything else.
6822 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6823 and flag the new error -20 for the case when the attribute type
6824 does not have valid targets specified. csc does not catch this.
6826 * ../errors/errors.txt : update for error # -20
6828 2002-04-11 Ravi Pratap <ravi@ximian.com>
6830 * support.cs (InternalParameters.ParameterModifier): Do some null
6831 checking and return sane values.
6833 * class.cs (Method.Define): If we are a PInvoke method, ensure
6834 that we are static and extern. Report error # 601
6836 * ../errors/cs0601.cs : Add test case for the above error.
6838 2002-04-07 Ravi Pratap <ravi@ximian.com>
6840 * rootcontext.cs (attribute_types): We need to keep type of
6841 all attribute types separately and emit code for them first.
6843 (RegisterAttribute) : Implement.
6845 * class.cs (DefineType): Check if the current Type is a custom
6846 attribute type and register it accordingly.
6848 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6849 adding the first attribute twice and rename to
6851 (SetGlobalAttributes): this.
6853 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6856 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6857 if we are processing global arguments. Hmm, I am unsure of this.
6859 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6861 * expression.cs: added static array of strings to avoid calling
6862 Enum.ToString () for Operator in Binary. Significant recover of
6865 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6867 * class.cs (FindMembers): Allow the Builders of the various
6868 members to be null. If they are skip them. This only happens
6869 during the PInvoke declaration.
6871 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6873 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6874 failure, so we do not keep going afterwards.
6876 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6877 wanted to pass `false' as the `is_delegate' argument. If this is
6878 the case, why not use delegate_type == null to mean `is_delegate =
6879 false' and anything else as is_delegate = true.
6881 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6883 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6884 code for the section, not the beginning of the tests.
6886 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6888 * cfold.cs: Handle operator + (Enum x, Underlying x)
6890 * expression.cs (Binary): same. Warn about errors where we have
6891 Enum/Enum in operator + as well.
6893 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6896 - added support for switch(bool)
6897 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6898 - add TableSwitchEmit() to handle table-based switch statements
6900 2002-04-05 Ravi Pratap <ravi@ximian.com>
6902 * expression.cs (Invocation.OverloadResolve): Factor out code which
6903 does parameter compatibility checking with arguments so that we can
6904 re-use the code even from Delegate.VerifyApplicability
6906 (VerifyArgumentsCompat): Move above code here.
6908 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6909 and instead make a call to the above method.
6911 2002-03-31 Ravi Pratap <ravi@ximian.com>
6913 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6914 We use it to keep track of classes which are attribute types.
6916 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6918 * delegate.cs (Delegate.Define): Correctly define the types in the
6919 presence of fixed and array parameters.
6921 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6924 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6925 include NonPublic after the first iteration.
6927 * class.cs (Indexer.CheckBase): Only check if both parents are
6930 * cs-parser.jay (accessor_body): If empty, set to null.
6932 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6933 same code path here to resolve constants names that we did have in
6934 MemberAccess.DoResolve. There is too much code duplicated here.
6936 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6938 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6940 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6943 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6944 tokens, numbers and strings.
6946 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6949 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6950 asyncronous parameters and the regular parameters.
6952 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6953 specify the target directory.
6955 * expression.cs: (This.DoResolve): Simplify
6956 (As.Emit): Optimize, do not generate IsInst if the expression is
6957 always of the given type.
6959 (Is.DoResolve): Bug fix, we were reporting both always/never for
6962 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6963 creating too many unnecessary arrays.
6965 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6967 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6968 fields instead of rolling our own initializer. Takes care of all
6969 implicit conversions, and drops unnecessary static checks/argument.
6971 2002-03-31 Dick Porter <dick@ximian.com>
6973 * driver.cs: use the GetDirectories() return values properly, and
6974 use "/" as path separator.
6976 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6978 * expression.cs (Unary): Optimize - - expr into expr.
6979 (Binary): Optimize a + (-b) into a -b.
6981 * codegen.cs (CodeGen): Made all methods static.
6983 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6987 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6988 TypeBuilder property.
6990 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6993 * tree.cs: Removed the various RecordXXXX, and replaced with a
6994 single RecordDecl. Removed all the accessor methods, and just
6995 left a single access point Type
6997 * enum.cs: Rename DefineEnum to DefineType.
6999 * decl.cs: New abstract method `DefineType' used to unify the
7000 Defines for Enumerations, Interfaces, TypeContainers and
7003 (FindType): Moved LookupInterfaceOrClass here. Moved the
7004 LookupBaseClasses method that used to live in class.cs and
7005 interface.cs here, and renamed to FindType.
7007 * delegate.cs: Implement DefineType. Take advantage of the
7008 refactored pattern for locating the parent builder without taking
7009 the parent_builder argument (which we know does not work if we are
7010 nested, and triggering a toplevel definition).
7012 2002-03-28 Miguel de Icaza <miguel@ximian.com>
7014 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
7015 accessibility of a member has changed during override and report
7018 * class.cs (Method.Define, Property.Define): Only complain on
7019 overrides if the method is private, any other accessibility is
7020 fine (and since we just checked the permission is the same, we are
7023 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7024 and elif are processed always. The other pre-processing
7025 directives are only processed if we are "taking" the path
7027 2002-03-29 Martin Baulig <martin@gnome.org>
7029 * class.cs (Method.Emit): Only emit symbolic debugging info if the
7030 current location is not Null.
7032 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7033 a separate method so we can profile it.
7035 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7036 `span.Seconds' are just seconds, but no minutes or hours.
7037 (MainDriver): Profile the CodeGen.SaveSymbols calls.
7039 2002-03-28 Miguel de Icaza <miguel@ximian.com>
7041 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7042 Remove the gratuitous set of Final:
7044 // If an interface implementation, then we can set Final.
7045 if (((flags & MethodAttributes.Abstract) == 0) &&
7046 implementing.DeclaringType.IsInterface)
7047 flags |= MethodAttributes.Final;
7049 I do not know what I was smoking when I used that.
7052 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
7053 step into fixing the name resolution issues for delegates and
7054 unifying the toplevel name resolution.
7056 2002-03-28 Martin Baulig <martin@gnome.org>
7058 * class.cs (Method.Emit): If we have a symbol writer, call its
7059 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
7060 tell it about the current method.
7062 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
7063 writer that we're going to emit the first byte of IL code for a new
7064 statement (a new source line).
7065 (EmitContext.EmitTopBlock): If we have a symbol writer, call
7066 EmitContext.Mark() before emitting any code.
7068 * location.cs (SymbolDocument): Return null when we're Null.
7070 * statement.cs (Statement): Moved the `Location loc' variable here.
7071 (Statement.EmitBoolExpression): If we have a symbol writer, call
7072 ec.Mark() before emitting any code to tell it that we're at the
7073 beginning of a new statement.
7074 (StatementExpression): Added `Location' argument to the constructor.
7075 (Block): Added public readonly variable `StartLocation' and public
7076 variable `EndLocation'. The latter is to be set using SetEndLocation().
7077 (Block): Added constructor which takes a start and end location.
7078 (Block.SetEndLocation): New method. This sets the end location.
7079 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
7080 local variables we create.
7081 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
7082 each statement and do also mark the begin and end of the block.
7084 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
7085 tell it the current lexer.Location, use Location.Null for the end of the
7087 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
7088 current block, set its end location using SetEndLocation().
7089 (statement_expression): StatementExpression constructor now takes the
7090 lexer.Location as additional argument.
7091 (for_statement, declare_local_variables): Likewise.
7092 (declare_local_variables): When creating a new implicit block, use the
7093 new Block constructor and pass it the lexer.Location.
7095 2002-03-28 Miguel de Icaza <miguel@ximian.com>
7097 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
7098 members also on the parent interfaces recursively.
7100 2002-03-27 Miguel de Icaza <miguel@ximian.com>
7102 * report.cs: Use new formats, since Gonzalo finished the missing
7105 * expression.cs (Binary.ResolveOperator): added missing operator|
7106 operator& and operator^ for bool/bool.
7108 * cs-parser.jay: CheckDef now takes a Location argument that is
7109 used to report errors more precisly (instead of reporting the end
7110 of a definition, we try to track something which is a lot closer
7111 to the source of the problem).
7113 * cs-tokenizer.cs: Track global token use, so we can properly flag
7114 the use of #define/#undef after the first token has been seen.
7116 Also, rename the reportXXXX to Error_DescriptiveName
7118 * decl.cs (DeclSpace.IsTopLevel): Move property here from
7119 TypeContainer, so that Enum and Interface can use this too.
7121 * class.cs (TypeContainer.LookupInterfaceOrClass,
7122 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7123 `builder' argument. Typically this was used to pass the parent
7124 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7127 The problem is that a nested class could trigger the definition of
7128 a toplevel class, and the builder would be obviously wrong in that
7131 So we drop this argument, and we compute dynamically the
7132 TypeBuilder/ModuleBuilder (the correct information was available
7133 to us anyways from DeclSpace.Parent)
7135 * interface.cs (Interface.DefineInterface): Drop builder
7136 parameter cleanup like class.cs
7138 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
7141 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7144 (Try.Emit): Propagate the returns value from the statement.
7146 (Return.Emit): Even if we are leavning
7148 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7150 * modifiers.cs: Fix the computation of MethodAttributes flags.
7152 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7154 * driver.cs: allow compilation of files that start with '/'.
7155 Add a default case when checking the argument of --target.
7157 2002-03-25 Miguel de Icaza <miguel@ximian.com>
7159 * interface.cs: Implement the same search algorithm for types in
7162 * delegate.cs: Do not allow multiple definition.
7164 * Recovered ChangeLog that got accidentally amputated
7166 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7168 * rootcontext.cs: Load manually enum to allow core classes to
7169 contain enumerations.
7171 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7172 Update to new static methods in TypeManager.
7174 * typemanager.cs (GetMethod, GetConstructor): Use our
7175 implementation of FindMembers to find the members, since during
7176 corlib compilation, the types are TypeBuilders and GetMethod and
7177 GetConstructor do not work.
7179 Make all methods in TypeManager static.
7181 (InitCodeHelpers): Split the functionality from
7182 the InitCodeTypes function.
7184 * driver.cs: Call InitCodeHelpers after we have populated the
7187 * cs-parser.jay (delegate_declaration): we did not used to compute
7188 the delegate name correctly for void delegates.
7190 2002-03-24 Miguel de Icaza <miguel@ximian.com>
7192 * rootcontext.cs (RootContext): Init the interface_resolve_order
7193 and type_container_resolve_order always.
7195 (ResolveCore, BootstrapCorlib_ResolveClass,
7196 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7197 compiler when compiling with --nostdlib
7199 * class.cs (TypeContainer.DefineType): Check that our parent is
7200 not null. This test is most important when we are bootstraping
7203 * codegen.cs: Split out the symbol writing code.
7205 2002-03-25 Martin Baulig <martin@gnome.org>
7207 * driver.cs (-g): Made -g an alias for --debug.
7209 2002-03-24 Martin Baulig <martin@gnome.org>
7211 * codegen.cs (SymbolWriter): New public variable. Returns the
7212 current symbol writer.
7213 (CodeGen): Added `bool want_debugging_support' argument to the
7214 constructor. If true, tell the ModuleBuild that we want debugging
7215 support and ask it for the ISymbolWriter.
7216 (Save): If we have a symbol writer, call it's Close() method after
7217 saving the assembly.
7219 * driver.c (--debug): New command line argument to create a
7220 debugger information file.
7222 * location.cs (SymbolDocument): New public property. Returns an
7223 ISymbolDocumentWriter object for the current source file or null
7224 if we don't have a symbol writer.
7226 2002-03-21 Miguel de Icaza <miguel@ximian.com>
7228 * driver.cs (LoadAssembly): Correctly return when all the paths
7229 have been tried and not before.
7231 * statement.cs (Switch.Emit): return the actual coverage for this
7232 statement (returns/not-returns)
7234 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7235 switch of the statement if we are the last switch section. That
7236 kills two problems: try/catch problems (we used to emit an empty
7237 nop at the end) and switch statements where all branches would
7240 2002-03-19 Miguel de Icaza <miguel@ximian.com>
7242 * driver.cs: Add default assemblies (the equivalent to the
7243 Microsoft CSC.RSP file)
7245 * cs-tokenizer.cs: When updating `cols and setting it to zero,
7246 also update tokens_seen and set it to false.
7248 * driver.cs: Implement --recurse for Mike.
7250 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7251 correctly splitting out the paths.
7253 2002-03-18 Miguel de Icaza <miguel@ximian.com>
7255 * interface.cs (Interface.PopulateProperty): Instead of using
7256 `parent' as the declaration space for the set parameters, use
7259 * support.cs (InternalParameters): InternalParameters constructor
7260 takes a DeclSpace instead of a TypeContainer.
7262 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7263 types are being initialized, load the address of it before calling
7266 (New): Provide a mechanism to disable the generation of local
7267 value type temporaries when the caller will be providing us with
7268 an address to store it.
7270 (ArrayCreation.EmitDynamicInitializers): Use it.
7272 2002-03-17 Miguel de Icaza <miguel@ximian.com>
7274 * expression.cs (Invocation.EmitArguments): Only probe for array
7275 property if there is more than one argument. Sorry about that.
7277 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7280 * class.cs (Method.LabelParameters): Fix incorrect code path that
7281 prevented the `ParamArrayAttribute' from being applied to the
7284 2002-03-16 Miguel de Icaza <miguel@ximian.com>
7286 * support.cs (ReflectionParameters): Correctly compute whether the
7287 last argument is a params array. Fixes the problem with
7290 * typemanager.cs: Make the assemblies array always be non-null
7291 (empty, but non-null)
7293 * tree.cs (RecordDecl): New function that abstracts the recording
7294 of names. This reports error 101, and provides a pointer to the
7295 previous declaration. Fixes a crash in the compiler.
7297 * cs-parser.jay (constructor_declaration): Update to new grammar,
7298 and provide a constructor_body that can be empty.
7300 2002-03-15 Miguel de Icaza <miguel@ximian.com>
7302 * driver.cs: Add support for --resources.
7304 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7305 Make all types for the various array helper methods be integer.
7307 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7308 CheckState to ConvCast.
7310 (ConvCast): Now it takes a `checked' state argument, to avoid
7311 depending on the emit context for the conversion, and just using
7312 the resolve time setting.
7314 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7315 instead of Invocation.EmitArguments. We do not emit the original
7316 arguments, instead we emit those which have been converted to
7317 unsigned int expressions.
7319 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7321 * codegen.cs: ditto.
7323 * expression.cs (LocalVariableReference): Drop the use of the
7324 Store function that depended on the variable index.
7326 * statement.cs (VariableInfo): Drop the `Idx' property from this
7327 class, as this is not taking into account the indexes for
7328 temporaries tat we generate during the execution, getting the
7331 * class.cs: First emit class initializers, then call the parent
7334 * expression.cs (Binary): Fix opcode emision.
7335 (UnaryMutator.EmitCode): Support checked code generation
7337 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7338 matches for events for both the Static and Instance scans,
7339 pointing to the same element. Fix that.
7341 2002-03-14 Miguel de Icaza <miguel@ximian.com>
7343 * rootcontext.cs (ResolveTree): Always set the
7344 interface_resolve_order, because nested interfaces will be calling
7347 * class.cs (GetInterfaceOrClass): Track the same resolution
7348 process used by TypeManager.LookupType. This fixes the nested
7349 type lookups in class declarations (separate path from
7352 (TypeContainer.DefineType): Also define nested interfaces.
7353 (TypeContainer.RegisterOrder): New public function used to
7354 register the order in which child interfaces need to be closed.
7356 Nested interfaces need to be closed after their parents have been
7359 * interface.cs (InterfaceAttr): Put all the logic for computing
7360 the interface attribute here.
7362 (DefineInterface): Register our interface order with the
7363 RootContext or with the TypeContainer depending on the case.
7365 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7367 * cs-parser.jay: rework foreach statement to work with the new
7368 changes to the policy on SimpleNames.
7370 * report.cs: support Stacktrace on warnings as well.
7372 * makefile: drop --unsafe and /unsafe from the compile.
7374 2002-03-13 Ravi Pratap <ravi@ximian.com>
7376 * ecore.cs (StandardConversionExists): Modify to take an Expression
7377 as the first parameter. Ensure we do null -> reference type conversion
7380 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7381 temporary Expression objects.
7383 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7385 * interface.cs: workaround bug in method overloading resolution
7386 (there is already a bugzilla bug for it).
7388 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7390 We could also solve this problem by having a separate path for
7391 performing type lookups, instead of DoResolve, we could have a
7392 ResolveType entry point, and only participating pieces of the
7393 production (simplename, deref, array) would implement this.
7395 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7396 signal SimpleName to only resolve type names and not attempt to
7397 resolve anything else.
7399 * expression.cs (Cast): Set the flag.
7401 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7403 * class.cs: Only report 108 if there is no `new' modifier.
7405 * cs-parser.jay: rework foreach statement to work with the new
7406 changes to the policy on SimpleNames.
7408 * report.cs: support Stacktrace on warnings as well.
7410 * makefile: drop --unsafe and /unsafe from the compile.
7412 2002-03-11 Miguel de Icaza <miguel@ximian.com>
7414 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7415 lookups here, instead of doing that at parse time. This means
7416 that our grammar will not introduce `LocalVariableReferences' as
7417 expressions at this point. That solves the problem of code like
7425 This is only half the fix. The full fix requires parameters to
7426 also be handled in this way.
7428 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7429 makes the use more obvious of the DeclSpace. The
7430 ec.TypeContainer.TypeBuilder is now only used to pull the
7433 My theory is that I can get rid of the TypeBuilder completely from
7434 the EmitContext, and have typecasts where it is used (from
7435 DeclSpace to where it matters).
7437 The only pending problem is that the code that implements Aliases
7438 is on TypeContainer, and probably should go in DeclSpace.
7440 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7441 lookups here, instead of doing that at parse time. This means
7442 that our grammar will not introduce `LocalVariableReferences' as
7443 expressions at this point. That solves the problem of code like
7451 This is only half the fix. The full fix requires parameters to
7452 also be handled in this way.
7454 * class.cs (Property.DefineMethod): When implementing an interface
7455 method, set newslot, when implementing an abstract method, do not
7456 set the flag (before we tried never setting it, or always setting
7457 it, which is the difference).
7458 (Indexer.DefineMethod): same.
7459 (Method.DefineMethod): same.
7461 * ecore.cs: Only set the status used flag if we get back a Field.
7463 * attribute.cs: Temporary hack, so Paolo can keep working.
7465 2002-03-08 Ravi Pratap <ravi@ximian.com>
7467 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7468 the unmanaged type in the case we have a MarshalAs attribute.
7470 (Resolve): Handle the case when we are parsing the special MarshalAs
7471 attribute [we need to store the unmanaged type to use later]
7473 * typemanager.cs (marshal_as_attr_type): Built in type for the
7474 MarshalAs Attribute.
7476 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
7477 on parameters and accordingly set the marshalling info.
7479 2002-03-09 Miguel de Icaza <miguel@ximian.com>
7481 * class.cs: Optimizing slightly by removing redundant code after
7482 we switched to the `NoTypes' return value.
7483 (Property.DefineMethod): use NoTypes here too.
7485 This fixes the bug I introduced in my last batch of changes.
7487 2002-03-05 Ravi Pratap <ravi@ximian.com>
7489 * tree.cs (RecordEnum): Add. We now keep track of enums too.
7491 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7492 Enums since those are types too.
7494 * cs-parser.jay (enum_declaration): Record enums as we parse them.
7496 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
7497 thanks to a call during the lookup process.
7499 2002-03-07 Miguel de Icaza <miguel@ximian.com>
7501 * statement.cs (Foreach): Lots of work to accomodate a particular
7502 kind of foreach statement that I had not kept in mind. It is
7503 possible to have foreachs on classes that provide a GetEnumerator
7504 method that return objects that implement the "pattern" for using
7505 a foreach, there is no need to support GetEnumerator
7508 This is needed to compile nant.
7510 * decl.cs: Only report 114 if the member is not `Finalize' and if
7511 the warning level is at least 2.
7513 * class.cs: Moved the compare function from Method to
7516 (MethodSignature.InheritableMemberSignatureCompare): Add new
7517 filter function that is used to extract inheritable methods from a
7520 (Method.Define): Use the new `inheritable_method_signature_filter'
7523 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7526 2002-03-06 Miguel de Icaza <miguel@ximian.com>
7528 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7530 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7532 * expression.cs: Pass location information to
7533 ConvertImplicitStandard.
7535 * class.cs: Added debugging code to track return values from
7538 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7540 * expression.cs (Is.DoResolve): If either side of the `is' is an
7541 interface, do not flag the warning.
7543 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7546 * report.cs: Allow for --fatal to be used with --probe.
7548 * typemanager.cs (NoTypes): Move the definition for the empty Type
7551 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7553 (TypeContainer.DefineProxy): New function used to proxy to parent
7554 implementations when implementing interfaces.
7555 (TypeContainer.ParentImplements): used to lookup if our parent
7556 implements a public function that is required by an interface.
7557 (TypeContainer.VerifyPendingMethods): Hook this up.
7559 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7560 `modules' and `assemblies' arraylists into arrays. We only grow
7561 these are the very early start up of the program, so this improves
7562 the speedof LookupType (nicely measured).
7564 * expression.cs (MakeByteBlob): Replaced unsafe code with
7565 BitConverter, as suggested by Paolo.
7567 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7568 folding of string concatenation, but if either side is a string,
7569 and the other is not, then return null, and let the runtime use
7570 the concatenation on the string plus the object (using
7573 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7575 Constant Folding has been implemented now.
7577 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7578 the error instead on types that are not supported in one's
7581 * constant.cs (Constant and all children): New set of functions to
7582 perform implict and explicit conversions.
7584 * ecore.cs (EnumConstant): Implement the new functions to perform
7585 conversion by proxying to the child expression.
7587 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7588 own separate setting that can not be turned off from the command
7589 line using --unchecked or --checked and is only controlled using
7590 the checked/unchecked statements and expressions. This setting is
7591 used by the constant folder to flag errors.
7593 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7594 ConstantCheckState as well.
7596 During Resolve, they also have to flag the state, because the
7597 constant folder runs completely in the Resolve phase.
7599 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7602 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7604 * cfold.cs: New file, this file contains the constant folder.
7606 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7607 argument to track whether we are using the resulting address to
7608 load or store a value and provide better error messages.
7610 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7611 new AddressOf arguments.
7613 * statement.cs (Foreach.EmitCollectionForeach): Update
7615 * expression.cs (Argument.Emit): Call AddressOf with proper
7616 arguments to track usage.
7618 (New.DoEmit): Call AddressOf with new arguments.
7620 (Unary.Emit): Adjust AddressOf call.
7622 2002-03-01 Ravi Pratap <ravi@ximian.com>
7624 * cs-parser.jay (member_access): Change the case for pre-defined types
7625 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7628 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7631 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7632 essentially like methods and apply attributes like MethodImplOptions to them too.
7634 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7637 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7638 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7641 * Update code everywhere accordingly.
7643 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7645 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7647 2002-02-28 Ravi Pratap <ravi@ximian.com>
7649 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7650 try performing lookups against those instead of jumping straight into using
7651 the 'using' clauses.
7653 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7655 (LookupType): Perform lookups in implicit parents too.
7657 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7658 sequence as RootContext.LookupType.
7660 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7661 the various cases of namespace lookups into this method.
7663 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7665 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7666 in positional arguments)
7668 * class.cs (Operator): Update the AllowedModifiers to contain
7671 * cs-parser.jay: Update operator declaration to allow for the
7672 operator body to be empty.
7674 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7677 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7679 * class.cs (Method.Emit): Label parameters.
7681 * driver.cs: Return 1 or 0 as the program exit code.
7683 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7685 * expression.cs: Special case the `null' object when trying to
7686 auto-compute the type, as anything can be explicitly converted to
7689 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7690 spotting this Paolo.
7692 (Expression.ImplicitNumericConversion): Perform comparissions of
7693 the type using the underlying type in the case of an enumeration
7694 rather than using the enumeration type for the compare.
7696 Cope with the underlying == type case, which is not possible to
7699 (Expression.ConvertNumericExplicit): Perform comparissions of
7700 the type using the underlying type in the case of an enumeration
7701 rather than using the enumeration type for the compare.
7703 * driver.cs: If the user does not supply an extension, assume .exe
7705 * cs-parser.jay (if_statement): Rewrote so that we can track the
7706 location for the if statement.
7708 * expression.cs (Binary.ConstantFold): Only concat strings when
7709 the operation is "+", not everything ;-)
7711 * statement.cs (Statement.EmitBoolExpression): Take a location
7713 (If, While, Do): Track location.
7715 * expression.cs (Binary.ResolveOperator): In the object + string
7716 case, I was missing a call to ConvertImplicit
7718 2002-02-25 Ravi Pratap <ravi@ximian.com>
7720 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7721 Location arguments. Ensure we use RootContext.LookupType to do our work
7722 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7724 * interface.cs (PopulateMethod): Handle the type of the parameter being
7727 * expression.cs (Invocation.BetterFunction): Handle the case when we
7728 have a params method with no fixed arguments and a call is made with no
7731 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7733 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7734 the verbatim-string-literal
7736 * support.cs (InternalParameters.ParameterModifier): handle null
7738 (InternalParameters.ParameterType): ditto.
7740 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7741 duplicating the name of the variable parameter.
7742 (GetParameterByName): Fix bug where we were not looking up array
7743 paramters if they were the only present (thanks Paolo!).
7744 (GetParameterInfo): We only have an empty set of types if both
7745 fixed and array are set to null.
7746 (GetParameterInfo-idx): Handle FixedParameter == null
7748 * cs-parser.jay: Handle the case where there is no catch
7749 statements (missing null test).
7751 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7753 * driver.cs (MainDriver): Be conservative on our command line
7756 Catch DirectoryNotFoundException when calling GetFiles.
7758 (SplitPathAndPattern): Used to split the input specification into
7759 a path and a pattern that we can feed to Directory.GetFiles.
7761 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7763 * statement.cs (Fixed): Implement the last case of the Fixed
7764 statement (string handling).
7766 * expression.cs (StringPtr): New class used to return a char * to
7767 a string; Used by the Fixed statement.
7769 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7771 * expression.cs (Binary.ResolveOperator): Remove redundant
7772 MemberLookup pn parent type.
7773 Optimize union call, we do not need a union if the types are the same.
7774 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7777 Specialize the use of MemberLookup everywhere, instead of using
7778 the default settings.
7780 (StackAlloc): Implement stackalloc keyword.
7782 * cs-parser.jay: Add rule to parse stackalloc.
7784 * driver.cs: Handle /h, /help, /?
7786 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7787 before we supported unsafe code.
7789 * makefile: add --unsafe to the self compilation of mcs.
7791 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7793 * expression.cs (PointerArithmetic): New class that is used to
7794 perform pointer arithmetic.
7795 (Binary.Resolve): Handle pointer arithmetic
7796 Handle pointer comparission.
7797 (ArrayPtr): Utility expression class that is used to take the
7798 address of an array.
7800 (ElementAccess): Implement array access for pointers
7802 * statement.cs (Fixed): Implement fixed statement for arrays, we
7803 are missing one more case before we are done.
7805 * expression.cs (Indirection): Implement EmitAssign and set the
7806 ExprClass to Variable. This allows pointer dereferences to be
7807 treated as variables, and to have values assigned to them.
7809 * ecore.cs (Expression.StoreFromPtr): New utility function to
7810 store values dereferencing.
7812 2002-02-20 Ravi Pratap <ravi@ximian.com>
7814 * expression.cs (Binary.ResolveOperator): Ensure that we are
7815 not trying to operate on a void type - this fixes the reported
7818 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7819 the parent implementation is sealed.
7821 * ../errors/cs0239.cs : Add.
7823 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7825 * typemanager.cs (unverifiable_code_type): Corresponds to
7826 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7827 which have unsafe code in them.
7829 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7832 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7834 * cs-tokenizer.cs: Add support for @"litreal strings"
7836 Make tokenizer accept pre-processor directives
7837 on any column (remove the old C-like limitation).
7839 * rootcontext.cs (EmitCode): Emit any global attributes.
7840 (AddGlobalAttributes): Used to keep track of assembly attributes.
7842 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7844 * cs-parser.jay: Add support for global attributes.
7846 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7848 * expression.cs (Indirection): New helper class. Unary will
7849 create Indirection classes to be able to implement the
7850 IMemoryLocation interface on it.
7852 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7854 * cs-parser.jay (fixed_statement): reference the right statement.
7856 * statement.cs (Fixed.Emit): Finish implementing the fixed
7857 statement for the &x case.
7859 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7861 * class.cs (Property.Define, Method.Define): Remove newslot when
7864 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7865 wrong. NewSlot should only be used if the `new' keyword is present.
7867 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7868 locating our system dir. Sorry about this.
7870 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7872 * driver.cs (GetSystemDir): Compute correctly the location of our
7873 system assemblies. I was using the compiler directory instead of
7874 the library directory.
7876 2002-02-13 Ravi Pratap <ravi@ximian.com>
7878 * expression.cs (BetterFunction): Put back in what Miguel commented out
7879 since it is the correct fix. The problem is elsewhere ;-)
7881 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7882 parameters of the parms method are themselves compatible or not !
7884 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7885 to check that a class implements an interface before saying that an implicit
7886 conversion was allowed. Use ImplementsInterface to do the checking.
7888 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7890 * class.cs (Method.Define): Track whether we are an explicit
7891 implementation or not. And only call DefineMethodOverride if we
7892 are an explicit implementation.
7894 (Property.DefineMethod): Ditto.
7896 2002-02-11 Ravi Pratap <ravi@ximian.com>
7898 * expression.cs (BetterFunction): Catch hideous bug which was
7899 preventing us from detecting ambiguous calls due to implicit casts i.e
7902 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7904 * support.cs (Pair): Remove un-needed method. I figured why I was
7905 getting the error in cs-parser.jay, the variable in a foreach loop
7906 is readonly, and the compiler does not really treat this as a variable.
7908 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7909 instead of EQUALS in grammar.
7911 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7913 * expression.cs (Unary.DoResolve): Check whether the argument is
7916 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7918 * support.cs: Api for Pair to set a value. Despite the fact that
7919 the variables are public the MS C# compiler refuses to compile
7920 code that accesses the field if the variable is part of a foreach
7923 * statement.cs (Fixed): Begin implementation of the fixed
7926 (Block.AddVariable): Return the VariableInfo on success and null
7927 on failure instead of true/false.
7929 * cs-parser.jay (foreach): Catch errors on variables already
7930 defined (we were ignoring this value before) and properly unwind
7933 (fixed_statement): grammar for the fixed statement.
7935 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7937 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7938 pointer types to be incretemented.
7940 (SizeOf): Implement.
7942 * cs-parser.jay (pointer_member_access): Implement
7943 expr->IDENTIFIER production.
7945 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7946 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7949 (Unary): Implement indirection.
7951 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7952 use in non-unsafe context).
7954 (SimpleName.DoResolve): Check for pointers in field access on safe
7957 (Expression.LoadFromPtr): Factor the load-indirect code in this
7958 function. This was duplicated in UnboxCast and ParameterReference
7960 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7962 * expression.cs (ComposedCast): report an error if a pointer cast
7963 is used in a safe region.
7965 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7966 pointer type casts in unsafe context.
7968 * codegen.cs (EmitContext): Set up IsUnsafe.
7970 * cs-parser.jay (non_expression_type): Add productions for pointer
7973 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7974 code. We should not use force into static mode if the method is
7975 not virtual. Fixes bug in MIS
7977 * statement.cs (Do.Emit, While.Emit, For.Emit,
7978 Statement.EmitBoolExpression): Add support to Do and While to
7979 propagate infinite loop as `I do return' semantics.
7981 Improve the For case to also test for boolean constants.
7983 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7984 to the list of attributes we can add.
7986 Remove `EmitContext' argument.
7988 * class.cs (Method.Define): Apply parameter attributes.
7989 (Constructor.Define): Apply parameter attributes.
7990 (MethodCore.LabelParameters): Move here the core of labeling
7993 * support.cs (ReflectionParameters.ParameterModifier,
7994 InternalParameters.ParameterModifier): Use IsByRef on the type and
7995 only return the OUT bit for these parameters instead of in/out/ref
7998 This is because I miss-understood things. The ParameterInfo.IsIn
7999 and IsOut represent whether the parameter has the [In] and [Out]
8002 2002-01-22 Miguel de Icaza <miguel@ximian.com>
8004 * ecore.cs (FieldExpr.Emit): Release temporaries.
8006 * assign.cs (LocalTemporary.Release): new function.
8008 * codegen.cs (EmitContext.GetTemporaryStorage,
8009 EmitContext.FreeTemporaryStorage): Rework the way we deal with
8010 temporary storage. Now we can "put back" localbuilders when we
8013 2002-01-21 Miguel de Icaza <miguel@ximian.com>
8015 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
8016 need to make a copy of the variable to generate verifiable code.
8018 2002-01-19 Miguel de Icaza <miguel@ximian.com>
8020 * driver.cs: Compute dynamically the system directory.
8022 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8023 Slower, but more generally useful. Used by the abstract
8024 registering implementation.
8026 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8027 the rules for the special rule on Type/instances. First check if
8028 we have the same name, and if so, try that special static path
8029 rather than the instance path.
8031 2002-01-18 Miguel de Icaza <miguel@ximian.com>
8033 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8036 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8037 Enum, ValueType, Delegate or Array for non-corlib compiles.
8039 * cs-tokenizer.cs: Catch long identifiers (645)
8041 * typemanager.cs (IndexerPropetyName): Ravi never tested this
8044 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8045 fix, we were returning too early, so we were not registering
8046 pending methods from abstract classes.
8048 Do not register pending methods if the class is abstract.
8050 * expression.cs (Conditional.DoResolve): Report circular implicit
8051 conversions when we neecd to compute it for conditional
8054 (Is.DoResolve): If the expression is always of the provided type,
8055 flag warning 183. If the expression can not ever be of the
8056 provided type flag warning 184.
8058 * class.cs: Catch 169 as well.
8060 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
8063 2002-01-18 Nick Drochak <ndrochak@gol.com>
8065 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
8067 2002-01-17 Miguel de Icaza <miguel@ximian.com>
8069 * interface.cs: (PopulateMethod): Check for pointers being defined
8070 only if the unsafe context is active.
8071 (PopulateProperty): ditto.
8072 (PopulateIndexer): ditto.
8074 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
8075 specified. If pointers are present, make sure that they are
8076 present in an unsafe context.
8077 (Constructor, Constructor.Define): ditto.
8078 (Field, Field.Define): ditto.
8079 (Property, Property.Define): ditto.
8080 (Event, Event.Define): ditto.
8082 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
8083 hashtable if there are classes or structs defined.
8085 * expression.cs (LocalVariableReference.DoResolve): Simplify this
8086 code, as the constant resolution moved.
8088 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
8089 the metadata, so we can flag error 133.
8091 * decl.cs (MemberCore.UnsafeOK): New function to test that a
8092 pointer is being declared in an unsafe context.
8094 2002-01-16 Miguel de Icaza <miguel@ximian.com>
8096 * modifiers.cs (Modifiers.Check): Require a Location argument.
8097 Report error 227 for Unsafe use.
8099 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
8101 * statement.cs (For.Emit): If the test is null, then report that
8102 we do `return', as we wont reach anything afterwards.
8104 (Switch.SwitchGoverningType): Track the expression that matched
8107 * driver.cs: Allow negative numbers as an error code to flag.
8109 * cs-parser.jay: Handle 1551.
8111 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8113 2002-01-15 Miguel de Icaza <miguel@ximian.com>
8115 * cs-parser.jay: Report 1518 (type declaration can only contain
8116 class, struct, interface, enum or delegate)
8118 (switch_label): Report 1523 (keywords `case' or `default' must
8121 (opt_switch_sections): Report 1522 (empty switch)
8123 * driver.cs: Report 1515 (response file specified multiple times)
8124 Report 1516 (Source file specified multiple times).
8126 * expression.cs (Argument.Resolve): Signal 1510
8128 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8129 access not allowed in static code)
8131 2002-01-11 Ravi Pratap <ravi@ximian.com>
8133 * typemanager.cs (IsPointerType): Utility method which we are going
8136 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8137 the object type, so we take care of that.
8139 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8141 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8142 added to non-params parameters :-)
8144 * typemanager.cs (CSharpName): Include 'void' type too.
8146 (void_ptr_type): Include in the set of core types.
8148 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
8151 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
8154 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
8155 completely forgotten about it.
8157 2002-01-10 Ravi Pratap <ravi@ximian.com>
8159 * cs-parser.jay (pointer_type): Add. This begins our implementation
8160 of parsing rules for unsafe code.
8162 (unsafe_statement): Implement.
8164 (embedded_statement): Modify to include the above.
8166 * statement.cs (Unsafe): Implement new class for unsafe blocks.
8168 * codegen.cs (EmitContext.InUnsafe): Add. This determines
8169 if the current context is an unsafe one.
8171 * cs-parser.jay (local_variable_pointer_type): Since local variable types
8172 are handled differently, we need separate rules for them.
8174 (local_variable_declaration): Update to use local_variable_pointer_type
8175 to allow variable declarations of unmanaged pointer types.
8177 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8180 * ../errors/cs0214.cs : Add.
8182 2002-01-16 Nick Drochak <ndrochak@gol.com>
8184 * makefile: remove 'response' file when cleaning.
8186 2002-01-15 Miguel de Icaza <miguel@ximian.com>
8188 * cs-parser.jay: Report 1524.
8190 2002-01-14 Miguel de Icaza <miguel@ximian.com>
8192 * typemanager.cs (RegisterMethod): drop checking if we have
8193 registered this from here
8195 2002-01-12 Miguel de Icaza <miguel@ximian.com>
8197 * class.cs (Method.EmitDestructor): Implement calling our base
8200 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8203 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8204 this routine and will wrap the call in a try/catch block. Deal
8207 2002-01-11 Miguel de Icaza <miguel@ximian.com>
8209 * ecore.cs (Expression.MemberLookup): instead of taking a
8210 parameter `same_type' that was used to tell whether we could
8211 access private members we compute our containing type from the
8214 (FieldExpr): Added partial support for volatile fields. This does
8215 not work for volatile fields exposed from assemblies, as I can not
8216 figure out how to extract the modreq from it.
8218 Updated all the source files to use this.
8220 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8221 because it is referenced by MemberLookup very often.
8223 2002-01-09 Ravi Pratap <ravi@ximian.com>
8225 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8226 TypeBuilder.GetCustomAttributes to retrieve what we need.
8228 Get rid of redundant default_member_attr_type as this is the same as
8229 default_member_type which already exists.
8231 * interface.cs, attribute.cs : Update accordingly.
8233 2002-01-08 Miguel de Icaza <miguel@ximian.com>
8235 * typemanager.cs: Enable IndexerPropertyName again. It does not
8236 work for TYpeBuilders though. Ravi, can you please fix this?
8238 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8240 * expression.cs (Argument.Emit): Handle the case of ref objects
8241 being passed to ref functions;
8243 (ParameterReference.EmitLoad): Loads the content of the pointer
8244 without dereferencing.
8246 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8248 * cs-tokenizer.cs: Implemented the pre-processing expressions.
8250 2002-01-08 Ravi Pratap <ravi@ximian.com>
8252 * class.cs (Indexer.DefineMethod): Incorporate the interface
8253 type in the name of the method if we are doing explicit interface
8256 * expression.cs (ConversionExists): Remove as it is completely obsolete.
8258 (BetterConversion): Fix extremely trivial bug where we were referring to
8259 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8262 * ../errors/bug16.cs : Add although we have fixed it.
8264 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8266 * expression.cs (BaseIndexer): Begin implementation.
8268 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8270 * cs-parser.jay (indexer_declarator): Use qualified_identifier
8271 production directly to remove a shift/reduce, and implement
8272 explicit interface implementation.
8274 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8275 after a floating point suffix.
8277 * expression.cs (DoNumericPromotions): Improved the conversion for
8278 uint/uint. If we have a constant, we avoid doing a typecast to a
8281 * class.cs (Indexer): Implement explicit interface implementation
8284 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8286 * class.cs: make the default instance constructor public and hidebysig.
8288 2001-01-03 Ravi Pratap <ravi@ximian.com>
8290 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8291 so we can call it from elsewhere.
8293 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8294 we emit it internally if the class has a defined indexer; otherwise the user
8295 emits it by decorating the class definition with the DefaultMemberAttribute.
8297 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8298 attribute is not used on a type which defines an indexer.
8300 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8301 character when we skip whitespace.
8303 * ../errors/cs0646.cs : Add.
8305 2002-01-03 Miguel de Icaza <miguel@ximian.com>
8307 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8310 * makefile: Add practical target `mcs3.exe' which builds the third
8311 generation compiler.
8313 * expression.cs (New): Fix structures constructor calling.
8315 * class.cs (Property, Method, Indexer): Emit Final flag on the
8316 method if we are an interface implementation and we are not
8319 * ecore.cs (PropertyExpr): New public field `IsBase', tells
8320 whether this property is referencing a `base' method.
8322 * expression.cs (Invocation.EmitCall): take an extra argument:
8323 is_base, this is used to determine whether the `call' or
8324 `callvirt' opcode should be used.
8327 * delegate.cs: update EmitCall.
8329 * class.cs (Method.Define): Set NewSlot for the cases where we are
8330 not implementing an interface method.
8332 (Property.Define): ditto.
8334 2002-01-02 Miguel de Icaza <miguel@ximian.com>
8336 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8337 'r'. Allows mcs to parse itself fully.
8339 2002-01-02 Ravi Pratap <ravi@ximian.com>
8341 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8342 of the number of initializers that require the InitializeArray method.
8344 (CheckIndices): Store the Expression in all cases - not the plain value. Also
8345 update the above field where necessary.
8347 (MakeByteBlob): Update accordingly.
8349 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
8352 (EmitDynamicInitializers): Update in accordance with the new optimization.
8354 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8355 same OpCode applies.
8357 * cs-parser.jay : Fix some glaring errors I introduced.
8359 2002-01-01 Ravi Pratap <ravi@ximian.com>
8361 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8362 so that we can check for name clashes there too.
8364 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8365 for interface indexers.
8367 * interfaces.cs (Define): Emit the default member attribute.
8369 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8370 variable was being referred to while setting the value ;-)
8372 2002-01-01 Miguel de Icaza <miguel@ximian.com>
8374 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8375 byte-by-byte information when we know the data is zero.
8377 Make the block always a multiple of 4, because
8378 DefineInitializedData has a bug.
8380 * assign.cs: Fix, we should assign from the temporary, not from
8383 * expression.cs (MakeByteBlob): Fix my incorrect code.
8385 2001-12-31 Miguel de Icaza <miguel@ximian.com>
8387 * typemanager.cs (EnumToUnderlying): This function is used to get
8388 the underlying type from an enumeration, because it does not
8391 * constant.cs: Use the I4_S form for values between -128 and 127.
8393 * statement.cs (Block.LookupLabel): Looks up a label.
8394 (Block): Drop support for labeled blocks.
8396 (LabeledStatement): New kind of statement that represents a label
8399 (Goto): Finally implement this bad boy.
8401 * cs-parser.jay: Update to reflect new mechanism to implement
8404 2001-12-30 Miguel de Icaza <miguel@ximian.com>
8406 * codegen.cs (EmitContext.This): a codegen property that keeps the
8407 a single instance of this instead of creating many different this
8410 * delegate.cs (Delegate.DoResolve): Update to use the property;
8412 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8414 * expression.cs (BaseAccess.DoResolve): Ditto.
8416 2001-12-29 Ravi Pratap <ravi@ximian.com>
8418 * typemanager.cs (methodimpl_attr_type): Add to hold the type
8419 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8421 (InitCoreTypes): Update accordingly.
8423 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8424 so we can quickly store the state.
8426 (ApplyAttributes): Set the correct implementation flags
8427 for InternalCall methods.
8429 2001-12-29 Miguel de Icaza <miguel@ximian.com>
8431 * expression.cs (EmitCall): if a method is not virtual, then do
8432 not use callvirt on it.
8434 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8435 user defined stuff) requires the use of stobj, which takes an
8436 address on the stack instead of an array and an index. So emit
8437 the Ldelema operation for it.
8439 (EmitStoreOpcode): Use stobj for valuetypes.
8441 (UnaryMutator.EmitCode): Use the right 1 value depending on
8442 whether we are dealing with int64/uint64, float or doubles.
8444 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8445 constructors that I implemented last night.
8447 (Constructor.IsDefault): Fix to work properly for static
8450 * cs-parser.jay (CheckDef): report method signature errors.
8451 Update error number 103 to be 132.
8453 * decl.cs: New AdditionResult enumeration value: MethodExists.
8454 Although we do this check for methods later on in the semantic
8455 analysis, catching repeated default constructors is so easy that
8456 we catch these here.
8458 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8461 (ParameterReference.EmitAssign, Emit): handle
8464 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8465 (ArrayAccess.EmitStoreOpcode): ditto.
8467 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8469 * expression.cs (MakeByteBlob): Complete all the missing types
8470 (uint, short, ushort, byte, sbyte)
8472 * class.cs: Only init instance field initializers on instance
8475 Rename `constructors' to instance_constructors.
8477 (TypeContainer.AddConstructor): Only add constructors to the list
8478 if it is not static.
8480 Make sure that we handle default_static_constructor independently
8481 everywhere where we handle instance_constructors
8483 2001-12-28 Miguel de Icaza <miguel@ximian.com>
8485 * class.cs: Do not lookup or create a base initializer for a
8488 (ConstructorInitializer.Resolve): use the proper type to lookup
8491 * cs-parser.jay: Report error 1585 (modifiers between type and name).
8493 * enum.cs, interface.cs: Remove CloseType, this is taken care by
8496 * decl.cs: CloseType is now an virtual method, the default
8497 implementation just closes this type.
8499 2001-12-28 Ravi Pratap <ravi@ximian.com>
8501 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8502 to PreserveSig by default. Also emit HideBySig on such methods.
8504 Basically, set the defaults to standard values.
8506 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8507 argument, if candidate is better, it can't be worse than the best !
8509 (Invocation): Re-write bits to differentiate between methods being
8510 applicable in their expanded form and their normal form - for params
8513 Get rid of use_standard everywhere as only standard conversions are allowed
8514 in overload resolution.
8516 More spec conformance.
8518 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8520 * driver.cs: Add --timestamp, to see where the compiler spends
8523 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8524 `this' in static code.
8526 (SimpleName.DoResolve): Implement in terms of a helper function
8527 that allows static-references to be passed upstream to
8530 (Expression.ResolveWithSimpleName): Resolve specially simple
8531 names when called by MemberAccess to implement the special
8534 (Expression.ImplicitReferenceConversion): Handle conversions from
8535 Null to reference types before others, as Null's type is
8538 * expression.cs (Invocation.EmitCall): Handle the special case of
8539 calling methods declared on a reference type from a ValueType
8540 (Base classes System.Object and System.Enum)
8542 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8543 the left hand side is a TypeExpr, not on every enumeration.
8545 (Binary.Resolve): If types are reference types, then do a cast to
8546 object on operators != and == of both arguments.
8548 * typemanager.cs (FindMembers): Extract instance and static
8549 members if requested.
8551 * interface.cs (PopulateProperty): Use void_type instead of null
8552 as the return type for the setter method.
8554 (PopulateIndexer): ditto.
8556 2001-12-27 Ravi Pratap <ravi@ximian.com>
8558 * support.cs (ReflectionParameters): Fix minor bug where we
8559 were examining the wrong parameter for the ParamArray attribute.
8561 Cope with requests for the type of the parameter at position
8562 greater than the params parameter's. We now return the element
8563 type of the params array as that makes more sense.
8565 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8566 accordingly as we no longer have to extract the element type
8569 (Invocation.OverloadResolve): Update.
8571 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8573 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8574 against IEnumerator, test whether the return value is a descendant
8575 of the IEnumerator interface.
8577 * class.cs (Indexer.Define): Use an auxiliary method to implement
8578 the other bits of the method definition. Begin support for
8579 explicit interface implementation.
8581 (Property.DefineMethod): Use TypeManager.void_type instead of null
8582 for an empty return value.
8584 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8586 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8587 dealing with a FieldExpr which is composed of a FieldBuilder, in
8588 the code path we did extract the constant, but we should have
8589 obtained the underlying value to be able to cast it (otherwise we
8590 end up in an infinite loop, this is what Ravi was running into).
8592 (ArrayCreation.UpdateIndices): Arrays might be empty.
8594 (MemberAccess.ResolveMemberAccess): Add support for section
8595 14.5.4.1 that deals with the special case of E.I when E is a type
8596 and something else, that I can be a reference to a static member.
8598 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8599 handle a particular array type to create byte blobs, it is just
8600 something we dont generate byteblobs for.
8602 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8605 * location.cs (Push): remove the key from the hashtable that we
8606 are about to add. This happens for empty files.
8608 * driver.cs: Dispose files after we have parsed them.
8610 (tokenize): new function that only runs the tokenizer on its
8611 input, for speed testing.
8613 2001-12-26 Ravi Pratap <ravi@ximian.com>
8615 * class.cs (Event.Define): Define the private field only if there
8616 are no accessors defined.
8618 * expression.cs (ResolveMemberAccess): If there is no associated
8619 field with the event, that means we have an event defined with its
8620 own accessors and we should flag error cs0070 since transforming
8621 ourselves into a field is not valid in that case.
8623 * ecore.cs (SimpleName.DoResolve): Same as above.
8625 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8626 and charset to sane values.
8628 2001-12-25 Ravi Pratap <ravi@ximian.com>
8630 * assign.cs (DoResolve): Perform check on events only if they
8631 are being accessed outside the declaring type.
8633 * cs-parser.jay (event_declarations): Update rules to correctly
8634 set the type of the implicit parameter etc.
8636 (add_accessor, remove_accessor): Set current local parameters.
8638 * expression.cs (Binary): For delegate addition and subtraction,
8639 cast the return value from the method into the appropriate delegate
8642 2001-12-24 Ravi Pratap <ravi@ximian.com>
8644 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8645 of these as the workaround is unnecessary.
8647 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8648 delegate data - none of that is needed at all.
8650 Re-write bits to extract the instance expression and the delegate method
8653 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8656 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8657 of attaching attributes instead of duplicating code everywhere.
8659 * everywhere : Update code to do attribute emission using the above method.
8661 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8663 * expression.cs (IsParamsMethodApplicable): if there are not
8664 parameters, return immediately.
8666 * ecore.cs: The 0 literal can be implicity converted to an enum
8669 (SimpleName.DoResolve): First lookup the type, then lookup the
8672 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8673 want to get its address. If the InstanceExpression is not
8674 addressable, store the result in a temporary variable, then get
8677 * codegen.cs: Only display 219 errors on warning level or above.
8679 * expression.cs (ArrayAccess): Make it implement the
8680 IMemoryLocation interface.
8682 (Binary.DoResolve): handle the operator == (object a, object b)
8683 and operator != (object a, object b) without incurring into a
8684 BoxedCast (because 5 != o should never be performed).
8686 Handle binary enumerator operators.
8688 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8689 value type, otherwise use Ldelem_ref.
8691 Use precomputed names;
8693 (AddressOf): Implement address of
8695 * cs-parser.jay (labeled_statement): Fix recursive block
8696 addition by reworking the production.
8698 * expression.cs (New.DoEmit): New has a special case:
8700 If we are dealing with a ValueType, we have a few
8701 situations to deal with:
8703 * The target of New is a ValueType variable, that is
8704 easy, we just pass this as the variable reference
8706 * The target of New is being passed as an argument,
8707 to a boxing operation or a function that takes a
8710 In this case, we need to create a temporary variable
8711 that is the argument of New.
8714 2001-12-23 Ravi Pratap <ravi@ximian.com>
8716 * rootcontext.cs (LookupType): Check that current_type is not null before
8717 going about looking at nested types.
8719 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8720 not implement the IAssignMethod interface any more.
8722 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8723 where we tranform them into FieldExprs if they are being resolved from within
8726 * ecore.cs (SimpleName.DoResolve): Do the same here.
8728 * assign.cs (DoResolve, Emit): Clean up code considerably.
8730 * ../errors/bug10.cs : Add.
8732 * ../errors/cs0070.cs : Add.
8734 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8736 * assign.cs : Get rid of EventIsLocal everywhere.
8738 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8740 * ecore.cs (ConvertIntLiteral): finished the implementation.
8742 * statement.cs (SwitchLabel): Convert the value we are using as a
8743 key before looking up the table.
8745 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8747 * codegen.cs (EmitTopBlock): Require a Location argument now.
8749 * cs-parser.jay (constructor_declarator): We need to setup
8750 current_local_parameters before we parse the
8751 opt_constructor_initializer, to allow the variables to be bound
8752 to the constructor arguments.
8754 * rootcontext.cs (LookupType): First lookup nested classes in our
8755 class and our parents before we go looking outside our class.
8757 * expression.cs (ConstantFold): Extract/debox the values at the
8760 * rootcontext.cs (EmitCode): Resolve the constants first before we
8761 resolve the types. This is not really needed, but it helps debugging.
8763 * statement.cs: report location.
8765 * cs-parser.jay: pass location to throw statement.
8767 * driver.cs: Small bug fix.
8769 * report.cs: Updated format to be 4-zero filled digits.
8771 2001-12-22 Ravi Pratap <ravi@ximian.com>
8773 * expression.cs (CheckIndices): Fix minor bug where the wrong
8774 variable was being referred to ;-)
8776 (DoEmit): Do not call EmitStaticInitializers when the
8777 underlying type is System.Object.
8779 2001-12-21 Ravi Pratap <ravi@ximian.com>
8781 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8782 and do the usual workaround for SRE.
8784 * class.cs (MyEventBuilder.EventType): New member to get at the type
8785 of the event, quickly.
8787 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8789 * assign.cs (Assign.DoResolve): Handle the case when the target
8790 is an EventExpr and perform the necessary checks.
8792 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8795 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8797 (EventExpr): Set the type in the constructor itself since we
8798 are meant to be born fully resolved.
8800 (EventExpr.Define): Revert code I wrote earlier.
8802 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8803 instance expression is null. The instance expression is a This in that case
8804 or a null, depending on whether it is a static method or not.
8806 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8807 refers to more than one method.
8809 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8810 and accordingly flag errors.
8812 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8814 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8816 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8818 * location.cs (ToString): Provide useful rutine.
8820 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8822 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8823 objects, return the actual integral boxed.
8825 * statement.cs (SwitchLabel): define an ILLabel for each
8828 (Switch.CheckSwitch): If the value is a Literal, extract
8829 the underlying literal.
8831 Also in the unused hashtable we had, add the SwitchLabel so we can
8832 quickly look this value up.
8834 * constant.cs: Implement a bunch of new constants. Rewrite
8835 Literal based on this. Made changes everywhere to adapt to this.
8837 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8838 dereferencing array only once, and also copes with enumrations.
8840 bytes are two bytes wide, not one.
8842 (Cast): Perform constant conversions.
8844 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8845 wrappers to the literals here.
8847 * expression.cs (DoNumericPromotions): long literals can converted
8848 to ulong implicity (this is taken care of elsewhere, but I was
8851 * ecore.cs (Expression.Literalize): Make the return type Literal,
8852 to improve type checking.
8854 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8856 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8858 * literal.cs: Revert code from ravi that checked the bounds. The
8859 bounds are sane by the definition of the type itself.
8861 * typemanager.cs: Fix implementation of ImplementsInterface. We
8862 need to actually look up in our parent hierarchy for interfaces
8865 * const.cs: Use the underlying type for enumerations
8867 * delegate.cs: Compute the basename for the delegate creation,
8868 that should fix the delegate test case, and restore the correct
8869 Type Lookup semantics in rootcontext
8871 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8872 referencing a nested type with the Reflection API is using the "+"
8875 * cs-parser.jay: Do not require EOF token at the end.
8877 2001-12-20 Ravi Pratap <ravi@ximian.com>
8879 * rootcontext.cs (LookupType): Concatenate type names with
8880 a '.' instead of a '+' The test suite passes again.
8882 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8883 field of the enumeration.
8885 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8886 the case when the member is an EventExpr.
8888 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8889 static has an associated instance expression.
8891 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8893 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8895 * class.cs (Event.Define): Register event and perform appropriate checks
8898 We define the Add and Remove methods even if the use provides none because
8899 in that case, we provide default implementations ourselves.
8901 Define a private field of the type of the event. This is done by the CSC compiler
8902 and we should be doing it too ;-)
8904 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8905 More methods we use in code we generate.
8907 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8910 (InitCoreTypes): Update accordingly for the above.
8912 * class.cs (Event.Emit): Generate code for default accessors that we provide
8914 (EmitDefaultMethod): Do the job in the above.
8916 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8919 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8921 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8922 builders even if we were missing one.
8924 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8925 pass the Basename as our class name instead of the Name. The
8926 basename will be correctly composed for us.
8928 * parameter.cs (Paramters): Now takes a Location argument.
8930 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8931 make all the code call directly LookupType in RootContext and take
8932 this chance to pass the Location information everywhere.
8934 * Everywhere: pass Location information.
8936 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8938 * class.cs (Constructor.Define): Updated way of detecting the
8939 length of the parameters.
8941 (TypeContainer.DefineType): Use basename as the type name for
8944 (TypeContainer.Define): Do not recursively define types here, as
8945 definition is taken care in order by the RootContext.
8947 * tree.cs: Keep track of namespaces in a per-file basis.
8949 * parameter.cs (Parameter.ComputeSignature): Update to use
8952 (Parameters.GetSignature): ditto.
8954 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8955 instead of a TypeContainer.
8957 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8958 resolve names. Because we need to be resolve in our context, not
8961 * driver.cs: Implement response files.
8963 * class.cs (TypeContainer.DefineType): If we are defined, do not
8966 (Event.Emit): Emit the code for add/remove handlers.
8967 (Event.Define): Save the MethodBuilders for add/remove.
8969 * typemanager.cs: Use pair here too.
8971 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8972 DictionaryEntry requires the first argument to be non-null.
8974 (enum_declaration): Compute full name for registering the
8977 (delegate_declaration): Instead of using
8978 formal_parameter_list, use opt_formal_parameter_list as the list
8981 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8982 (EventParsing): New property that controls whether `add' and
8983 `remove' are returned as tokens or identifiers (for events);
8985 2001-12-19 Ravi Pratap <ravi@ximian.com>
8987 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8988 use MyEventBuilder only and let it wrap the real builder for us.
8990 (MyEventBuilder): Revamp constructor etc.
8992 Implement all operations that we perform on EventBuilder in precisely the same
8995 (FindMembers): Update to use the EventBuilder member.
8997 (Event.Emit): Update accordingly.
8999 2001-12-18 Ravi Pratap <ravi@ximian.com>
9001 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
9002 by calling the appropriate methods.
9004 (GetCustomAttributes): Make stubs as they cannot possibly do anything
9007 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
9009 2001-12-17 Ravi Pratap <ravi@ximian.com>
9011 * delegate.cs (Delegate.Populate): Check that the return type
9012 and various parameters types are indeed accessible.
9014 * class.cs (Constructor.Define): Same here.
9016 (Field.Define): Ditto.
9018 (Event.Define): Ditto.
9020 (Operator.Define): Check that the underlying Method defined itself
9021 correctly - so it's MethodBuilder should not be null.
9023 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9024 expression happens to be null.
9026 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9027 members but as of now we don't seem to be able to do anything really useful with it.
9029 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9030 not the EventBuilder.
9032 2001-12-18 Miguel de Icaza <miguel@ximian.com>
9034 * cs-tokenizer.cs: Add support for defines.
9035 Add support for #if, #elif, #else, #endif
9037 (eval_var): evaluates a variable.
9038 (eval): stubbed for evaluating functions.
9040 * cs-parser.jay: Pass the defines information
9042 * driver.cs: Add --define command line option.
9044 * decl.cs: Move MemberCore here.
9046 Make it the base class for DeclSpace. This allows us to catch and
9047 report 108 and 109 for everything now.
9049 * class.cs (TypeContainer.Define): Extract all the members
9050 before populating and emit the warning 108 (new keyword required
9051 to override) instead of having each member implement this.
9053 (MemberCore.Define): New abstract method, we will be using this in
9054 the warning reporting engine in Populate.
9056 (Operator.Define): Adjust to new MemberCore protocol.
9058 * const.cs (Const): This does not derive from Expression, it is a
9059 temporary object we use to create fields, it is a MemberCore.
9061 * class.cs (Method.Define): Allow the entry point to be in a
9064 * driver.cs: Rewrite the argument handler to clean it up a bit.
9066 * rootcontext.cs: Made it just an auxiliary namespace feature by
9067 making everything static.
9069 * driver.cs: Adapt code to use RootContext type name instead of
9072 * delegate.cs: Remove RootContext argument.
9074 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
9077 * class.cs (Event.Define): The lookup can fail.
9079 * cs-tokenizer.cs: Begin implementation of pre-procesor.
9081 * expression.cs: Resolve the this instance before invoking the code.
9083 2001-12-17 Miguel de Icaza <miguel@ximian.com>
9085 * cs-parser.jay: Add a production in element_access that allows
9086 the thing to become a "type" reference. This way we can parse
9087 things like "(string [])" as a type.
9089 Note that this still does not handle the more complex rules of
9093 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
9095 * ecore.cs: (CopyNewMethods): new utility function used to
9096 assemble the list of methods from running FindMembers.
9098 (MemberLookup): Rework FindMembers so that
9100 2001-12-16 Miguel de Icaza <miguel@ximian.com>
9102 * class.cs (TypeContainer): Remove Delegates who fail to be
9105 * delegate.cs (Populate): Verify that we dont get null return
9106 values. TODO: Check for AsAccessible.
9108 * cs-parser.jay: Use basename to emit error 574 (destructor should
9109 have the same name as container class), not the full name.
9111 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9112 possible representation.
9114 Also implements integer type suffixes U and L.
9116 2001-12-15 Miguel de Icaza <miguel@ximian.com>
9118 * expression.cs (ArrayCreation.DoResolve): We need to do the
9119 argument resolution *always*.
9121 * decl.cs: Make this hold the namespace. Hold the root context as
9123 (LookupType): Move here.
9125 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9127 * location.cs (Row, Name): Fixed the code, it was always returning
9128 references to the first file.
9130 * interface.cs: Register properties defined through interfaces.
9132 * driver.cs: Add support for globbing on the command line
9134 * class.cs (Field): Make it derive from MemberCore as well.
9137 2001-12-15 Ravi Pratap <ravi@ximian.com>
9139 * class.cs (Event::Define): Check that the type of the event is a delegate
9140 type else flag error #66.
9142 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9145 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9146 values of EntryPoint, CharSet etc etc.
9148 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9150 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9151 be null and we should ignore this. I am not sure if this is really clean. Apparently,
9152 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9153 which needs this to do its work.
9155 * ../errors/cs0066.cs : Add.
9157 2001-12-14 Miguel de Icaza <miguel@ximian.com>
9159 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9162 * class.cs: (MethodSignature.MethodSignature): Removed hack that
9163 clears out the parameters field.
9164 (MemberSignatureCompare): Cleanup
9166 (MemberCore): New base class used to share code between MethodCore
9169 (RegisterRequiredImplementations) BindingFlags.Public requires
9170 either BindingFlags.Instace or Static. Use instance here.
9172 (Property): Refactored code to cope better with the full spec.
9174 * parameter.cs (GetParameterInfo): Return an empty array instead
9177 * class.cs (Property): Abstract or extern properties have no bodies.
9179 * parameter.cs (GetParameterInfo): return a zero-sized array.
9181 * class.cs (TypeContainer.MethodModifiersValid): Move all the
9182 method modifier validation to the typecontainer so we can reuse
9185 (MethodCore.ParameterTypes): return an empty sized array of types.
9187 (Property.Define): Test property modifier validity.
9189 Add tests for sealed/override too.
9191 (Method.Emit): abstract or extern methods have no bodies.
9193 2001-12-14 Ravi Pratap <ravi@ximian.com>
9195 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9198 (Method::Define, ::Emit): Modify accordingly.
9200 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9202 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9204 * makefile: Pass in /unsafe.
9206 2001-12-13 Miguel de Icaza <miguel@ximian.com>
9208 * class.cs (MakeKey): Kill routine.
9210 * class.cs (TypeContainer.Define): Correctly define explicit
9211 method implementations (they require the full interface name plus
9214 * typemanager.cs: Deply the PtrHashtable here and stop using the
9215 lame keys. Things work so much better.
9217 This of course broke everyone who depended on `RegisterMethod' to
9218 do the `test for existance' test. This has to be done elsewhere.
9220 * support.cs (PtrHashtable): A hashtable that avoid comparing with
9221 the object stupid Equals method (because, that like fails all over
9222 the place). We still do not use it.
9224 * class.cs (TypeContainer.SetRequiredInterface,
9225 TypeContainer.RequireMethods): Killed these two routines and moved
9226 all the functionality to RegisterRequiredImplementations.
9228 (TypeContainer.RegisterRequiredImplementations): This routine now
9229 registers all the implementations required in an array for the
9230 interfaces and abstract methods. We use an array of structures
9231 which can be computed ahead of time to reduce memory usage and we
9232 also assume that lookups are cheap as most classes will not
9233 implement too many interfaces.
9235 We also avoid creating too many MethodSignatures.
9237 (TypeContainer.IsInterfaceMethod): Update and optionally does not
9238 clear the "pending" bit if we find that there are problems with
9241 (TypeContainer.VerifyPendingMethods): Update to report errors of
9242 methods that look like implementations but are not.
9244 (TypeContainer.Define): Add support for explicit interface method
9247 2001-12-12 Miguel de Icaza <miguel@ximian.com>
9249 * typemanager.cs: Keep track of the parameters here instead of
9250 being a feature of the TypeContainer.
9252 * class.cs: Drop the registration of parameters here, as
9253 InterfaceMethods are also interface declarations.
9255 * delegate.cs: Register methods with the TypeManager not only with
9256 the TypeContainer. This code was buggy.
9258 * interface.cs: Full registation here.
9260 2001-12-11 Miguel de Icaza <miguel@ximian.com>
9262 * expression.cs: Remove reducer for binary expressions, it can not
9265 * const.cs: Put here the code that used to go into constant.cs
9267 * constant.cs: Put here the code for constants, this is a new base
9270 * literal.cs: Make Literal derive from Constant.
9272 2001-12-09 Miguel de Icaza <miguel@ximian.com>
9274 * statement.cs (Return.Emit): Report error 157 if the user
9275 attempts to return from a finally block.
9277 (Return.Emit): Instead of emitting a return, jump to the end of
9280 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9281 LocalBuilder to store the result of the function. ReturnLabel is
9282 the target where we jump.
9285 2001-12-09 Radek Doulik <rodo@ximian.com>
9287 * cs-parser.jay: remember alias in current namespace
9289 * ecore.cs (SimpleName::DoResolve): use aliases for types or
9292 * class.cs (LookupAlias): lookup alias in my_namespace
9294 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9296 (LookupAlias): lookup alias in this and if needed in parent
9299 2001-12-08 Miguel de Icaza <miguel@ximian.com>
9303 * rootcontext.cs: (ModuleBuilder) Made static, first step into
9304 making things static. I need this to avoid passing the
9305 TypeContainer when calling ParameterType.
9307 * support.cs (InternalParameters.ParameterType): Remove ugly hack
9308 that did string manipulation to compute the type and then call
9309 GetType. Use Parameter.ParameterType instead.
9311 * cs-tokenizer.cs: Consume the suffix for floating values.
9313 * expression.cs (ParameterReference): figure out whether this is a
9314 reference parameter or not. Kill an extra variable by computing
9315 the arg_idx during emission.
9317 * parameter.cs (Parameters.GetParameterInfo): New overloaded
9318 function that returns whether a parameter is an out/ref value or not.
9320 (Parameter.ParameterType): The type of the parameter (base,
9321 without ref/out applied).
9323 (Parameter.Resolve): Perform resolution here.
9324 (Parameter.ExternalType): The full type (with ref/out applied).
9326 * statement.cs (Using.Emit, Using.EmitExpression): Implement
9327 support for expressions on the using statement.
9329 2001-12-07 Miguel de Icaza <miguel@ximian.com>
9331 * statement.cs (Using.EmitLocalVariableDecls): Split the
9332 localvariable handling of the using statement.
9334 (Block.EmitMeta): Keep track of variable count across blocks. We
9335 were reusing slots on separate branches of blocks.
9337 (Try.Emit): Emit the general code block, we were not emitting it.
9339 Check the type of the declaration to be an IDisposable or
9340 something that can be implicity converted to it.
9342 Emit conversions if required.
9344 * ecore.cs (EmptyExpression): New utility class.
9345 (Expression.ImplicitConversionExists): New utility function.
9347 2001-12-06 Miguel de Icaza <miguel@ximian.com>
9349 * statement.cs (Using): Implement.
9351 * expression.cs (LocalVariableReference): Support read only variables.
9353 * statement.cs: Remove the explicit emit for the Leave opcode.
9354 (VariableInfo): Add a readonly field.
9356 2001-12-05 Miguel de Icaza <miguel@ximian.com>
9358 * ecore.cs (ConvCast): new class used to encapsulate the various
9359 explicit integer conversions that works in both checked and
9362 (Expression.ConvertNumericExplicit): Use new ConvCast class to
9363 properly generate the overflow opcodes.
9365 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9367 * statement.cs: The correct type for the EmptyExpression is the
9368 element_type, not the variable type. Ravi pointed this out.
9370 2001-12-04 Ravi Pratap <ravi@ximian.com>
9372 * class.cs (Method::Define): Handle PInvoke methods specially
9373 by using DefinePInvokeMethod instead of the usual one.
9375 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9376 above to do the task of extracting information and defining the method.
9378 2001-12-04 Ravi Pratap <ravi@ximian.com>
9380 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9381 of the condition for string type.
9383 (Emit): Move that here.
9385 (ArrayCreation::CheckIndices): Keep string literals in their expression
9388 (EmitDynamicInitializers): Handle strings appropriately.
9390 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9392 * codegen.cs (EmitContext): Replace multiple variables with a
9393 single pointer to the current Switch statement.
9395 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9398 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9402 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9405 (Foreach.Emit): Foreach on arrays was not setting
9406 up the loop variables (for break/continue).
9408 (GotoCase): Semi-implented.
9410 2001-12-03 Ravi Pratap <ravi@ximian.com>
9412 * attribute.cs (CheckAttribute): Handle system attributes by using
9413 Attribute.GetAttributes to examine information we need.
9415 (GetValidPlaces): Same here.
9417 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9419 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9421 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9423 (Method::Define): Set appropriate flags if we have a DllImport attribute.
9425 (Method::Emit): Handle the case when we are a PInvoke method.
9427 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9429 * expression.cs: Use ResolveWithSimpleName on compound names.
9431 2001-12-02 Ravi Pratap <ravi@ximian.com>
9433 * constant.cs (EmitConstant): Make sure we resolve the associated expression
9434 before trying to reduce it.
9436 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9438 * constant.cs (LookupConstantValue): Implement.
9440 (EmitConstant): Use the above in emitting the constant.
9442 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9443 that are user-defined by doing a LookupConstantValue on them.
9445 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9448 2001-11-29 Miguel de Icaza <miguel@ximian.com>
9450 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9452 (BaseAccess.DoResolve): Implement.
9454 (MemberAccess.DoResolve): Split this routine into a
9455 ResolveMemberAccess routine that can be used independently
9457 2001-11-28 Miguel de Icaza <miguel@ximian.com>
9459 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9460 As that share bits of the implementation. Is returns a boolean,
9461 while As returns the Type that is being probed.
9463 2001-12-01 Ravi Pratap <ravi@ximian.com>
9465 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9466 instead of a Literal - much easier.
9468 (EnumInTransit): Remove - utterly useless :-)
9470 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9472 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9474 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9475 chain when we have no associated expression.
9477 2001-11-30 Ravi Pratap <ravi@ximian.com>
9479 * constant.cs (Define): Use Location while reporting the errror.
9481 Also emit a warning when 'new' is used and there is no inherited
9484 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
9487 (LookupEnumValue): Implement to lookup an enum member's value and define it
9490 (Populate): Re-write accordingly to use the above routine.
9492 2001-11-27 Miguel de Icaza <miguel@ximian.com>
9494 * expression.cs (This): Fix prototype for DoResolveLValue to
9495 override the base class DoResolveLValue.
9497 * cs-parser.cs: Report errors cs574 and cs575 (destructor
9500 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9501 (we need to load the address of the field here). This fixes
9504 (FieldExpr.DoResolveLValue): Call the DoResolve
9505 function to initialize the Instance expression.
9507 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9508 correctly the GetEnumerator operation on a value type.
9510 * cs-parser.jay: Add more simple parsing error catches.
9512 * statement.cs (Switch): Add support for string switches.
9513 Handle null specially.
9515 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
9517 2001-11-28 Ravi Pratap <ravi@ximian.com>
9519 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9521 (declare_local_constant): New helper function.
9523 * statement.cs (AddConstant): Keep a separate record of constants
9525 (IsConstant): Implement to determine if a variable is a constant.
9527 (GetConstantExpression): Implement.
9529 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9531 * statement.cs (IsVariableDefined): Re-write.
9533 2001-11-27 Ravi Pratap <ravi@ximian.com>
9535 * class.cs (TypeContainer::FindMembers): Look for constants
9536 in the case when we are looking for MemberTypes.Field
9538 * expression.cs (MemberAccess::DoResolve): Check that in the
9539 case we are a FieldExpr and a Literal, we are not being accessed
9540 by an instance reference.
9542 * cs-parser.jay (local_constant_declaration): Implement.
9544 (declaration_statement): Implement for constant declarations.
9546 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9548 * statement.cs (Switch): Catch double defaults.
9550 (Switch): More work on the switch() statement
9551 implementation. It works for integral values now, need to finish
9555 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9557 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9558 integer literals into other integer literals. To be used by
9561 2001-11-24 Ravi Pratap <ravi@ximian.com>
9563 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9566 (EmitDynamicInitializers): Cope with the above since we extract data
9567 directly from ArrayData now.
9569 (ExpectInitializers): Keep track of whether initializers are mandatory
9572 (Bounds): Make it a hashtable to prevent the same dimension being
9573 recorded for every element in that dimension.
9575 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9578 Also fix bug which was causing the indices to be emitted in the reverse
9581 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9583 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9584 unfinished. They do not work, because the underlying code is
9587 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9589 * cs-parser.jay: Remove bogus fixme.
9591 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9592 on Switch statement.
9594 2001-11-23 Ravi Pratap <ravi@ximian.com>
9596 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9599 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9600 parameter. Apparently, any expression is allowed.
9602 (ValidateInitializers): Update accordingly.
9604 (CheckIndices): Fix some tricky bugs thanks to recursion.
9606 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9607 I was being completely brain-dead.
9609 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9610 and re-write acordingly.
9612 (DelegateInvocation): Re-write accordingly.
9614 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9616 (MakeByteBlob): Handle types more correctly.
9618 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9619 initialization from expressions but it is incomplete because I am a complete
9622 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9624 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9625 on If. Basically, we have to return `true' (ie, we do return to
9626 our caller) only if both branches of the if return.
9628 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9629 short-circuit operators, handle them as short circuit operators.
9631 (Cast.DoResolve): Resolve type.
9632 (Cast.Cast): Take an expression as the target type.
9634 * cs-parser.jay (cast_expression): Remove old hack that only
9635 allowed a limited set of types to be handled. Now we take a
9636 unary_expression and we resolve to a type during semantic
9639 Use the grammar productions from Rhys to handle casts (this is
9640 not complete like Rhys syntax yet, we fail to handle that corner
9641 case that C# has regarding (-x), but we will get there.
9643 2001-11-22 Ravi Pratap <ravi@ximian.com>
9645 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9646 field which is an array type.
9648 * cs-parser.jay (declare_local_variables): Support array initialization too.
9650 * typemanager.cs (MakeKey): Implement.
9652 (everywhere): Use the above appropriately.
9654 * cs-parser.jay (for_statement): Update for array initialization while
9655 declaring variables.
9657 * ecore.cs : The error message was correct, it's the variable's names that
9658 were misleading ;-) Make the code more readable.
9660 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9661 the correct type etc.
9663 (ConvertExplicit): Handle Enum types by examining the underlying type.
9665 2001-11-21 Ravi Pratap <ravi@ximian.com>
9667 * parameter.cs (GetCallingConvention): Always return
9668 CallingConventions.Standard for now.
9670 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9672 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9673 and `r' after calling DoNumericPromotions.
9675 * ecore.cs: Fix error message (the types were in the wrong order).
9677 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9678 BindingFlags.Instance as well
9680 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9681 implicit int literal conversion in an empty cast so that we
9682 propagate the right type upstream.
9684 (UnboxCast): new class used to unbox value types.
9685 (Expression.ConvertExplicit): Add explicit type conversions done
9688 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9689 the target type before applying the implicit LongLiterals to ULong
9692 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9694 * cs-parser.jay (for_statement): Reworked the way For works: now
9695 we declare manually any variables that are introduced in
9696 for_initializer to solve the problem of having out-of-band code
9697 emition (that is what got for broken).
9699 (declaration_statement): Perform the actual variable declaration
9700 that used to be done in local_variable_declaration here.
9702 (local_variable_declaration): Do not declare anything, just pass
9703 the information on a DictionaryEntry
9705 2001-11-20 Ravi Pratap <ravi@ximian.com>
9707 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9708 re-write of the logic to now make it recursive.
9710 (UpdateIndices): Re-write accordingly.
9712 Store element data in a separate ArrayData list in the above methods.
9714 (MakeByteBlob): Implement to dump the array data into a byte array.
9716 2001-11-19 Ravi Pratap <ravi@ximian.com>
9718 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9721 * constant.cs (Define): Implement.
9723 (EmitConstant): Re-write fully.
9725 Pass in location info.
9727 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9730 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9731 DictionaryEntry since we need location info too.
9733 (constant_declaration): Update accordingly.
9735 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9736 code into another method : UpdateIndices.
9738 2001-11-18 Ravi Pratap <ravi@ximian.com>
9740 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9741 some type checking etc.
9743 2001-11-17 Ravi Pratap <ravi@ximian.com>
9745 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9746 bits to provide dimension info if the user skips doing that.
9748 Update second constructor to store the rank correctly.
9750 2001-11-16 Ravi Pratap <ravi@ximian.com>
9752 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9753 and try to implement.
9755 * ../errors/cs0150.cs : Add.
9757 * ../errors/cs0178.cs : Add.
9759 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9761 * statement.cs: Implement foreach on multi-dimensional arrays.
9763 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9764 name of the params argument.
9766 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9767 initializing the array.
9769 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9770 we can use this elsewhere.
9772 * statement.cs: Finish implementation of foreach for single
9775 * cs-parser.jay: Use an out-of-band stack to pass information
9776 around, I wonder why I need this.
9778 foreach_block: Make the new foreach_block the current_block.
9780 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9781 function used to return a static Parameters structure. Used for
9782 empty parameters, as those are created very frequently.
9784 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9786 2001-11-15 Ravi Pratap <ravi@ximian.com>
9788 * interface.cs : Default modifier is private, not public. The
9789 make verify test passes again.
9791 2001-11-15 Ravi Pratap <ravi@ximian.com>
9793 * support.cs (ReflectionParameters): Fix logic to determine
9794 whether the last parameter is a params one. Test 9 passes again.
9796 * delegate.cs (Populate): Register the builders we define with
9797 RegisterParameterForBuilder. Test 19 passes again.
9799 * cs-parser.jay (property_declaration): Reference $6 instead
9800 of $$ to get at the location.
9802 (indexer_declaration): Similar stuff.
9806 * class.cs (Property): Register parameters for the Get and Set methods
9807 if they exist. Test 23 passes again.
9809 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9810 call to EmitArguments as we are sure there aren't any params arguments.
9811 Test 32 passes again.
9813 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9814 IndexOutOfRangeException.
9816 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9817 Test 33 now passes again.
9819 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9821 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9822 broke a bunch of things. Will have to come up with a better way
9823 of tracking locations.
9825 * statement.cs: Implemented foreach for single dimension arrays.
9827 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9829 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9830 an error. This removes the lookup from the critical path.
9832 * cs-parser.jay: Removed use of temporary_loc, which is completely
9835 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9837 * support.cs (ReflectionParameters.ParameterModifier): Report
9838 whether the argument is a PARAMS argument or not.
9840 * class.cs: Set the attribute `ParamArrayAttribute' on the
9843 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9844 and cons_param_array_attribute (ConstructorInfo for
9845 ParamArrayAttribute).,
9847 * codegen.cs: Emit the return using the `Return' statement, that
9848 way we can report the error correctly for missing return values.
9850 * class.cs (Method.Emit): Clean up.
9852 * expression.cs (Argument.Resolve): Take another argument: the
9853 location where this argument is used. Notice that this is not
9854 part of the "Argument" class as to reduce the size of the
9855 structure (we know the approximate location anyways).
9857 Test if the argument is a variable-reference, if not, then
9858 complain with a 206.
9860 (Argument.Emit): Emit addresses of variables.
9862 (Argument.FullDesc): Simplify.
9864 (Invocation.DoResolve): Update for Argument.Resolve.
9866 (ElementAccess.DoResolve): ditto.
9868 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9869 method should be virtual, as this method is always virtual.
9871 (NewDelegate.DoResolve): Update for Argument.Resolve.
9873 * class.cs (ConstructorInitializer.DoResolve): ditto.
9875 * attribute.cs (Attribute.Resolve): ditto.
9877 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9879 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9881 * expression.cs (ParameterReference): Drop IStackStorage and implement
9882 IAssignMethod instead.
9884 (LocalVariableReference): ditto.
9886 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9887 IAssignMethod instead.
9889 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9891 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9892 enumerations that are used in heavily used structures derive from
9893 byte in a laughable and pathetic attempt to reduce memory usage.
9894 This is the kind of pre-optimzations that you should not do at
9895 home without adult supervision.
9897 * expression.cs (UnaryMutator): New class, used to handle ++ and
9898 -- separatedly from the other unary operators. Cleans up the
9899 code, and kills the ExpressionStatement dependency in Unary.
9901 (Unary): Removed `method' and `Arguments' from this class, making
9902 it smaller, and moving it all to SimpleCall, so I can reuse this
9903 code in other locations and avoid creating a lot of transient data
9904 strucutres when not required.
9906 * cs-parser.jay: Adjust for new changes.
9908 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9910 * enum.cs (Enum.Populate): If there is a failure during
9913 * cs-parser.jay (opt_enum_base): we used to catch type errors
9914 here, but this is really incorrect. The type error should be
9915 catched during semantic analysis.
9917 2001-12-11 Ravi Pratap <ravi@ximian.com>
9919 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9920 current_local_parameters as expected since I, in my stupidity, had forgotten
9923 * attribute.cs (GetValidPlaces): Fix stupid bug.
9925 * class.cs (Method::Emit): Perform check on applicability of attributes.
9927 (Constructor::Emit): Ditto.
9929 (Field::Emit): Ditto.
9931 (Field.Location): Store location information.
9933 (Property, Event, Indexer, Operator): Ditto.
9935 * cs-parser.jay (field_declaration): Pass in location for each field.
9937 * ../errors/cs0592.cs : Add.
9939 2001-11-12 Ravi Pratap <ravi@ximian.com>
9941 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9943 (InitCoreTypes): Update accordingly.
9945 (RegisterAttrType, LookupAttr): Implement.
9947 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9948 info about the same.
9950 (Resolve): Update to populate the above as necessary.
9954 (GetValidPlaces): Helper to the above.
9956 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9958 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9960 2001-11-12 Ravi Pratap <ravi@ximian.com>
9962 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9964 * ../errors/cs0617.cs : Add.
9966 2001-11-11 Ravi Pratap <ravi@ximian.com>
9968 * enum.cs (Emit): Rename to Populate to be more consistent with what
9969 we expect it to do and when exactly it is called.
9971 * class.cs, rootcontext.cs : Update accordingly.
9973 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9974 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9976 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9978 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9979 of a fieldinfo using the above, when dealing with a FieldBuilder.
9981 2001-11-10 Ravi Pratap <ravi@ximian.com>
9983 * ../errors/cs0031.cs : Add.
9985 * ../errors/cs1008.cs : Add.
9987 * ../errrors/cs0543.cs : Add.
9989 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9992 (FindMembers): Implement.
9994 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9995 enums and delegates too.
9997 (enum_types): Rename to builder_to_enum.
9999 (delegate_types): Rename to builder_to_delegate.
10001 * delegate.cs (FindMembers): Implement.
10003 2001-11-09 Ravi Pratap <ravi@ximian.com>
10005 * typemanager.cs (IsEnumType): Implement.
10007 * enum.cs (Emit): Re-write parts to account for the underlying type
10008 better and perform checking etc.
10010 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
10011 of the underlying type.
10013 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
10016 * enum.cs (error31): Helper to report error #31.
10018 * cs-parser.jay (enum_declaration): Store location of each member too.
10020 * enum.cs (member_to_location): New hashtable.
10022 (AddEnumMember): Update location hashtable.
10024 (Emit): Use the location of each member while reporting errors.
10026 2001-11-09 Miguel de Icaza <miguel@ximian.com>
10028 * cs-parser.jay: A for_initializer if is a
10029 local_variable_declaration really ammount to have an implicit
10030 block with the variable declaration and no initializer for for.
10032 * statement.cs (For.Emit): Cope with null initializers.
10034 This fixes the infinite loop on for initializers.
10036 2001-11-08 Miguel de Icaza <miguel@ximian.com>
10038 * enum.cs: More cleanup.
10040 * ecore.cs: Remove dead code.
10042 * class.cs (Property.Emit): More simplification.
10043 (Event.Emit): ditto.
10045 Reworked to have less levels of indentation.
10047 2001-11-08 Ravi Pratap <ravi@ximian.com>
10049 * class.cs (Property): Emit attributes.
10059 * enum.cs (Emit): Ditto.
10061 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
10064 * class.cs (Field, Event, etc.): Move attribute generation into the
10065 Emit method everywhere.
10067 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
10068 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
10069 as we had no way of defining nested enums !
10071 * rootcontext.cs : Adjust code accordingly.
10073 * typemanager.cs (AddEnumType): To keep track of enum types separately.
10075 2001-11-07 Ravi Pratap <ravi@ximian.com>
10077 * expression.cs (EvalConstantExpression): Move into ecore.cs
10079 * enum.cs (Enum): Rename some members and make them public and readonly
10080 according to our convention.
10082 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
10085 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
10087 (Enum::Emit): Write a simple version for now which doesn't try to compute
10088 expressions. I shall modify this to be more robust in just a while.
10090 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
10092 (TypeContainer::CloseType): Create the Enum types too.
10094 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
10096 * expression.cs (EvalConstantExpression): Get rid of completely.
10098 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
10099 user-defined values and other cases.
10101 (IsValidEnumLiteral): Helper function.
10103 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
10104 out there in the case we had a literal FieldExpr.
10106 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
10108 (Literalize): Revamp a bit to take two arguments.
10110 (EnumLiteral): New class which derives from Literal to wrap enum literals.
10112 2001-11-06 Ravi Pratap <ravi@ximian.com>
10114 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10116 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10118 (Resolve): Use the above to ensure we have proper initializers.
10120 2001-11-05 Ravi Pratap <ravi@ximian.com>
10122 * expression.cs (Expression::EvalConstantExpression): New method to
10123 evaluate constant expressions.
10125 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10127 2001-11-07 Miguel de Icaza <miguel@ximian.com>
10129 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10132 (Binary.ResolveOperator): Handle operator != (object a, object b)
10133 and operator == (object a, object b);
10135 (Binary.DoNumericPromotions): Indicate whether the numeric
10136 promotion was possible.
10138 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10141 Made the ArrayAccess implement interface IAssignMethod instead of
10142 IStackStore as the order in which arguments are passed reflects
10145 * assign.cs: Instead of using expr.ExprClass to select the way of
10146 assinging, probe for the IStackStore/IAssignMethod interfaces.
10148 * typemanager.cs: Load InitializeArray definition.
10150 * rootcontext.cs (RootContext.MakeStaticData): Used to define
10151 static data that can be used to initialize arrays.
10153 2001-11-05 Miguel de Icaza <miguel@ximian.com>
10155 * expression.cs: Handle operator== and operator!= for booleans.
10157 (Conditioal.Reduce): Implement reducer for the ?: operator.
10159 (Conditional.Resolve): Implement dead code elimination.
10161 (Binary.Resolve): Catch string literals and return a new
10162 concatenated string.
10164 (Unary.Reduce): Implement reduction of unary expressions.
10166 * ecore.cs: Split out the expression core handling here.
10168 (Expression.Reduce): New method used to perform constant folding
10169 and CSE. This is needed to support constant-expressions.
10171 * statement.cs (Statement.EmitBoolExpression): Pass true and false
10172 targets, and optimize for !x.
10174 2001-11-04 Ravi Pratap <ravi@ximian.com>
10176 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10177 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10178 set custom atttributes.
10180 * literal.cs (Literal::GetValue): New abstract method to return the actual
10181 value of the literal, cast as an object.
10183 (*Literal): Implement GetValue method.
10185 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10186 expressions to the arraylist but objects of type Argument.
10188 * class.cs (TypeContainer::Emit): Emit our attributes too.
10190 (Method::Emit, Constructor::Emit): Ditto.
10192 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10193 to be ignoring earlier.
10195 2001-11-03 Ravi Pratap <ravi@ximian.com>
10197 * attribute.cs (AttributeSection::Define): Implement to do the business
10198 of constructing a CustomAttributeBuilder.
10200 (Attribute): New trivial class. Increases readability of code.
10202 * cs-parser.jay : Update accordingly.
10204 (positional_argument_list, named_argument_list, named_argument): New rules
10206 (attribute_arguments): Use the above so that we are more correct.
10208 2001-11-02 Ravi Pratap <ravi@ximian.com>
10210 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10211 to perform all checks for a method with a params parameter.
10213 (Invocation::OverloadResolve): Update to use the above method and therefore
10214 cope correctly with params method invocations.
10216 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
10219 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10220 constructors in our parent too because we can't afford to miss out on
10223 * attribute.cs (AttributeSection): New name for the class Attribute
10225 Other trivial changes to improve readability.
10227 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10228 use the new class names.
10230 2001-11-01 Ravi Pratap <ravi@ximian.com>
10232 * class.cs (Method::Define): Complete definition for params types too
10234 (Indexer::Define): Ditto.
10236 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10237 Cope everywhere with a request for info about the array parameter.
10239 2001-11-01 Ravi Pratap <ravi@ximian.com>
10241 * tree.cs (RecordNamespace): Fix up to check for the correct key.
10243 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
10244 local_variable_type to extract the string corresponding to the type.
10246 (local_variable_type): Fixup the action to use the new helper method.
10248 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
10251 * expression.cs : Clean out code which uses the above.
10253 2001-10-31 Ravi Pratap <ravi@ximian.com>
10255 * typemanager.cs (RegisterMethod): Check if we already have an existing key
10256 and bale out if necessary by returning a false.
10258 (RegisterProperty): Ditto.
10260 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10261 and print out appropriate error messages.
10263 * interface.cs (everywhere): Ditto.
10265 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10266 location to constructor.
10268 * class.cs (Property, Event, Indexer): Update accordingly.
10270 * ../errors/cs111.cs : Added.
10272 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10273 of a method, as laid down by the spec.
10275 (Invocation::OverloadResolve): Use the above method.
10277 2001-10-31 Ravi Pratap <ravi@ximian.com>
10279 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10280 now take a TypeContainer and a Parameters object.
10282 (ParameterData): Modify return type of ParameterModifier method to be
10283 Parameter.Modifier and not a string.
10285 (ReflectionParameters, InternalParameters): Update accordingly.
10287 * expression.cs (Argument::GetParameterModifier): Same here.
10289 * support.cs (InternalParameters::ParameterType): Find a better way of determining
10290 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10291 symbol in it at all so maybe this is only for now.
10293 2001-10-30 Ravi Pratap <ravi@ximian.com>
10295 * support.cs (InternalParameters): Constructor now takes an extra argument
10296 which is the actual Parameters class.
10298 (ParameterDesc): Update to provide info on ref/out modifiers.
10300 * class.cs (everywhere): Update call to InternalParameters to pass in
10301 the second argument too.
10303 * support.cs (ParameterData): Add ParameterModifier, which is a method
10304 to return the modifier info [ref/out etc]
10306 (InternalParameters, ReflectionParameters): Implement the above.
10308 * expression.cs (Argument::ParameterModifier): Similar function to return
10309 info about the argument's modifiers.
10311 (Invocation::OverloadResolve): Update to take into account matching modifiers
10314 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10315 a new SetFormalParameters object which we pass to InternalParameters.
10317 2001-10-30 Ravi Pratap <ravi@ximian.com>
10319 * expression.cs (NewArray): Merge into the ArrayCreation class.
10321 2001-10-29 Ravi Pratap <ravi@ximian.com>
10323 * expression.cs (NewArray): Merge classes NewBuiltinArray and
10324 NewUserdefinedArray into one as there wasn't much of a use in having
10327 * expression.cs (Argument): Change field's name to ArgType from Type.
10329 (Type): New readonly property which returns the proper type, taking into
10330 account ref/out modifiers.
10332 (everywhere): Adjust code accordingly for the above.
10334 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10335 whether we are emitting for a ref or out parameter.
10337 * expression.cs (Argument::Emit): Use the above field to set the state.
10339 (LocalVariableReference::Emit): Update to honour the flag and emit the
10342 * parameter.cs (Attributes): Set the correct flags for ref parameters.
10344 * expression.cs (Argument::FullDesc): New function to provide a full desc.
10346 * support.cs (ParameterData): Add method ParameterDesc to the interface.
10348 (ReflectionParameters, InternalParameters): Implement the above method.
10350 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10353 (Invocation::FullMethodDesc): Ditto.
10355 2001-10-29 Miguel de Icaza <miguel@ximian.com>
10357 * cs-parser.jay: Add extra production for the second form of array
10360 * expression.cs (ArrayCreation): Update to reflect the above
10363 * Small changes to prepare for Array initialization.
10365 2001-10-28 Miguel de Icaza <miguel@ximian.com>
10367 * typemanager.cs (ImplementsInterface): interface might be null;
10368 Deal with this problem;
10370 Also, we do store negative hits on the cache (null values), so use
10371 this instead of calling t.GetInterfaces on the type everytime.
10373 2001-10-28 Ravi Pratap <ravi@ximian.com>
10375 * typemanager.cs (IsBuiltinType): New method to help determine the same.
10377 * expression.cs (New::DoResolve): Get rid of array creation code and instead
10378 split functionality out into different classes.
10380 (New::FormArrayType): Move into NewBuiltinArray.
10382 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10385 (NewBuiltinArray): New class to handle creation of built-in arrays.
10387 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10388 account creation of one-dimensional arrays.
10390 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10392 (NewUserdefinedArray::DoResolve): Implement.
10394 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10396 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10397 we maintain inside the TypeManager. This is necessary to perform lookups on the
10400 (LookupType): Update to perform GetType on the module builders too.
10402 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10404 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10406 2001-10-23 Ravi Pratap <ravi@ximian.com>
10408 * expression.cs (New::DoResolve): Implement guts of array creation.
10410 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10412 2001-10-27 Miguel de Icaza <miguel@ximian.com>
10414 * expression.cs: Fix bug I introduced lsat night that broke
10417 (Expression.Resolve): Report a 246 error (can not resolve name)
10418 if we find a SimpleName in the stream.
10420 (Expression.ResolveLValue): Ditto.
10422 (Expression.ResolveWithSimpleName): This function is a variant of
10423 ResolveName, this one allows SimpleNames to be returned without a
10424 warning. The only consumer of SimpleNames is MemberAccess
10426 2001-10-26 Miguel de Icaza <miguel@ximian.com>
10428 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10429 might arrive here. I have my doubts that this is correct.
10431 * statement.cs (Lock): Implement lock statement.
10433 * cs-parser.jay: Small fixes to support `lock' and `using'
10435 * cs-tokenizer.cs: Remove extra space
10437 * driver.cs: New flag --checked, allows to turn on integer math
10440 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10441 Threading.Monitor.Exit
10443 2001-10-23 Miguel de Icaza <miguel@ximian.com>
10445 * expression.cs (IndexerAccess::DoResolveLValue): Set the
10446 Expression Class to be IndexerAccess.
10448 Notice that Indexer::DoResolve sets the eclass to Value.
10450 2001-10-22 Miguel de Icaza <miguel@ximian.com>
10452 * class.cs (TypeContainer::Emit): Emit code for indexers.
10454 * assign.cs (IAssignMethod): New interface implemented by Indexers
10455 and Properties for handling assignment.
10457 (Assign::Emit): Simplify and reuse code.
10459 * expression.cs (IndexerAccess, PropertyExpr): Implement
10460 IAssignMethod, clean up old code.
10462 2001-10-22 Ravi Pratap <ravi@ximian.com>
10464 * typemanager.cs (ImplementsInterface): New method to determine if a type
10465 implements a given interface. Provides a nice cache too.
10467 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10470 (ConvertReferenceExplicit): Ditto.
10472 * delegate.cs (Delegate::Populate): Update to define the parameters on the
10473 various methods, with correct names etc.
10475 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
10476 Operator.UnaryNegation.
10478 * cs-parser.jay (operator_declarator): Be a little clever in the case where
10479 we have a unary plus or minus operator.
10481 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
10484 * everywhere : update accordingly.
10486 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10489 * class.cs (Method::Define): For the case where we are implementing a method
10490 inherited from an interface, we need to set the MethodAttributes.Final flag too.
10491 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10493 2001-10-21 Ravi Pratap <ravi@ximian.com>
10495 * interface.cs (FindMembers): Implement to work around S.R.E
10498 * typemanager.cs (IsInterfaceType): Implement.
10500 (FindMembers): Update to handle interface types too.
10502 * expression.cs (ImplicitReferenceConversion): Re-write bits which
10503 use IsAssignableFrom as that is not correct - it doesn't work.
10505 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10506 and accordingly override EmitStatement.
10508 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10509 using the correct logic :-)
10511 2001-10-19 Ravi Pratap <ravi@ximian.com>
10513 * ../errors/cs-11.cs : Add to demonstrate error -11
10515 2001-10-17 Miguel de Icaza <miguel@ximian.com>
10517 * assign.cs (Assign::Resolve): Resolve right hand side first, and
10518 then pass this as a hint to ResolveLValue.
10520 * expression.cs (FieldExpr): Add Location information
10522 (FieldExpr::LValueResolve): Report assignment to readonly
10525 (Expression::ExprClassFromMemberInfo): Pass location information.
10527 (Expression::ResolveLValue): Add new method that resolves an
10530 (Expression::DoResolveLValue): Default invocation calls
10533 (Indexers): New class used to keep track of indexers in a given
10536 (IStackStore): Renamed from LValue, as it did not really describe
10537 what this did. Also ResolveLValue is gone from this interface and
10538 now is part of Expression.
10540 (ElementAccess): Depending on the element access type
10542 * typemanager.cs: Add `indexer_name_type' as a Core type
10543 (System.Runtime.CompilerServices.IndexerNameAttribute)
10545 * statement.cs (Goto): Take a location.
10547 2001-10-18 Ravi Pratap <ravi@ximian.com>
10549 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10550 if two delegates are compatible.
10552 (NewDelegate::DoResolve): Update to take care of the case when
10553 we instantiate a delegate from another delegate.
10555 * typemanager.cs (FindMembers): Don't even try to look up members
10556 of Delegate types for now.
10558 2001-10-18 Ravi Pratap <ravi@ximian.com>
10560 * delegate.cs (NewDelegate): New class to take care of delegate
10563 * expression.cs (New): Split the delegate related code out into
10564 the NewDelegate class.
10566 * delegate.cs (DelegateInvocation): New class to handle delegate
10569 * expression.cs (Invocation): Split out delegate related code into
10570 the DelegateInvocation class.
10572 2001-10-17 Ravi Pratap <ravi@ximian.com>
10574 * expression.cs (New::DoResolve): Implement delegate creation fully
10575 and according to the spec.
10577 (New::DoEmit): Update to handle delegates differently.
10579 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10580 because of which we were printing out arguments in reverse order !
10582 * delegate.cs (VerifyMethod): Implement to check if the given method
10583 matches the delegate.
10585 (FullDelegateDesc): Implement.
10587 (VerifyApplicability): Implement.
10589 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10590 delegate invocations too.
10592 (Invocation::Emit): Ditto.
10594 * ../errors/cs1593.cs : Added.
10596 * ../errors/cs1594.cs : Added.
10598 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10600 2001-10-16 Ravi Pratap <ravi@ximian.com>
10602 * typemanager.cs (intptr_type): Core type for System.IntPtr
10604 (InitCoreTypes): Update for the same.
10606 (iasyncresult_type, asynccallback_type): Ditto.
10608 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10611 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10614 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10615 the builders for the 4 members of a delegate type :-)
10617 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10620 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10622 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10624 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10626 * statement.cs (Break::Emit): Implement.
10627 (Continue::Emit): Implement.
10629 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10630 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10631 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10632 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10635 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10636 properties that track the label for the current loop (begin of the
10637 loop and end of the loop).
10639 2001-10-15 Ravi Pratap <ravi@ximian.com>
10641 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10642 use of emitting anything at all.
10644 * class.cs, rootcontext.cs : Get rid of calls to the same.
10646 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10648 (Populate): Define the constructor correctly and set the implementation
10651 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10654 (AddDelegateType): Implement.
10656 (IsDelegateType): Implement helper method.
10658 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10660 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10661 and accordingly handle it.
10663 * delegate.cs (Populate): Take TypeContainer argument.
10664 Implement bits to define the Invoke method. However, I still haven't figured out
10665 how to take care of the native int bit :-(
10667 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10668 Qualify the name of the delegate, not its return type !
10670 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10673 (StandardConversionExists): Checking for array types turns out to be recursive.
10675 (ConvertReferenceExplicit): Implement array conversion.
10677 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10679 2001-10-12 Ravi Pratap <ravi@ximian.com>
10681 * cs-parser.jay (delegate_declaration): Store the fully qualified
10682 name as it is a type declaration.
10684 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10687 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10688 as TypeContainer::DefineType.
10690 (Populate): Method in which all the definition of the various methods (Invoke)
10693 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10696 (CloseDelegate): Finally creates the delegate.
10698 * class.cs (TypeContainer::DefineType): Update to define delegates.
10699 (Populate, Emit and CloseType): Do the same thing here too.
10701 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10702 delegates in all these operations.
10704 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10706 * expression.cs: LocalTemporary: a new expression used to
10707 reference a temporary that has been created.
10709 * assign.cs: Handle PropertyAccess back here, so that we can
10710 provide the proper semantic access to properties.
10712 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10713 a few more explicit conversions.
10715 * modifiers.cs: `NEW' modifier maps to HideBySig.
10717 * expression.cs (PropertyExpr): Make this into an
10718 ExpressionStatement, and support the EmitStatement code path.
10720 Perform get/set error checking, clean up the interface.
10722 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10723 them into toplevel access objects.
10725 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10727 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10730 * typemanager.cs: Keep track here of our PropertyBuilders again to
10731 work around lameness in SRE.
10733 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10735 * expression.cs (LValue::LValueResolve): New method in the
10736 interface, used to perform a second resolution pass for LValues.
10738 (This::DoResolve): Catch the use of this in static methods.
10740 (This::LValueResolve): Implement.
10742 (This::Store): Remove warning, assigning to `this' in structures
10745 (Invocation::Emit): Deal with invocation of
10746 methods on value types. We need to pass the address to structure
10747 methods rather than the object itself. (The equivalent code to
10748 emit "this" for structures leaves the entire structure on the
10749 stack instead of a pointer to it).
10751 (ParameterReference::DoResolve): Compute the real index for the
10752 argument based on whether the method takes or not a `this' pointer
10753 (ie, the method is static).
10755 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10756 value types returned from functions when we need to invoke a
10757 method on the sturcture.
10760 2001-10-11 Ravi Pratap <ravi@ximian.com>
10762 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10763 defining the type in the Modulebuilder or Typebuilder. This is to take
10764 care of nested types which need to be defined on the TypeBuilder using
10765 DefineNestedMethod.
10767 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10768 methods in RootContext, only ported to be part of TypeContainer.
10770 (TypeContainer::GetInterfaceOrClass): Ditto.
10772 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10774 * interface.cs (Interface::DefineInterface): New method. Does exactly
10775 what RootContext.CreateInterface did earlier, only it takes care of nested types
10778 (Interface::GetInterfaces): Move from RootContext here and port.
10780 (Interface::GetInterfaceByName): Same here.
10782 * rootcontext.cs (ResolveTree): Re-write.
10784 (PopulateTypes): Re-write.
10786 * class.cs (TypeContainer::Populate): Populate nested types too.
10787 (TypeContainer::Emit): Emit nested members too.
10789 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10790 instead just use the name argument passed in as it is already fully
10793 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10794 to TypeContainer mapping to see if a type is user-defined.
10796 * class.cs (TypeContainer::CloseType): Implement.
10798 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10799 the default constructor.
10801 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10804 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10806 * interface.cs (CloseType): Create the type here.
10808 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10811 Remove all the methods which are now in TypeContainer.
10813 2001-10-10 Ravi Pratap <ravi@ximian.com>
10815 * delegate.cs (Define): Re-write bits to define the delegate
10818 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10820 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10822 * expression.cs (ImplicitReferenceConversion): handle null as well
10823 as a source to convert to any reference type.
10825 * statement.cs (Return): Perform any implicit conversions to
10826 expected return type.
10828 Validate use of return statement.
10830 * codegen.cs (EmitContext): Pass the expected return type here.
10832 * class.cs (Method, Constructor, Property): Pass expected return
10833 type to EmitContext.
10835 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10837 * expression.cs: Make DoResolve take an EmitContext instead of a
10840 Replaced `l' and `location' for `loc', for consistency.
10842 (Error, Warning): Remove unneeded Tc argument.
10844 * assign.cs, literal.cs, constant.cs: Update to new calling
10847 * codegen.cs: EmitContext now contains a flag indicating whether
10848 code is being generated in a static method or not.
10850 * cs-parser.jay: DecomposeQI, new function that replaces the old
10851 QualifiedIdentifier. Now we always decompose the assembled
10852 strings from qualified_identifier productions into a group of
10855 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10857 * rootcontext.cs: Deal with field-less struct types correctly now
10858 by passing the size option to Define Type.
10860 * class.cs: Removed hack that created one static field.
10862 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10864 * statement.cs: Moved most of the code generation here.
10866 2001-10-09 Ravi Pratap <ravi@ximian.com>
10868 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10871 (ElementAccess): Remove useless bits for now - keep checks as the spec
10874 2001-10-08 Ravi Pratap <ravi@ximian.com>
10876 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10877 and start performing checks according to the spec.
10879 2001-10-07 Ravi Pratap <ravi@ximian.com>
10881 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10882 rank_specifiers instead.
10884 (rank_specifiers): Change the order in which the rank specifiers are stored
10886 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10888 * expression.cs (ElementAccess): Implement the LValue interface too.
10890 2001-10-06 Ravi Pratap <ravi@ximian.com>
10892 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10893 except that user defined conversions are not included.
10895 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10896 perform the conversion of the return type, if necessary.
10898 (New::DoResolve): Check whether we are creating an array or an object
10899 and accordingly do the needful.
10901 (New::Emit): Same here.
10903 (New::DoResolve): Implement guts of array creation.
10905 (New::FormLookupType): Helper function.
10907 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10909 * codegen.cs: Removed most of the code generation here, and move the
10910 corresponding code generation bits to the statement classes.
10912 Added support for try/catch/finalize and throw.
10914 * cs-parser.jay: Added support for try/catch/finalize.
10916 * class.cs: Catch static methods having the flags override,
10917 virtual or abstract.
10919 * expression.cs (UserCast): This user cast was not really doing
10920 what it was supposed to do. Which is to be born in fully resolved
10921 state. Parts of the resolution were being performed at Emit time!
10925 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10927 * expression.cs: Implicity convert the result from UserCast.
10929 2001-10-05 Ravi Pratap <ravi@ximian.com>
10931 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10932 prevented it from working correctly.
10934 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10935 merely ConvertImplicit.
10937 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10939 * typemanager.cs: Make the LookupTypeContainer function static,
10940 and not per-instance.
10942 * class.cs: Make static FindMembers (the one that takes a Type
10945 * codegen.cs: Add EmitForeach here.
10947 * cs-parser.jay: Make foreach a toplevel object instead of the
10948 inline expansion, as we need to perform semantic analysis on it.
10950 2001-10-05 Ravi Pratap <ravi@ximian.com>
10952 * expression.cs (Expression::ImplicitUserConversion): Rename to
10953 UserDefinedConversion.
10955 (Expression::UserDefinedConversion): Take an extra argument specifying
10956 whether we look for explicit user conversions too.
10958 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10960 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10962 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10963 with the appropriate arguments.
10965 * cs-parser.jay (cast_expression): Record location too.
10967 * expression.cs (Cast): Record location info.
10969 (Expression::ConvertExplicit): Take location argument.
10971 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10972 to determine if we are doing explicit conversions.
10974 (UserCast::Emit): Update accordingly.
10976 (Expression::ConvertExplicit): Report an error if everything fails.
10978 * ../errors/cs0030.cs : Add.
10980 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10982 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10983 virtual and newslot bits.
10985 * class.cs (TypeContainer::RegisterRequiredImplementations):
10986 Record methods we need.
10988 (TypeContainer::MakeKey): Helper function to make keys for
10989 MethodBases, since the Methodbase key is useless.
10991 (TypeContainer::Populate): Call RegisterRequiredImplementations
10992 before defining the methods.
10994 Create a mapping for method_builders_to_methods ahead of time
10995 instead of inside a tight loop.
10997 (::RequireMethods): Accept an object as the data to set into the
10998 hashtable so we can report interface vs abstract method mismatch.
11000 2001-10-03 Miguel de Icaza <miguel@ximian.com>
11002 * report.cs: Make all of it static.
11004 * rootcontext.cs: Drop object_type and value_type computations, as
11005 we have those in the TypeManager anyways.
11007 Drop report instance variable too, now it is a global.
11009 * driver.cs: Use try/catch on command line handling.
11011 Add --probe option to debug the error reporting system with a test
11014 * report.cs: Add support for exiting program when a probe
11015 condition is reached.
11017 2001-10-03 Ravi Pratap <ravi@ximian.com>
11019 * expression.cs (Binary::DoNumericPromotions): Fix the case when
11020 we do a forcible conversion regardless of type, to check if
11021 ForceConversion returns a null.
11023 (Binary::error19): Use location to report error.
11025 (Unary::error23): Use location here too.
11027 * ../errors/cs0019.cs : Check in.
11029 * ../errors/cs0023.cs : Check in.
11031 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11032 case of a non-null MethodInfo object with a length of 0 !
11034 (Binary::ResolveOperator): Flag error if overload resolution fails to find
11035 an applicable member - according to the spec :-)
11036 Also fix logic to find members in base types.
11038 (Unary::ResolveOperator): Same here.
11040 (Unary::report23): Change name to error23 and make first argument a TypeContainer
11041 as I was getting thoroughly confused between this and error19 :-)
11043 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11044 (::FindMostEncompassedType): Implement.
11045 (::FindMostEncompassingType): Implement.
11046 (::StandardConversionExists): Implement.
11048 (UserImplicitCast): Re-vamp. We now need info about most specific
11049 source and target types so that we can do the necessary conversions.
11051 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11052 mathematical union with no duplicates.
11054 2001-10-03 Miguel de Icaza <miguel@ximian.com>
11056 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
11057 in order from base classes to child classes, so that we can in
11058 child classes look up in our parent for method names and
11059 attributes (required for handling abstract, virtual, new, override
11060 constructs: we need to instrospect our base class, and if we dont
11061 populate the classes in order, the introspection might be
11062 incorrect. For example, a method could query its parent before
11063 the parent has any methods and would determine that the parent has
11064 no abstract methods (while it could have had them)).
11066 (RootContext::CreateType): Record the order in which we define the
11069 2001-10-02 Miguel de Icaza <miguel@ximian.com>
11071 * class.cs (TypeContainer::Populate): Also method definitions can
11072 fail now, keep track of this.
11074 (TypeContainer::FindMembers): Implement support for
11075 DeclaredOnly/noDeclaredOnly flag.
11077 (Constructor::Emit) Return the ConstructorBuilder.
11079 (Method::Emit) Return the MethodBuilder.
11080 Check for abstract or virtual methods to be public.
11082 * rootcontext.cs (RootContext::CreateType): Register all the
11083 abstract methods required for the class to be complete and the
11084 interface methods that must be implemented.
11086 * cs-parser.jay: Report error 501 (method requires body if it is
11087 not marked abstract or extern).
11089 * expression.cs (TypeOf::Emit): Implement.
11091 * typemanager.cs: runtime_handle_type, new global type.
11093 * class.cs (Property::Emit): Generate code for properties.
11095 2001-10-02 Ravi Pratap <ravi@ximian.com>
11097 * expression.cs (Unary::ResolveOperator): Find operators on base type
11098 too - we now conform exactly to the spec.
11100 (Binary::ResolveOperator): Same here.
11102 * class.cs (Operator::Define): Fix minor quirk in the tests.
11104 * ../errors/cs0215.cs : Added.
11106 * ../errors/cs0556.cs : Added.
11108 * ../errors/cs0555.cs : Added.
11110 2001-10-01 Miguel de Icaza <miguel@ximian.com>
11112 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11113 single integer which is really efficient
11115 2001-10-01 Ravi Pratap <ravi@ximian.com>
11117 * expression.cs (Expression::ImplicitUserConversion): Use location
11118 even in the case when we are examining True operators.
11120 * class.cs (Operator::Define): Perform extensive checks to conform
11121 with the rules for operator overloading in the spec.
11123 * expression.cs (Expression::ImplicitReferenceConversion): Implement
11124 some of the other conversions mentioned in the spec.
11126 * typemanager.cs (array_type): New static member for the System.Array built-in
11129 (cloneable_interface): For System.ICloneable interface.
11131 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11132 we start resolving the tree and populating types.
11134 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11136 2001-10-01 Miguel de Icaza <miguel@ximian.com>
11138 * expression.cs (Expression::ExprClassFromMemberInfo,
11139 Expression::Literalize): Create literal expressions from
11140 FieldInfos which are literals.
11142 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11143 type casts, because they were wrong. The test suite in tests
11146 (ImplicitNumericConversion): ushort to ulong requires a widening
11149 Int32 constant to long requires widening cast as well.
11151 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11152 for integers because the type on the stack is not i4.
11154 2001-09-30 Miguel de Icaza <miguel@ximian.com>
11156 * expression.cs (report118): require location argument.
11158 * parameter.cs: Do not dereference potential null value.
11160 * class.cs: Catch methods that lack the `new' keyword when
11161 overriding a name. Report warnings when `new' is used without
11162 anything being there to override.
11164 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11166 * class.cs: Only add constructor to hashtable if it is non-null
11167 (as now constructors can fail on define).
11169 (TypeManager, Class, Struct): Take location arguments.
11171 Catch field instance initialization in structs as errors.
11173 accepting_filter: a new filter for FindMembers that is static so
11174 that we dont create an instance per invocation.
11176 (Constructor::Define): Catch errors where a struct constructor is
11179 * cs-parser.jay: Pass location information for various new
11182 * delegate.cs (Delegate): take a location argument.
11184 * driver.cs: Do not call EmitCode if there were problesm in the
11185 Definition of the types, as many Builders wont be there.
11187 * decl.cs (Decl::Decl): Require a location argument.
11189 * cs-tokenizer.cs: Handle properly hex constants that can not fit
11190 into integers, and find the most appropiate integer for it.
11192 * literal.cs: Implement ULongLiteral.
11194 * rootcontext.cs: Provide better information about the location of
11195 failure when CreateType fails.
11197 2001-09-29 Miguel de Icaza <miguel@ximian.com>
11199 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11202 * expression.cs (Binary::CheckShiftArguments): Add missing type
11204 (Binary::ResolveOperator): Add type to the logical and and logical
11205 or, Bitwise And/Or and Exclusive Or code paths, it was missing
11208 (Binary::DoNumericPromotions): In the case where either argument
11209 is ulong (and most signed types combined with ulong cause an
11210 error) perform implicit integer constant conversions as well.
11212 2001-09-28 Miguel de Icaza <miguel@ximian.com>
11214 * expression.cs (UserImplicitCast): Method should always be
11216 (Invocation::BetterConversion): Simplified test for IntLiteral.
11218 (Expression::ImplicitNumericConversion): Split this routine out.
11219 Put the code that performs implicit constant integer conversions
11222 (Expression::Resolve): Become a wrapper around DoResolve so we can
11223 check eclass and type being set after resolve.
11225 (Invocation::Badness): Remove this dead function
11227 (Binary::ResolveOperator): Do not compute the expensive argumnets
11228 unless we have a union for it.
11230 (Probe::Emit): Is needs to do an isinst and then
11231 compare against null.
11233 (::CanConvert): Added Location argument. If the Location argument
11234 is null (Location.Null), then we do not report errors. This is
11235 used by the `probe' mechanism of the Explicit conversion. We do
11236 not want to generate an error for something that the user
11237 explicitly requested to be casted. But the pipeline for an
11238 explicit cast first tests for potential implicit casts.
11240 So for now, if the Location is null, it means `Probe only' to
11241 avoid adding another argument. Might have to revise this
11244 (ClassCast): New class used to type cast objects into arbitrary
11245 classes (used in Explicit Reference Conversions).
11247 Implement `as' as well.
11249 Reverted all the patches from Ravi below: they were broken:
11251 * The use of `level' as a mechanism to stop recursive
11252 invocations is wrong. That was there just to catch the
11253 bug with a strack trace but not as a way of addressing
11256 To fix the problem we have to *understand* what is going
11257 on and the interactions and come up with a plan, not
11258 just get things going.
11260 * The use of the type conversion cache that I proposed
11261 last night had an open topic: How does this work across
11262 protection domains. A user defined conversion might not
11263 be public in the location where we are applying the
11264 conversion, a different conversion might be selected
11265 (ie, private A->B (better) but public B->A (worse),
11266 inside A, A->B applies, but outside it, B->A will
11269 * On top of that (ie, even if the above is solved),
11270 conversions in a cache need to be abstract. Ie, `To
11271 convert from an Int to a Short use an OpcodeCast', not
11272 `To convert from an Int to a Short use the OpcodeCast on
11273 the variable 5' (which is what this patch was doing).
11275 2001-09-28 Ravi Pratap <ravi@ximian.com>
11277 * expression.cs (Invocation::ConversionExists): Re-write to use
11278 the conversion cache
11280 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11281 cache all conversions done, not just user-defined ones.
11283 (Invocation::BetterConversion): The real culprit. Use ConversionExists
11284 to determine if a conversion exists instead of acutually trying to
11285 perform the conversion. It's faster too.
11287 (Expression::ConvertExplicit): Modify to use ConversionExists to check
11288 and only then attempt the implicit conversion.
11290 2001-09-28 Ravi Pratap <ravi@ximian.com>
11292 * expression.cs (ConvertImplicit): Use a cache for conversions
11293 already found. Check level of recursion and bail out if necessary.
11295 2001-09-28 Miguel de Icaza <miguel@ximian.com>
11297 * typemanager.cs (string_concat_string_string, string_concat_object_object):
11298 Export standard methods that we expect for string operations.
11300 * statement.cs (Block::UsageWarning): Track usage of variables and
11301 report the errors for not used variables.
11303 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11306 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11308 * codegen.cs: remove unnneded code
11310 * expression.cs: Removed BuiltinTypeAccess class
11312 Fix the order in which implicit conversions are
11315 The previous fixed dropped support for boxed conversions (adding a
11316 test to the test suite now)
11318 (UserImplicitCast::CanConvert): Remove test for source being null,
11319 that code is broken. We should not feed a null to begin with, if
11320 we do, then we should track the bug where the problem originates
11321 and not try to cover it up here.
11323 Return a resolved expression of type UserImplicitCast on success
11324 rather than true/false. Ravi: this is what I was talking about,
11325 the pattern is to use a static method as a "constructor" for
11328 Also, do not create arguments until the very last minute,
11329 otherwise we always create the arguments even for lookups that
11330 will never be performed.
11332 (UserImplicitCast::Resolve): Eliminate, objects of type
11333 UserImplicitCast are born in a fully resolved state.
11335 * typemanager.cs (InitCoreTypes): Init also value_type
11336 (System.ValueType).
11338 * expression.cs (Cast::Resolve): First resolve the child expression.
11340 (LValue): Add new method AddressOf to be used by
11343 Change the argument of Store to take an EmitContext instead of an
11344 ILGenerator, because things like FieldExpr need to be able to call
11345 their children expression to generate the instance code.
11347 (Expression::Error, Expression::Warning): Sugar functions for
11350 (Expression::MemberLookup): Accept a TypeContainer instead of a
11351 Report as the first argument.
11353 (Expression::ResolvePrimary): Killed. I still want to improve
11354 this as currently the code is just not right.
11356 (Expression::ResolveMemberAccess): Simplify, but it is still
11359 (Unary::Resolve): Catch errors in AddressOf operators.
11361 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11362 index to a byte for the short-version, or the compiler will choose
11363 the wrong Emit call, which generates the wrong data.
11365 (ParameterReference::Emit, ::Store): same.
11367 (FieldExpr::AddressOf): Implement.
11369 * typemanager.cs: TypeManager: made public variable instead of
11372 * driver.cs: document --fatal.
11374 * report.cs (ErrorMessage, WarningMessage): new names for the old
11375 Error and Warning classes.
11377 * cs-parser.jay (member_access): Turn built-in access to types
11378 into a normal simplename
11380 2001-09-27 Ravi Pratap <ravi@ximian.com>
11382 * expression.cs (Invocation::BetterConversion): Fix to cope
11383 with q being null, since this was introducing a bug.
11385 * expression.cs (ConvertImplicit): Do built-in conversions first.
11387 2001-09-27 Ravi Pratap <ravi@ximian.com>
11389 * expression.cs (UserImplicitCast::Resolve): Fix bug.
11391 2001-09-27 Ravi Pratap <ravi@ximian.com>
11393 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11394 I had introduced long ago (what's new ?).
11396 * expression.cs (UserImplicitCast::CanConvert): Static method to do
11397 the work of all the checking.
11398 (ConvertImplicit): Call CanConvert and only then create object if necessary.
11399 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11401 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11402 that is the right way.
11404 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
11405 overloading resolution. Use everywhere instead of cutting and pasting code.
11407 (Binary::ResolveOperator): Use MakeUnionSet.
11409 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
11410 we have to convert to bool types. Not complete yet.
11412 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11414 * typemanager.cs (TypeManager::CSharpName): support ushort.
11416 * expression.cs (Expression::TryImplicitIntConversion): Attempts
11417 to provide an expression that performsn an implicit constant int
11418 conversion (section 6.1.6).
11419 (Expression::ConvertImplicitRequired): Reworked to include
11420 implicit constant expression conversions.
11422 (Expression::ConvertNumericExplicit): Finished.
11424 (Invocation::Emit): If InstanceExpression is null, then it means
11425 that we perform a call on this.
11427 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11429 * expression.cs (Unary::Emit): Remove some dead code.
11430 (Probe): Implement Resolve and Emit for `is'.
11431 (Expression::ConvertImplicitRequired): Attempt to do constant
11432 expression conversions here. Maybe should be moved to
11433 ConvertImplicit, but I am not sure.
11434 (Expression::ImplicitLongConstantConversionPossible,
11435 Expression::ImplicitIntConstantConversionPossible): New functions
11436 that tell whether is it possible to apply an implicit constant
11437 expression conversion.
11439 (ConvertNumericExplicit): Started work on explicit numeric
11442 * cs-parser.jay: Update operator constants.
11444 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11445 (Parameters::GetSignature): Hook up VerifyArgs here.
11446 (Parameters::VerifyArgs): Verifies that no two arguments have the
11449 * class.cs (Operator): Update the operator names to reflect the
11450 ones that the spec expects (as we are just stringizing the
11453 * expression.cs (Unary::ResolveOperator): Fix bug: Use
11454 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11455 previous usage did only work for our methods.
11456 (Expression::ConvertImplicit): Handle decimal implicit numeric
11457 conversions as well.
11458 (Expression::InternalTypeConstructor): Used to invoke constructors
11459 on internal types for default promotions.
11461 (Unary::Emit): Implement special handling for the pre/post
11462 increment/decrement for overloaded operators, as they need to have
11463 the same semantics as the other operators.
11465 (Binary::ResolveOperator): ditto.
11466 (Invocation::ConversionExists): ditto.
11467 (UserImplicitCast::Resolve): ditto.
11469 2001-09-26 Ravi Pratap <ravi@ximian.com>
11471 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11472 operator, return after emitting body. Regression tests pass again !
11474 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11475 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11476 (Invocation::OverloadResolve): Ditto.
11477 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11479 * everywhere : update calls to the above methods accordingly.
11481 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11483 * assign.cs (Assign): Make it inherit from ExpressionStatement.
11485 * expression.cs (ExpressionStatement): New base class used for
11486 expressions that can appear in statements, so that we can provide
11487 an alternate path to generate expression that do not leave a value
11490 (Expression::Emit, and all the derivatives): We no longer return
11491 whether a value is left on the stack or not. Every expression
11492 after being emitted leaves a single value on the stack.
11494 * codegen.cs (EmitContext::EmitStatementExpression): Use the
11495 facilties of ExpressionStatement if possible.
11497 * cs-parser.jay: Update statement_expression.
11499 2001-09-25 Miguel de Icaza <miguel@ximian.com>
11501 * driver.cs: Change the wording of message
11503 2001-09-25 Ravi Pratap <ravi@ximian.com>
11505 * expression.cs (Binary::ResolveOperator): Had forgottten to set
11506 the type of the expression to the return type of the method if
11507 we have an overloaded operator match ! The regression tests pass again !
11508 (Unary::ResolveOperator): Ditto.
11510 * expression.cs (Invocation::ConversionExists): Correct the member lookup
11511 to find "op_Implicit", not "implicit" ;-)
11512 (UserImplicitCast): New class to take care of user-defined implicit conversions.
11513 (ConvertImplicit, ForceConversion): Take TypeContainer argument
11515 * everywhere : Correct calls to the above accordingly.
11517 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11518 (ConvertImplicit): Do user-defined conversion if it exists.
11520 2001-09-24 Miguel de Icaza <miguel@ximian.com>
11522 * assign.cs: track location.
11523 (Resolve): Use implicit conversions on assignment.
11525 * literal.cs: Oops. Not good, Emit of short access values should
11526 pass (Bytes) or the wrong argument will be selected.
11528 * expression.cs (Unary::Emit): Emit code for -expr.
11530 (Unary::ResolveOperator): Handle `Substract' for non-constants
11531 (substract from zero from the non-constants).
11532 Deal with Doubles as well.
11534 (Expression::ConvertImplicitRequired): New routine that reports an
11535 error if no implicit conversion exists.
11537 (Invocation::OverloadResolve): Store the converted implicit
11538 expressions if we make them
11540 2001-09-24 Ravi Pratap <ravi@ximian.com>
11542 * class.cs (ConstructorInitializer): Take a Location argument.
11543 (ConstructorBaseInitializer): Same here.
11544 (ConstructorThisInitializer): Same here.
11546 * cs-parser.jay : Update all calls accordingly.
11548 * expression.cs (Unary, Binary, New): Take location argument.
11549 Update accordingly everywhere.
11551 * cs-parser.jay : Update all calls to the above to take a location
11554 * class.cs : Ditto.
11556 2001-09-24 Ravi Pratap <ravi@ximian.com>
11558 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11559 (Invocation::BetterConversion): Same here
11560 (Invocation::ConversionExists): Ditto.
11562 (Invocation::ConversionExists): Implement.
11564 2001-09-22 Ravi Pratap <ravi@ximian.com>
11566 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11567 Also take an additional TypeContainer argument.
11569 * All over : Pass in TypeContainer as argument to OverloadResolve.
11571 * typemanager.cs (CSharpName): Update to check for the string type and return
11574 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11577 2001-09-21 Ravi Pratap <ravi@ximian.com>
11579 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11580 (Invocation::BetterFunction): Implement.
11581 (Invocation::BetterConversion): Implement.
11582 (Invocation::ConversionExists): Skeleton, no implementation yet.
11584 Okay, things work fine !
11586 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11588 * typemanager.cs: declare and load enum_type, delegate_type and
11591 * expression.cs (Expression::Emit): Now emit returns a value that
11592 tells whether a value is left on the stack or not. This strategy
11593 might be reveted tomorrow with a mechanism that would address
11594 multiple assignments.
11595 (Expression::report118): Utility routine to report mismatches on
11598 (Unary::Report23): Report impossible type/operator combination
11601 (Unary::IsIncrementableNumber): Whether the type can be
11602 incremented or decremented with add.
11603 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11605 (Unary::ResolveOperator): Implement ++, !, ~,
11607 (Invocation::Emit): Deal with new Emit convetion.
11609 * All Expression derivatives: Updated their Emit method to return
11610 whether they leave values on the stack or not.
11612 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11613 stack for expressions that are statements.
11615 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11617 * expression.cs (LValue): New interface. Must be implemented by
11619 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11622 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11623 interface for generating code, simplifies the code.
11625 2001-09-20 Ravi Pratap <ravi@ximian.com>
11627 * expression.cs (everywhere): Comment out return statements in ::Resolve
11628 methods to avoid the warnings.
11630 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11632 * driver.cs (parse): Report error 2001 if we can not open the
11635 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11638 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11641 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11642 otherwise nested blocks end up with the same index.
11644 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11646 * expression.cs: Instead of having FIXMEs in the Resolve
11647 functions, throw exceptions so it is obvious that we are facing a
11650 * cs-parser.jay (invocation_expression): Pass Location information.
11652 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11653 Use a basename for those routines because .NET does not like paths
11656 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11659 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11661 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11662 are loading the correct data types (throws an exception if not).
11663 (TypeManager::InitCoreTypes): Use CoreLookupType
11665 * expression.cs (Unary::ResolveOperator): return the child
11666 expression for expressions which are just +expr.
11667 (Unary::ResolveOperator): Return negative literals for -LITERAL
11668 expressions (otherwise they are Unary {Literal}).
11669 (Invocation::Badness): Take into account `Implicit constant
11670 expression conversions'.
11672 * literal.cs (LongLiteral): Implement long literal class.
11673 (IntLiteral): export the `Value' of the intliteral.
11675 2001-09-19 Ravi Pratap <ravi@ximian.com>
11677 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11679 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11680 instead of 'Operator'
11682 * expression.cs (Binary::ResolveOperator): Update accordingly.
11683 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11686 * cs-parser.jay (unary_expression): Update to use the new names.
11688 * gen-treedump.cs (GetUnary): Same here.
11690 * expression.cs (Unary::Resolve): Implement.
11691 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11692 operators are found instead of making noise ;-)
11693 (Unary::ResolveOperator): New method to do precisely the same thing which
11694 Binary::ResolveOperator does for Binary expressions.
11695 (Unary.method, .Arguments): Add.
11696 (Unary::OperName): Implement.
11697 (Unary::ForceConversion): Copy and Paste !
11699 * class.cs (Operator::Define): Fix a small bug for the case when we have
11702 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11703 for the inbuilt operators. Only overloading works for now ;-)
11705 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11707 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11708 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11710 * expression.cs (This::Emit): Implement.
11711 (This::Resolve): Implement.
11712 (TypeOf:Resolve): Implement.
11713 (Expression::ResolveSimpleName): Add an implicit this to instance
11715 (MemberAccess::Resolve): Deal with Parameters and Fields.
11716 Bind instance variable to Field expressions.
11717 (FieldExpr::Instance): New field used to track the expression that
11718 represents the object instance.
11719 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11721 (FieldExpr::Emit): Implement.
11723 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11724 the last instruction contains a return opcode to avoid generating
11725 the last `ret' instruction (this generates correct code, and it is
11726 nice to pass the peverify output).
11728 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11729 initializer for static and instance variables.
11730 (Constructor::Emit): Allow initializer to be null in the case of
11731 static constructors. Only emit initializer for instance
11734 (TypeContainer::FindMembers): Return a null array if there are no
11737 Also fix the code for the MemberTypes.Method branch, as it was not
11738 scanning that for operators (or tried to access null variables before).
11740 * assign.cs (Assign::Emit): Handle instance and static fields.
11744 * driver.cs: Stop compilation if there are parse errors.
11746 * cs-parser.jay (constructor_declaration): Provide default base
11747 initializer for non-static constructors.
11748 (constructor_declarator): Do not provide a default base
11749 initializers if none was specified.
11750 Catch the fact that constructors should not have parameters.
11752 * class.cs: Do not emit parent class initializers for static
11753 constructors, that should be flagged as an error.
11755 2001-09-18 Ravi Pratap <ravi@ximian.com>
11757 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11758 Move back code into TypeContainer::Populate.
11760 2001-09-18 Ravi Pratap <ravi@ximian.com>
11762 * class.cs (TypeContainer::AddConstructor): Fix the check to
11763 compare against Name, not Basename.
11764 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11766 * cs-parser.jay : Update accordingly.
11768 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11769 for methods, don't forget to look into the operators too.
11770 (RegisterMethodBuilder): Helper method to take care of this for
11771 methods, constructors and operators.
11772 (Operator::Define): Completely revamp.
11773 (Operator.OperatorMethod, MethodName): New fields.
11774 (TypeContainer::Populate): Move the registering of builders into
11775 RegisterMethodBuilder.
11776 (Operator::Emit): Re-write.
11778 * expression.cs (Binary::Emit): Comment out code path to emit method
11779 invocation stuff for the case when we have a user defined operator. I am
11780 just not able to get it right !
11782 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11784 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11787 (Expression::MemberLookup): Provide a version that allows to
11788 specify the MemberTypes and BindingFlags.
11790 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11791 so it was not fetching variable information from outer blocks.
11793 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11794 Beforefieldinit as it was buggy.
11796 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11797 that Ravi put here.
11799 * class.cs (Constructor::Emit): Only emit if block is not null.
11800 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11801 deal with this by semantically definining it as if the user had
11804 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11805 constructors as we now "emit" them at a higher level.
11807 (TypeContainer::DefineDefaultConstructor): Used to define the
11808 default constructors if none was provided.
11810 (ConstructorInitializer): Add methods Resolve and Emit.
11812 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11814 2001-09-17 Ravi Pratap <ravi@ximian.com>
11816 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11817 the default constructor builder with our hashtable for methodbuilders
11820 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11821 and argument_count is 0 in which case we have a match.
11822 (Binary::ResolveOperator): More null checking and miscellaneous coding
11825 2001-09-17 Ravi Pratap <ravi@ximian.com>
11827 * rootcontext.cs (IsNameSpace): Compare against null.
11829 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11831 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11832 and Unary::Operator.
11834 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11837 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11838 we have overloaded operators.
11839 (Binary::ResolveOperator): Implement the part which does the operator overload
11842 * class.cs (Operator::Emit): Implement.
11843 (TypeContainer::Emit): Emit the operators we have too.
11845 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11846 the case when we have a user-defined operator.
11848 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11850 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11852 2001-09-16 Ravi Pratap <ravi@ximian.com>
11854 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11855 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11856 (Constructor::Emit): Implement.
11857 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11858 if we have no work to do.
11859 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11862 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11863 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11865 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11868 2001-09-15 Ravi Pratap <ravi@ximian.com>
11870 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11872 (Tree::RecordNamespace): Method to do what the name says ;-)
11873 (Tree::Namespaces): Property to get at the namespaces hashtable.
11875 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11878 * rootcontext.cs (IsNamespace): Fixed it :-)
11880 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11882 * class.cs (TypeContainer::FindMembers): Add support for
11884 (MethodCore): New class that encapsulates both the shared aspects
11885 of a Constructor and a Method.
11886 (Method, Constructor): Factored pieces into MethodCore.
11888 * driver.cs: Added --fatal which makes errors throw exceptions.
11889 Load System assembly as well as part of the standard library.
11891 * report.cs: Allow throwing exceptions on errors for debugging.
11893 * modifiers.cs: Do not use `parent', instead use the real type
11894 container to evaluate permission settings.
11896 * class.cs: Put Ravi's patch back in. He is right, and we will
11897 have to cope with the
11899 2001-09-14 Ravi Pratap <ravi@ximian.com>
11901 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11902 FamORAssem, not FamANDAssem.
11904 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11906 * driver.cs: Added --parse option that only parses its input files
11909 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11910 incorrect. IsTopLevel is not used to tell whether an object is
11911 root_types or not (that can be achieved by testing this ==
11912 root_types). But to see if this is a top-level *class* (not
11913 necessarly our "toplevel" container).
11915 2001-09-14 Ravi Pratap <ravi@ximian.com>
11917 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11918 parent instead of a direct call to GetType.
11920 2001-09-14 Ravi Pratap <ravi@ximian.com>
11922 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11923 Modifiers.TypeAttr. This should just be a call to that method.
11925 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11926 object so that we can determine if we are top-level or not.
11928 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11931 * enum.cs (Enum::Define): Ditto.
11933 * modifiers.cs (FieldAttr): Re-write.
11935 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11936 (TypeContainer::HaveStaticConstructor): New property to provide access
11937 to precisely that info.
11939 * modifiers.cs (MethodAttr): Re-write.
11940 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11942 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11943 of top-level types as claimed.
11945 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11947 * expression.cs (MemberLookup): Fruitless attempt to lookup
11948 constructors. Maybe I need to emit default constructors? That
11949 might be it (currently .NET emits this for me automatically).
11950 (Invocation::OverloadResolve): Cope with Arguments == null.
11951 (Invocation::EmitArguments): new function, shared by the new
11952 constructor and us.
11953 (Invocation::Emit): Handle static and instance methods. Emit
11954 proper call instruction for virtual or non-virtual invocations.
11955 (New::Emit): Implement.
11956 (New::Resolve): Implement.
11957 (MemberAccess:Resolve): Implement.
11958 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11959 to track instances.
11960 (FieldExpr::Resolve): Set type.
11962 * support.cs: Handle empty arguments.
11964 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11965 SimpleLookup): Auxiliary routines to help parse a qualifier
11968 Update qualifier_identifier rule.
11970 * codegen.cs: Removed debugging messages.
11972 * class.cs: Make this a global thing, this acts just as a "key" to
11973 objects that we might have around.
11975 (Populate): Only initialize method_builders_to_methods once.
11977 * expression.cs (PropertyExpr): Initialize type from the
11980 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11981 Resolve pattern. Attempt to implicitly convert value to boolean.
11984 * expression.cs: Set the type for the int32/int32 argument case.
11985 (Binary::ResolveOperator): Set the return type to boolean for
11986 comparission operators
11988 * typemanager.cs: Remove debugging print code.
11990 (Invocation::Resolve): resolve type.
11992 * class.cs: Allocate a MemberInfo of the correct size, as the code
11993 elsewhere depends on the test to reflect the correct contents.
11995 (Method::) Keep track of parameters, due to System.Reflection holes
11997 (TypeContainer::Populate): Keep track of MethodBuilders to Method
12000 (TypeContainer::FindMembers): Use ArrayList and then copy an array
12001 of the exact size and return that.
12003 (Class::LookupMethodByBuilder): New function that maps
12004 MethodBuilders to its methods. Required to locate the information
12005 on methods because System.Reflection bit us again.
12007 * support.cs: New file, contains an interface ParameterData and
12008 two implementations: ReflectionParameters and InternalParameters
12009 used to access Parameter information. We will need to grow this
12012 * expression.cs (Invocation::GetParameterData): implement a cache
12013 and a wrapper around the ParameterData creation for methods.
12014 (Invocation::OverloadResolve): Use new code.
12016 2001-09-13 Ravi Pratap <ravi@ximian.com>
12018 * class.cs (TypeContainer::EmitField): Remove and move into
12019 (Field::Define): here and modify accordingly.
12020 (Field.FieldBuilder): New member.
12021 (TypeContainer::Populate): Update accordingly.
12022 (TypeContainer::FindMembers): Implement.
12024 2001-09-13 Miguel de Icaza <miguel@ximian.com>
12026 * statement.cs: (VariableInfo::VariableType): New field to be
12027 initialized with the full type once it is resolved.
12029 2001-09-12 Miguel de Icaza <miguel@ximian.com>
12031 * parameter.cs (GetParameterInfo): Use a type cache to compute
12032 things only once, and to reuse this information
12034 * expression.cs (LocalVariableReference::Emit): Implement.
12035 (OpcodeCast::Emit): fix.
12037 (ParameterReference::Resolve): Implement.
12038 (ParameterReference::Emit): Implement.
12040 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12041 that are expressions need to stay as Expressions.
12043 * typemanager.cs (CSharpName): Returns the C# name of a type if
12046 * expression.cs (Expression::ConvertImplicit): New function that
12047 implements implicit type conversions.
12049 (Expression::ImplicitReferenceConversion): Implements implicit
12050 reference conversions.
12052 (EmptyCast): New type for transparent casts.
12054 (OpcodeCast): New type for casts of types that are performed with
12055 a sequence of bytecodes.
12057 (BoxedCast): New type used for casting value types into reference
12058 types. Emits a box opcode.
12060 (Binary::DoNumericPromotions): Implements numeric promotions of
12061 and computation of the Binary::Type.
12063 (Binary::EmitBranchable): Optimization.
12065 (Binary::Emit): Implement code emission for expressions.
12067 * typemanager.cs (TypeManager): Added two new core types: sbyte
12070 2001-09-12 Ravi Pratap <ravi@ximian.com>
12072 * class.cs (TypeContainer::FindMembers): Method which does exactly
12073 what Type.FindMembers does, only we don't have to use reflection. No
12074 implementation yet.
12076 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
12077 typecontainer objects as we need to get at them.
12078 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
12080 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
12081 typecontainer object.
12083 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
12084 of just a Report object.
12086 2001-09-11 Ravi Pratap <ravi@ximian.com>
12088 * class.cs (Event::Define): Go back to using the prefixes "add_" and
12090 (TypeContainer::Populate): Now define the delegates of the type too.
12091 (TypeContainer.Delegates): Property to access the list of delegates defined
12094 * delegates.cs (Delegate::Define): Implement partially.
12096 * modifiers.cs (TypeAttr): Handle more flags.
12098 2001-09-11 Ravi Pratap <ravi@ximian.com>
12100 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
12102 (Operator::Define): Re-write logic to get types by using the LookupType method
12103 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
12104 (Indexer::Define): Ditto.
12105 (Event::Define): Ditto.
12106 (Property::Define): Ditto.
12108 2001-09-10 Ravi Pratap <ravi@ximian.com>
12110 * class.cs (TypeContainer::Populate): Now define operators too.
12111 (TypeContainer.Operators): New property to access the list of operators
12113 (Operator.OperatorMethodBuilder): New member to hold the method builder
12114 for the operator we are defining.
12115 (Operator::Define): Implement.
12117 2001-09-10 Ravi Pratap <ravi@ximian.com>
12119 * class.cs (Event::Define): Make the prefixes of the accessor methods
12120 addOn_ and removeOn_
12122 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12123 of the location being passed in too. Ideally, this should go later since all
12124 error reporting should be done through the Report object.
12126 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12127 (Populate): Iterate thru the indexers we have and define them too.
12128 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12129 for the get and set accessors.
12130 (Indexer::Define): Implement.
12132 2001-09-09 Miguel de Icaza <miguel@ximian.com>
12134 * expression.cs (Binary::Resolve): Beginning of it. I scratched
12135 my previous implementation, did not work.
12137 * typemanager.cs: Add a couple of missing types (the longs).
12139 * literal.cs: Use TypeManager.bool_type instead of getting it.
12141 * expression.cs (EventExpr): New kind of expressions.
12142 (Expressio::ExprClassFromMemberInfo): finish
12144 2001-09-08 Miguel de Icaza <miguel@ximian.com>
12146 * assign.cs: Emit stores to static fields differently.
12148 2001-09-08 Ravi Pratap <ravi@ximian.com>
12150 * Merge in changes and adjust code to tackle conflicts. Backed out my
12151 code in Assign::Resolve ;-)
12153 2001-09-08 Ravi Pratap <ravi@ximian.com>
12155 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12156 instead Report.Error and also pass in the location.
12157 (CSharpParser::Lexer): New readonly property to return the reference
12158 to the Tokenizer object.
12159 (declare_local_variables): Use Report.Error with location instead of plain
12163 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12164 (Operator.CheckBinaryOperator): Ditto.
12166 * cs-parser.jay (operator_declarator): Update accordingly.
12168 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12169 (CheckBinaryOperator): Same here.
12171 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12172 on the name without any prefixes of namespace names etc. This is because we
12173 already might have something already fully qualified like
12174 'System.Console.WriteLine'
12176 * assign.cs (Resolve): Begin implementation. Stuck ;-)
12178 2001-09-07 Ravi Pratap <ravi@ximian.com>
12180 * cs-tokenizer.cs (location): Return a string which also contains
12183 * expression.cs (ElementAccess): New class for expressions of the
12184 type 'element access.'
12185 (BaseAccess): New class for expressions of the type 'base access.'
12186 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12189 * cs-parser.jay (element_access): Implement action.
12190 (base_access): Implement actions.
12191 (checked_expression, unchecked_expression): Implement.
12193 * cs-parser.jay (local_variable_type): Correct and implement.
12194 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12196 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12198 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12199 name and the specifiers.
12201 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12203 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
12204 making them all public ;-)
12206 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12209 2001-09-07 Miguel de Icaza <miguel@ximian.com>
12211 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12213 (FieldExpr, PropertyExprs): New resolved expressions.
12214 (SimpleName::MemberStaticCheck): Perform static checks for access
12215 to non-static fields on static methods. Maybe this should be
12216 generalized for MemberAccesses.
12217 (SimpleName::ResolveSimpleName): More work on simple name
12220 * cs-parser.jay (primary_expression/qualified_identifier): track
12221 the parameter index.
12223 * codegen.cs (CodeGen::Save): Catch save exception, report error.
12224 (EmitContext::EmitBoolExpression): Chain to expression generation
12225 instead of temporary hack.
12226 (::EmitStatementExpression): Put generic expression code generation.
12228 * assign.cs (Assign::Emit): Implement variable assignments to
12229 local variables, parameters and fields.
12231 2001-09-06 Miguel de Icaza <miguel@ximian.com>
12233 * statement.cs (Block::GetVariableInfo): New method, returns the
12234 VariableInfo for a variable name in a block.
12235 (Block::GetVariableType): Implement in terms of GetVariableInfo
12237 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12238 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12240 2001-09-06 Ravi Pratap <ravi@ximian.com>
12242 * cs-parser.jay (operator_declaration): Continue on my quest : update
12243 to take attributes argument.
12244 (event_declaration): Ditto.
12245 (enum_declaration): Ditto.
12246 (indexer_declaration): Ditto.
12248 * class.cs (Operator::Operator): Update constructor accordingly.
12249 (Event::Event): Ditto.
12251 * delegate.cs (Delegate::Delegate): Same here.
12253 * enum.cs (Enum::Enum): Same here.
12255 2001-09-05 Ravi Pratap <ravi@ximian.com>
12257 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12259 * ../tests/cs0658.cs : New file to demonstrate error 0658.
12261 * attribute.cs (Attributes): New class to encapsulate all attributes which were
12262 being passed around as an arraylist.
12263 (Attributes::AddAttribute): Method to add attribute sections.
12265 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12266 (struct_declaration): Update accordingly.
12267 (constant_declaration): Update.
12268 (field_declaration): Update.
12269 (method_header): Update.
12270 (fixed_parameter): Update.
12271 (parameter_array): Ditto.
12272 (property_declaration): Ditto.
12273 (destructor_declaration): Ditto.
12275 * class.cs (Struct::Struct): Update constructors accordingly.
12276 (Class::Class): Ditto.
12277 (Field::Field): Ditto.
12278 (Method::Method): Ditto.
12279 (Property::Property): Ditto.
12280 (TypeContainer::OptAttribute): update property's return type.
12282 * interface.cs (Interface.opt_attributes): New member.
12283 (Interface::Interface): Update to take the extra Attributes argument.
12285 * parameter.cs (Parameter::Parameter): Ditto.
12287 * constant.cs (Constant::Constant): Ditto.
12289 * interface.cs (InterfaceMemberBase): New OptAttributes field.
12290 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
12291 the attributes as a parameter.
12292 (InterfaceProperty): Update constructor call.
12293 (InterfaceEvent): Ditto.
12294 (InterfaceMethod): Ditto.
12295 (InterfaceIndexer): Ditto.
12297 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
12298 pass the attributes too.
12299 (interface_event_declaration): Ditto.
12300 (interface_property_declaration): Ditto.
12301 (interface_method_declaration): Ditto.
12302 (interface_declaration): Ditto.
12304 2001-09-05 Miguel de Icaza <miguel@ximian.com>
12306 * class.cs (Method::Define): Track the "static Main" definition to
12307 create an entry point.
12309 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12310 EntryPoint if we find it.
12312 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12313 (EmitContext::ig): Make this variable public.
12315 * driver.cs: Make the default output file be the first file name
12316 with the .exe extension.
12318 Detect empty compilations
12320 Handle various kinds of output targets. Handle --target and
12321 rename -t to --dumper.
12323 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12324 methods inherited from Expression return now an Expression. This
12325 will is used during the tree rewriting as we resolve them during
12328 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12329 the spec. Missing entirely is the information about
12330 accessability of elements of it.
12332 (Expression::ExprClassFromMemberInfo): New constructor for
12333 Expressions that creates a fully initialized Expression based on
12334 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12337 (Invocation::Resolve): Begin implementing resolution of invocations.
12339 * literal.cs (StringLiteral): Implement Emit.
12341 2001-09-05 Ravi Pratap <ravi@ximian.com>
12343 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12346 2001-09-04 Ravi Pratap <ravi@ximian.com>
12348 * cs-parser.jay (attribute_arguments): Implement actions.
12349 (attribute): Fix bug in production. Implement action.
12350 (attribute_list): Implement.
12351 (attribute_target): Implement.
12352 (attribute_target_specifier, opt_target_specifier): Implement
12353 (CheckAttributeTarget): New method to check if the attribute target
12355 (attribute_section): Implement.
12356 (opt_attributes): Implement.
12358 * attribute.cs : New file to handle attributes.
12359 (Attribute): Class to hold attribute info.
12361 * cs-parser.jay (opt_attribute_target_specifier): Remove production
12362 (attribute_section): Modify production to use 2 different rules to
12363 achieve the same thing. 1 s/r conflict down !
12364 Clean out commented, useless, non-reducing dimension_separator rules.
12366 * class.cs (TypeContainer.attributes): New member to hold list
12367 of attributes for a type.
12368 (Struct::Struct): Modify to take one more argument, the attribute list.
12369 (Class::Class): Ditto.
12370 (Field::Field): Ditto.
12371 (Method::Method): Ditto.
12372 (Property::Property): Ditto.
12374 * cs-parser.jay (struct_declaration): Update constructor call to
12375 pass in the attributes too.
12376 (class_declaration): Ditto.
12377 (constant_declaration): Ditto.
12378 (field_declaration): Ditto.
12379 (method_header): Ditto.
12380 (fixed_parameter): Ditto.
12381 (parameter_array): Ditto.
12382 (property_declaration): Ditto.
12384 * constant.cs (Constant::Constant): Update constructor similarly.
12385 Use System.Collections.
12387 * parameter.cs (Parameter::Parameter): Update as above.
12389 2001-09-02 Ravi Pratap <ravi@ximian.com>
12391 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12392 (TypeContainer.delegates): New member to hold list of delegates.
12394 * cs-parser.jay (delegate_declaration): Implement the action correctly
12395 this time as I seem to be on crack ;-)
12397 2001-09-02 Miguel de Icaza <miguel@ximian.com>
12399 * rootcontext.cs (RootContext::IsNamespace): new function, used to
12400 tell whether an identifier represents a namespace.
12402 * expression.cs (NamespaceExpr): A namespace expression, used only
12403 temporarly during expression resolution.
12404 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12405 utility functions to resolve names on expressions.
12407 2001-09-01 Miguel de Icaza <miguel@ximian.com>
12409 * codegen.cs: Add hook for StatementExpressions.
12411 * class.cs: Fix inverted test for static flag in methods.
12413 2001-09-02 Ravi Pratap <ravi@ximian.com>
12415 * class.cs (Operator::CheckUnaryOperator): Correct error number used
12416 to make it coincide with MS' number.
12417 (Operator::CheckBinaryOperator): Ditto.
12419 * ../errors/errors.txt : Remove error numbers added earlier.
12421 * ../errors/cs1019.cs : Test case for error # 1019
12423 * ../errros/cs1020.cs : Test case for error # 1020
12425 * cs-parser.jay : Clean out commented cruft.
12426 (dimension_separators, dimension_separator): Comment out. Ostensibly not
12427 used anywhere - non-reducing rule.
12428 (namespace_declarations): Non-reducing rule - comment out.
12430 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12431 with TypeContainer::AddEnum.
12433 * delegate.cs : New file for delegate handling classes.
12434 (Delegate): Class for declaring delegates.
12436 * makefile : Update.
12438 * cs-parser.jay (delegate_declaration): Implement.
12440 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
12442 * class.cs (Event::Define): Implement.
12443 (Event.EventBuilder): New member.
12445 * class.cs (TypeContainer::Populate): Update to define all enums and events
12447 (Events): New property for the events arraylist we hold. Shouldn't we move to using
12448 readonly fields for all these cases ?
12450 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12452 * class.cs (Property): Revamp to use the convention of making fields readonly.
12453 Accordingly modify code elsewhere.
12455 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12456 the Define method of the Property class.
12458 * class.cs : Clean up applied patch and update references to variables etc. Fix
12460 (TypeContainer::Populate): Update to define all the properties we have. Also
12461 define all enumerations.
12463 * enum.cs (Define): Implement.
12465 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12467 * cs-parser.jay (overloadable_operator): The semantic value is an
12468 enum of the Operator class.
12469 (operator_declarator): Implement actions.
12470 (operator_declaration): Implement.
12472 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12473 validity of definitions.
12474 (Operator::CheckBinaryOperator): Static method to check for binary operators
12475 (TypeContainer::AddOperator): New method to add an operator to a type.
12477 * cs-parser.jay (indexer_declaration): Added line to actually call the
12478 AddIndexer method so it gets added ;-)
12480 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
12481 already taken care of by the MS compiler ?
12483 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12485 * class.cs (Operator): New class for operator declarations.
12486 (Operator::OpType): Enum for the various operators.
12488 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12490 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12491 ostensibly handle this in semantic analysis.
12493 * cs-parser.jay (general_catch_clause): Comment out
12494 (specific_catch_clauses, specific_catch_clause): Ditto.
12495 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12496 (catch_args, opt_catch_args): New productions.
12497 (catch_clause): Rewrite to use the new productions above
12498 (catch_clauses): Modify accordingly.
12499 (opt_catch_clauses): New production to use in try_statement
12500 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12501 and re-write the code in the actions to extract the specific and
12502 general catch clauses by being a little smart ;-)
12504 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12505 Hooray, try and catch statements parse fine !
12507 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12509 * statement.cs (Block::GetVariableType): Fix logic to extract the type
12510 string from the hashtable of variables.
12512 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12513 I end up making that mistake ;-)
12514 (catch_clauses): Fixed gross error which made Key and Value of the
12515 DictionaryEntry the same : $1 !!
12517 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12519 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12521 * cs-parser.jay (event_declaration): Correct to remove the semicolon
12522 when the add and remove accessors are specified.
12524 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12526 * cs-parser.jay (IndexerDeclaration): New helper class to hold
12527 information about indexer_declarator.
12528 (indexer_declarator): Implement actions.
12529 (parsing_indexer): New local boolean used to keep track of whether
12530 we are parsing indexers or properties. This is necessary because
12531 implicit_parameters come into picture even for the get accessor in the
12532 case of an indexer.
12533 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12535 * class.cs (Indexer): New class for indexer declarations.
12536 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12537 (TypeContainer::indexers): New member to hold list of indexers for the
12540 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12542 * cs-parser.jay (add_accessor_declaration): Implement action.
12543 (remove_accessor_declaration): Implement action.
12544 (event_accessors_declaration): Implement
12545 (variable_declarators): swap statements for first rule - trivial.
12547 * class.cs (Event): New class to hold information about event
12549 (TypeContainer::AddEvent): New method to add an event to a type
12550 (TypeContainer::events): New member to hold list of events.
12552 * cs-parser.jay (event_declaration): Implement actions.
12554 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12556 * cs-parser.jay (dim_separators): Implement. Make it a string
12557 concatenating all the commas together, just as they appear.
12558 (opt_dim_separators): Modify accordingly
12559 (rank_specifiers): Update accordingly. Basically do the same
12560 thing - instead, collect the brackets here.
12561 (opt_rank_sepcifiers): Modify accordingly.
12562 (array_type): Modify to actually return the complete type string
12563 instead of ignoring the rank_specifiers.
12564 (expression_list): Implement to collect the expressions
12565 (variable_initializer): Implement. We make it a list of expressions
12566 essentially so that we can handle the array_initializer case neatly too.
12567 (variable_initializer_list): Implement.
12568 (array_initializer): Make it a list of variable_initializers
12569 (opt_array_initializer): Modify accordingly.
12571 * expression.cs (New::NType): Add enumeration to help us
12572 keep track of whether we have an object/delegate creation
12573 or an array creation.
12574 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12575 members to hold data about array creation.
12576 (New:New): Modify to update NewType
12577 (New:New): New Overloaded contructor for the array creation
12580 * cs-parser.jay (array_creation_expression): Implement to call
12581 the overloaded New constructor.
12583 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12585 * class.cs (TypeContainer::Constructors): Return member
12586 constructors instead of returning null.
12588 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12590 * typemanager.cs (InitCoreTypes): Initialize the various core
12591 types after we have populated the type manager with the user
12592 defined types (this distinction will be important later while
12593 compiling corlib.dll)
12595 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12596 on Expression Classification. Now all expressions have a method
12597 `Resolve' and a method `Emit'.
12599 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12600 generation from working. Also add some temporary debugging
12603 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12605 * codegen.cs: Lots of code generation pieces. This is only the
12606 beginning, will continue tomorrow with more touches of polish. We
12607 handle the fundamentals of if, while, do, for, return. Others are
12608 trickier and I need to start working on invocations soon.
12610 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12613 * codegen.cs (EmitContext): New struct, used during code
12614 emission to keep a context. Most of the code generation will be
12617 * cs-parser.jay: Add embedded blocks to the list of statements of
12618 this block. So code generation proceeds in a top down fashion.
12620 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12622 * statement.cs: Add support for multiple child blocks.
12624 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12626 * codegen.cs (EmitCode): New function, will emit the code for a
12627 Block of code given a TypeContainer and its ILGenerator.
12629 * statement.cs (Block): Standard public readonly optimization.
12630 (Block::Block constructors): Link children.
12631 (Block::Child): Child Linker.
12632 (Block::EmitVariables): Emits IL variable declarations.
12634 * class.cs: Drop support for MethodGroups here, delay until
12636 (Method::): Applied the same simplification that I did before, and
12637 move from Properties to public readonly fields.
12638 (Method::ParameterTypes): Returns the parameter types for the
12639 function, and implements a cache that will be useful later when I
12640 do error checking and the semantic analysis on the methods is
12642 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12643 and made a method, optional argument tells whether this is a class
12644 or a structure to apply the `has-this' bit.
12645 (Method::GetCallingConvention): Implement, returns the calling
12647 (Method::Define): Defines the type, a second pass is performed
12648 later to populate the methods.
12650 (Constructor::ParameterTypes): implement a cache similar to the
12651 one on Method::ParameterTypes, useful later when we do semantic
12654 (TypeContainer::EmitMethod): New method. Emits methods.
12656 * expression.cs: Removed MethodGroup class from here.
12658 * parameter.cs (Parameters::GetCallingConvention): new method.
12660 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12662 * class.cs (TypeContainer::Populate): Drop RootContext from the
12665 (Constructor::CallingConvention): Returns the calling convention.
12666 (Constructor::ParameterTypes): Returns the constructor parameter
12669 (TypeContainer::AddConstructor): Keep track of default constructor
12670 and the default static constructor.
12672 (Constructor::) Another class that starts using `public readonly'
12673 instead of properties.
12675 (Constructor::IsDefault): Whether this is a default constructor.
12677 (Field::) use readonly public fields instead of properties also.
12679 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12680 track of static constructors; If none is used, turn on
12681 BeforeFieldInit in the TypeAttributes.
12683 * cs-parser.jay (opt_argument_list): now the return can be null
12684 for the cases where there are no arguments.
12686 (constructor_declarator): If there is no implicit `base' or
12687 `this', then invoke the default parent constructor.
12689 * modifiers.cs (MethodAttr): New static function maps a set of
12690 modifiers flags into a MethodAttributes enum
12691 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12692 MethodAttr, TypeAttr to represent the various mappings where the
12693 modifiers are used.
12694 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12696 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12698 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12701 * interface.cs (PopulateIndexer): Implemented the code generator
12702 for interface indexers.
12704 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12706 * interface.cs (InterfaceMemberBase): Now we track the new status
12709 (PopulateProperty): Implement property population. Woohoo! Got
12710 Methods and Properties going today.
12712 Removed all the properties for interfaces, and replaced them with
12713 `public readonly' fields.
12715 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12717 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12718 initialize their hashtables/arraylists only when they are needed
12719 instead of doing this always.
12721 * parameter.cs: Handle refs and out parameters.
12723 * cs-parser.jay: Use an ArrayList to construct the arguments
12724 instead of the ParameterCollection, and then cast that to a
12727 * parameter.cs: Drop the use of ParameterCollection and use
12728 instead arrays of Parameters.
12730 (GetParameterInfo): Use the Type, not the Name when resolving
12733 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12735 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12736 and instead use public readonly fields.
12738 * class.cs: Put back walking code for type containers.
12740 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12742 * class.cs (MakeConstant): Code to define constants.
12744 * rootcontext.cs (LookupType): New function. Used to locate types
12747 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12749 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12750 this System.Reflection code is. Kudos to Microsoft
12752 * typemanager.cs: Implement a type cache and avoid loading all
12753 types at boot time. Wrap in LookupType the internals. This made
12754 the compiler so much faster. Wow. I rule!
12756 * driver.cs: Make sure we always load mscorlib first (for
12757 debugging purposes, nothing really important).
12759 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12760 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12762 * rootcontext.cs: Lookup types on their namespace; Lookup types
12763 on namespaces that have been imported using the `using' keyword.
12765 * class.cs (TypeContainer::TypeAttr): Virtualize.
12766 (Class::TypeAttr): Return attributes suitable for this bad boy.
12767 (Struct::TypeAttr): ditto.
12768 Handle nested classes.
12769 (TypeContainer::) Remove all the type visiting code, it is now
12770 replaced with the rootcontext.cs code
12772 * rootcontext.cs (GetClassBases): Added support for structs.
12774 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12776 * interface.cs, statement.cs, class.cs, parameter.cs,
12777 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12778 Drop use of TypeRefs, and use strings instead.
12780 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12784 * class.cs (Struct::Struct): set the SEALED flags after
12785 checking the modifiers.
12786 (TypeContainer::TypeAttr): new property, returns the
12787 TypeAttributes for a class.
12789 * cs-parser.jay (type_list): Oops, list production was creating a
12790 new list of base types.
12792 * rootcontext.cs (StdLib): New property.
12793 (GetInterfaceTypeByName): returns an interface by type name, and
12794 encapsulates error handling here.
12795 (GetInterfaces): simplified.
12796 (ResolveTree): Encapsulated all the tree resolution here.
12797 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12800 * driver.cs: Add support for --nostdlib, to avoid loading the
12801 default assemblies.
12802 (Main): Do not put tree resolution here.
12804 * rootcontext.cs: Beginning of the class resolution.
12806 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12808 * rootcontext.cs: Provide better error reporting.
12810 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12812 * rootcontext.cs (CreateInterface): Handle the case where there
12813 are no parent interfaces.
12815 (CloseTypes): Routine to flush types at the end.
12816 (CreateInterface): Track types.
12817 (GetInterfaces): Returns an array of Types from the list of
12818 defined interfaces.
12820 * typemanager.c (AddUserType): Mechanism to track user types (puts
12821 the type on the global type hash, and allows us to close it at the
12824 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12826 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12827 RecordInterface instead.
12829 * cs-parser.jay: Updated to reflect changes above.
12831 * decl.cs (Definition): Keep track of the TypeBuilder type that
12832 represents this type here. Not sure we will use it in the long
12833 run, but wont hurt for now.
12835 * driver.cs: Smaller changes to accomodate the new code.
12837 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12840 * rootcontext.cs (CreateInterface): New method, used to create
12841 the System.TypeBuilder type for interfaces.
12842 (ResolveInterfaces): new entry point to resolve the interface
12844 (CodeGen): Property, used to keep track of the code generator.
12846 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12848 * cs-parser.jay: Add a second production for delegate_declaration
12851 (enum_body): Put an opt_comma here instead of putting it on
12852 enum_body or enum_member_declarations so we can handle trailing
12853 commas on enumeration members. Gets rid of a shift/reduce.
12855 (type_list): Need a COMMA in the middle.
12857 (indexer_declaration): Tell tokenizer to recognize get/set
12859 * Remove old targets.
12861 * Re-add the parser target.
12863 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12865 * cs-parser.jay: Add precendence rules for a number of operators
12866 ot reduce the number of shift/reduce conflicts in the grammar.
12868 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12870 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12873 Get rid of old crufty code.
12875 * rootcontext.cs: Use this to keep track of the parsed
12876 representation and the defined types available to the program.
12878 * gen-treedump.cs: adjust for new convention.
12880 * type.cs: Split out the type manager, and the assembly builder
12883 * typemanager.cs: the type manager will live here now.
12885 * cil-codegen.cs: And the code generator here.
12887 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12889 * makefile: Fixed up for easy making.
12891 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12893 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12896 (unary_expression): Expand pre_increment_expression and
12897 post_decrement_expression to reduce a shift/reduce.
12899 2001-07-11 Simon Cozens
12901 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12903 Improve allow_keyword_as_indent name.
12905 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12907 * Adjustments for Beta2.
12909 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12911 * decl.cs: Added `Define' abstract method.
12912 (InTransit): new property, used to catch recursive definitions.
12914 * interface.cs: Implement `Define'.
12916 * modifiers.cs: Map Modifiers.constants to
12917 System.Reflection.TypeAttribute flags.
12919 * class.cs: Keep track of types and user-defined types.
12920 (BuilderInit): New method for creating an assembly
12921 (ResolveType): New function to launch the resolution process, only
12922 used by interfaces for now.
12924 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12925 that are inserted into the name space.
12927 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12929 * ARGH. I have screwed up my tree so many times due to the use of
12930 rsync rather than using CVS. Going to fix this at once.
12932 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12935 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12937 * Experiment successful: Use System.Type rather that our own
12940 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12942 * cs-parser.jay: Removed nsAliases from here.
12944 Use new namespaces, handle `using XXX;'
12946 * namespace.cs: Reimplemented namespace handling, use a recursive
12947 definition of the class. Now we can keep track of using clauses
12948 and catch invalid using clauses.
12950 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12952 * gen-treedump.cs: Adapted for all the renaming.
12954 * expression.cs (Expression): this class now has a Type property
12955 which returns an expression Type.
12957 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12958 `Type', as this has a different meaning now in the base
12960 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12962 * interface.cs, class.cs: Removed from all the sources the
12963 references to signature computation, as we can not do method
12964 signature computation during the parsing time, as we are not
12965 trying to solve at that point distinguishing:
12969 void a (NS.Blah x) {}
12972 Which depending on the context might be valid or not, as we do not
12973 know if Blah is the same thing as NS.Blah at that point.
12975 * Redid everything so the code uses TypeRefs now instead of
12976 Types. TypeRefs are just temporary type placeholders, that need
12977 to be resolved. They initially have a pointer to a string and the
12978 current scope in which they are used. This is used later by the
12979 compiler to resolve the reference to an actual Type.
12981 * DeclSpace is no longer a CIR.Type, and neither are
12982 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12983 are all DeclSpaces, but no Types.
12985 * type.cs (TypeRefManager): This implements the TypeRef manager,
12986 which keeps track of all the types that need to be resolved after
12987 the parsing has finished.
12989 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12991 * ARGH. We are going to have to store `foreach' as a class rather
12992 than resolving it, as we need to verify error 1579 after name
12993 resolution. *OR* we could keep a flag that says `This request to
12994 IEnumerator comes from a foreach statement' which we can then use
12995 to generate the error.
12997 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12999 * class.cs (TypeContainer.AddMethod): we now add methods to the
13000 MethodGroup instead of the method hashtable.
13002 * expression.cs: Add MethodGroup abstraction, which gets us one
13003 step closer to the specification in the way we handle method
13006 * cs-parser.jay (primary_expression): qualified_identifier now
13007 tried to match up an identifier to a local variable reference or
13008 to a parameter reference.
13010 current_local_parameters is now a parser global variable that
13011 points to the current parameters for the block, used during name
13014 (property_declaration): Now creates an implicit `value' argument to
13017 2001-05-09 Miguel de Icaza <miguel@ximian.com>
13019 * parameter.cs: Do not use `param' arguments as part of the
13020 signature, per the spec.
13022 2001-05-08 Miguel de Icaza <miguel@ximian.com>
13024 * decl.cs: Base class for classes, structs and interfaces. This
13025 is the "Declaration Space"
13027 * cs-parser.jay: Use CheckDef for checking declaration errors
13028 instead of having one on each function.
13030 * class.cs: Factor out some code for handling error handling in
13031 accordance to the "Declarations" section in the "Basic Concepts"
13032 chapter in the ECMA C# spec.
13034 * interface.cs: Make all interface member classes derive from
13035 InterfaceMemberBase.
13037 2001-05-07 Miguel de Icaza <miguel@ximian.com>
13039 * Many things: all interfaces are parsed and generated in
13040 gen-treedump. Support for member variables, constructors,
13041 destructors, properties, constants is there.
13043 Beginning of the IL backend, but very little done, just there for
13046 2001-04-29 Miguel de Icaza <miguel@ximian.com>
13048 * cs-parser.jay: Fix labeled statement.
13050 * cs-tokenizer.cs (escape): Escape " and ' always.
13051 ref_line, ref_name: keep track of the line/filename as instructed
13052 by #line by the compiler.
13055 2001-04-27 Miguel de Icaza <miguel@ximian.com>
13057 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
13058 to match the values in System.CodeDOM.
13060 Divid renamed to Divide.
13062 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
13064 (Statements.set): remove.
13066 * System.CodeDOM/CodeCatchClause.cs: always have a valid
13069 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
13070 falseStatements always have valid values.
13072 * cs-parser.jay: Use System.CodeDOM now.