1 2003-12-09 Martin Baulig <martin@ximian.com>
3 * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
4 call them directly on the UsageVector.
6 2003-12-09 Martin Baulig <martin@ximian.com>
8 * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
9 Changed return type from `FlowReturns' to `Reachability'.
11 2003-12-09 Martin Baulig <martin@ximian.com>
13 * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
14 (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
15 `Reachable' fields with a single `Reachability' one.
17 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
19 * class.cs (FindMembers): Remove foreach's.
32 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
37 This patch does a few things:
38 1. EmptyStatement is now a singleton, so it is never reallocated.
39 2. All blah is EmptyStatement constructs have been changed to
40 blah == EmptyStatement.Value, which is much faster and valid
41 now that EmptyStatement is a singleton.
42 3. When resolving a block, rather than allocating a new array for
43 the non-empty statements, empty statements are replaced with
45 4. Some recursive functions have been made non-recursive.
46 Mainly the performance impact is from (3), however (1) and (2) are needed for
47 this to work. (4) does not make a big difference in normal situations, however
48 it makes the profile look saner.
53 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
54 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
55 Total memory allocated: 56397 KB
58 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
59 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
60 Total memory allocated: 55666 KB
62 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
64 * support.cs: Rewrite DoubleHash to use its own impl. Is faster
65 than the hashtable in a hashtable version
67 * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
68 we always end up concating a string. This results in a huge perf
69 loss, because many strings have to be tracked by the GC. In this
70 patch, we first use a hashtable that works with two keys, so that
71 the strings do not need to be concat'ed.
82 2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
84 * Makefile: Add a new target `do-time' that does a quick and simple
85 profile, leaving easy to parse output.
87 2003-12-08 Zoltan Varga <vargaz@freemail.hu>
89 * codegen.cs (Init): Create the dynamic assembly with
90 AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
92 2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
94 * support.cs: Make the PtrHashtable use only one
95 instance of its comparer.
97 2003-11-30 Zoltan Varga <vargaz@freemail.hu>
99 * typemanager.cs: Fix lookup of GetNamespaces.
101 2003-11-29 Miguel de Icaza <miguel@ximian.com>
103 * expression.cs: Removed redundant line.
105 * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
106 ArrayLists, use for loops with bounds.
108 * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
111 * expression.cs (Invocation.OverloadResolve): Avoid foreach on
112 arraylists, use for loop with bounds.
114 The above three changes give us a 0.071 second performance
115 improvement out of 3.294 seconds down to 3.223. On my machine
116 the above changes reduced the memory usage by 1,387 KB during
119 * cs-parser.jay (QualifiedIdentifier): New class used to represent
120 QualifiedIdentifiers. Before we created a new string through
121 concatenation, and mostly later on, the result would be
122 manipulated by DecomposeQI through string manipulation.
124 This reduced the compiler memory usage for bootstrapping from
125 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
126 compile times in 0.05 seconds.
128 2003-11-28 Dick Porter <dick@ximian.com>
130 * support.cs: Do string compares with the Invariant culture.
138 * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
139 the comparison is done with the Invariant culture.
141 2003-11-27 Miguel de Icaza <miguel@ximian.com>
143 * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
144 GetEnumerator method.
146 (ProbeCollectionType): Iterate starting at the most specific type
147 upwards looking for a GetEnumerator
149 * expression.cs: Shift count can be up to 31 for int/uint and 63
152 2003-11-26 Miguel de Icaza <miguel@ximian.com>
154 * statement.cs (Block.LookupLabel): Also look for the label on the
155 children blocks. Use a hash table to keep track of visited
158 * cfold.cs (IntConstant to UIntConstant mapping): Only return if
159 we actually did transform the other operand, otherwise fall back
160 to the common codepath that casts to long.
162 * cs-tokenizer.cs: Use the same code pattern as the int case.
163 Maybe I should do the parsing myself, and avoid depending on the
164 Parse routines to get this done.
166 2003-11-25 Miguel de Icaza <miguel@ximian.com>
168 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
169 which fixes bug 51347. This time test it.
171 * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
172 attributes for example can not tell the difference between these.
173 The difference was only a syntax feature of the language.
175 * attribute.cs: Apply attributes to delegates.
177 * delegate.cs: Call the apply attributes method.
179 2003-11-24 Miguel de Icaza <miguel@ximian.com>
181 * convert.cs (TryImplicitIntConversion): One line bug fix: we were
182 comparing 0 vs Byte.MinValue, not the value
184 (ImplicitConversionRequired): When reporting a conversion error,
185 use error 31 to print out the constant error instead of the
188 * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
189 which fixes bug 51347.
191 2003-11-22 Miguel de Icaza <miguel@ximian.com>
193 * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
194 which fixes the -warnaserror command line option.
196 2003-11-21 Miguel de Icaza <miguel@ximian.com>
198 * cfold.cs (DoNumericPromotions): During constant folding of
199 additions on UIntConstant, special case intconstants with
200 IntConstants like we do on the expression binary operator.
202 2003-11-12 Miguel de Icaza <miguel@ximian.com>
204 * convert.cs (ImplicitReferenceConversion): We were missing a case
205 (System.Enum are not value types or class types, so we need to
206 classify them separatedly).
208 * driver.cs: We do not support error 2007.
210 2003-11-12 Jackson Harper <jackson@ximian.com>
212 * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
213 system directory. Also use the full file name so users can
214 libraries names mscorlib-o-tron.dll in a non system dir.
216 2003-11-10 Martin Baulig <martin@ximian.com>
218 * typemanager.cs (TypeManager.ResolveExpressionTypes): Removed.
219 (TypeManager.InitCoreTypes): Initialize them here, but instead of
220 calling `ResolveType()' on them, directly assign their `Type'.
222 2003-11-08 Martin Baulig <martin@ximian.com>
224 * class.cs (TypeContainer.GetClassBases): Use TypeExpr's for the
225 return value and the `out parent' parameter.
226 (TypeContainer.DefineType): Moved the CS0644 check into
227 GetClassBases(). Don't pass the interface types to the
228 `builder.DefineType()'/`builder.DefineNestedType()', but resolve
229 them later and then call `TypeBuilder.AddInterfaceImplementation()'.
231 * ecore.cs (TypeExpr.IsAttribute): New property.
232 (TypeExpr.GetInterfaces): New method.
234 * interface.cs (Interface.GetInterfaceTypeByName): Return a
235 TypeExpr instead of a Type.
236 (Interface.GetInterfaceBases): Return TypeExpr's instead of Type's.
237 (Interface.DefineType): Don't pass the interface types to the
238 `builder.Definetype()'/`builder.DefineNestedType()', but resolve
239 them later and then call `TypeBulider.AddInterfaceImplementation()'.
241 * typemanager.cs (TypeManager.AddUserType): Take a `TypeExpr[]'
242 instead of a `Type[]'.
243 (TypeManager.RegisterBuilder): Likewise.
244 (TypeManager.AddUserInterface): Likewise.
245 (TypeManager.ExpandInterfaces): Take a `Type[]' instead of a
246 `Type[]' and also return a `TypeExpr[]'.
247 (TypeManager.GetInterfaces): Return a `TypeExpr[]'.
249 2003-11-08 Martin Baulig <martin@ximian.com>
251 * decl.cs (DeclSpace.ResolveTypeExpr): Return a TypeExpr, not an
254 2003-11-08 Martin Baulig <martin@ximian.com>
256 * decl.cs (DeclSpace.GetTypeResolveEmitContext): Call
257 TypeManager.ResolveExpressionTypes().
259 * ecore.cs (Expression.ResolveAsTypeTerminal): Return a TypeExpr
260 instead of an Expression.
261 (TypeExpr): This is now an abstract base class for `TypeExpression'.
262 (TypeExpression): New public class; formerly known as `TypeExpr'.
264 * expression.cs (ComposedCast): Derive from TypeExpr.
266 * typemanager.cs (TypeManager.system_*_expr): These are now
267 TypExpr's instead of Expression's.
268 (TypeManager.ResolveExpressionTypes): New public static function;
269 called from DeclSpace.GetTypeResolveEmitContext() to resolve all
272 2003-11-06 Miguel de Icaza <miguel@ximian.com>
274 * expression.cs (New.DoResolve): Do not dereference value that
275 might be a null return.
277 * statement.cs (Block.EmitMeta): Use the Const.ChangeType to make
278 sure that the constant value has the right type. Fixes an
279 unreported bug, similar to 50425.
281 * const.cs (Const.LookupConstantValue): Call
282 ImplicitStandardConversionExists before doing a conversion to
283 avoid havng the TypeManager.ChangeType do conversions.
285 Reduced the number of casts used
287 (Const.ChangeType): New routine to enable reuse of the constant
288 type changing code from statement.
290 * typemanager.cs (ChangeType): Move common initialization to
291 static global variables.
295 * convert.cs (ImplicitReferenceConversion): Somehow we allowed
296 every value type to go through, even if it was void. Fix that.
298 * cs-tokenizer.cs: Use is_identifier_start_character on the start
299 character of the define, and the is_identifier_part_character for
300 the rest of the string.
302 2003-11-05 Miguel de Icaza <miguel@ximian.com>
304 * expression.cs (UnaryMutator.EmitCode): When I updated
305 LocalVariableReference.DoResolve, I overdid it, and dropped an
306 optimization done on local variable references.
308 2003-11-04 Miguel de Icaza <miguel@ximian.com>
310 * ecore.cs: Convert the return from Ldlen into an int.
312 2003-10-20 Miguel de Icaza <miguel@ximian.com>
314 * decl.cs (DeclSpace.GetAccessLevel): Handle NotPublic case for
315 the accessibility, this is a special case for toplevel non-public
316 classes (internal for instance).
318 2003-10-20 Nick Drochak <ndrochak@gol.com>
320 * ecore.cs: Fix typo and build. Needed another right paren.
322 2003-10-19 Miguel de Icaza <miguel@ximian.com>
324 * ecore.cs: Applied fix from Ben Maurer. We were handling in the
325 `internal' case regular and protected, but not allowing protected
326 to be evaluated later. Bug 49840
328 2003-10-15 Miguel de Icaza <miguel@ximian.com>
330 * statement.cs (Switch.TableSwitchEmit): Compare the upper bound
331 to kb.Nlast, and not the kb.nFirst to isolate the switch
334 Extract the underlying type, so enumerations of long/ulong are
335 treated like long/ulong.
337 2003-10-14 Miguel de Icaza <miguel@ximian.com>
339 * expression.cs (New): Overload the meaning of RequestedType to
340 track the possible creation of the NewDelegate type, since
341 DoResolve is invoked more than once for new constructors on field
344 See bugs: #48800 and #37014
346 * cs-parser.jay (declare_local_constants): Take an arraylist
347 instead of a single constant.
349 (local_constant_declaration): It should take a
350 constant_declarators, not a constant_declarator. Fixes 49487
352 * convert.cs: Fix error report.
354 2003-10-13 Jackson Harper <jackson@ximian.com>
356 * typemanager.cs (TypeToCoreType): Add float and double this fixes
359 2003-10-09 Martin Baulig <martin@ximian.com>
361 * class.cs (MethodCore): Added additional `DeclSpace ds' argument
363 (MethodCore.DoDefineParameters): Removed the TypeContainer
364 argument; use the DeclSpace which was passed to the .ctor instead.
365 (MethodCore.CheckParameter): Take a DeclSpace instead of a
366 TypeContainer; we only need a DeclSpace here.
368 2003-10-09 Martin Baulig <martin@ximian.com>
370 * class.cs (MethodData): Added additional `DeclSpace ds' argument
372 (MethodData.Define, MethodData.Emit): Pass the `ds' to the
375 2003-10-09 Martin Baulig <martin@ximian.com>
377 * decl.cs (DeclSpace.AsAccessible): Moved here from TypeContainer.
378 (AccessLevel, CheckAccessLevel, GetAccessLevel): They're used by
379 AsAccessible(), moved them as well.
381 * class.cs (TypeContainer.AsAccessible): Moved to DeclSpace.
383 2003-10-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
385 * cs-parser.jay : Renamed yyName to yyNames related to jay.
387 2003-10-07 Miguel de Icaza <miguel@ximian.com>
389 * expression.cs (Binary.Emit.GreatherThanOrEqual): Fix the code
390 generation for >=, as spotted by Paolo, bug 48679.
391 Patch from David Waite.
393 * cs-tokenizer.cs: Add handling for #pragma.
395 * cs-parser.jay: Allow for both yield and yield return in the
396 syntax. The anti-cobolization of C# fight will go on!
398 * class.cs (TypeBuilder.DefineType): Catch error condition here
399 (Parent.DefineType erroring out and returning null).
401 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
402 coping with enumerations variables, we were mistakenly processing
403 them as a regular value type instead of built-in types. Fixes the
406 * typemanager.cs (IsBuiltinOrEnum): New method.
408 2003-09-30 Miguel de Icaza <miguel@ximian.com>
410 * cs-parser.jay: Upgrade: yield now needs the return clause.
412 2003-09-19 Martin Baulig <martin@ximian.com>
414 * decl.cs (MemberCache.SetupCacheForInterface): Take a
415 `MemberCache parent' argument. Normally, an interface doesn't
416 have a parent type except System.Object, but we use this in gmcs
417 for generic type parameters.
419 2003-09-18 Martin Baulig <martin@ximian.com>
421 * typemanager.cs (TypeHandle.ctor): Set `IsInterface' solely based
422 on `type.IsInterface'; don't check whether the type has a parent
423 to determine whether it's an interface.
425 2003-09-15 Martin Baulig <martin@ximian.com>
427 * class.cs (TypeContainer.DefineType): Added an error flag to
428 avoid reporting duplicate CS0146's ("class definition is
431 * driver.cs (Driver.MainDriver): Abort if
432 RootContext.ResolveTree() reported any errors.
434 2003-09-07 Martin Baulig <martin@ximian.com>
436 * report.cs (Error, Warning): Added overloaded versions which take
437 a `params object[] args' and call String.Format().
439 2003-09-07 Martin Baulig <martin@ximian.com>
441 * decl.cs (DeclSpace..ctor): Don't call
442 NamespaceEntry.DefineName() here; do it in RecordDecl() which is
443 called from Tree.RecordDecl(). Fixes the CS0101 reporting.
444 (DeclSpace.RecordDecl): New method.
446 * tree.cs (Tree.RecordDecl): Call ds.RecordDecl().
448 2003-09-02 Ravi Pratap <ravi@ximian.com>
450 * attribute.cs (CheckAttributeTarget): Ensure that we allow return
451 value attributes to be applied to ParameterBuilders.
453 * class.cs (MethodCore.LabelParameters): Make static and more
454 generic so that it can be used from other places - like interface
455 methods, for instance.
457 * interface.cs (Interface.Emit): Call LabelParameters before
458 emitting attributes on the InterfaceMethod.
460 2003-08-26 Martin Baulig <martin@ximian.com>
462 * ecore.cs (SimpleName.SimpleNameResolve): Look for members before
463 resolving aliases; fixes #47927.
465 2003-08-26 Martin Baulig <martin@ximian.com>
467 * statement.cs (Using.DoResolve): This is internally emitting a
468 try/finally clause, so we need to set ec.NeedExplicitReturn if we
469 do not always return. Fixes #47681.
471 2003-08-26 Martin Baulig <martin@ximian.com>
473 * decl.cs (MemberCore): Moved WarningNotHiding(),
474 Error_CannotChangeAccessModifiers() and CheckMethodAgainstBase()
476 (AdditionResult): Make this nested in DeclSpace.
477 (DeclSpace.ctor): The .ctor now takes an additional NamespaceEntry
478 argument; call NamespaceEntry.Define() unless we're nested in a
481 * namespace.cs (Namespace.DefineName): New public function. This
482 is called from DeclSpace's .ctor to add
483 (Namespace.Lookup): Include DeclSpaces in the lookup.
485 * class.cs (Operator): Derive from MemberBase, not MemberCore.
487 * const.cs (Const): Derive from MemberBase, not MemberCore.
489 2003-08-25 Martin Baulig <martin@ximian.com>
491 * convert.cs (Convert.ExplicitReferenceConversion): When
492 converting from an interface type to a class, unbox if the target
493 type is a struct type. Fixes #47822.
495 2003-08-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
497 * typemanager.cs: fixed the values of MethodFlags. Closes #47855 and
500 2003-08-22 Martin Baulig <martin@ximian.com>
502 * class.cs (TypeManager.DefineType): When defining a nested type,
503 call DefineType() on our parent; fixes #47801.
505 2003-08-22 Martin Baulig <martin@ximian.com>
507 * class.cs (MethodData.Define): While checking if a method is an
508 interface implementation, improve the test a bit more to fix #47654.
510 2003-08-22 Martin Baulig <martin@ximian.com>
512 * expression.cs (Probe.DoResolve): Check whether `expr' resolved
513 correctly; fixes #47722.
515 2003-08-22 Martin Baulig <martin@ximian.com>
517 * expression.cs (UnaryMutator.ResolveVariable): If the target is a
518 LocalVariableReference, ensure it's not read-only. Fixes #47536.
520 * statement.cs (Fixed.DoResolve): Make all variables read-only.
522 2003-08-22 Martin Baulig <martin@ximian.com>
524 * ecore.cs (FieldExpr.DoResolveLValue): Static read-only fields
525 can only be assigned in static constructors. Fixes #47161.
527 2003-08-22 Martin Baulig <martin@ximian.com>
529 Rewrote and improved the flow analysis code.
531 * flowbranching.cs (FlowBranching): Make this class abstract.
532 (FlowBranching.CreateBranching): New static function to create a
534 (FlowBranchingBlock, FlowBranchingException): New classes.
535 (FlowBranching.UsageVector.Type): New public readonly field.
536 (FlowBranching.UsageVector.Breaks): Removed the setter.
537 (FlowBranching.UsageVector.Returns): Removed the setter.
538 (FlowBranching.UsageVector): Added Break(), Return(),
539 NeverReachable() and Throw() methods to modify the reachability.
540 (FlowBranching.UsageVector.MergeChildren): Removed, this is now
541 done by FlowBranching.Merge().
542 (FlowBranching.UsageVector.MergeChild): New method; merges the
543 merge result into the current vector.
544 (FlowBranching.Merge): New abstract method to merge a branching.
546 2003-08-12 Martin Baulig <martin@ximian.com>
548 * expression.cs (Indirection.CacheTemporaries): Create the
549 LocalTemporary with the pointer type, not its element type.
551 2003-08-10 Miguel de Icaza <miguel@ximian.com>
553 * cs-parser.jay: FIRST_KEYWORD, LAST_KEYWORD: used to know if a
554 token was a keyword or not.
556 Add `error' options where an IDENTIFIER was expected; Provide
557 CheckToken and CheckIdentifierToken convenience error reporting
560 Do not use `DeclSpace.Namespace', use `DeclSpace.NamespaceEntry'.
562 * decl.cs: Rename `NamespaceEntry Namespace' public field into
563 NameSpaceEntry NameSpaceEntry.
565 (LookupInterfaceOrClass): Avoid creating a full qualified name
566 from namespace and name: avoid doing lookups when we know the
567 namespace is non-existant. Use new Tree.LookupByNamespace which
568 looks up DeclSpaces based on their namespace, name pair.
570 * driver.cs: Provide a new `parser verbose' to display the
571 exception thrown during parsing. This is turned off by default
572 now, so the output of a failure from mcs is more graceful.
574 * namespace.cs: Track all the namespaces defined in a hashtable
577 (IsNamespace): New method
579 2003-08-09 Miguel de Icaza <miguel@ximian.com>
581 * namespace.cs: Remove redundant call; Avoid using MakeFQN when
582 we know that we need to concatenate (full typename can never be
587 * statement.cs: Use a bitfield; Do not initialize to null things
588 which are done by the constructor by default.
590 * cs-parser.jay: bug fix, parameter was 4, not 3.
592 * expression.cs: Just use the property;
594 * statement.cs: No need for GetVariableInfo method.
596 2003-08-08 Martin Baulig <martin@ximian.com>
598 * flowanalysis.cs (FlowReturns): This is now nested in the
599 `FlowBranching' class.
600 (MyBitVector): Moved this here from statement.cs.
601 (FlowBranching.SiblingType): New enum type.
602 (FlowBranching.CreateSibling): Added `SiblingType' argument.
604 2003-08-07 Martin Baulig <martin@ximian.com>
606 * flowanalysis.cs (FlowBranchingType): This is now nested in the
607 `FlowBranching' class and called `BranchingType'.
609 2003-08-07 Martin Baulig <martin@ximian.com>
611 * flowanalysis.cs: Moved all the control flow analysis code into
614 2003-08-07 Martin Baulig <martin@ximian.com>
616 * assign.cs (Assign.DoResolve): `target' must either be an
617 IAssignMethod or an EventAccess; report a CS0131 otherwise. Fixes
620 2003-08-07 Miguel de Icaza <miguel@ximian.com>
622 * expression.cs (BinaryMethod): This kind of expression is created by the
623 Binary class if it determines that the operator has to be handled
626 (BinaryDelegate): This kind of expression is created if we are
627 dealing with a + or - operator on delegates.
629 (Binary): remove method, argumetns, and DelegateOperator: when
630 dealing with methods,
632 * ecore.cs (EventExpr.EmitAddOrRemove): Update to new layout.
634 * statement.cs (Block): use bitfields for the three extra booleans
635 we had in use. Remove unused topblock parameter.
637 * codegen.cs: Remove unecessary argument to Block.EmitTopBlock
639 * assign.cs: Drop extra unneeded tests.
641 2003-08-06 Miguel de Icaza <miguel@ximian.com>
643 * iterators.cs (Mapvariable): provide a mechanism to use prefixes.
645 * statement.cs (Foreach): Use VariableStorage instead of
648 * codegen.cs (VariableStorage): New class used by clients that
649 require a variable stored: locals or fields for variables that
650 need to live across yield.
652 Maybe provide a convenience api for EmitThis+EmitLoad?
654 (GetTemporaryLocal, FreeTemporaryLocal): Recycle
657 2003-08-05 Miguel de Icaza <miguel@ximian.com>
659 * codegen.cs (RemapLocal, RemapLocalLValue, RemapParameter,
660 RemapParameterLValue): New methods that are used to turn a
661 precomputed FieldInfo into an expression like this:
665 The idea is to use this instead of making LocalVariableReference
666 have more than one meaning.
668 * cs-parser.jay: Add error production to BASE.
670 * ecore.cs: Deal with TypeManager.GetField returning null, which
671 is now a valid return value.
673 (FieldExprNoAddress): New expression for Fields whose address can
676 * expression.cs (LocalVariableReference): During the resolve
677 phases, create new expressions if we are in a remapping context.
678 Remove code that dealt with remapping here.
680 (ParameterReference): same.
682 (ProxyInstance): New expression, like the `This' expression, but
683 it is born fully resolved. We know what we are doing, so remove
684 the errors that are targeted to user-provided uses of `this'.
686 * statement.cs (Foreach): our variable is now stored as an
687 Expression; During resolution, follow the protocol, dont just
688 assume it will return this.
690 2003-08-06 Martin Baulig <martin@ximian.com>
692 * support.cs (SeekableStreamReader.cs): New public class.
694 * cs-tokenizer.cs, cs-parser.jay, driver.cs: Use the new
695 SeekableStreamReader instead of the normal StreamReader.
697 2003-08-04 Martin Baulig <martin@ximian.com>
699 * cs-parser.jay (CLOSE_PARENS_CAST, CLOSE_PARENS_NO_CAST,
700 CLOSE_PARENS_OPEN_PARENS, CLOSE_PARENS_MINUS): New tokens to
701 deambiguate casts and delegate invocations.
702 (parenthesized_expression): Use the new tokens to ensure this is
703 not a cast of method invocation.
705 * cs-tokenizer.cs (is_punct): Return one of the new special tokens
706 when reading a `)' and Deambiguate_CloseParens () was previously
709 * expression.cs (ParenthesizedExpression): New class. This is
710 just used for the CS0075 test.
711 (Binary.DoResolve): Check for CS0075.
713 2003-07-29 Ravi Pratap <ravi@ximian.com>
715 * expression.cs (Invocation.MakeUnionSet): Patch from Lluis
716 Sanchez : use TypeManager.ArrayContainsMethod instead of a direct
717 reference comparison.
719 (TypeManager.ArrayContainsMethod): When we have a MethodInfo, also
720 examine the ReturnType for equality - this is necessary in the
721 cases of implicit and explicit operators whose signature also
722 includes the return type.
724 2003-07-26 Miguel de Icaza <miguel@ximian.com>
726 * namespace.cs: Cache the result of the namespace computation,
727 instead of computing it every time.
729 2003-07-24 Miguel de Icaza <miguel@ximian.com>
731 * decl.cs: Use a global arraylist that we reuse over invocations
732 to avoid excesive memory consumption. Reduces memory usage on an
733 mcs compile by one meg (45 average).
735 * typemanager.cs (LookupTypeReflection): In .NET pointers are
736 private, work around that.
738 2003-07-23 Miguel de Icaza <miguel@ximian.com>
740 * literal.cs (IntLiteral): Define Zero and One static literals.
742 * cs-parser.jay (integer_literal): use static literals to reduce
743 memory usage for the most used literals (0, 1 and -1). 211kb
744 reduced in memory usage.
746 Replace all calls to `new ArrayList' with `new
747 ArrayList(4)' which is a good average number for most allocations,
748 and also requires only 16 bytes of memory for its buffer by
751 This reduced MCS memory usage in seven megabytes for the RSS after
754 2003-07-28 Ravi Pratap <ravi@ximian.com>
756 * expression.cs (Invocation.OverloadResolve): Fix the algorithm to
757 handle params methods the correct way by forming only one
758 applicable set with params and normal methods in them. Earlier we
759 were looking at params methods only if we found no normal methods
760 which was not the correct thing to do.
762 (Invocation.BetterFunction): Take separate arguments indicating
763 when candidate and the best method are params methods in their
766 This fixes bugs #43367 and #46199.
768 * attribute.cs: Documentation updates.
770 (CheckAttribute): Rename to CheckAttributeTarget.
771 (GetValidPlaces): Rename to GetValidTargets.
773 * expression.cs (Invocation.IsParamsMethodApplicable): Fix trivial
774 bug - use Convert.ImplicitConversion, not ImplicitUserConversion!
778 2003-07-28 Martin Baulig <martin@ximian.com>
780 * class.cs (TypeContainer.DefineMembers): Use the base type's full
781 name when looking up the base class of a nested class. Fixes #46977.
783 2003-07-26 Martin Baulig <martin@ximian.com>
785 * expression.cs (Indexers.Indexer): New nested struct; contains
786 getter, setter and the indexer's type.
787 (Indexers.Properties): This is now an ArrayList of
789 (IndexerAccess.DoResolveLValue): Correctly set the type if the
790 indexer doesn't have any getters.
792 * assign.cs (Assign.DoResolve): Also do the implicit conversions
793 for embedded property and indexer assignments.
795 2003-07-26 Martin Baulig <martin@ximian.com>
797 * cs-tokenizer.cs (Tokenizer.xtoken): Report a CS1040 if a
798 preprocessor directive is not the first non-whitespace character
801 2003-07-26 Martin Baulig <martin@ximian.com>
803 * namespace.cs (NamespaceEntry.Lookup): New method; rewrote the
804 namespace parsing, follow the spec more closely.
806 * rootcontext.cs (RootContext.NamespaceLookup): Use the new
807 NamespaceEntry.Lookup().
809 2003-07-25 Martin Baulig <martin@ximian.com>
811 * MethodCore.cs (OverridesSomething): New public field; it's set
812 from TypeContainer.DefineMembers if this method overrides
813 something (which doesn't need to be a method). Fix #39462.
815 2003-07-25 Ravi Pratap <ravi@ximian.com>
817 * typemanager.cs (GetMembers): Ensure that the list of members is
818 reversed. This keeps things in sync.
820 * attribute.cs (Attribute.CheckAttribute): Break as soon as we
821 find an AttributeUsage attribute.
823 * expression.cs (Invocation.OverloadResolve): Perform the check
824 which disallows Invoke to be directly called on a Delegate.
826 (Error_InvokeOnDelegate): Report error cs1533.
828 2003-07-25 Martin Baulig <martin@ximian.com>
830 * expression.cs (Indexers.GetIndexersForType): Only look in the
831 interface hierarchy if the requested type is already an
832 interface. Fixes #46788 while keeping #46502 fixed.
834 2003-07-25 Martin Baulig <martin@ximian.com>
836 * class.cs (TypeContainer.DefineMembers): Check whether all
837 readonly fields have been assigned and report warning CS0649 if
840 * statement.cs (LocalInfo.IsFixed): Always return true if this is
843 2003-07-24 Ravi Pratap <ravi@ximian.com>
845 * decl.cs (MemberCache.AddMethods): Reverse the order of the array
846 returned from GetMethods to make things consistent with the
847 assumptions MCS makes about ordering of methods.
849 This should comprehensively fix bug #45127 and it does :-)
851 * ecore.cs (MethodGroupExpr.DeclaringType): Correct bug - the
852 ordering is actually reverse.
854 * Clean up some debug messages I left lying around.
856 * interface.cs (Populate*): Get rid of code which emits attributes
857 since the stage in which we emit attributes is the 'Emit' stage,
858 not the define stage.
860 (Emit): Move attribute emission for interface members here.
862 2003-07-22 Ravi Pratap <ravi@ximian.com>
864 * expression.cs (Invocation.OverloadResolve): Follow the spec more
865 closely: we eliminate methods in base types when we have an
866 applicable method in a top-level type.
868 Please see section 14.5.5.1 for an exact description of what goes
871 This fixes bug #45127 and a host of other related to corlib compilation.
873 * ecore.cs (MethodGroupExpr.DeclaringType): The element in the
874 array is the method corresponding to the top-level type (this is
875 because of the changes made to icall.c) so we change this
878 (MethodGroupExpr.Name): This too.
880 * typemanager.cs (GetElementType): New method which does the right
881 thing when compiling corlib.
883 * everywhere: Make use of the above in the relevant places.
885 2003-07-22 Martin Baulig <martin@ximian.com>
887 * cs-parser.jay (invocation_expression): Moved
888 `OPEN_PARENS expression CLOSE_PARENS unary_expression' here from
889 `cast_expression', but create a InvocationOrCast which later
890 resolves to either an Invocation or a Cast.
892 * ecore.cs (ExpressionStatement.ResolveStatement): New virtual
893 method; call this before EmitStatement() to make sure that this
894 expression can be used as a statement.
896 * expression.cs (InvocationOrCast): New class; resolves to either
897 an Invocation or a Cast.
899 * statement.cs (StatementExpression): Call ResolveStatement() on
900 the ExpressionStatement before emitting it.
902 2003-07-21 Martin Baulig <martin@ximian.com>
904 * expression.cs (Invocation.VerifyArgumentsCompat): Check whether
905 `ref' and `out' attributes match; fixes #46220.
906 (MemberAccess.ResolveMemberAccess): You can't reference a type
907 through an expression; fixes #33180.
908 (Indexers.GetIndexersForType): Don't return the indexers from
909 interfaces the class implements; fixes #46502.
911 2003-07-21 Martin Baulig <martin@ximian.com>
913 * class.cs (TypeContainer.CheckPairedOperators): Added CS0660 and
914 CS0661 checks; fixes bug #30442.
916 2003-07-21 Martin Baulig <martin@ximian.com>
918 * decl.cs (AdditionResult): Added `Error'.
920 * enum.cs (AddEnumMember): Report a CS0076 if name is `value__'.
922 * typemanager.cs (TypeManager.ChangeType): Catch exceptions;
923 makes cs0031.cs actually work.
925 2003-07-20 Martin Baulig <martin@ximian.com>
927 * namespace.cs: Fixed that bug which caused a crash when compiling
930 2003-07-20 Miguel de Icaza <miguel@ximian.com>
932 * typemanager.cs (LookupTypeReflection): Never expose types which
933 are NotPublic, NestedPrivate, NestedAssembly, or
934 NestedFamANDAssem. We used to return these, and later do a check
935 that would report a meaningful error, but the problem is that we
936 would not get the real match, if there was a name override.
938 2003-07-18 Miguel de Icaza <miguel@ximian.com>
940 * namespace.cs (Namespace, Name): Do not compute the namespace
941 name dynamically, compute it in the constructor. This reduced
942 memory usage by 1697 KB.
944 * driver.cs: Use --pause to pause at the end.
946 2003-07-17 Peter Williams <peter@newton.cx>
948 * Makefile: Change the name of the test target so that it doesn't
949 conflict with the recursive test target.
951 2003-07-17 Miguel de Icaza <miguel@ximian.com>
953 * expression.cs (LocalVariableReference.Emit, EmitAssign,
954 AddressOf): Do not use EmitThis, that was wrong, use the actual
957 2003-07-15 Miguel de Icaza <miguel@ximian.com>
959 * class.cs (MethodData.Define): While checking if a method is an
960 interface implementation, improve the test: If we are not public
961 (use new test here: use the computed MethodAttributes directly,
962 instead of the parsed modifier flags) check if the `implementing'
963 method comes from an interface or not.
965 * pending.cs (VerifyPendingMethods): Slightly better error
968 * makefile: add test target that does the mcs bootstrap.
970 2003-07-16 Ravi Pratap <ravi@ximian.com>
972 * interface.cs (Define): Do nothing here since there are no
973 members to populate etc. Move the attribute emission out of here
974 since this was just totally the wrong place to put it. Attribute
975 application happens during the 'Emit' phase, not in the 'Define'
978 (Emit): Add this method and move the attribute emission here
980 * rootcontext.cs (EmitCode): Call the Emit method on interface
983 2003-07-14 Ravi Pratap M <ravi@ximian.com>
985 * expression.cs (OverloadResolve): Report error only if Location
986 is not 'Null' which means that there was a probe going on.
988 2003-07-14 Martin Baulig <martin@ximian.com>
990 * expression.cs (ConditionalLogicalOperator): New public class to
991 implement user defined conditional logical operators.
992 This is section 14.11.2 in the spec and bug #40505.
994 2003-07-14 Martin Baulig <martin@ximian.com>
996 * ecore.cs (FieldExpr.DoResolveLValue): Fixed bug #46198.
998 2003-07-14 Martin Baulig <martin@ximian.com>
1000 * codegen.cs (EmitContext.InFixedInitializer): New public field.
1002 * ecore.cs (IVariable.VerifyFixed): New interface method.
1004 * expression.cs (Unary.ResolveOperator): When resolving the `&'
1005 operator, check whether the variable is actually fixed. Fixes bug
1006 #36055. Set a variable definitely assigned when taking its
1007 address as required by the spec.
1009 * statement.cs (LocalInfo.IsFixed): New field.
1010 (LocalInfo.MakePinned): Set `IsFixed' to true.
1012 2003-07-14 Ravi Pratap M <ravi@ximian.com>
1014 * attribute.cs (Attribute.Resolve): While doing a Member lookup
1015 for .ctors, ensure that we only ask for members declared in the
1016 attribute type (BindingFlags.DeclaredOnly).
1020 * expression.cs (Error_WrongNumArguments): Report error 1501
1021 correctly the way CSC does.
1023 2003-07-13 Martin Baulig <martin@ximian.com>
1025 * expression.cs (MemberAccess.ResolveAsTypeStep): Try to do a type
1026 lookup on the fully qualified name, to make things like "X.X" work
1027 where "X.X" is a fully qualified type name, but we also have a
1028 namespace "X" in the using list. Fixes #41975.
1030 2003-07-13 Martin Baulig <martin@ximian.com>
1032 * assign.cs (Assign.GetEmbeddedAssign): New protected virtual
1033 function. If we're a CompoundAssign, we need to create an embedded
1034 CompoundAssign, not an embedded Assign.
1035 (Assign.DoResolve): Make this work for embedded CompoundAssign's.
1038 2003-07-13 Martin Baulig <martin@ximian.com>
1040 * typemanager.cs (TypeManager.IsNestedChildOf): Make this actually
1041 work to fix bug #46088.
1043 2003-07-13 Ravi Pratap <ravi@ximian.com>
1045 * class.cs (Operator.Emit): Do not emit attributes here - it is
1046 taken care of by the Method class that we delegate too. This takes
1049 2003-07-10 Martin Baulig <martin@ximian.com>
1051 * expression.cs (TypeOfVoid): New class.
1052 (TypeOf): Report a CS0673 if it's System.Void. Fixes #42264.
1054 2003-07-10 Martin Baulig <martin@ximian.com>
1056 * class.cs (MethodCore.DoDefineParameters): Added CS0225 check;
1059 2003-07-10 Martin Baulig <martin@ximian.com>
1061 * rootcontext.cs (RootContext.NamespaceLookup): Take a DeclSpace,
1062 not a NamespaceEntry, so we can use DeclSpace.CheckAccessLevel().
1064 * decl.cs (DeclSpace.FindType): Use DeclSpace.CheckAccessLevel().
1066 * typemanager.cs (TypeManager.IsAccessibleFrom): Removed.
1068 2003-07-10 Martin Baulig <martin@ximian.com>
1070 * expression.cs (ArrayCreation): Don't use a byte blob for arrays
1071 of decimal. Fixes #42850.
1073 NOTE: I also fixed the created byte blob, but this doesn't work on
1074 the MS runtime and csc never produces any byte blobs for decimal
1077 2003-07-10 Martin Baulig <martin@ximian.com>
1079 * statement.cs (StructInfo.GetStructInfo): Catch deep cycles in
1080 structs; fixes #32068.
1081 (Block.AddChildVariableNames): Fixed #44302.
1083 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1085 * namespace.cs: fixed compilation with csc. It's bugzilla #44302.
1087 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1089 * attribute.cs: And this test is onger needed.
1091 2003-07-08 Martin Baulig <martin@ximian.com>
1093 * rootcontext.cs (RootContext.NamespaceLookup): Ignore
1094 inaccessible types. Fixes #36313.
1096 * decl.cs (DeclSpace.FindType): Ignore inaccessible types.
1098 * namespace.cs (NamespaceEntry): Create implicit entries for all
1099 namespaces; ie. if we have `namespace N1.N2.N3 { ... }', we create
1100 implicit entries for N1.N2 and N1.
1102 2003-07-08 Martin Baulig <martin@ximian.com>
1104 Rewrote the handling of namespaces to fix a lot of the issues
1105 wrt. `using' aliases etc.
1107 * namespace.cs (Namespace): Splitted this class into a
1108 per-assembly `Namespace' and a per-file `NamespaceEntry'.
1110 * typemanager.cs (TypeManager.IsNamespace): Removed.
1111 (TypeManager.ComputeNamespaces): Only compute namespaces from
1112 loaded assemblies here, not the namespaces from the assembly we're
1113 currently compiling.
1115 2003-07-08 Martin Baulig <martin@ximian.com>
1117 * rootcontext.cs, class.cs: Fixed the CS1530 reporting.
1119 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1121 * typemanager.cs: Reverted patch from Gonzalo, my previous patch
1124 I thought about the memory savings here, but LookupTypeReflection
1125 is used under already very constrained scenarios. Compiling
1126 corlib or mcs only exposes one hit, so it would not really reduce
1127 any memory consumption.
1129 2003-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1131 * typemanager.cs: fixes bug #45889 by only adding public types from
1132 other assemblies to the list of known types.
1134 2003-07-07 Miguel de Icaza <miguel@ximian.com>
1136 * attribute.cs (Attribute.Resolve): Add call to CheckAccessLevel
1137 on the type we resolved.
1139 2003-07-05 Martin Baulig <martin@ximian.com>
1141 * pending.cs (PendingImplementation.ParentImplements): Don't
1142 create the proxy if the parent is abstract.
1144 * class.cs (TypeContainer.DefineIndexers): Process explicit
1145 interface implementations first. Fixes #37714.
1147 2003-07-04 Miguel de Icaza <miguel@ximian.com>
1149 * expression.cs (MemberAccess.ResolveMemberAccess): Events are
1150 defined recursively; but since we modify the input parameters
1151 (left is set to `this' temporarily), we reset this value if the
1152 left_is_explicit is false, which gives the original semantics to
1155 * literal.cs (NullPointer): new class used to represent a null
1156 literal in a pointer context.
1158 * convert.cs (Convert.ImplicitReferenceConversion): Is the target
1159 type is a pointer, use a NullPointer object instead of a
1160 NullLiteral. Closes 43687
1162 (ExplicitConversion): Convert pointer values using
1163 the conv opcode to the proper type.
1165 * ecore.cs (New): change ValueTypeVariable property into a method,
1166 that returns whether the valuetype is suitable for being used.
1168 * expression.cs (Binary.DoNumericPromotions): Only return if we
1169 the int constant was a valid uint, and we can return both left and
1170 right as uints. If not, we continue processing, to trigger the
1171 type conversion. This fixes 39018.
1173 * statement.cs (Block.EmitMeta): During constant resolution, set
1174 the CurrentBlock property on the emitcontext, so that we resolve
1175 constants propertly.
1177 2003-07-02 Martin Baulig <martin@ximian.com>
1179 * codegen.cs (EmitContext.NeedExplicitReturn): New public variable.
1180 (EmitContext.EmitTopBlock): Emit an explicit return if it's set.
1182 * statement.cs (Try.Resolve): Set ec.NeedExplicitReturn rather
1183 than emitting it here.
1185 * statement.cs: Fixed some more flow analysis bugs.
1187 2003-07-02 Martin Baulig <martin@ximian.com>
1189 * class.cs (MethodData.Define): When implementing interface
1190 methods, set Final unless we're Virtual.
1192 * decl.cs (MemberCore.CheckMethodAgainstBase): Make the CS0506
1193 check work for interface methods.
1195 2003-07-01 Martin Baulig <martin@ximian.com>
1197 * ecore.cs (EmitContext.This): Replaced this property with a
1198 GetThis() method which takes a Location argument. This ensures
1199 that we get the correct error location for a CS0188.
1201 2003-07-01 Miguel de Icaza <miguel@ximian.com>
1203 * ecore.cs: (Convert.ConvertIntLiteral): Add test for
1204 ImplicitStandardConversion.
1206 * class.cs (TypeContainer.GetClassBases): Small bug fix for 45649.
1208 2003-07-01 Zoltan Varga <vargaz@freemail.hu>
1210 * expression.cs (ResolveOperator): Fix Concat (string, string, string)
1213 2003-06-30 Miguel de Icaza <miguel@ximian.com>
1215 * class.cs (Constructor.Define): Turn off initlocals for unsafe
1218 (MethodData.Define): Turn off initlocals for unsafe methods.
1220 2003-06-29 Miguel de Icaza <miguel@ximian.com>
1222 * decl.cs (DeclSpace.CheckAccessLevel): Make this routine
1223 complete; Fixes #37521.
1225 * delegate.cs: Use Modifiers.TypeAttr to compute the
1226 TypeAttributes, instead of rolling our own. This makes the flags
1227 correct for the delegates.
1229 2003-06-28 Miguel de Icaza <miguel@ximian.com>
1231 * class.cs (Constructor.Define): Set the private flag for static
1232 constructors as well.
1234 * cs-parser.jay (statement_expression): Set the return value to
1235 null, to avoid a crash when we catch an error.
1237 2003-06-24 Miguel de Icaza <miguel@ximian.com>
1239 * cs-parser.jay: Applied patch from Jackson that adds support for
1240 extern and unsafe modifiers to destructor declarations.
1242 * expression.cs: Report error 21 if the user is trying to index a
1245 * driver.cs: Add an error message, suggested by the bug report.
1247 * class.cs (TypeContainer.Emit): Only call EmitFieldInitializers
1248 if we do not have a ": this ()" constructor initializer. Fixes 45149
1250 2003-06-14 Miguel de Icaza <miguel@ximian.com>
1252 * namespace.cs: Add some information to reduce FAQs.
1254 2003-06-13 Miguel de Icaza <miguel@ximian.com>
1256 * cfold.cs (BinaryFold): BitwiseAnd, BitwiseOr: handle other
1257 underlying enumeration types. Fixes #43915.
1259 * expression.cs: Treat ushort/short as legal values to be used in
1262 Wed Jun 4 13:19:04 CEST 2003 Paolo Molaro <lupus@ximian.com>
1264 * delegate.cs: transfer custom attributes for paramenters from
1265 the delegate declaration to Invoke and BeginInvoke.
1267 Tue Jun 3 11:11:08 CEST 2003 Paolo Molaro <lupus@ximian.com>
1269 * attribute.cs: handle custom marshalers and emit marshal info
1272 2003-05-28 Hector E. Gomez Morales <hgomez_36@flashmail.com>
1274 * makefile.gnu: Added anonymous.cs to the compiler sources.
1276 2003-05-28 Miguel de Icaza <miguel@ximian.com>
1278 * iterators.cs: Change the name of the proxy class to include two
1281 * cs-parser.jay: Update grammar to include anonymous methods.
1283 * anonymous.cs: new file.
1285 2003-05-27 Miguel de Icaza <miguel@ximian.com>
1287 * class.cs (Field.Define): Add missing test for pointers and
1290 2003-05-27 Ravi Pratap <ravi@ximian.com>
1292 * expression.cs (ArrayAccess.GetStoreOpCode): For System.IntPtr,
1293 we use the stobj opcode.
1295 (ArrayCreation.EmitDynamicInitializers): Revert Miguel's patch
1296 since it wasn't the correct fix.
1298 It still is puzzling that we are required to use stobj for IntPtr
1299 which seems to be a ValueType.
1301 2003-05-26 Miguel de Icaza <miguel@ximian.com>
1303 * ecore.cs (SimpleName.SimpleNameResolve): Consider using aliases
1304 during regular simple name resolution. Now, the trick is that
1305 instead of returning for processing the simplename, we do a
1306 TypeManager.LookupType (ie, a rooted lookup as opposed to a
1307 contextual lookup type). If a match is found, return that, if
1308 not, return for further composition.
1310 This fixes long-standing 30485.
1312 * expression.cs (ArrayCreation.EmitDynamicInitializers): When
1313 using the address to initialize an object, do an Stobj instead of
1314 using the regular Stelem.
1316 (IndexerAccess.Emit, IndexerAccess.EmitAssign):
1317 Pass `is_base_indexer' to Invocation.EmitCall instead of false.
1318 Because if we are a BaseIndexerAccess that value will be true.
1321 * statement.cs (GotoCase.Resolve): Return after reporting an
1322 error, do not attempt to continue.
1324 * expression.cs (PointerArithmetic.Emit): If our operand is a
1325 long, convert our constants to match the operand before
1326 multiplying. Convert to I type before adding. Fixes 43670.
1328 2003-05-14 Ravi Pratap <ravi@ximian.com>
1330 * enum.cs (ImplicitConversionExists) : Rename to
1331 ImplicitEnumConversionExists to remove ambiguity.
1333 * ecore.cs (NullCast): New type of cast expression class which
1334 basically is very similar to EmptyCast with the difference being
1335 it still is a constant since it is used only to cast a null to
1339 * convert.cs (ImplicitReferenceConversion): When casting a null
1340 literal, we return a NullCast.
1342 * literal.cs (NullLiteralTyped): Remove - I don't see why this
1343 should be around anymore.
1345 The renaming (reported was slightly wrong). Corrections:
1347 ConvertImplicitStandard -> ImplicitConversionStandard
1348 ConvertExplicitStandard -> ExplicitConversionStandard
1350 * expression.cs (StaticCallExpr.MakeSimpleCall): Resolve arguments
1351 before passing them in !
1353 * convert.cs (ImplicitConversionStandard): When comparing for
1354 equal expr and target types, ensure that expr is not a
1357 In general, we must not be checking (expr_type ==
1358 target_type) in the top level conversion methods
1359 (ImplicitConversion, ExplicitConversion etc). This checking is
1360 done in the methods that they delegate to.
1362 2003-05-20 Miguel de Icaza <miguel@ximian.com>
1364 * convert.cs: Move Error_CannotConvertType,
1365 ImplicitReferenceConversion, ImplicitReferenceConversionExists,
1366 ImplicitNumericConversion, ImplicitConversionExists,
1367 ImplicitUserConversionExists, StandardConversionExists,
1368 FindMostEncompassedType, FindMostSpecificSource,
1369 FindMostSpecificTarget, ImplicitUserConversion,
1370 ExplicitUserConversion, GetConversionOperators,
1371 UserDefinedConversion, ConvertImplicit, ConvertImplicitStandard,
1372 TryImplicitIntConversion, Error_CannotConvertImplicit,
1373 ConvertImplicitRequired, ConvertNumericExplicit,
1374 ExplicitReferenceConversionExists, ConvertReferenceExplicit,
1375 ConvertExplicit, ConvertExplicitStandard from the ecore.cs into
1378 Perform the following renames:
1380 StandardConversionExists -> ImplicitStandardConversionExists
1381 ConvertImplicit -> ImplicitConversion
1382 ConvertImplicitStandard -> ImplicitStandardConversion
1383 TryImplicitIntConversion -> ImplicitIntConversion
1384 ConvertImplicitRequired -> ImplicitConversionRequired
1385 ConvertNumericExplicit -> ExplicitNumericConversion
1386 ConvertReferenceExplicit -> ExplicitReferenceConversion
1387 ConvertExplicit -> ExplicitConversion
1388 ConvertExplicitStandard -> ExplicitStandardConversion
1390 2003-05-19 Martin Baulig <martin@ximian.com>
1392 * statement.cs (TypeInfo.StructInfo): Made this type protected.
1393 (TypeInfo): Added support for structs having structs as fields.
1395 * ecore.cs (FieldExpr): Implement IVariable.
1396 (FieldExpr.DoResolve): Call VariableInfo.GetSubStruct() to get the
1397 VariableInfo for the field.
1399 2003-05-18 Martin Baulig <martin@ximian.com>
1401 * expression.cs (This.DoResolve): Report a CS0027 if we're
1402 emitting a field initializer.
1404 2003-05-18 Martin Baulig <martin@ximian.com>
1406 * expression.cs (This.ResolveBase): New public function.
1407 (This.DoResolve): Check for CS0188.
1409 * codegen.cs (EmitContext.This): Just call This.ResolveBase(), not
1412 * ecore.cs (MethodGroupExpr.DoResolve): Set the
1413 `instance_expression' to null if we don't have any non-static
1416 2003-05-18 Martin Baulig <martin@ximian.com>
1418 Reworked the way how local variables and parameters are handled by
1419 the flow analysis code.
1421 * statement.cs (TypeInfo, VariableMap): New public classes.
1422 (VariableInfo): New public class. This is now responsible for
1423 checking whether a variable has been assigned. It is used for
1424 parameters and local variables.
1425 (Block.EmitMeta): Take the InternalParameters as argument; compute
1426 the layout of the flow vectors here.
1427 (Block.LocalMap, Block.ParameterMap): New public properties.
1428 (FlowBranching): The .ctor doesn't get the InternalParameters
1429 anymore since Block.EmitMeta() now computes the layout of the flow
1431 (MyStructInfo): This class is now known as `StructInfo' and nested
1432 in `TypeInfo'; we don't access this directly anymore.
1434 * ecore.cs (IVariable): Added `VariableInfo VariableInfo'
1435 property and removed IsAssigned(), IsFieldAssigned(),
1436 SetAssigned() and SetFieldAssigned(); we now call them on the
1437 VariableInfo so we don't need to duplicate this code everywhere.
1439 * expression.cs (ParameterReference): Added `Block block' argument
1441 (LocalVariableReference, ParameterReference, This): The new
1442 VariableInfo class is now responsible for all the definite
1445 * codegen.cs (EmitContext.IsVariableAssigned, SetVariableAssigned,
1446 IsParameterAssigned, SetParameterAssigned): Removed.
1448 2003-05-18 Martin Baulig <martin@ximian.com>
1450 * typemanager.cs (InitCoreTypes): Try calling
1451 SetCorlibTypeBuilders() with 4 args; if that fails, fall back to
1452 the 3-args-version. Corlib now also needs our `void_type'.
1453 (GetMethod): Added overloaded version which takes an optional
1454 `bool report_errors' to allow lookups of optional methods.
1456 2003-05-12 Martin Baulig <martin@ximian.com>
1458 * statement.cs (VariableInfo): Renamed to LocalInfo since it's
1459 only used for locals and not for parameters.
1461 2003-05-12 Miguel de Icaza <miguel@ximian.com>
1463 * support.cs (InternalParameters.ParameterType): Return the
1464 ExternalType of the parameter.
1466 * parameter.cs (Parameter.ExternalType): drop the two arguments,
1469 2003-05-11 Miguel de Icaza <miguel@ximian.com>
1471 * class.cs (MethodData.Define): Do not set the `newslot' on
1472 interface members, if they are also flagged as "override".
1474 * expression.cs (UnaryMutator.EmitCode): Simple workaround to emit
1475 better code for ++i and i++. This only works for static fields
1476 and local variables.
1478 * typemanager.cs (LookupDeclSpace): Add new method, sometimes we
1479 want to pull the DeclSpace out of the builder_to_declspace instead
1480 of the TypeBuilder (like in TypeContainer.FindMembers).
1482 * class.cs (TypeContainer.FindMembers): Use LookupDeclSpace
1483 instead of LookupTypeContainer. Fixes the crash on .NET for
1484 looking up interface members.
1486 * const.cs: Create our own emit context during the Definition
1487 stage, so that constants are evaluated in the proper context, when
1488 a recursive definition happens.
1490 2003-05-11 Martin Baulig <martin@ximian.com>
1492 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
1493 new block for a switch section.
1494 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
1495 the adding/lookup in the switch block. Fixes #39828.
1497 2003-05-09 Miguel de Icaza <miguel@ximian.com>
1499 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
1500 functionality: I needed to convert the data after I had performed
1501 the add/sub operation into the operands type size.
1503 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
1504 pass the type for the box operation, otherwise the resulting
1505 object would have been of type object.
1507 (BoxedCast): Add constructor to specify the type to box as.
1509 2003-05-07 Miguel de Icaza <miguel@ximian.com>
1511 * iterators.cs: I was reusing the `count' variable inadvertently,
1512 take steps to not allow this to happen.
1514 2003-05-06 Miguel de Icaza <miguel@ximian.com>
1516 * attribute.cs (Attribute.Resolve): Params attributes are encoded
1517 by creating an array at the point where the params starts and
1518 putting all those arguments there, then adjusting the size of the
1521 2003-05-05 Miguel de Icaza <miguel@ximian.com>
1523 * expression.cs (New.AddressOf): Implement interface
1524 IMemoryLocation. This is used when the `new' operator is used in
1525 the context of an invocation to a method on a value type.
1527 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
1530 * namespace.cs: Also check the using aliases here.
1532 * driver.cs: Move the test for using validity after the types have
1533 been entered, so we do a single pass that also includes the using
1536 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
1537 in the regular case. CreateSiblingForFinally is doing extra
1540 * attribute.cs (GetAttributeArgumentExpression): Store the result
1541 on an out value, and use the return value to indicate failure
1542 instead of using null (which is a valid return for Constant.GetValue).
1544 * statement.cs: Perform the analysis flow for the increment
1545 portion after the statement, because this will be the real flow of
1546 execution. Fixes #42385
1548 * codegen.cs (EmitContext.EmitArgument,
1549 EmitContext.EmitStoreArgument): New helper functions when the
1550 RemapToProxy flag is set.
1552 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
1555 Add support for remapping parameters.
1557 * iterators.cs: Propagate parameter values; Store parameter
1558 values in the proxy classes.
1560 2003-05-04 Miguel de Icaza <miguel@ximian.com>
1562 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
1563 need a proxy reference; I do not know what I was thinking
1565 * cs-parser.jay (constructor_initializer): catch another error,
1566 and display nice message.
1568 (field_declaration): catch void field declaration
1569 to flag a better error.
1571 * class.cs (MemberBase.CheckBase): Report an error instead of a
1572 warning if a new protected member is declared in a struct.
1573 (Field.Define): catch the error of readonly/volatile.
1575 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
1577 (FieldExpr.AddressOf): ditto. Catch error where the address of a
1578 volatile variable is taken
1580 2003-05-02 Miguel de Icaza <miguel@ximian.com>
1582 * statement.cs (Fixed.Resolve): Report an error if we are not in
1585 2003-05-01 Miguel de Icaza <miguel@ximian.com>
1587 * typemanager.cs: reuse the code that handles type clashes for
1588 delegates and enumerations.
1590 * class.cs (Report28): Always report.
1592 * expression.cs (EncodeAsAttribute): Allow nulls here.
1594 2003-04-28 Miguel de Icaza <miguel@ximian.com>
1596 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
1597 the functionality for testing whether an expression is valid for
1598 an attribute here. Also handle the case of arrays of elements
1601 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
1602 encoding a linear array into an array of objects that are suitable
1603 to be passed to an CustomAttributeBuilder.
1605 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
1607 * ecore.cs: (FieldExpr): Handle field remapping here.
1609 * iteratators.cs: Pass the instance variable (if the method is an
1610 instance method) to the constructors, so we can access the field
1611 variables on the class.
1613 TODO: Test this with structs. I think the THIS variable on
1614 structs might have to be a pointer, and not a refenrece
1616 2003-04-27 Miguel de Icaza <miguel@ximian.com>
1618 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
1619 local variables to fields in a proxy class.
1621 * iterators.cs (PopulateProxy): Rename our internal fields to
1623 Create a <THIS> field if we are an instance method, so we can
1624 reference our parent container variables.
1625 (MapVariable): Called back from the EmitContext code to enter a
1626 new variable to field mapping into the proxy class (we just create
1630 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
1631 for using the remapped locals to fields.
1633 I placed the code here, because that gives the same semantics to
1634 local variables, and only changes the Emit code.
1636 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
1637 statements inside iterators.
1638 (VariableInfo): Add a FieldBuilder for the cases when we are
1639 remapping local variables to fields in a proxy class
1641 * ecore.cs (SimpleNameResolve): Avoid testing two times for
1642 current_block != null.
1644 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
1645 not cope with strings, as it has been moved to the
1646 TableSwitchEmit. Fixed bug in switch generation.
1648 * expression.cs (New.DoResolve): Provide more context for the user
1649 when reporting an error.
1651 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
1654 * expression.cs (MemberAccess.DoResolve): When we get a type back,
1655 check the permissions for it. Note than in a type-resolution
1656 context the check was already present in DeclSpace.ResolveType,
1657 but was missing from the MemberAccess.
1659 (ArrayCreation.CheckIndices): warn if the user has
1660 more nested levels of expressions, but there are no more
1661 dimensions specified. Avoids crash on bug 41906.
1663 2003-04-26 Miguel de Icaza <miguel@ximian.com>
1665 * statement.cs (Block): replace Implicit bool, for a generic
1667 New flag: `Unchecked'. This is used during the EmitMeta phase
1668 (which is out-of-line with the regular Resolve/Emit process for a
1669 statement, as this is done ahead of time, but still gets a chance
1670 to call constant resolve).
1672 (Block.Flags): new enum for adding a new flag.
1674 (Block.EmitMeta): track the state of unchecked.
1676 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
1677 to enable constant resolution to work there as well.
1679 2003-04-22 Miguel de Icaza <miguel@ximian.com>
1681 * typemanager.cs (ienumerable_type): Also look up
1682 System.Collections.IEnumerable.
1684 2003-04-21 Miguel de Icaza <miguel@ximian.com>
1686 TODO: Test more than one conditional per method.
1688 * class.cs (Indexer.Define): Report the location where the user is
1689 referencing the unsupported feature.
1691 (MethodData): Overload the use of `conditionals' to
1692 minimize the creation of needless ArrayLists. This saves roughly
1693 212kb on my machine.
1695 (Method): Implement the new IIteratorContainer interface.
1696 (Method.SetYields): Implement the method by setting the ModFlags
1697 to contain METHOD_YIELDS.
1699 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
1700 which just got set to null.
1702 * iterators.cs: New file.
1704 (Yield, YieldBreak): New statements.
1706 * statement.cs (Return.Resolve): Flag an error if we are used in
1709 * codegen.cs (InIterator): New flag set if the code is being
1710 compiled in an iterator method.
1712 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
1713 internal modifier, and we just use it to avoid adding extra
1714 fields, as this is seldom used.
1716 * cs-parser.jay: Add yield_statement (yield and yield break).
1718 * driver.cs: New flag -v2 to turn on version 2 features.
1720 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
1721 hashtable when v2 is enabled.
1723 2003-04-20 Miguel de Icaza <miguel@ximian.com>
1725 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
1726 there is already a namespace defined with this name.
1728 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
1729 people upgraded their corlibs.
1731 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
1732 always use fully qualified types, no need to use the compiler
1735 (TypeManager.IsNamespace): Use binarysearch.
1737 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
1738 AddDelegate): I did not quite use the new IsValid API properly: I
1739 have to pass the short-name and the fullname. I was passing only
1740 the basename instead of the fullname sometimes.
1742 (TypeContainer.DefineType): call NamespaceClash.
1744 * interface.cs (Interface.DefineType): use NamespaceClash before
1747 * delegate.cs (Delegate.DefineType): use NamespaceClash before
1750 * enum.cs: (Enum.DefineType): use NamespaceClash before
1753 * typemanager.cs (: 3-line patch that gives us some tasty 11%
1754 speed increase. First, use the negative_hits cache when we get a
1755 negative. Second, add the type with its full original name
1756 instead of the new . and + encoded name (reflection uses + to
1757 separate type from a nested type). Use LookupTypeReflection
1758 directly which bypasses the type->name hashtable (that we already
1759 know does not contain the type.
1761 * decl.cs (DeclSpace.ResolveTypeExpr): track the
1762 location/container type.
1764 * driver.cs: When passing utf8, use directly the UTF8Encoding.
1766 2003-04-19 Miguel de Icaza <miguel@ximian.com>
1768 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
1770 * delegate.cs (NewDelegate.Resolve): Test whether an instance
1771 method is being referenced in the method group from a static
1772 context, and report error 120 if so.
1774 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
1777 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
1778 is created, we create the A namespace).
1780 * cs-parser.jay: A namespace also introduces a DeclarationFound.
1783 2003-04-18 Miguel de Icaza <miguel@ximian.com>
1785 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
1786 invocation to ModuleBuilder.GetType with the same values will
1787 return a new type instance, so we need to cache its return
1790 * expression.cs (Binary.ResolveOperator): Only allow the compare
1791 operators on enums if they are of the same type.
1793 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
1794 types of ValueType on their own case. Before we were giving them
1795 the same treatment as objects.
1797 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
1798 fullname. Short name is used to compare against container name.
1799 Fullname is used to check against defined namespace names.
1801 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
1802 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
1804 (Method.CheckBase): Call parent.
1805 (MemberBase.CheckBase): Check for protected members on sealed
1807 (PropertyBase.CheckBase): Call parent.
1808 (Field.Define): Call parent.
1810 * report.cs: Negative error codes are now mapped to 8000 - code,
1811 so that the display is render more nicely.
1813 * typemanager.cs: Do not use try/catch, instead report a regular
1816 (GetPointerType, GetReferenceType): These methods provide
1817 mechanisms to obtain the T* and T& from a T. We had the code
1818 previously scattered around the code base, and it also used
1819 TypeManager.LookupType that would go through plenty of caches.
1820 This one goes directly to the type source.
1822 In some places we did the Type.GetType followed by
1823 ModuleBuilder.GetType, but not in others, so this unifies the
1826 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
1827 statements now that we have namespace information.
1829 * typemanager.cs (IsNamespace): New method, returns whether the
1830 string presented is a namespace or not.
1832 (ComputeNamespaces): New public entry point, computes the list of
1833 available namespaces, using the GetNamespaces API call in Mono, or
1834 the slower version in MS.NET.
1836 Now before we start the semantic analysis phase, we have a
1837 complete list of namespaces including everything that the user has
1840 Deleted old code to cache namespaces in .nsc files.
1842 2003-04-17 Miguel de Icaza <miguel@ximian.com>
1844 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
1845 class/struct location definition Location for the implicit
1846 constructor location.
1848 (Operator.Define): Use the location of the operator for the
1849 implicit Method definition.
1851 (Constructor.Emit): use the constructor location for the implicit
1852 base initializer constructor.
1854 * ecore.cs: Remove ITypeExpression. This interface is now gone,
1855 and the Expression class now contains two new methods:
1857 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
1858 isolate type lookup from the rest of the resolution process.
1860 Since we use Expressions to hold type definitions due to the way
1861 we parse the input we have historically overloaded Resolve to
1862 perform the Type lookups if a special flag is passed. Now this is
1863 eliminated and two methods take their place.
1865 The differences in the two methods between xStep and xTerminal is
1866 that xStep is involved in our current lookup system that uses
1867 SimpleNames to compose a name, while xTerminal is used just to
1868 catch the case where the simplename lookup failed.
1870 2003-04-16 Miguel de Icaza <miguel@ximian.com>
1872 * expression.cs (ResolveMemberAccess): Remove redundant code.
1873 TypeExpr expressions are always born fully resolved.
1875 * interface.cs (PopulateMethod): Do not lookup the types twice.
1876 We were doing it once during SemanticAnalysis and once during
1879 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
1880 in local variable type definitions, were being returned as a
1881 SimpleName (we decomposed everything into a string), that is
1882 because primary_expression was being used instead of a type in the
1883 grammar (reduce/reduce conflicts).
1885 The part that was wrong is that we converted the expression into a
1886 string (an oversimplification in one hand, compounded with primary
1887 expressions doing string concatenation).
1893 Would return "A.B.C[]" as a SimpleName. This stopped things like
1894 using clauses from working on this particular context. And a type
1895 was being matched directly against "A.B.C[]".
1897 We now use the correct approach, and allow for ComposedCast to be
1898 part of the unary expression. So the "A.B.C []" become a composed
1899 cast of "A.B.C" (as a nested group of MemberAccess with a
1900 SimpleName at the end) plus the rank composition "[]".
1904 2003-04-10 Miguel de Icaza <miguel@ximian.com>
1906 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
1907 for the access level checking.
1909 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
1910 `TypeContainer container', because I kept getting confused when I
1911 was debugging this code.
1913 * expression.cs (Indexers): Instead of tracking getters/setters,
1914 we now track them in parallel. We create one arraylist less, but
1915 most importantly it is possible now for the LValue code to find a
1916 matching get for a set.
1918 (IndexerAccess.DoResolveLValue): Update the code.
1919 GetIndexersForType has been modified already to extract all the
1920 indexers from a type. The code assumed it did not.
1922 Also make the code set the correct return type for the indexer.
1923 This was fixed a long time ago for properties, but was missing for
1924 indexers. It used to be void_type.
1926 (Binary.Emit): Test first for doubles instead of
1927 floats, as they are more common.
1929 (Binary.EmitBranchable): Use the .un version of the branch opcodes
1930 when dealing with floats and the <=, >= operators. This fixes bug
1933 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
1934 to load the array value by emitting a load on the foreach variable
1935 type. This was incorrect.
1937 We now emit the code to load an element using the the array
1938 variable type, and then we emit the conversion operator.
1942 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
1944 * attribute.cs: Avoid allocation of ArrayLists in the common case.
1946 2003-04-09 Miguel de Icaza <miguel@ximian.com>
1948 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
1949 test for protection before we test for signatures.
1951 (MethodSignature.ToString): implement.
1953 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
1954 to the case where we reduced into a LongConstant.
1956 * decl.cs (CheckAccessLevel): If the type is an array, we can not
1957 depend on whether the information is acurrate, because the
1958 Microsoft runtime will always claim that the array type is public,
1959 regardless of the real state.
1961 If the type is a pointer, another problem happens: the type is
1962 reported as non-public in Microsoft.
1964 In both cases we have to call CheckAccessLevel recursively with
1965 the underlying type as the argument to be tested.
1967 2003-04-08 Miguel de Icaza <miguel@ximian.com>
1969 * assign.cs (Assign.Emit): If we are dealing with a compound
1970 assignment expression, we should use the code path that stores the
1971 intermediate result in a temporary value. This fixes #40903.
1973 *expression.cs (Indirection.ToString): Provide ToString method for
1976 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
1978 * class.cs: Null out fields holding references to Block objects so
1979 they can be garbage collected.
1981 * expression.cs (OverloadResolve): Remove unused local.
1983 2003-04-07 Martin Baulig <martin@ximian.com>
1985 * codegen.cs (EmitContext.CurrentFile): New public field.
1986 (EmitContext.Mark): Use the CurrentFile to check whether the
1987 location is in the correct file.
1988 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
1990 2003-04-07 Martin Baulig <martin@ximian.com>
1992 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
1994 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
1995 location. [FIXME: The location argument which gets passed to this
1996 method is sometimes wrong!]
1998 2003-04-07 Nick Drochak <ndrochak@gol.com>
2000 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
2002 2003-04-07 Miguel de Icaza <miguel@ximian.com>
2004 * expression.cs (Indirection.EmitAssign): We were using the
2005 temporary, but returning immediately instead of continuing the
2008 2003-04-06 Martin Baulig <martin@ximian.com>
2010 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
2011 if it's a nested child, but also deriving from the outer class.
2014 * typemanager.cs (IsNestedChildOf): Make this work if it's a
2015 nested child, but also deriving from the outer class. See
2017 (FilterWithClosure): We may access private members of the outer
2018 class if we're a nested child and deriving from the outer class.
2019 (RealMemberLookup): Only set `closure_private_ok' if the
2020 `original_bf' contained BindingFlags.NonPublic.
2022 2003-04-05 Martin Baulig <martin@ximian.com>
2024 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
2026 2003-04-02 Miguel de Icaza <miguel@ximian.com>
2028 * class.cs (Event.Define): Do not allow abstract events to have
2031 2003-04-01 Miguel de Icaza <miguel@ximian.com>
2033 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
2034 block in event declarations.
2036 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
2037 value type, get its address.
2039 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
2040 leaving a class on the stack instead of a boolean value (int
2041 0/1). Change the code so we compare against null, and then the
2042 result against zero.
2044 * class.cs (TypeContainer.GetClassBases): We were checking for the
2045 parent class being sealed too late.
2047 * expression.cs (Binary.Emit): For <= and >= when dealing with
2048 floating point values, use cgt.un and clt.un instead of cgt and
2051 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
2053 * statement.cs: Apply the same optimization as MS: skip the
2054 GetEnumerator returning an IEnumerator, and use the one returning a
2055 CharEnumerator instead. This allows us to avoid the try-finally block
2058 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
2060 * cs-parser.jay: Attributes cannot be applied to
2061 namespaces. Fixes #40473
2063 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2066 (Add*): check if the name is valid using the full name for constants,
2067 fields, properties and events.
2069 2003-03-28 Miguel de Icaza <miguel@ximian.com>
2071 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
2072 char constants to be part of the enumeration.
2074 * expression.cs (Conditional.DoResolve): Add support for operator
2075 true. Implements the missing functionality from 14.12
2077 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
2078 operator true/false as required by the spec.
2080 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
2081 implicit conversion to boolean.
2083 * statement.cs (Statement.ResolveBoolean): A boolean expression is
2084 also one where the type implements `operator true'.
2086 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
2087 get an expression that will invoke operator true based on an
2090 (GetConversionOperators): Removed the hack that called op_True
2093 (Expression.ResolveBoolean): Move this from Statement.
2095 2003-03-17 Miguel de Icaza <miguel@ximian.com>
2097 * ecore.cs (FieldExpr): do not allow initialization of initonly
2098 fields on derived classes
2100 2003-03-13 Martin Baulig <martin@ximian.com>
2102 * statement.cs (Block.Emit): Call ig.BeginScope() and
2103 ig.EndScope() when compiling with debugging info; call
2104 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
2106 2003-03-08 Miguel de Icaza <miguel@ximian.com>
2108 * expression.cs (Indexers): Do not construct immediately, allow
2109 for new members to be appended as we go. Fixes 38143
2111 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2113 * expression.cs: save/restore context when resolving an unchecked
2116 2003-03-05 Miguel de Icaza <miguel@ximian.com>
2118 * cfold.cs: Catch division by zero in modulus operator during
2121 2003-03-03 Miguel de Icaza <miguel@ximian.com>
2123 * interface.cs (Interface.DefineMembers): Avoid defining members
2126 2003-02-27 Miguel de Icaza <miguel@ximian.com>
2128 * driver.cs: handle the +/- options for -noconfig
2130 * statement.cs (Unckeched.Resolve): Also track the state of
2131 unchecked in the Resolve phase.
2133 2003-02-27 Martin Baulig <martin@ximian.com>
2135 * ecore.cs (Expression.MemberLookup): Don't create a
2136 MethodGroupExpr for something which is not a method. Fixes #38291.
2138 2003-02-25 Miguel de Icaza <miguel@ximian.com>
2140 * class.cs (MemberBase.CheckParameters): Also check that the type
2141 is unmanaged if it is a pointer.
2143 * expression.cs (SizeOf.Resolve): Add location information.
2145 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
2146 a managed type is declared.
2148 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
2149 parameter modifiers as well. Fixes bug 38606
2151 * class.cs: Very sad. Am backing out the speed up changes
2152 introduced by the ArrayList -> Array in the TypeContainer, as they
2153 were not actually that much faster, and introduced a bug (no error
2154 reports on duplicated methods).
2156 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
2157 source first, this will guarantee that we have a valid expression
2158 before calling in lower levels functions that will require a
2159 resolved object. Then use this original_source in the
2160 target.ResolveLValue instead of the original source that was
2163 Another change. Use target.Resolve instead of LValueResolve.
2164 Although we are resolving for LValues, we will let the Assign code
2165 take care of that (it will be called again from Resolve). This
2166 basically allows code like this:
2168 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
2169 class Y { void A (X x) { x [0] += o; }
2171 The problem was that the indexer was trying to resolve for
2172 set_Item (idx, object o) and never finding one. The real set_Item
2173 was set_Item (idx, X). By delaying the process we get the right
2178 2003-02-23 Martin Baulig <martin@ximian.com>
2180 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
2181 while calling DoEmit ().
2183 * codegen.cs (EmitContext.Mark): Don't mark locations in other
2184 source files; if you use the #line directive inside a method, the
2185 compiler stops emitting line numbers for the debugger until it
2186 reaches the end of the method or another #line directive which
2187 restores the original file.
2189 2003-02-23 Martin Baulig <martin@ximian.com>
2191 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
2193 2003-02-23 Martin Baulig <martin@ximian.com>
2195 * statement.cs (Block.AddChildVariableNames): We need to call this
2196 recursively, not just for our immediate children.
2198 2003-02-23 Martin Baulig <martin@ximian.com>
2200 * class.cs (Event.Define): Always make the field private, like csc does.
2202 * typemanager.cs (TypeManager.RealMemberLookup): Make events
2203 actually work, fixes bug #37521.
2205 2003-02-23 Miguel de Icaza <miguel@ximian.com>
2207 * delegate.cs: When creating the various temporary "Parameters"
2208 classes, make sure that we call the ComputeAndDefineParameterTypes
2209 on those new parameters (just like we do with the formal ones), to
2210 allow them to be resolved in the context of the DeclSpace.
2212 This fixes the bug that Dick observed in Bugzilla #38530.
2214 2003-02-22 Miguel de Icaza <miguel@ximian.com>
2216 * expression.cs (ResolveMemberAccess): When resolving a constant,
2217 do not attempt to pull a constant if the value was not able to
2218 generate a valid constant.
2220 * const.cs (LookupConstantValue): Do not report more errors than required.
2222 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2224 * expression.cs: fixes bug #38328.
2226 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2228 * class.cs: Changed all the various members that can be part of a
2229 class from being an ArrayList to be an Array of the right type.
2230 During the DefineType type_list, interface_list, delegate_list and
2231 enum_list are turned into types, interfaces, delegates and enums
2234 And during the member population, indexer_list, event_list,
2235 constant_list, field_list, instance_constructor_list, method_list,
2236 operator_list and property_list are turned into their real arrays.
2238 Although we could probably perform this operation earlier, for
2239 good error reporting we need to keep the lists and remove the
2240 lists for longer than required.
2242 This optimization was triggered by Paolo profiling the compiler
2243 speed on the output of `gen-sample-program.pl' perl script.
2245 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
2246 not crash in methods like MemberLookupFailed that use this field.
2248 This problem arises when the compiler fails to resolve a type
2249 during interface type definition for example.
2251 2003-02-18 Miguel de Icaza <miguel@ximian.com>
2253 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
2254 inherit from System.Object, so we have to stop at null, not only
2255 when reaching System.Object.
2257 2003-02-17 Miguel de Icaza <miguel@ximian.com>
2259 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
2260 DeclaredOnly because the parent indexer might have had a different
2261 name, but did not loop until the top of the hierarchy was reached.
2263 The problem this one fixes is 35492: when a class implemented an
2264 indexer from an interface, we were getting the interface method
2265 (which was abstract) and we were flagging an error (can not invoke
2268 This also keeps bug 33089 functioning, and test-148 functioning.
2270 * typemanager.cs (IsSpecialMethod): The correct way of figuring
2271 out if a method is special is to see if it is declared in a
2272 property or event, or whether it is one of the predefined operator
2273 names. This should fix correctly #36804.
2275 2003-02-15 Miguel de Icaza <miguel@ximian.com>
2277 The goal here is to remove the dependency on EmptyCast.Peel ().
2278 Killing it completely.
2280 The problem is that currently in a number of places where
2281 constants are expected, we have to "probe" for an EmptyCast, and
2282 Peel, which is not the correct thing to do, as this will be
2283 repetitive and will likely lead to errors.
2285 The idea is to remove any EmptyCasts that are used in casts that
2286 can be reduced to constants, so we only have to cope with
2289 This bug hunt was triggered by Bug 37363 and the desire to remove
2290 the duplicate pattern where we were "peeling" emptycasts to check
2291 whether they were constants. Now constants will always be
2294 * ecore.cs: Use an enumconstant here instead of wrapping with
2297 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
2298 throwing me off. By handling this we can get rid of a few hacks.
2300 * statement.cs (Switch): Removed Peel() code.
2302 2003-02-14 Miguel de Icaza <miguel@ximian.com>
2304 * class.cs: Location information for error 508
2306 * expression.cs (New.DoResolve): Add a guard against double
2307 resolution of an expression.
2309 The New DoResolve might be called twice when initializing field
2310 expressions (see EmitFieldInitializers, the call to
2311 GetInitializerExpression will perform a resolve on the expression,
2312 and later the assign will trigger another resolution
2314 This leads to bugs (#37014)
2316 * delegate.cs: The signature for EndInvoke should contain any ref
2317 or out parameters as well. We were not doing this in the past.
2319 * class.cs (Field.Define): Do not overwrite the type definition
2320 inside the `volatile' group. Turns out that volatile enumerations
2321 were changing the type here to perform a validity test, which
2324 2003-02-12 Miguel de Icaza <miguel@ximian.com>
2326 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
2327 and structs, we do not want to load the instance variable
2329 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
2330 enum_type has to be handled like an object reference (implicit
2331 conversions exists from this to object), but the regular IsClass
2332 and IsValueType tests will never return true for this one.
2334 Also we use TypeManager.IsValueType instead of type.IsValueType,
2335 just for consistency with the rest of the code (this is only
2336 needed if we ever use the construct exposed by test-180.cs inside
2337 corlib, which we dont today).
2339 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
2341 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
2344 2003-02-09 Martin Baulig <martin@ximian.com>
2346 * namespace.cs (Namespace..ctor): Added SourceFile argument.
2347 (Namespace.DefineNamespaces): New static public method; this is
2348 called when we're compiling with debugging to add all namespaces
2351 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
2352 pass it to the Namespace's .ctor.
2354 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
2355 and MethodBase arguments; pass the namespace ID to the symwriter;
2356 pass the MethodBase instead of the token to the symwriter.
2357 (SymbolWriter.DefineNamespace): New method to add a namespace to
2360 2003-02-09 Martin Baulig <martin@ximian.com>
2362 * symbolwriter.cs: New file. This is a wrapper around
2363 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
2364 methods here in near future.
2366 2003-02-09 Martin Baulig <martin@ximian.com>
2368 * codegen.cs (EmitContext.Mark): Just pass the arguments to
2369 ILGenerator.MarkSequencePoint() which are actually used by the
2372 2003-02-09 Martin Baulig <martin@ximian.com>
2374 * location.cs (SourceFile): New public sealed class. This
2375 contains the name and an index which is used in the location's token.
2376 (Location): Reserve an appropriate number of bits in the token for
2377 the source file instead of walking over that list, this gives us a
2378 really huge performance improvement when compiling with debugging.
2380 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
2381 `SourceFile' argument instead of a string.
2382 (Driver.ProcessFile): Add all the files via Location.AddFile(),
2383 but don't parse/tokenize here, we need to generate the list of all
2384 source files before we do that.
2385 (Driver.ProcessFiles): New static function. Parses/tokenizes all
2388 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
2389 instead of a string.
2391 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
2394 2003-02-09 Martin Baulig <martin@ximian.com>
2396 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
2397 filename on `#line default'.
2399 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
2401 * statement.cs: don't clear the pinned var when the fixed statement
2402 returns from the method (fixes bug#37752).
2404 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
2406 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
2409 2003-02-07 Martin Baulig <martin@ximian.com>
2411 * driver.cs: Removed the `--debug-args' command line argument.
2413 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
2414 automatically by the AsssemblyBuilder.
2415 (CodeGen.InitializeSymbolWriter): We don't need to call any
2416 initialization function on the symbol writer anymore. This method
2417 doesn't take any arguments.
2419 2003-02-03 Miguel de Icaza <miguel@ximian.com>
2421 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
2422 from referenced assemblies as well.
2424 2003-02-02 Martin Baulig <martin@ximian.com>
2426 * class.cs (MethodData.Emit): Generate debugging info for external methods.
2428 2003-02-02 Martin Baulig <martin@ximian.com>
2430 * class.cs (Constructor.Emit): Open the symbol writer before
2431 emitting the constructor initializer.
2432 (ConstructorInitializer.Emit): Call ec.Mark() to allow
2433 single-stepping through constructor initializers.
2435 2003-01-30 Miguel de Icaza <miguel@ximian.com>
2437 * class.cs: Handle error 549: do not allow virtual methods in
2440 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
2442 * decl.cs: Check access levels when resolving types
2444 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
2446 * statement.cs: Add parameters and locals set in catch blocks that might
2447 return to set vector
2449 2003-01-29 Miguel de Icaza <miguel@ximian.com>
2451 * class.cs (Operator): Set the SpecialName flags for operators.
2453 * expression.cs (Invocation.DoResolve): Only block calls to
2454 accessors and operators on SpecialName methods.
2456 (Cast.TryReduce): Handle conversions from char constants.
2459 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
2461 * statement.cs: small memory and time optimization in FlowBranching.
2463 2003-01-28 Pedro Mart <yoros@wanadoo.es>
2465 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
2466 problem that the last fix but in the other sid (Set).
2468 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
2469 access when there is no indexer in the hierarchy.
2471 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
2473 * class.cs: Combine some if statements.
2475 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2477 * driver.cs: fixed bug #37187.
2479 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
2481 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
2482 any indexer, it's needed to build a list with all the indexers in the
2483 hierarchy (AllGetters), else we have problems. Fixes #35653.
2485 2003-01-23 Miguel de Icaza <miguel@ximian.com>
2487 * class.cs (MethodData.Define): It is wrong for an interface
2488 implementation to be static in both cases: explicit and implicit.
2489 We were only handling this in one case.
2491 Improve the if situation there to not have negations.
2493 * class.cs (Field.Define): Turns out that we do not need to check
2494 the unsafe bit on field definition, only on usage. Remove the test.
2496 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2498 * driver.cs: use assembly.Location instead of Codebase (the latest
2499 patch made mcs fail when using MS assemblies).
2501 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
2503 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
2504 get the path to *corlib.dll.
2506 2003-01-21 Nick Drochak <ndrochak@gol.com>
2510 * typemanager.cs: Remove compiler warnings
2512 2003-01-20 Duncan Mak <duncan@ximian.com>
2514 * AssemblyInfo.cs: Bump the version number to 0.19.
2516 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2518 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
2520 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
2522 * class.cs (Constructor::Emit): Emit debugging info for constructors.
2524 2003-01-17 Miguel de Icaza <miguel@ximian.com>
2526 * cs-parser.jay: Small fix: we were not comparing the constructor
2527 name correctly. Thanks to Zoltan for the initial pointer.
2529 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
2531 * cs-tokenizer.cs: Set file name when specified with #line
2533 2003-01-15 Miguel de Icaza <miguel@ximian.com>
2535 * cs-parser.jay: Only perform the constructor checks here if we
2536 are named like the class; This will help provider a better
2537 error. The constructor path is taken when a type definition is
2538 not found, but most likely the user forgot to add the type, so
2539 report that rather than the constructor error.
2541 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
2543 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
2546 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2548 * cs-parser.jay: Add cleanup call.
2550 2003-01-13 Duncan Mak <duncan@ximian.com>
2552 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
2553 consistent with other methods.
2555 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
2557 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
2559 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
2561 * attribute.cs: only set GuidAttr to true when we have a
2564 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2568 * typemanager.cs: fixes to allow mcs compile corlib with the new
2569 Type.IsSubclassOf fix.
2571 2003-01-08 Miguel de Icaza <miguel@ximian.com>
2573 * expression.cs (LocalVariableReference.DoResolve): Classify a
2574 constant as a value, not as a variable. Also, set the type for
2577 * cs-parser.jay (fixed_statement): take a type instead of a
2578 pointer_type, so we can produce a better error message later.
2580 * statement.cs (Fixed.Resolve): Flag types that are not pointers
2583 (For.DoEmit): Make inifinite loops have a
2584 non-conditional branch back.
2586 (Fixed.DoEmit): First populate the pinned variables, then emit the
2587 statement, then clear the variables. Before I was emitting the
2588 code once for each fixed piece.
2591 2003-01-08 Martin Baulig <martin@ximian.com>
2593 * statement.cs (FlowBranching.MergeChild): A break in a
2594 SWITCH_SECTION does not leave a loop. Fixes #36155.
2596 2003-01-08 Martin Baulig <martin@ximian.com>
2598 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
2599 lives in the same number space than `param_map'. Fixes #36154.
2601 2003-01-07 Miguel de Icaza <miguel@ximian.com>
2603 * cs-parser.jay (constructor_declaration): Set the
2604 Constructor.ModFlags before probing for it. This makes the
2605 compiler report 514, 515 and 132 (the code was there, but got
2608 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
2609 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
2610 (GotoCase.Resolve): Set `Returns' to ALWAYS.
2612 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
2614 * enum.cs: create the enum static fields using the enum type.
2616 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
2618 * class.cs: don't try to create the ParamBuilder for the return
2619 type if it's not needed (and handle it breaking for the ms runtime
2622 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
2624 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
2626 2002-12-29 Miguel de Icaza <miguel@ximian.com>
2628 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
2629 the command. This showed up while compiling the JANET source
2630 code, which used \r as its only newline separator.
2632 2002-12-28 Miguel de Icaza <miguel@ximian.com>
2634 * class.cs (Method.Define): If we are an operator (because it
2635 reuses our code), then set the SpecialName and HideBySig. #36128
2637 2002-12-22 Miguel de Icaza <miguel@ximian.com>
2639 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
2640 exception, report error 120 `object reference required'.
2642 * driver.cs: Add --pause option, used during to measure the size
2643 of the process as it goes with --timestamp.
2645 * expression.cs (Invocation.DoResolve): Do not allow methods with
2646 SpecialName to be invoked.
2648 2002-12-21 Miguel de Icaza <miguel@ximian.com>
2650 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
2651 number before adding it.
2653 2002-12-21 Ravi Pratap <ravi@ximian.com>
2655 * ecore.cs (StandardImplicitConversion): When in an unsafe
2656 context, we allow conversion between void * to any other pointer
2657 type. This fixes bug #35973.
2659 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
2661 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
2662 is not thrown when extensionless outputs are used
2664 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2666 * rootcontext.cs: fixed compilation of corlib.
2668 2002-12-19 Miguel de Icaza <miguel@ximian.com>
2670 * attribute.cs (Attributes.Contains): Add new method.
2672 * class.cs (MethodCore.LabelParameters): if the parameter is an
2673 `out' parameter, check that no attribute `[In]' has been passed.
2675 * enum.cs: Handle the `value__' name in an enumeration.
2677 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
2679 * decl.cs: Added special case to allow overrides on "protected
2682 2002-12-18 Ravi Pratap <ravi@ximian.com>
2684 * attribute.cs (Attributes.AddAttributeSection): Rename to this
2685 since it makes much more sense.
2687 (Attributes.ctor): Don't require a Location parameter.
2689 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
2691 * attribute.cs (ApplyAttributes): Remove extra Location parameters
2692 since we already have that information per attribute.
2694 * everywhere : make appropriate changes.
2696 * class.cs (LabelParameters): Write the code which actually
2697 applies attributes to the return type. We can't do this on the MS
2698 .NET runtime so we flag a warning in the case an exception is
2701 2002-12-18 Miguel de Icaza <miguel@ximian.com>
2703 * const.cs: Handle implicit null conversions here too.
2705 2002-12-17 Ravi Pratap <ravi@ximian.com>
2707 * class.cs (MethodCore.LabelParameters): Remove the extra
2708 Type [] parameter since it is completely unnecessary. Instead
2709 pass in the method's attributes so that we can extract
2710 the "return" attribute.
2712 2002-12-17 Miguel de Icaza <miguel@ximian.com>
2714 * cs-parser.jay (parse): Use Report.Error to flag errors instead
2715 of ignoring it and letting the compile continue.
2717 * typemanager.cs (ChangeType): use an extra argument to return an
2718 error condition instead of throwing an exception.
2720 2002-12-15 Miguel de Icaza <miguel@ximian.com>
2722 * expression.cs (Unary.TryReduce): mimic the code for the regular
2723 code path. Perform an implicit cast in the cases where we can
2724 implicitly convert to one of the integral types, and then reduce
2725 based on that constant. This fixes bug #35483.
2727 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2729 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
2731 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2733 * namespace.cs: fixed bug #35489.
2735 2002-12-12 Miguel de Icaza <miguel@ximian.com>
2737 * class.cs: Remove some dead code.
2739 * cs-parser.jay: Estimate the number of methods needed
2740 (RootContext.MethodCount);
2742 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
2743 numbers instead of StringBuilders.
2745 * support.cs (PtrHashtable): Add constructor with initial size;
2746 We can now reduce reallocations of the method table.
2748 2002-12-10 Ravi Pratap <ravi@ximian.com>
2750 * attribute.cs (ApplyAttributes): Keep track of the emitted
2751 attributes on a per-target basis. This fixes bug #35413.
2753 2002-12-10 Miguel de Icaza <miguel@ximian.com>
2755 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
2756 default to the Windows 1252 encoding.
2758 (UnixParseOption): Support version, thanks to Alp for the missing
2761 * AssemblyInfo.cs: Add nice assembly information.
2763 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
2766 * cs-parser.jay: Allow a trailing comma before the close bracked
2767 in the attribute_section production.
2769 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
2770 address of the instance was being taken, I will take this out,
2771 because we take the address of the object immediately here.
2773 2002-12-09 Ravi Pratap <ravi@ximian.com>
2775 * typemanager.cs (AreMultipleAllowed): Take care of the most
2776 obvious case where attribute type is not in the current assembly -
2779 2002-12-08 Miguel de Icaza <miguel@ximian.com>
2781 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
2782 definitions, instead of doing that afterwards.
2784 Also we use a nice little hack, depending on the constructor, we
2785 know if we are a "composed" name or a simple name. Hence, we
2786 avoid the IndexOf test, and we avoid
2788 * codegen.cs: Add code to assist in a bug reporter to track down
2789 the source of a compiler crash.
2791 2002-12-07 Ravi Pratap <ravi@ximian.com>
2793 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
2794 types have been emitted for a given element and flag an error
2795 if something which does not have AllowMultiple set is used more
2798 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
2799 attribute types and their corresponding AllowMultiple properties
2801 (AreMultipleAllowed): Check the property for a given type.
2803 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
2804 property in the case we have a TypeContainer.
2806 (Attributes.AddAttribute): Detect duplicates and just skip on
2807 adding them. This trivial fix catches a pretty gross error in our
2808 attribute emission - global attributes were being emitted twice!
2810 Bugzilla bug #33187 is now fixed.
2812 2002-12-06 Miguel de Icaza <miguel@ximian.com>
2814 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
2817 * expression.cs (Binary.ResolveOperator): I can only use the
2818 Concat (string, string, string) and Concat (string, string,
2819 string, string) if the child is actually a concatenation of
2822 2002-12-04 Miguel de Icaza <miguel@ximian.com>
2824 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
2825 context where we need a 2-character lookahead.
2827 * pending.cs (PendingImplementation): Rework so we can keep track
2828 of interface types all the time, and flag those which were
2829 implemented by parents as optional.
2831 2002-12-03 Miguel de Icaza <miguel@ximian.com>
2833 * expression.cs (Binary.ResolveOperator): Use
2834 String.Concat(string,string,string) or
2835 String.Concat(string,string,string,string) when possible.
2837 * typemanager: More helper methods.
2840 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
2842 * pending.cs: remove the bogus return from GetMissingInterfaces()
2843 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
2845 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2847 * namespace.cs: avoid duplicated 'using xxx' being added to
2848 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
2849 when we get more than one 'using' statement for the same namespace.
2850 Report a CS0105 warning for it.
2852 2002-11-30 Miguel de Icaza <miguel@ximian.com>
2854 * cs-tokenizer.cs (consume_identifier): use read directly, instead
2855 of calling getChar/putback, uses internal knowledge of it.
2857 (xtoken): Reorder tokenizer so most common patterns are checked
2858 first. This reduces the compilation time in another 5% (from 8.11s
2859 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
2861 The parsing time is 22% of the compilation in mcs, and from that
2862 64% is spent on the tokenization process.
2864 I tried using a binary search for keywords, but this is slower
2865 than the hashtable. Another option would be to do a couple of
2868 * Not use a StringBuilder, instead use an array of chars,
2869 with a set value. Notice that this way we could catch
2870 the 645 error without having to do it *afterwards*.
2872 * We could write a hand-parser to avoid the hashtable
2873 compares altogether.
2875 The identifier consumption process takes 37% of the tokenization
2876 time. Another 15% is spent on is_number. 56% of the time spent
2877 on is_number is spent on Int64.Parse:
2879 * We could probably choose based on the string length to
2880 use Int32.Parse or Int64.Parse and avoid all the 64-bit
2883 Another 3% is spend on wrapping `xtoken' in the `token' function.
2885 Handle 0xa0 as whitespace (#34752)
2887 2002-11-26 Miguel de Icaza <miguel@ximian.com>
2889 * typemanager.cs (IsCLRType): New routine to tell whether a type
2890 is one of the builtin types.
2892 Maybe it needs to use TypeCodes to be faster. Maybe we could use
2893 typecode in more places instead of doing pointer comparissions.
2894 We could leverage some knowledge about the way the typecodes are
2897 New code to cache namespaces in assemblies, it is currently not
2898 invoked, to be used soon.
2900 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
2902 * expression.cs (Binary.ResolveOperator): specially handle
2903 strings, and do not perform user-defined operator overloading for
2906 2002-11-24 Miguel de Icaza <miguel@ximian.com>
2908 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
2909 internalcall as it is a pretty simple operation; Avoid whenever
2910 possible to call Char.IsLetter.
2912 (consume_identifier): Cut by half the number of
2913 hashtable calls by merging the is_keyword and GetKeyword behavior.
2915 Do not short-circuit, because if we do, we
2916 report errors (ie, #if false && true would produce an invalid
2920 2002-11-24 Martin Baulig <martin@ximian.com>
2922 * expression.cs (Cast.TryReduce): If we're in checked syntax,
2923 check constant ranges and report a CS0221. Fixes #33186.
2925 2002-11-24 Martin Baulig <martin@ximian.com>
2927 * cs-parser.jay: Make this work for uninitialized variable
2928 declarations in the `for' initializer. Fixes #32416.
2930 2002-11-24 Martin Baulig <martin@ximian.com>
2932 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
2933 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
2935 2002-11-24 Martin Baulig <martin@ximian.com>
2937 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
2938 argument; if true, we also check for user-defined conversions.
2939 This is only needed if both arguments are of a user-defined type.
2940 Fixes #30443, added test-175.cs.
2941 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
2943 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
2945 2002-11-24 Martin Baulig <martin@ximian.com>
2947 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
2948 function to get the store opcode.
2949 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
2950 only emit the Ldelema if the store opcode is Stobj. You must run
2951 both test-34 and test-167 to test this. Fixes #34529.
2953 2002-11-23 Martin Baulig <martin@ximian.com>
2955 * ecore.cs (Expression.MemberLookup): Added additional
2956 `qualifier_type' argument which is used when we're being called
2957 from MemberAccess.DoResolve() and null if we're called from a
2959 (Expression.MemberLookupFailed): New method to report errors; this
2960 does the CS1540 check and reports the correct error message.
2962 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
2963 argument for the CS1540 check and redone the way how we're dealing
2964 with private members. See the comment in the source code for details.
2965 (FilterWithClosure): Reverted this back to revision 1.197; renamed
2966 `closure_start_type' to `closure_qualifier_type' and check whether
2967 it's not null. It was not this filter being broken, it was just
2968 being called with the wrong arguments.
2970 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
2971 and pass it the correct `qualifier_type'; this also does the error
2974 2002-11-22 Miguel de Icaza <miguel@ximian.com>
2976 * expression.cs (Invocation.EmitParams): If the we are dealing
2977 with a non-built-in value type, load its address as well.
2979 (ArrayCreation): Use a a pretty constant instead
2980 of the hardcoded value 2. Use 6 instead of 2 for the number of
2981 static initializers.
2983 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
2984 because they are not really value types, just glorified integers.
2986 * driver.cs: Do not append .exe, the CSC compiler does not do it.
2988 * ecore.cs: Remove redundant code for enumerations, make them use
2989 the same code path as everything else, fixes the casting issue
2990 with enumerations in Windows.Forms.
2992 * attribute.cs: Do only cast to string if it is a string, the
2993 validation happens later.
2995 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
2996 people upgrade their corlibs.
2998 * ecore.cs: Oops, enumerations were not following the entire code path
3000 2002-11-21 Miguel de Icaza <miguel@ximian.com>
3002 * typemanager.cs (FilterWithClosure): Commented out the test for
3003 1540 in typemanager.cs, as it has problems when accessing
3004 protected methods from a parent class (see test-174.cs).
3006 * attribute.cs (Attribute.ValidateGuid): new method.
3007 (Attribute.Resolve): Use above.
3009 2002-11-19 Miguel de Icaza <miguel@ximian.com>
3011 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
3013 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
3014 handling for enumerations, as we only needed the TypeContainer
3015 functionality to begin with (this is required for the fix below to
3016 work for enums that reference constants in a container class for
3019 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
3021 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
3022 a valid TypeBuilder to perform lookups on.o
3024 * class.cs (InheritableMemberSignatureCompare): Use true in the
3025 call to GetGetMethod and GetSetMethod, because we are comparing
3026 the signature, and we need to get the methods *even* if they are
3029 (PropertyBase.CheckBase): ditto.
3031 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
3032 GotoCase.Resolve): Use Peel on EmpytCasts.
3034 * ecore.cs (EmptyCast): drop child, add Peel method.
3036 2002-11-17 Martin Baulig <martin@ximian.com>
3038 * ecore.cs (EmptyCast.Child): New public property.
3040 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
3041 label resolved to an EmptyCast. Fixes #34162.
3042 (GotoCase.Resolve): Likewise.
3043 (Block.EmitMeta): Likewise.
3045 2002-11-17 Martin Baulig <martin@ximian.com>
3047 * expression.cs (Invocation.BetterConversion): Prefer int over
3048 uint; short over ushort; long over ulong for integer literals.
3049 Use ImplicitConversionExists instead of StandardConversionExists
3050 since we also need to check for user-defined implicit conversions.
3051 Fixes #34165. Added test-173.cs.
3053 2002-11-16 Martin Baulig <martin@ximian.com>
3055 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
3056 with the `true' and `false' literals. Fixes #33151.
3058 2002-11-16 Martin Baulig <martin@ximian.com>
3060 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
3061 October 22nd; don't do the cs1540 check for static members.
3063 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
3064 now using our own filter here and doing the cs1540 check again.
3066 2002-11-16 Martin Baulig <martin@ximian.com>
3068 * support.cs (InternalParameters): Don't crash if we don't have
3069 any fixed parameters. Fixes #33532.
3071 2002-11-16 Martin Baulig <martin@ximian.com>
3073 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
3074 when looking up static methods to make this work on Windows.
3077 2002-11-16 Martin Baulig <martin@ximian.com>
3079 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
3080 a setter rather than using PropertyInfo.CanWrite.
3082 2002-11-15 Nick Drochak <ndrochak@gol.com>
3084 * class.cs: Allow acces to block member by subclasses. Fixes build
3087 2002-11-14 Martin Baulig <martin@ximian.com>
3089 * class.cs (Constructor.Emit): Added the extern/block check.
3092 2002-11-14 Martin Baulig <martin@ximian.com>
3094 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
3095 iteration while looking for indexers, this is needed because the
3096 indexer may have a different name in our base classes. Fixed the
3097 error reporting (no indexers at all, not get accessor, no
3098 overloaded match). Fixes bug #33089.
3099 (IndexerAccess.DoResolveLValue): Likewise.
3101 2002-11-14 Martin Baulig <martin@ximian.com>
3103 * class.cs (PropertyBase.CheckBase): Make this work for multiple
3104 indexers. Fixes the first part of bug #33089.
3105 (MethodSignature.InheritableMemberSignatureCompare): Added support
3108 2002-11-13 Ravi Pratap <ravi@ximian.com>
3110 * attribute.cs (Attribute.Resolve): Catch the
3111 NullReferenceException and report it since it isn't supposed to
3114 2002-11-12 Miguel de Icaza <miguel@ximian.com>
3116 * expression.cs (Binary.EmitBranchable): Also handle the cases for
3117 LogicalOr and LogicalAnd that can benefit from recursively
3118 handling EmitBranchable. The code now should be nice for Paolo.
3120 2002-11-08 Miguel de Icaza <miguel@ximian.com>
3122 * typemanager.cs (LookupType): Added a negative-hit hashtable for
3123 the Type lookups, as we perform quite a number of lookups on
3124 non-Types. This can be removed once we can deterministically tell
3125 whether we have a type or a namespace in advance.
3127 But this might require special hacks from our corlib.
3131 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
3132 and double which avoids a conversion from an integer to a double.
3134 * expression.cs: tiny optimization, avoid calling IsConstant,
3135 because it effectively performs the lookup twice.
3137 2002-11-06 Miguel de Icaza <miguel@ximian.com>
3139 But a bogus return here to keep the semantics of the old code
3140 until the Mono runtime is fixed.
3142 * pending.cs (GetMissingInterfaces): New method used to remove all
3143 the interfaces that are already implemented by our parent
3144 classes from the list of pending methods.
3146 * interface.cs: Add checks for calls after ResolveTypeExpr.
3148 2002-11-05 Miguel de Icaza <miguel@ximian.com>
3150 * class.cs (Class.Emit): Report warning 67: event not used if the
3151 warning level is beyond 3.
3153 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
3154 being a NullLiteral.
3156 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
3159 * class.cs (TypeContainer.GetClassBases): Cover a missing code
3160 path that might fail if a type can not be resolved.
3162 * expression.cs (Binary.Emit): Emit unsigned versions of the
3165 * driver.cs: use error 5.
3167 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
3169 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
3171 2002-11-01 Miguel de Icaza <miguel@ximian.com>
3173 * cs-parser.jay (switch_section): A beautiful patch from Martin
3174 Baulig that fixed 33094.
3176 2002-10-31 Miguel de Icaza <miguel@ximian.com>
3178 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
3179 Check whether the base is abstract and report an error if so.
3181 * expression.cs (IndexerAccess.DoResolveLValue,
3182 IndexerAccess.DoResolve): ditto.
3184 (Invocation.DoResolve): ditto.
3186 (Invocation.FullMethodDesc): Improve the report string.
3188 * statement.cs (Block): Eliminate IsVariableDefined as it is
3189 basically just a wrapper for GetVariableInfo.
3191 * ecore.cs (SimpleName): Use new
3193 * support.cs (ReflectionParamter.ParameterType): We unwrap the
3194 type, as we return the actual parameter ref/unref state on a
3197 2002-10-30 Miguel de Icaza <miguel@ximian.com>
3199 * support.cs: Return proper flags REF/OUT fixing the previous
3202 * expression.cs: Reverted last patch, that was wrong. Is_ref is
3203 not used to mean `ref' but `ref or out' in ParameterReference
3205 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
3206 full type signature instead of calling TypeManger.CSharpName
3209 * support.cs (InternalParameters.ParameterDesc): Do not compare
3210 directly to the modflags, because REF/OUT will actually be bitsets
3213 * delegate.cs (VerifyMethod): Check also the modifiers.
3215 * cs-tokenizer.cs: Fix bug where floating point values with an
3216 exponent where a sign was missing was ignored.
3218 * driver.cs: Allow multiple assemblies to be specified in a single
3221 2002-10-28 Miguel de Icaza <miguel@ximian.com>
3223 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
3224 because identifiers after a parenthesis would end up in this kind
3225 of production, and we needed to desamiguate it for having casts
3228 (UserDefinedType *) xxx
3230 2002-10-24 Miguel de Icaza <miguel@ximian.com>
3232 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
3233 we should set on the Bindingflags.NonPublic, but not turn on
3234 private_ok. private_ok controls whether a Private member is
3235 returned (this is chekced on the filter routine), while the
3236 BindingFlags.NonPublic just controls whether private/protected
3237 will be allowed. This fixes the problem part of the problem of
3238 private properties being allowed to be used in derived classes.
3240 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
3241 so we can call the children DoResolveLValue method (this will
3242 properly signal errors on lvalue assignments to base properties)
3244 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
3245 getter are null, and we have a property info, we know that this
3246 happened because the lookup failed, so we report an error 122 for
3247 protection level violation.
3249 We also silently return if setter and getter are null in the
3250 resolve functions, this condition only happens if we have flagged
3251 the error before. This is the other half of the problem.
3253 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
3254 not have accessibility information, that is why we were returning
3255 true in the filter function in typemanager.cs.
3257 To properly report 122 (property is inaccessible because of its
3258 protection level) correctly, we report this error in ResolveAccess
3259 by failing if both the setter and the getter are lacking (ie, the
3262 DoResolve and DoLResolve have been modified to check for both
3263 setter/getter being null and returning silently, the reason being
3264 that I did not want to put the knowledge about this error in upper
3267 int old = Report.Errors;
3268 x = new PropertyExpr (...);
3269 if (old != Report.Errors)
3274 So the property expr is returned, but it is invalid, so the error
3275 will be flagged during the resolve process.
3277 * class.cs: Remove InheritablePropertySignatureCompare from the
3278 class, as we no longer depend on the property signature to compute
3279 whether it is possible to implement a method or not.
3281 The reason is that calling PropertyInfo.GetGetMethod will return
3282 null (in .NET, in Mono it works, and we should change this), in
3283 cases where the Get Method does not exist in that particular
3288 class X { public virtual int A { get { return 1; } } }
3290 class Z : Y { public override int A { get { return 2; } } }
3292 Would fail in Z because the parent (Y) would not have the property
3293 defined. So we avoid this completely now (because the alternative
3294 fix was ugly and slow), and we now depend exclusively on the
3297 (PropertyBase.CheckBase): Use a method-base mechanism to find our
3298 reference method, instead of using the property.
3300 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
3301 routines are gone now.
3303 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
3304 names, they were incorrectly named.
3306 * cs-tokenizer.cs: Return are more gentle token on failure.
3308 * pending.cs (PendingImplementation.InterfaceMethod): This routine
3309 had an out-of-sync index variable, which caused it to remove from
3310 the list of pending methods the wrong method sometimes.
3312 2002-10-22 Miguel de Icaza <miguel@ximian.com>
3314 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
3315 CanWrite, because those refer to this particular instance of the
3316 property, and do not take into account the fact that we can
3317 override single members of a property.
3319 Constructor requires an EmitContext. The resolution process does
3320 not happen here, but we need to compute the accessors before,
3321 because the resolution does not always happen for properties.
3323 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
3324 subclass, before we did not update this flag, but we did update
3327 (GetAccessors): Drop this routine, as it did not work in the
3328 presence of partially overwritten set/get methods.
3330 Notice that this broke the cs1540 detection, but that will require
3333 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3337 * driver.cs: issue a warning instead of an error if we don't support
3338 debugging for the platform. Also ignore a couple of errors that may
3339 arise when trying to write the symbols. Undo my previous patch.
3341 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3343 * driver.cs: ignore /debug switch except for Unix platforms.
3345 2002-10-23 Nick Drochak <ndrochak@gol.com>
3347 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
3349 2002-10-21 Miguel de Icaza <miguel@ximian.com>
3351 * driver.cs: Do not make mcs-debug conditional, so we do not break
3354 * statement.cs (UsageVector.MergeChildren): I would like Martin to
3355 review this patch. But basically after all the children variables
3356 have been merged, the value of "Breaks" was not being set to
3357 new_breaks for Switch blocks. I think that it should be set after
3358 it has executed. Currently I set this to the value of new_breaks,
3359 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
3360 conservative, but I do not understand this code very well.
3362 I did not break anything in the build, so that is good ;-)
3364 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
3366 2002-10-20 Mark Crichton <crichton@gimp.org>
3368 * cfold.cs: Fixed compile blocker. Really fixed it this time.
3370 2002-10-20 Nick Drochak <ndrochak@gol.com>
3372 * cfold.cs: Fixed compile blocker.
3374 2002-10-20 Miguel de Icaza <miguel@ximian.com>
3376 * driver.cs: I was chekcing the key, not the file.
3378 2002-10-19 Ravi Pratap <ravi@ximian.com>
3380 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
3381 message that we were generating - we just need to silently return
3384 2002-10-19 Miguel de Icaza <miguel@ximian.com>
3386 * class.cs (Event.Define): Change my previous commit, as this
3387 breaks the debugger. This is a temporary hack, as it seems like
3388 the compiler is generating events incorrectly to begin with.
3390 * expression.cs (Binary.ResolveOperator): Added support for
3391 "U operator - (E x, E y)"
3393 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
3396 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
3397 init-only variables, but this path did not take into account that
3398 there might be also instance readonly variables. Correct this
3401 This fixes bug 32253
3403 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
3406 * driver.cs: Change the extension for modules to `netmodule'
3408 * cs-parser.jay: Improved slightly the location tracking for
3409 the debugger symbols.
3411 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
3412 modifiers that were specified instead of the hardcoded value
3413 (FamAndAssem). This was basically ignoring the static modifier,
3414 and others. Fixes 32429.
3416 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
3417 fixed a bug in the process (32476)
3419 * expression.cs (ArrayAccess.EmitAssign): Patch from
3420 hwang_rob@yahoo.ca that fixes bug 31834.3
3422 2002-10-18 Miguel de Icaza <miguel@ximian.com>
3424 * driver.cs: Make the module extension .netmodule.
3426 2002-10-16 Miguel de Icaza <miguel@ximian.com>
3428 * driver.cs: Report an error if the resource file is not found
3429 instead of crashing.
3431 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
3432 false, like Emit does.
3434 2002-10-16 Nick Drochak <ndrochak@gol.com>
3436 * typemanager.cs: Remove unused private member. Also reported mcs
3437 bug to report this as a warning like csc.
3439 2002-10-15 Martin Baulig <martin@gnome.org>
3441 * statement.cs (Statement.Emit): Made this a virtual method; emits
3442 the line number info and calls DoEmit().
3443 (Statement.DoEmit): New protected abstract method, formerly knows
3444 as Statement.Emit().
3446 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
3448 2002-10-11 Miguel de Icaza <miguel@ximian.com>
3450 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
3451 have fixed a remaining problem: not every AddXXXX was adding a
3452 fully qualified name.
3454 Now everyone registers a fully qualified name in the DeclSpace as
3455 being defined instead of the partial name.
3457 Downsides: we are slower than we need to be due to the excess
3458 copies and the names being registered this way.
3460 The reason for this is that we currently depend (on the corlib
3461 bootstrap for instance) that types are fully qualified, because
3462 we dump all the types in the namespace, and we should really have
3463 types inserted into the proper namespace, so we can only store the
3464 basenames in the defined_names array.
3466 2002-10-10 Martin Baulig <martin@gnome.org>
3468 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
3469 from bug #31834, see the bug report for a testcase which is
3472 2002-10-10 Martin Baulig <martin@gnome.org>
3474 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
3475 flow analysis code for this.
3477 * statement.cs (Do, While, For): Tell the flow analysis code about
3479 (FlowBranching.UsageVector): Added support for infinite loops.
3480 (Block.Resolve): Moved the dead code elimination here and use flow
3483 2002-10-09 Miguel de Icaza <miguel@ximian.com>
3485 * class.cs (Field.Define): Catch cycles on struct type
3488 * typemanager.cs (IsUnmanagedtype): Do not recursively check
3489 fields if the fields are static. We only need to check instance
3492 * expression.cs (As.DoResolve): Test for reference type.
3494 * statement.cs (Using.ResolveExpression): Use
3495 ConvertImplicitRequired, not ConvertImplicit which reports an
3497 (Using.ResolveLocalVariableDecls): ditto.
3499 * expression.cs (Binary.ResolveOperator): Report errors in a few
3500 places where we had to.
3502 * typemanager.cs (IsUnmanagedtype): Finish implementation.
3504 2002-10-08 Miguel de Icaza <miguel@ximian.com>
3506 * expression.cs: Use StoreFromPtr instead of extracting the type
3507 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
3509 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
3510 an enumeration value to a System.Enum, but System.Enum is not a
3511 value type, but an class type, so we need to box.
3513 (Expression.ConvertExplicit): One codepath could return
3514 errors but not flag them. Fix this. Fixes #31853
3516 * parameter.cs (Resolve): Do not allow void as a parameter type.
3518 2002-10-06 Martin Baulig <martin@gnome.org>
3520 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
3521 if it's a class type and not a struct. Fixes #31815.
3523 2002-10-06 Martin Baulig <martin@gnome.org>
3525 * statement.cs: Reworked the flow analysis code a bit to make it
3526 usable for dead code elimination.
3528 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3530 * cs-parser.jay: allow empty source files. Fixes bug #31781.
3532 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3534 * expression.cs (ComposedCast.DoResolveType): A quick workaround
3535 to fix the test 165, will investigate deeper.
3537 2002-10-04 Martin Baulig <martin@gnome.org>
3539 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
3540 finally blocks actually work.
3541 (Try.Resolve): We don't need to create a sibling for `finally' if
3542 there is no finally block.
3544 2002-10-04 Martin Baulig <martin@gnome.org>
3546 * class.cs (Constructor.Define): The default accessibility for a
3547 non-default constructor is private, not public.
3549 2002-10-04 Miguel de Icaza <miguel@ximian.com>
3551 * class.cs (Constructor): Make AllowedModifiers public, add
3554 * cs-parser.jay: Perform the modifiers test here, as the
3555 constructor for the Constructor class usually receives a zero
3556 because of the way we create it (first we create, later we
3557 customize, and we were never checking the modifiers).
3559 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
3560 is a version of LookupTypeReflection that includes the type-name
3561 cache. This can be used as a fast path for functions that know
3562 the fully qualified name and are only calling into *.GetType() to
3563 obtain a composed type.
3565 This is also used by TypeManager.LookupType during its type
3568 (LookupType): We now also track the real type name, as sometimes
3569 we can get a quey for the real type name from things like
3570 ComposedCast. This fixes bug 31422.
3572 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
3573 complete type fullname, it does not have to go through the type
3574 resolution system to obtain the composed version of the type (for
3575 obtaining arrays or pointers).
3577 (Conditional.Emit): Use the EmitBoolExpression to
3578 generate nicer code, as requested by Paolo.
3580 (ArrayCreation.CheckIndices): Use the patch from
3581 hwang_rob@yahoo.ca to validate the array initializers.
3583 2002-10-03 Miguel de Icaza <miguel@ximian.com>
3585 * class.cs (ConstructorInitializer.Emit): simplify code by using
3586 Invocation.EmitCall, and at the same time, fix the bugs in calling
3587 parent constructors that took variable arguments.
3589 * ecore.cs (Expression.ConvertNumericExplicit,
3590 Expression.ImplicitNumericConversion): Remove the code that
3591 manually wrapped decimal (InternalTypeConstructor call is now gone
3594 * expression.cs (Cast.TryReduce): Also handle decimal types when
3595 trying to perform a constant fold on the type.
3597 * typemanager.cs (IsUnmanagedtype): Partially implemented.
3599 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
3600 that only turned off an error report, and did nothing else.
3602 2002-10-02 Miguel de Icaza <miguel@ximian.com>
3604 * driver.cs: Handle and ignore /fullpaths
3606 2002-10-01 Miguel de Icaza <miguel@ximian.com>
3608 * expression.cs (Binary.ResolveOperator): Catch the case where
3609 DoNumericPromotions returns true,
3611 (Binary.DoNumericPromotions): Simplify the code, and the tests.
3613 2002-09-27 Miguel de Icaza <miguel@ximian.com>
3615 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
3618 2002-09-26 Miguel de Icaza <miguel@ximian.com>
3620 * ecore.cs (ConvertNumericExplicit): It is not enough that the
3621 conversion exists, but it is also required that the conversion be
3622 performed. This manifested in "(Type64Enum) 2".
3624 * class.cs (TypeManager.AddMethod): The fix is not to change
3625 AddEnum, because that one was using a fully qualified name (every
3626 DeclSpace derivative does), but to change the AddMethod routine
3627 that was using an un-namespaced name. This now correctly reports
3628 the duplicated name.
3630 Revert patch until I can properly fix it. The issue
3631 is that we have a shared Type space across all namespaces
3632 currently, which is wrong.
3634 Options include making the Namespace a DeclSpace, and merge
3635 current_namespace/current_container in the parser.
3637 2002-09-25 Miguel de Icaza <miguel@ximian.com>
3639 * cs-parser.jay: Improve error reporting when we get a different
3640 kind of expression in local_variable_type and
3641 local_variable_pointer_type.
3643 Propagate this to avoid missleading errors being reported.
3645 * ecore.cs (ImplicitReferenceConversion): treat
3646 TypeManager.value_type as a target just like object_type. As
3651 Is valid, and needs to result in the int 1 being boxed before it
3652 is assigned to the value type v.
3654 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
3655 to validate the enumeration name.
3657 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
3658 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
3659 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
3661 * ecore.cs (TryImplicitIntConversion): When doing an
3662 implicit-enumeration-conversion, check if the type is 64-bits and
3663 perform a conversion before passing to EnumConstant.
3665 2002-09-23 Miguel de Icaza <miguel@ximian.com>
3667 * decl.cs (Error_AmbiguousTypeReference); New routine used to
3668 report ambiguous type references. Unlike the MS version, we
3669 report what the ambiguity is. Innovation at work ;-)
3671 (DeclSpace.FindType): Require a location argument to
3672 display when we display an ambiguous error.
3674 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
3676 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
3678 * expression.cs (EmitDynamicInitializers): Apply patch from
3679 hwang_rob@yahoo.ca that fixes the order in which we emit our
3682 2002-09-21 Martin Baulig <martin@gnome.org>
3684 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
3685 delegate takes no arguments.
3687 2002-09-20 Miguel de Icaza <miguel@ximian.com>
3689 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
3692 * expression.cs: Extract the underlying type.
3694 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
3696 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
3698 2002-09-19 Miguel de Icaza <miguel@ximian.com>
3700 * class.cs (TypeContainer.DefineType): We can not use the nice
3701 PackingSize with the size set to 1 DefineType method, because it
3702 will not allow us to define the interfaces that the struct
3705 This completes the fixing of bug 27287
3707 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
3708 means also structs. This fixes part of the problem.
3709 (Expresion.ImplicitReferenceConversionExists): ditto.
3711 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
3712 error if there were no errors reported during the type lookup
3713 process, to avoid duplicates or redundant errors. Without this
3714 you would get an ambiguous errors plus a type not found. We have
3715 beaten the user enough with the first error.
3717 (DeclSparce.FindType): Emit a warning if we have an ambiguous
3720 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
3721 during the resolution process, stop the lookup, this avoids
3722 repeated error reports (same error twice).
3724 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
3726 * typemanager.cs (LookupType): Redo the type lookup code to match
3727 the needs of System.Reflection.
3729 The issue is that System.Reflection requires references to nested
3730 types to begin with a "+" sign instead of a dot. So toplevel
3731 types look like: "NameSpace.TopLevelClass", and nested ones look
3732 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
3735 2002-09-19 Martin Baulig <martin@gnome.org>
3737 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
3738 says that a method always returns or always throws an exception,
3739 don't report the CS0161.
3741 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
3742 set `Returns = new_returns'.
3744 2002-09-19 Martin Baulig <martin@gnome.org>
3746 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
3747 to an enum constant, check for a CS0176.
3749 2002-09-18 Miguel de Icaza <miguel@ximian.com>
3751 * class.cs (TypeContainer.CheckPairedOperators): Now we check
3752 for operators that must be in pairs and report errors.
3754 * ecore.cs (SimpleName.DoResolveType): During the initial type
3755 resolution process, when we define types recursively, we must
3756 check first for types in our current scope before we perform
3757 lookups in the enclosing scopes.
3759 * expression.cs (MakeByteBlob): Handle Decimal blobs.
3761 (Invocation.VerifyArgumentsCompat): Call
3762 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
3763 I thought we were supposed to always call this, but there are a
3764 few places in the code where we dont do it.
3766 2002-09-17 Miguel de Icaza <miguel@ximian.com>
3768 * driver.cs: Add support in -linkres and -resource to specify the
3769 name of the identifier.
3771 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3773 * ecore.cs (StandardConversionExists): Sync with the conversion
3774 code: allow anything-* to void* conversions.
3776 (FindMostSpecificSource): Use an Expression argument
3777 instead of a Type, because we might be handed over a Literal which
3778 gets a few more implicit conversions that plain types do not. So
3779 this information was being lost.
3781 Also, we drop the temporary type-holder expression when not
3784 2002-09-17 Martin Baulig <martin@gnome.org>
3786 * class.cs (PropertyBase.CheckBase): Don't check the base class if
3787 this is an explicit interface implementation.
3789 2002-09-17 Martin Baulig <martin@gnome.org>
3791 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
3792 different `IndexerName' attributes.
3794 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
3795 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
3796 virtual CommonResolve().
3798 2002-09-16 Miguel de Icaza <miguel@ximian.com>
3800 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
3801 and convert that to the UnderlyingType.
3803 * statement.cs (Foreach.Resolve): Indexers are just like variables
3804 or PropertyAccesses.
3806 * cs-tokenizer.cs (consume_string): Track line numbers and columns
3807 inside quoted strings, we were not doing this before.
3809 2002-09-16 Martin Baulig <martin@gnome.org>
3811 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
3812 resolve it. This is needed for the definite assignment check of the
3813 instance expression, fixes bug #29846.
3814 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
3816 2002-09-16 Nick Drochak <ndrochak@gol.com>
3818 * parameter.cs: Fix compile error. Cannot reference static member
3819 from an instance object. Is this an mcs bug?
3821 2002-09-14 Martin Baulig <martin@gnome.org>
3823 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
3824 multiple times. Fixes bug #30295, added test-166.cs.
3826 2002-09-14 Martin Baulig <martin@gnome.org>
3828 * statement.cs (Block.Emit): Don't emit unreachable code.
3829 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
3831 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
3833 2002-09-14 Martin Baulig <martin@gnome.org>
3835 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
3838 2002-09-14 Martin Baulig <martin@gnome.org>
3840 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
3841 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
3842 be false on the ms runtime.
3844 2002-09-13 Martin Baulig <martin@gnome.org>
3846 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
3847 the CS0038 error message.
3849 2002-09-12 Miguel de Icaza <miguel@ximian.com>
3851 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
3852 constant inside, return it.
3854 2002-09-12 Martin Baulig <martin@gnome.org>
3856 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
3857 implicit conversion can be done between enum types.
3859 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
3860 check whether an implicit conversion to the current enum's UnderlyingType
3861 exists and report an error if not.
3863 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
3864 without debugging support.
3866 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
3867 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
3869 2002-09-12 Martin Baulig <martin@gnome.org>
3871 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
3873 * ecore.cs (IMemberExpr.DeclaringType): New property.
3874 (SimpleName.SimpleNameResolve): Check whether we're accessing a
3875 nonstatic member of an outer type (CS0038).
3877 2002-09-11 Miguel de Icaza <miguel@ximian.com>
3879 * driver.cs: Activate the using-error detector at warning level
3880 4 (at least for MS-compatible APIs).
3882 * namespace.cs (VerifyUsing): Small buglett fix.
3884 * pending.cs (PendingImplementation): pass the container pointer.
3886 * interface.cs (GetMethods): Allow for recursive definition. Long
3887 term, I would like to move every type to support recursive
3888 definitions, not the current ordering mechanism that we have right
3891 The situation is this: Attributes are handled before interfaces,
3892 so we can apply attributes to interfaces. But some attributes
3893 implement interfaces, we will now handle the simple cases
3894 (recursive definitions will just get an error).
3896 * parameter.cs: Only invalidate types at the end if we fail to
3899 2002-09-09 Martin Baulig <martin@gnome.org>
3901 * ecore.cs (PropertyExpr.Emit): Also check for
3902 TypeManager.system_int_array_get_length so this'll also work when
3903 compiling corlib. Fixes #30003.
3905 2002-09-09 Martin Baulig <martin@gnome.org>
3907 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
3908 and throw an exception if we can't get the type's size. Fixed #30040,
3911 2002-09-09 Martin Baulig <martin@gnome.org>
3913 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
3915 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
3916 context. Fixes bug #30027.
3918 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
3919 virtual functions. Fixes bug #30043, added test-164.cs.
3921 2002-09-08 Ravi Pratap <ravi@ximian.com>
3923 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
3925 2002-09-08 Nick Drochak <ndrochak@gol.com>
3927 * driver.cs: Use an object to get the windows codepage since it's not a
3930 2002-09-08 Miguel de Icaza <miguel@ximian.com>
3932 * statement.cs (For.Emit): for infinite loops (test == null)
3933 return whether there is a break inside, not always "true".
3935 * namespace.cs (UsingEntry): New struct to hold the name of the
3936 using definition, the location where it is defined, and whether it
3937 has been used in a successful type lookup.
3939 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
3944 2002-09-06 Ravi Pratap <ravi@ximian.com>
3946 * attribute.cs : Fix incorrect code which relied on catching
3947 a NullReferenceException to detect a null being passed in
3948 where an object was expected.
3950 2002-09-06 Miguel de Icaza <miguel@ximian.com>
3952 * statement.cs (Try): flag the catch variable as assigned
3954 * expression.cs (Cast): Simplified by using ResolveType instead of
3957 * statement.cs (Catch): Fix bug by using ResolveType.
3959 2002-09-06 Ravi Pratap <ravi@ximian.com>
3961 * expression.cs (BetterConversion): Special case for when we have
3962 a NullLiteral as the argument and we have to choose between string
3963 and object types - we choose string the way csc does.
3965 * attribute.cs (Attribute.Resolve): Catch the
3966 NullReferenceException and report error #182 since the Mono
3967 runtime no more has the bug and having this exception raised means
3968 we tried to select a constructor which takes an object and is
3971 2002-09-05 Ravi Pratap <ravi@ximian.com>
3973 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
3974 message (1502, 1503) when we can't locate a method after overload
3975 resolution. This is much more informative and closes the bug
3978 * interface.cs (PopulateMethod): Return if there are no argument
3979 types. Fixes a NullReferenceException bug.
3981 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
3982 expressions too. Previously we were checking only in one place for
3983 positional arguments leaving out named arguments.
3985 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
3986 type to the enum type is not allowed. Remove code corresponding to
3989 (ConvertNumericExplicit): Allow explicit conversions from
3990 the underlying type to enum type. This precisely follows the spec
3991 and closes a bug filed by Gonzalo.
3993 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3996 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
3998 2002-09-03 Miguel de Icaza <miguel@ximian.com>
4000 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
4001 it was important that we stored the right value after the
4002 reduction in `converted'.
4004 2002-09-04 Martin Baulig <martin@gnome.org>
4006 * location.cs (Location.SymbolDocument): Use full pathnames for the
4009 2002-08-30 Miguel de Icaza <miguel@ximian.com>
4011 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
4012 of the expression resolve mechanism, because that will catch the
4013 SimpleName error failures.
4015 (Conditional): If we can not resolve the
4016 expression, return, do not crash.
4018 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4021 (location): display token name instead of its number.
4023 2002-08-28 Martin Baulig <martin@gnome.org>
4025 * expression.cs (Binary.ResolveOperator): Don't silently return
4026 but return an error if an operator cannot be applied between two
4029 2002-08-28 Martin Baulig <martin@gnome.org>
4031 * class.cs (Constructor.Define): Set the permission attributes
4032 correctly instead of making all constructors public.
4034 2002-08-28 Martin Baulig <martin@gnome.org>
4036 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
4037 for private members before reporting a CS0103; if we find anything,
4040 2002-08-28 Martin Baulig <martin@gnome.org>
4042 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
4043 to check whether `closure_start_type == closure_invocation_type',
4044 we also need to check whether `m.DeclaringType == closure_invocation_type'
4045 before bypassing the permission checks. We might be accessing
4046 protected/private members from the base class.
4047 (TypeManager.RealMemberLookup): Only set private_ok if private
4048 members were requested via BindingFlags.NonPublic.
4050 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
4052 * expression.cs (MemberAccess.ResolveMemberAccess): Set
4053 MethodGroupExpr.IsExplicitImpl if appropriate.
4054 (Invocation.DoResolve): Don't report the CS0120 for explicit
4055 interface implementations.
4057 2002-08-27 Martin Baulig <martin@gnome.org>
4059 * expression.cs (Invocation.DoResolve): If this is a static
4060 method and we don't have an InstanceExpression, we must report
4063 2002-08-25 Martin Baulig <martin@gnome.org>
4065 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
4066 `==' between a valuetype and an object.
4068 2002-08-25 Miguel de Icaza <miguel@ximian.com>
4070 * ecore.cs (TypeExpr): Provide a ToString method.
4072 2002-08-24 Martin Baulig <martin@gnome.org>
4074 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
4075 now called proggie.dbg and it's a binary file.
4077 2002-08-23 Martin Baulig <martin@gnome.org>
4079 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
4081 2002-08-23 Martin Baulig <martin@gnome.org>
4083 * struct.cs (MyStructInfo.ctor): Make this work with empty
4084 structs; it's not allowed to use foreach() on null.
4086 2002-08-23 Martin Baulig <martin@gnome.org>
4088 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
4089 writer the full pathname of the generated assembly.
4091 2002-08-23 Martin Baulig <martin@gnome.org>
4093 * statements.cs (FlowBranching.UsageVector.MergeChildren):
4094 A `finally' block never returns or breaks; improved handling of
4097 2002-08-23 Martin Baulig <martin@gnome.org>
4099 * statement.cs (Throw.Resolve): Allow `throw null'.
4101 2002-08-23 Martin Baulig <martin@gnome.org>
4103 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
4104 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
4105 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
4106 MemberLookup would return a wrong event if this is an explicit
4107 interface implementation and the class has an event with the same
4110 2002-08-23 Martin Baulig <martin@gnome.org>
4112 * statement.cs (Block.AddChildVariableNames): New public method.
4113 (Block.AddChildVariableName): Likewise.
4114 (Block.IsVariableNameUsedInChildBlock): Likewise.
4115 (Block.AddVariable): Check whether a variable name has already
4116 been used in a child block.
4118 * cs-parser.jay (declare_local_variables): Mark all variable names
4119 from the current block as being used in a child block in the
4122 2002-08-23 Martin Baulig <martin@gnome.org>
4124 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
4125 find the symbol writer.
4127 * driver.cs: csc also allows the arguments to /define being
4128 separated by commas, not only by semicolons.
4130 2002-08-23 Martin Baulig <martin@gnome.org>
4132 * interface.cs (Interface.GetMembers): Added static check for events.
4134 2002-08-15 Martin Baulig <martin@gnome.org>
4136 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
4137 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
4139 * ecore.cs (Expression.MemberLookup): Added documentation and explained
4140 why the MethodData.EmitDestructor() change was necessary.
4142 2002-08-20 Martin Baulig <martin@gnome.org>
4144 * class.cs (TypeContainer.FindMembers): Added static check for events.
4146 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
4148 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
4149 use Type.GetEvents(), not Type.FindMembers().
4151 2002-08-20 Martin Baulig <martin@gnome.org>
4153 * decl.cs (MemberCache): Added a special method cache which will
4154 be used for method-only searched. This ensures that a method
4155 search will return a MethodInfo with the correct ReflectedType for
4158 2002-08-20 Martin Baulig <martin@gnome.org>
4160 * decl.cs (DeclSpace.FindMembers): Made this public.
4162 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4164 * delegate.cs: fixed build on windows.
4165 [FIXME: Filed as bug #29150: MCS must report these errors.]
4167 2002-08-19 Ravi Pratap <ravi@ximian.com>
4169 * ecore.cs (StandardConversionExists): Return a false
4170 if we are trying to convert the void type to anything else
4171 since that is not allowed.
4173 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
4174 we flag error 70 in the event an event is trying to be accessed
4175 directly from outside the declaring type.
4177 2002-08-20 Martin Baulig <martin@gnome.org>
4179 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
4180 MemberCache from typemanager.cs to decl.cs.
4182 2002-08-19 Martin Baulig <martin@gnome.org>
4184 * class.cs (TypeContainer): Implement IMemberContainer.
4185 (TypeContainer.DefineMembers): Create the MemberCache.
4186 (TypeContainer.FindMembers): Do better BindingFlags checking; only
4187 return public members if BindingFlags.Public was given, check
4188 whether members are static.
4190 2002-08-16 Martin Baulig <martin@gnome.org>
4192 * decl.cs (DeclSpace.Define): Splitted this in Define and
4193 DefineMembers. DefineMembers is called first and initializes the
4196 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
4197 DefineMembers() on all our DeclSpaces.
4199 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
4200 but call DefineMembers() on all nested interfaces. We call their
4201 Define() in our new Define() function.
4203 * interface.cs (Interface): Implement IMemberContainer.
4204 (Interface.Define): Moved all code except the attribute stuf to
4206 (Interface.DefineMembers): Initialize the member cache.
4208 * typemanager.cs (IMemberFinder): Removed this interface, we don't
4209 need this anymore since we can use MemberCache.FindMembers directly.
4211 2002-08-19 Martin Baulig <martin@gnome.org>
4213 * typemanager.cs (MemberCache): When creating the cache for an
4214 interface type, add all inherited members.
4215 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
4216 to `out bool used_cache' and documented it.
4217 (TypeManager.MemberLookup): If we already used the cache in the first
4218 iteration, we don't need to do the interfaces check.
4220 2002-08-19 Martin Baulig <martin@gnome.org>
4222 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
4223 here from IMemberFinder and don't implement this interface anymore.
4224 (DeclSpace.MemberCache): Moved here from IMemberFinder.
4226 * typemanager.cs (IMemberFinder): This interface is now only used by
4227 classes which actually support the member cache.
4228 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
4229 since we only put DeclSpaces into this Hashtable.
4230 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
4231 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
4233 2002-08-16 Martin Baulig <martin@gnome.org>
4235 * typemanager.cs (ICachingMemberFinder): Removed.
4236 (IMemberFinder.MemberCache): New property.
4237 (TypeManager.FindMembers): Merged this with RealFindMembers().
4238 This function will never be called from TypeManager.MemberLookup()
4239 so we can't use the cache here, just the IMemberFinder.
4240 (TypeManager.MemberLookup_FindMembers): Check whether the
4241 IMemberFinder has a MemberCache and call the cache's FindMembers
4243 (MemberCache): Rewrote larger parts of this yet another time and
4244 cleaned it up a bit.
4246 2002-08-15 Miguel de Icaza <miguel@ximian.com>
4248 * driver.cs (LoadArgs): Support quoting.
4250 (Usage): Show the CSC-like command line arguments.
4252 Improved a few error messages.
4254 2002-08-15 Martin Baulig <martin@gnome.org>
4256 * typemanager.cs (IMemberContainer.Type): New property.
4257 (IMemberContainer.IsInterface): New property.
4259 The following changes are conditional to BROKEN_RUNTIME, which is
4260 defined at the top of the file.
4262 * typemanager.cs (MemberCache.MemberCache): Don't add the base
4263 class'es members, but add all members from TypeHandle.ObjectType
4264 if we're an interface.
4265 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
4266 is the current type.
4267 (MemberCache.CacheEntry.Container): Removed this field.
4268 (TypeHandle.GetMembers): Include inherited members.
4270 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4272 * typemanager.cs: fixed compilation and added a comment on a field that
4275 2002-08-15 Martin Baulig <martin@gnome.org>
4277 * class.cs (ConstructorInitializer.Resolve): In the
4278 Expression.MemberLookup call, use the queried_type as
4281 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
4282 declared' attribute, it's always true.
4283 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
4284 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
4285 temporary wrapper for FindMembers which tells MemberLookup whether
4286 members from the base classes are included in the return value.
4287 This will go away soon.
4288 (TypeManager.MemberLookup): Use this temporary hack here; once the
4289 new MemberCache is completed, we don't need to do the DeclaredOnly
4290 looping here anymore since the MemberCache will take care of this.
4291 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
4292 (MemberCache): When creating the MemberCache for a class, get
4293 members from the current class and all its base classes.
4294 (MemberCache.CacheEntry.Container): New field. This is a
4295 temporary hack until the Mono runtime is fixed to distinguish
4296 between ReflectedType and DeclaringType. It allows us to use MCS
4297 with both the MS runtime and the unfixed Mono runtime without
4298 problems and without accecting performance.
4299 (MemberCache.SearchMembers): The DeclaredOnly looping from
4300 TypeManager.MemberLookup is now done here.
4302 2002-08-14 Martin Baulig <martin@gnome.org>
4304 * statement.cs (MyStructInfo.MyStructInfo): Don't call
4305 Type.GetFields on dynamic types but get the fields from the
4306 corresponding TypeContainer.
4307 (MyStructInfo.GetStructInfo): Added check for enum types.
4309 * typemanager.cs (MemberList.IsSynchronized): Implemented.
4310 (MemberList.SyncRoot): Implemented.
4311 (TypeManager.FilterWithClosure): No need to check permissions if
4312 closure_start_type == closure_invocation_type, don't crash if
4313 closure_invocation_type is null.
4315 2002-08-13 Martin Baulig <martin@gnome.org>
4317 Rewrote TypeContainer.FindMembers to use a member cache. This
4318 gives us a speed increase of about 35% for the self-hosting MCS
4319 build and of about 15-20% for the class libs (both on GNU/Linux).
4321 * report.cs (Timer): New class to get enhanced profiling. This
4322 whole class is "TIMER" conditional since it remarkably slows down
4325 * class.cs (MemberList): New class. This is an IList wrapper
4326 which we're now using instead of passing MemberInfo[]'s around to
4327 avoid copying this array unnecessarily.
4328 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
4329 (ICachingMemberFinder, IMemberContainer): New interface.
4330 (TypeManager.FilterWithClosure): If `criteria' is null, the name
4331 has already been checked, otherwise use it for the name comparision.
4332 (TypeManager.FindMembers): Renamed to RealMemberFinder and
4333 provided wrapper which tries to use ICachingMemberFinder.FindMembers
4334 if possible. Returns a MemberList, not a MemberInfo [].
4335 (TypeHandle): New class, implements IMemberContainer. We create
4336 one instance of this class per type, it contains a MemberCache
4337 which is used to do the member lookups.
4338 (MemberCache): New class. Each instance of this class contains
4339 all members of a type and a name-based hash table.
4340 (MemberCache.FindMembers): This is our new member lookup
4341 function. First, it looks up all members of the requested name in
4342 the hash table. Then, it walks this list and sorts out all
4343 applicable members and returns them.
4345 2002-08-13 Martin Baulig <martin@gnome.org>
4347 In addition to a nice code cleanup, this gives us a performance
4348 increase of about 1.4% on GNU/Linux - not much, but it's already
4349 half a second for the self-hosting MCS compilation.
4351 * typemanager.cs (IMemberFinder): New interface. It is used by
4352 TypeManager.FindMembers to call FindMembers on a TypeContainer,
4353 Enum, Delegate or Interface.
4354 (TypeManager.finder_to_member_finder): New PtrHashtable.
4355 (TypeManager.finder_to_container): Removed.
4356 (TypeManager.finder_to_delegate): Removed.
4357 (TypeManager.finder_to_interface): Removed.
4358 (TypeManager.finder_to_enum): Removed.
4360 * interface.cs (Interface): Implement IMemberFinder.
4362 * delegate.cs (Delegate): Implement IMemberFinder.
4364 * enum.cs (Enum): Implement IMemberFinder.
4366 * class.cs (TypeContainer): Implement IMemberFinder.
4368 2002-08-12 Martin Baulig <martin@gnome.org>
4370 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
4372 2002-08-12 Martin Baulig <martin@gnome.org>
4374 * ecore.cs (ITypeExpression): New interface for expressions which
4376 (TypeExpression): Renamed to TypeLookupExpression.
4377 (Expression.DoResolve): If we're doing a types-only lookup, the
4378 expression must implement the ITypeExpression interface and we
4379 call DoResolveType() on it.
4380 (SimpleName): Implement the new ITypeExpression interface.
4381 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
4382 hack, the situation that we're only looking up types can't happen
4383 anymore when this method is called. Moved the type lookup code to
4384 DoResolveType() and call it.
4385 (SimpleName.DoResolveType): This ITypeExpression interface method
4386 is now doing the types-only lookup.
4387 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
4388 (ResolveFlags): Added MaskExprClass.
4390 * expression.cs (MemberAccess): Implement the ITypeExpression
4392 (MemberAccess.DoResolve): Added support for a types-only lookup
4393 when we're called via ITypeExpression.DoResolveType().
4394 (ComposedCast): Implement the ITypeExpression interface.
4396 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
4397 Expression.Resolve() with ResolveFlags.Type instead.
4399 2002-08-12 Martin Baulig <martin@gnome.org>
4401 * interface.cs (Interface.Define): Apply attributes.
4403 * attribute.cs (Attribute.ApplyAttributes): Added support for
4404 interface attributes.
4406 2002-08-11 Martin Baulig <martin@gnome.org>
4408 * statement.cs (Block.Emit): Only check the "this" variable if we
4409 do not always throw an exception.
4411 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
4412 whether the property has a set accessor.
4414 2002-08-11 Martin Baulig <martin@gnome.org>
4416 Added control flow analysis support for structs.
4418 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
4419 with control flow analysis turned off.
4420 (IVariable): New interface.
4421 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
4422 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
4423 (FieldExpr.DoResolve): Resolve the instance expression with flow
4424 analysis turned off and do the definite assignment check after the
4425 resolving when we know what the expression will resolve to.
4427 * expression.cs (LocalVariableReference, ParameterReference):
4428 Implement the new IVariable interface, only call the flow analysis
4429 code if ec.DoFlowAnalysis is true.
4430 (This): Added constructor which takes a Block argument. Implement
4431 the new IVariable interface.
4432 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
4433 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
4434 This does the definite assignment checks for struct members.
4436 * class.cs (Constructor.Emit): If this is a non-static `struct'
4437 constructor which doesn't have any initializer, call
4438 Block.AddThisVariable() to tell the flow analysis code that all
4439 struct elements must be initialized before control returns from
4442 * statement.cs (MyStructInfo): New public class.
4443 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
4444 argument to this indexer. If non-zero, check an individual struct
4445 member, not the whole struct.
4446 (FlowBranching.CheckOutParameters): Check struct members.
4447 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
4448 overloaded versions of these methods which take an additional
4449 `int field_idx' argument to check struct members.
4450 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
4451 overloaded versions of these methods which take an additional
4452 `string field_name' argument to check struct member.s
4453 (VariableInfo): Implement the IVariable interface.
4454 (VariableInfo.StructInfo): New public property. Returns the
4455 MyStructInfo instance of the variable if it's a struct or null.
4456 (Block.AddThisVariable): New public method. This is called from
4457 Constructor.Emit() for non-static `struct' constructor which do
4458 not have any initializer. It creates a special variable for the
4459 "this" instance variable which will be checked by the flow
4460 analysis code to ensure that all of the struct's fields are
4461 initialized before control returns from the constructor.
4462 (UsageVector): Added support for struct members. If a
4463 variable/parameter is a struct with N members, we reserve a slot
4464 in the usage vector for each member. A struct is considered fully
4465 initialized if either the struct itself (slot 0) or all its
4466 members are initialized.
4468 2002-08-08 Martin Baulig <martin@gnome.org>
4470 * driver.cs (Driver.MainDriver): Only report an error CS5001
4471 if there were no compilation errors.
4473 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
4474 `UnsafeContext' property to determine whether the parent is in
4475 unsafe context rather than checking the parent's ModFlags:
4476 classes nested in an unsafe class are unsafe as well.
4478 2002-08-08 Martin Baulig <martin@gnome.org>
4480 * statement.cs (UsageVector.MergeChildren): Distinguish between
4481 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
4482 we return. Added test17() and test18() to test-154.cs.
4484 2002-08-08 Martin Baulig <martin@gnome.org>
4486 * typemanager.cs (TypeManager.FilterWithClosure): If we have
4487 Family access, make sure the invoking type isn't a subclass of the
4488 queried type (that'd be a CS1540).
4490 * ecore.cs (Expression.MemberLookup): Added overloaded version of
4491 this method which takes an additional `Type invocation_type'.
4493 * expression.cs (BaseAccess.DoResolve): Use the base type as
4494 invocation and query type.
4495 (MemberAccess.DoResolve): If the lookup failed and we're about to
4496 report a CS0122, try a lookup with the ec.ContainerType - if this
4497 succeeds, we must report a CS1540.
4499 2002-08-08 Martin Baulig <martin@gnome.org>
4501 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
4502 (MethodGroupExpr): Implement the IMemberExpr interface.
4504 * expression (MemberAccess.ResolveMemberAccess): No need to have
4505 any special code for MethodGroupExprs anymore, they're now
4508 2002-08-08 Martin Baulig <martin@gnome.org>
4510 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
4511 Family, FamANDAssem and FamORAssem permissions.
4512 (TypeManager.IsSubclassOrNestedChildOf): New public method.
4514 2002-08-08 Martin Baulig <martin@gnome.org>
4516 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
4517 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
4520 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
4522 * driver.cs: implemented /resource option to embed managed resources.
4524 2002-08-07 Martin Baulig <martin@gnome.org>
4526 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
4527 (FieldBase.HasFieldInitializer): New public property.
4528 (FieldBase.GetInitializerExpression): New public method. Resolves and
4529 returns the field initializer and makes sure it is only resolved once.
4530 (TypeContainer.EmitFieldInitializers): Call
4531 FieldBase.GetInitializerExpression to get the initializer, this ensures
4532 that it isn't resolved multiple times.
4534 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
4535 the resolving process (SimpleName/MemberLookup) that we're currently
4536 emitting a field initializer (which must not access any instance members,
4537 this is an error CS0236).
4539 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
4540 argument, if the `IsFieldInitializer' flag is set, we must report and
4541 error CS0236 and not an error CS0120.
4543 2002-08-07 Martin Baulig <martin@gnome.org>
4545 * ecore.cs (IMemberExpr): New public interface.
4546 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
4547 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
4548 if the expression is an IMemberExpr.
4550 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
4551 to be null, implicitly default to `this' if we're non-static in
4552 this case. Simplified the code a lot by using the new IMemberExpr
4553 interface. Also fixed bug #28176 here.
4555 2002-08-06 Martin Baulig <martin@gnome.org>
4557 * cs-parser.jay (SimpleLookup): Removed. We need to create
4558 ParameterReferences during semantic analysis so that we can do a
4559 type-only search when resolving Cast, TypeOf and SizeOf.
4560 (block): Pass the `current_local_parameters' to the Block's
4563 * class.cs (ConstructorInitializer): Added `Parameters parameters'
4564 argument to the constructor.
4565 (ConstructorInitializer.Resolve): Create a temporary implicit
4566 block with the parameters.
4568 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
4569 references here if we aren't doing a type-only search.
4571 * statement.cs (Block): Added constructor which takes a
4572 `Parameters parameters' argument.
4573 (Block.Parameters): New public property.
4575 * support.cs (InternalParameters.Parameters): Renamed `parameters'
4576 to `Parameters' and made it public readonly.
4578 2002-08-06 Martin Baulig <martin@gnome.org>
4580 * ecore.cs (Expression.Warning): Made this public as well.
4582 * report.cs (Report.Debug): Print the contents of collections.
4584 2002-08-06 Martin Baulig <martin@gnome.org>
4586 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
4587 used to tell Resolve() which kinds of expressions it may return.
4588 (Expression.Resolve): Added overloaded version of this method which
4589 takes a `ResolveFlags flags' argument. This can be used to tell
4590 Resolve() which kinds of expressions it may return. Reports a
4592 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
4593 ResolveFlags.SimpleName.
4594 (Expression.Error118): Added overloaded version of this method which
4595 takes a `ResolveFlags flags' argument. It uses the flags to determine
4596 which kinds of expressions are allowed.
4598 * expression.cs (Argument.ResolveMethodGroup): New public method.
4599 Resolves an argument, but allows a MethodGroup to be returned.
4600 This is used when invoking a delegate.
4602 * TODO: Updated a bit.
4604 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4606 Fixed compilation with csc.
4608 * ecore.cs: Expression.Error made public. Is this correct? Should
4609 Warning be made public too?
4611 * expression.cs: use ea.Location instead of ea.loc.
4612 [FIXME: Filed as bug #28607: MCS must report these errors.]
4614 2002-08-06 Martin Baulig <martin@gnome.org>
4616 * ecore.cs (Expression.loc): Moved the location here instead of
4617 duplicating it in all derived classes.
4618 (Expression.Location): New public property.
4619 (Expression.Error, Expression.Warning): Made them non-static and
4620 removed the location argument.
4621 (Expression.Warning): Added overloaded version which takes an
4622 `int level' argument.
4623 (Expression.Error118): Make this non-static and removed the
4624 expression and location arguments.
4625 (TypeExpr): Added location argument to the constructor.
4627 * expression.cs (StaticCallExpr): Added location argument to
4629 (Indirection, PointerArithmetic): Likewise.
4630 (CheckedExpr, UnCheckedExpr): Likewise.
4631 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
4632 (StringPtr): Likewise.
4635 2002-08-05 Martin Baulig <martin@gnome.org>
4637 * expression.cs (BaseAccess.DoResolve): Actually report errors.
4639 * assign.cs (Assign.DoResolve): Check whether the source
4640 expression is a value or variable.
4642 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
4643 while resolving the corresponding blocks.
4645 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
4646 an error, don't silently return null.
4648 * statement.cs (Block.AddVariable): Do the error reporting here
4649 and distinguish between CS0128 and CS0136.
4650 (Block.DoResolve): Report all unused labels (warning CS0164).
4651 (LabeledStatement): Pass the location to the constructor.
4652 (LabeledStatement.HasBeenReferenced): New property.
4653 (LabeledStatement.Resolve): Set it to true here.
4655 * statement.cs (Return.Emit): Return success even after reporting
4656 a type mismatch error (CS0126 or CS0127), this is what csc does and
4657 it avoids confusing the users with any consecutive errors.
4659 2002-08-05 Martin Baulig <martin@gnome.org>
4661 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
4663 * const.cs (Const.LookupConstantValue): Catch circular definitions.
4665 * expression.cs (MemberAccess.DoResolve): Silently return if an
4666 error has already been reported.
4668 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
4669 error has already been reported.
4671 2002-08-05 Martin Baulig <martin@gnome.org>
4673 * statement.cs (UsageVector): Only initialize the `parameters'
4674 vector if we actually have any "out" parameters.
4676 2002-08-05 Martin Baulig <martin@gnome.org>
4678 * expression.cs (Binary.ResolveOperator): When combining delegates,
4679 they must have the same type.
4681 2002-08-05 Martin Baulig <martin@gnome.org>
4683 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
4684 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
4685 work with the ms runtime and we also don't need it: if we're a
4686 PropertyBuilder and not in the `indexer_arguments' hash, then we
4687 are a property and not an indexer.
4689 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
4690 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
4691 since the latter one doesn't work with the ms runtime.
4693 2002-08-03 Martin Baulig <martin@gnome.org>
4695 Fixed bugs #27998 and #22735.
4697 * class.cs (Method.IsOperator): New public field.
4698 (Method.CheckBase): Report CS0111 if there's already a method
4699 with the same parameters in the current class. Report CS0508 when
4700 attempting to change the return type of an inherited method.
4701 (MethodData.Emit): Report CS0179 if a method doesn't have a body
4702 and it's not marked abstract or extern.
4703 (PropertyBase): New abstract base class for Property and Indexer.
4704 (PropertyBase.CheckBase): Moved here from Property and made it work
4706 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
4707 the same so we can reuse it there.
4708 (Property, Indexer): Derive from PropertyBase.
4709 (MethodSignature.inheritable_property_signature_filter): New delegate
4710 to find properties and indexers.
4712 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
4713 argument and improved error reporting.
4715 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
4716 EmptyReadOnlyParameters and made it a property.
4718 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
4719 version of this method which takes a `PropertyInfo indexer'.
4720 (TypeManager.RegisterIndexer): New method.
4722 * class.cs: Added myself as author of this file :-)
4724 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4726 * class.cs: fixed compilation on windoze.
4728 2002-08-03 Martin Baulig <martin@gnome.org>
4730 * interface.cs (Interface.GetInterfaceBases): Check whether all
4731 base interfaces are at least as accessible than the current one.
4733 * class.cs (TypeContainer.GetClassBases): Check whether base types
4734 are at least as accessible than the current type.
4735 (TypeContainer.AsAccessible): Implemented and made non-static.
4736 (MemberBase.CheckParameters): Report errors if the accessibility
4739 * delegate.cs (Delegate.Delegate): The default visibility is
4740 internal for top-level types and private for nested types.
4741 (Delegate.Define): Report errors if the accessibility checks fail.
4743 * enum.cs (Enum.Enum): The default visibility is internal for
4744 top-level types and private for nested types.
4745 (Enum.DefineType): Compute the correct visibility.
4747 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
4748 function which takes a `bool is_toplevel' instead of a TypeContainer.
4750 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
4753 2002-08-02 Martin Baulig <martin@gnome.org>
4755 * expression.cs (LocalVariableReferenc): Added constructor which
4756 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
4757 (LocalVariableReference.IsReadOnly): New property.
4758 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
4759 variable is readonly, use our own readonly flag to do this; you can
4760 use the new constructor to get a writable reference to a read-only
4763 * cs-parser.jay (foreach_statement, using_statement): Get a writable
4764 reference to the local variable.
4766 2002-08-01 Miguel de Icaza <miguel@ximian.com>
4768 * rootcontext.cs (ResolveCore): Also include System.Exception
4770 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
4771 we reach an EmptyStatement.
4773 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
4776 * expression.cs (Binary.ResolveOperator): Check error result in
4779 use brtrue/brfalse directly and avoid compares to null.
4781 2002-08-02 Martin Baulig <martin@gnome.org>
4783 * class.cs (TypeContainer.Define): Define all nested interfaces here.
4784 Fixes bug #28407, added test-155.cs.
4786 2002-08-01 Martin Baulig <martin@gnome.org>
4788 * class.cs (Event.EmitDefaultMethod): Make this work with static
4789 events. Fixes #28311, added verify-3.cs.
4791 2002-08-01 Martin Baulig <martin@gnome.org>
4793 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
4794 `is_disposable' fields.
4795 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
4796 `hm.is_disposable' if we're using the collection pattern.
4797 (Foreach.EmitCollectionForeach): Use the correct type for the
4798 enumerator's local variable, only emit the try/finally block if
4799 necessary (fixes #27713).
4801 2002-08-01 Martin Baulig <martin@gnome.org>
4803 * ecore.cs (Expression.report118): Renamed to Error118 and made
4806 * statement.cs (Throw.Resolve): Check whether the expression is of
4807 the correct type (CS0118) and whether the type derives from
4808 System.Exception (CS0155).
4809 (Catch.Resolve): New method. Do the type lookup here and check
4810 whether it derives from System.Exception (CS0155).
4811 (Catch.CatchType, Catch.IsGeneral): New public properties.
4813 * typemanager.cs (TypeManager.exception_type): Added.
4815 2002-07-31 Miguel de Icaza <miguel@ximian.com>
4817 * driver.cs: Updated About function.
4819 2002-07-31 Martin Baulig <martin@gnome.org>
4821 Implemented Control Flow Analysis.
4823 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
4824 (EmitContext.CurrentBranching): Added.
4825 (EmitContext.StartFlowBranching): Added.
4826 (EmitContext.EndFlowBranching): Added.
4827 (EmitContext.KillFlowBranching): Added.
4828 (EmitContext.IsVariableAssigned): Added.
4829 (EmitContext.SetVariableAssigned): Added.
4830 (EmitContext.IsParameterAssigned): Added.
4831 (EmitContext.SetParameterAssigned): Added.
4832 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
4833 Added control flow analysis stuff here.
4835 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
4836 resolve the expression as lvalue.
4837 (LocalVariableReference.DoResolve): Check whether the variable has
4838 already been assigned.
4839 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
4840 the parameter as assigned here.
4841 (ParameterReference.DoResolve): Check whether the parameter has already
4843 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
4844 expression as lvalue.
4846 * statement.cs (FlowBranching): New class for the flow analysis code.
4847 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
4848 (LabeledStatement.IsDefined): New public property.
4849 (LabeledStatement.AddUsageVector): New public method to tell flow
4850 analyis that the label may be reached via a forward jump.
4851 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
4853 (VariableInfo.Number): New public field. This is used by flow analysis
4854 to number all locals of a block.
4855 (Block.CountVariables): New public property. This is the number of
4856 local variables in this block (including the locals from all parent
4858 (Block.EmitMeta): Number all the variables.
4860 * statement.cs: Added flow analysis support to all classes.
4862 2002-07-31 Martin Baulig <martin@gnome.org>
4864 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
4865 To get debugging messages, compile mcs with /define:MCS_DEBUG and
4866 then use this argument.
4868 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
4870 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
4871 use this to specify /define options.
4873 2002-07-29 Martin Baulig <martin@gnome.org>
4875 * statement.cs (Fixed): Moved all code that does variable lookups
4876 and resolvings from Emit to Resolve.
4878 * statement.cs (For): Moved all code that does variable lookups
4879 and resolvings from Emit to Resolve.
4881 * statement.cs (Using): Moved all code that does variable lookups
4882 and resolvings from Emit to Resolve.
4884 2002-07-29 Martin Baulig <martin@gnome.org>
4886 * attribute.cs (Attribute.Resolve): Explicitly catch a
4887 System.NullReferenceException when creating the
4888 CustromAttributeBuilder and report a different warning message.
4890 2002-07-29 Martin Baulig <martin@gnome.org>
4892 * support.cs (ParameterData.ParameterName): Added method to
4893 get the name of a parameter.
4895 * typemanager.cs (TypeManager.IsValueType): New public method.
4897 2002-07-29 Martin Baulig <martin@gnome.org>
4899 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
4900 is a flag which specifies that it's either ref or out.
4901 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
4902 the out parameter to `out Parameter.Modifier mod', also set the
4903 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
4905 * support.cs (InternalParameters.ParameterModifier): Distinguish
4906 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4907 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4909 * expression.cs (Argument.GetParameterModifier): Distinguish
4910 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
4911 Parameter.Modifier.ISBYREF flag if it's either ref or out.
4913 2002-07-29 Martin Baulig <martin@gnome.org>
4915 * expression.cs (ParameterReference.ParameterReference): Added
4916 `Location loc' argument to the constructor.
4918 * cs-parser.jay: Pass location to ParameterReference.
4920 2002-07-28 Miguel de Icaza <miguel@ximian.com>
4922 * statement.cs (Try): Initialize the location.
4924 * cs-parser.jay: pass location to Try.
4926 * expression.cs (Unary.Reduce): Change the prototype to return
4927 whether a constant fold could be performed or not. The result is
4928 returned in an out parameters. In the case of Indirection and
4929 AddressOf, we want to perform the full tests.
4931 2002-07-26 Miguel de Icaza <miguel@ximian.com>
4933 * statement.cs (Statement.Emit): Flag dead code.
4935 2002-07-27 Andrew Birkett <andy@nobugs.org>
4937 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
4939 2002-07-27 Martin Baulig <martin@gnome.org>
4941 * class.cs (MethodData.Define): Put back call to
4942 TypeManager.AddMethod(), accidentally commented this out.
4944 * report.cs (Debug): New public method to print debugging information,
4945 this is `[Conditional ("DEBUG")]'.
4947 2002-07-26 Martin Baulig <martin@gnome.org>
4949 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
4950 (switch_statement): Push the current_block to the switch_stack and
4951 pop it again when we're done with the switch.
4952 (switch_section): The new block is a child of the current_block.
4953 Fixes bug #24007, added test-152.cs.
4955 2002-07-27 Martin Baulig <martin@gnome.org>
4957 * expression.cs (Invocation.EmitArguments): When calling a varargs
4958 function with only its fixed arguments, we need to pass an empty
4961 2002-07-27 Martin Baulig <martin@gnome.org>
4963 Mono 0.13 has been released.
4965 2002-07-25 Miguel de Icaza <miguel@ximian.com>
4967 * driver.cs: Rename --resource to --linkres, because that is what
4968 we do currently, we dont support --resource yet.
4970 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
4972 2002-07-25 Martin Baulig <martin@gnome.org>
4974 * class.cs (MethodData): New public class. This is a `method builder'
4975 class for a method or one accessor of a Property/Indexer/Event.
4976 (MethodData.GetMethodFlags): Moved here from MemberBase.
4977 (MethodData.ApplyAttributes): Likewise.
4978 (MethodData.ApplyObsoleteAttribute): Likewise.
4979 (MethodData.ApplyConditionalAttribute): Likewise.
4980 (MethodData.ApplyDllImportAttribute): Likewise.
4981 (MethodData.CheckAbstractAndExternal): Likewise.
4982 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
4983 (MethodData.Emit): Formerly known as Method.Emit().
4984 (MemberBase): Moved everything which was specific to a single
4985 accessor/method to MethodData.
4986 (Method): Create a new MethodData and call Define() and Emit() on it.
4987 (Property, Indexer, Event): Create a new MethodData objects for each
4988 accessor and call Define() and Emit() on them.
4990 2002-07-25 Martin Baulig <martin@gnome.org>
4992 Made MethodCore derive from MemberBase to reuse the code from there.
4993 MemberBase now also checks for attributes.
4995 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
4996 (MemberBase.GetMethodFlags): Moved here from class Method and marked
4998 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
4999 `CallingConventions cc' and `Attributes opt_attrs' arguments.
5000 (MemberBase.ApplyAttributes): New virtual method; applies the
5001 attributes to a method or accessor.
5002 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
5003 (MemberBase.ApplyConditionalAttribute): Likewise.
5004 (MemberBase.ApplyDllImportAttribute): Likewise.
5005 (MemberBase.CheckAbstractAndExternal): Likewise.
5006 (MethodCore.ParameterTypes): This is now a property instead of a
5007 method, it's initialized from DoDefineParameters().
5008 (MethodCore.ParameterInfo): Removed the set accessor.
5009 (MethodCore.DoDefineParameters): New protected virtual method to
5010 initialize ParameterTypes and ParameterInfo.
5011 (Method.GetReturnType): We can now simply return the MemberType.
5012 (Method.GetMethodFlags): Override the MemberBase version and add
5013 the conditional flags.
5014 (Method.CheckBase): Moved some code from Define() here, call
5015 DoDefineParameters() here.
5016 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
5017 here to avoid some larger code duplication.
5018 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
5019 ensure that abstract and external accessors don't declare a body.
5021 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
5022 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
5023 lookup in the attribute's parent classes, so we need to abort as soon
5024 as we found the first match.
5025 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
5026 the attribute has no arguments.
5028 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
5031 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5033 * cs-parser.jay: reverted previous patch.
5035 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5037 * cs-parser.jay: fixed bug #22119.
5039 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5041 * attribute.cs: fixed compilation. The error was:
5042 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
5043 be assigned to before control leaves the current method."
5044 [FIXME: Filed as bug #28186: MCS must report this error.]
5046 2002-07-25 Martin Baulig <martin@gnome.org>
5048 * attribute.cs (Attribute.Conditional_GetConditionName): New static
5049 method to pull the condition name ouf of a Conditional attribute.
5050 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
5051 the obsolete message and error flag out of an Obsolete attribute.
5053 * class.cs (Method.GetMethodFlags): New public method to get the
5054 TypeManager.MethodFlags for this method.
5055 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
5057 (Method.Define): Get and apply the Obsolete and Conditional attributes;
5058 if we're overriding a virtual function, set the new private variable
5059 `parent_method'; call the new TypeManager.AddMethod().
5061 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
5062 the MethodBuilder and the Method in a PtrHashtable.
5063 (TypeManager.builder_to_method): Added for this purpose.
5064 (TypeManager.MethodFlags): Added IsObsoleteError.
5065 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
5066 Obsolete and Conditional arguments in MethodBuilders. If we discover
5067 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
5068 the message from the attribute.
5070 2002-07-24 Martin Baulig <martin@gnome.org>
5072 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
5073 preprocessor directives, ensure that the argument to #define/#undef is
5074 exactly one identifier and that it's actually an identifier.
5076 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
5079 2002-07-24 Martin Baulig <martin@gnome.org>
5081 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
5082 initialize it to TypeManager.object_type in the constructor.
5083 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
5084 of the `hm.get_current' method if we're using the collection pattern.
5085 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
5086 for the explicit conversion to make it work when we're using the collection
5087 pattern and the `Current' property has a different return type than `object'.
5090 2002-07-24 Martin Baulig <martin@gnome.org>
5092 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
5093 does not match, but don't report any errors. This method is called in
5094 order for all methods in a MethodGroupExpr until a matching method is
5095 found, so we don't want to bail out if the first method doesn't match.
5096 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
5097 matches, report the 123. Fixes #28070.
5099 2002-07-24 Martin Baulig <martin@gnome.org>
5101 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
5102 TypeManager.TypeToCoreType() to the top of the method so the
5103 following equality checks will work. Fixes #28107.
5105 2002-07-24 Martin Baulig <martin@gnome.org>
5107 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
5108 operand is of type uint, and the other operand is of type sbyte,
5109 short or int, the operands are converted to type long." -
5110 Actually do what this comment already told us. Fixes bug #28106,
5113 2002-07-24 Martin Baulig <martin@gnome.org>
5115 * class.cs (MethodBase): New abstract class. This is now a base
5116 class for Property, Indexer and Event to avoid some code duplication
5117 in their Define() and DefineMethods() methods.
5118 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
5119 generic methods for Define() and DefineMethods().
5120 (FieldBase): Derive from MemberBase, not MemberCore.
5121 (Property): Derive from MemberBase, not MemberCore.
5122 (Property.DefineMethod): Moved all the code from this method to the
5123 new MethodBase.DefineAccessor(), just call it with appropriate
5125 (Property.Define): Call the new Property.DoDefine(), this does some
5126 sanity checks and we don't need to duplicate the code everywhere.
5127 (Event): Derive from MemberBase, not MemberCore.
5128 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
5129 accessors, this will also make them work with interface events.
5130 (Indexer): Derive from MemberBase, not MemberCore.
5131 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
5132 (Indexer.Define): Use the new MethodBase functions.
5134 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
5135 argument to the constructor.
5136 (Interface.FindMembers): Added support for interface events.
5137 (Interface.PopluateEvent): Implemented.
5139 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
5141 2002-07-22 Miguel de Icaza <miguel@ximian.com>
5143 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
5144 but this is required to check for a method name being the same as
5145 the containing class.
5149 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5151 * interface.cs: initialize variable.
5153 2002-07-23 Martin Baulig <martin@gnome.org>
5155 Implemented the IndexerName attribute in interfaces.
5157 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
5158 name if this is an explicit interface implementation.
5159 (Indexer.InterfaceIndexerName): New public variable. If we're
5160 implementing an interface indexer, this is the IndexerName in that
5161 interface. Otherwise, it's the IndexerName.
5162 (Indexer.DefineMethod): If we're implementing interface indexer,
5163 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
5164 and Pending.ImplementIndexer methods.
5165 (Indexer.Define): Also define the PropertyBuilder if we're
5166 implementing an interface indexer and this is neither an explicit
5167 interface implementation nor do the IndexerName match the one in
5170 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
5171 If a method is defined here, then we always need to create a proxy
5172 for it. This is used when implementing interface indexers.
5173 (Pending.IsInterfaceIndexer): New public method.
5174 (Pending.ImplementIndexer): New public method.
5175 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
5176 This is used when implementing interface indexers to define a proxy
5178 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
5179 define a proxy if necessary.
5181 * interface.cs (Interface.IndexerName): New public variable.
5182 (Interface.PopulateIndexer): Set the IndexerName.
5183 (Interface.DefineIndexers): New private method. Populate all the
5184 indexers and make sure their IndexerNames match.
5186 * typemanager.cs (IndexerPropertyName): Added support for interface
5189 2002-07-22 Martin Baulig <martin@gnome.org>
5191 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
5192 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
5193 ret if HasReturnLabel.
5194 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
5197 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
5198 and set the ec.LoopBeginTryCatchLevel.
5199 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
5200 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
5201 the current ec.TryCatchLevel, the branch goes out of an exception
5202 block. In this case, we need to use Leave and not Br.
5204 2002-07-22 Martin Baulig <martin@gnome.org>
5206 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
5207 block unless the block does not always return or it is contained in
5208 another try { ... } catch { ... } block. Fixes bug #26506.
5209 Added verify-1.cs to the test suite.
5211 2002-07-22 Martin Baulig <martin@gnome.org>
5213 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
5214 then we do not always return. Fixes bug #24985.
5216 2002-07-22 Martin Baulig <martin@gnome.org>
5218 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
5219 lookup on a per-class level; ie. walk up the class hierarchy until we
5220 found at least one applicable method, then choose the best among them.
5221 Fixes bug #24463 and test-29.cs.
5223 2002-07-22 Martin Baulig <martin@gnome.org>
5225 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
5226 return types of the methods. The return type is not part of the
5227 signature and we must not check it to make the `new' modifier work.
5228 Fixes bug #27999, also added test-147.cs.
5229 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
5231 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
5232 on the method's return type.
5234 2002-07-21 Martin Baulig <martin@gnome.org>
5236 * assign.cs: Make this work if the rightmost source is a constant and
5237 we need to do an implicit type conversion. Also adding a few more tests
5238 to test-38.cs which should have caught this.
5240 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
5241 target in the makefile for this. The makefile.gnu is primarily intended
5242 for end-users who don't want to debug the compiler.
5244 2002-07-21 Martin Baulig <martin@gnome.org>
5246 * assign.cs: Improved the Assign class so it can now handle embedded
5247 assignments (X = Y = Z = something). As a side-effect this'll now also
5248 consume less local variables. test-38.cs now passes with MCS, added
5249 a few new test cases to that test.
5251 2002-07-20 Martin Baulig <martin@gnome.org>
5253 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
5254 instructions. Fixes bug #27977, also added test-146.cs.
5256 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5258 * cs-tokenizer.cs: fixed getHex ().
5260 2002-07-19 Martin Baulig <martin@gnome.org>
5262 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
5263 not Type.GetType() to lookup the array type. This is needed when
5264 we're constructing an array of a user-defined type.
5265 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
5266 single-dimensional arrays, but also for single-dimensial arrays of
5269 2002-07-19 Martin Baulig <martin@gnome.org>
5271 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
5272 this function is called, it's not allowed to share LocalBuilders
5275 2002-07-19 Martin Baulig <martin@gnome.org>
5277 * expression.cs (Argument.Resolve): Report an error 118 when trying
5278 to pass a type as argument.
5280 2002-07-18 Martin Baulig <martin@gnome.org>
5282 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
5283 Conv_R_Un for the signed `long' type.
5285 2002-07-15 Miguel de Icaza <miguel@ximian.com>
5287 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
5288 `expr' for the temporary result, as that will fail if we do
5289 multiple resolves on the same expression.
5291 2002-07-05 Miguel de Icaza <miguel@ximian.com>
5293 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
5294 ec.TypeContainer for looking up aliases.
5296 * class.cs (TypeContainer): Remove LookupAlias from here.
5298 * decl.cs (DeclSpace); Move here.
5300 2002-07-01 Miguel de Icaza <miguel@ximian.com>
5302 * class.cs (FindMembers): Only call filter if the constructor
5303 bulider is not null.
5305 Also handle delegates in `NestedTypes' now. Now we will perform
5306 type lookups using the standard resolution process. This also
5309 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
5310 This uses Expressions (the limited kind that can be parsed by the
5311 tree) instead of strings.
5313 * expression.cs (ComposedCast.ToString): Implement, used to flag
5314 errors since now we have to render expressions.
5316 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
5319 * ecore.cs (SimpleName.ToString): ditto.
5321 * cs-parser.jay: Instead of using strings to assemble types, use
5322 Expressions to assemble the type (using SimpleName, ComposedCast,
5323 MemberAccess). This should fix the type lookups in declarations,
5324 because we were using a different code path for this.
5326 * statement.cs (Block.Resolve): Continue processing statements
5327 even when there is an error.
5329 2002-07-17 Miguel de Icaza <miguel@ximian.com>
5331 * class.cs (Event.Define): Also remove the `remove' method from
5332 the list of pending items.
5334 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
5335 generate more compact code.
5337 2002-07-17 Martin Baulig <martin@gnome.org>
5339 * const.cs (Const.LookupConstantValue): Add support for constant
5340 `unchecked' and `checked' expressions.
5341 Also adding test case test-140.cs for this.
5343 2002-07-17 Martin Baulig <martin@gnome.org>
5345 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
5346 check whether mi.ReturnType implements the IEnumerator interface; the
5347 `==' and the IsAssignableFrom() will fail in this situation.
5349 2002-07-16 Ravi Pratap <ravi@ximian.com>
5351 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
5354 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5356 * expression.cs: fixed bug #27811.
5358 2002-07-14 Miguel de Icaza <miguel@ximian.com>
5360 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
5361 Molaro: when we are a ref, the value already contains a pointer
5362 value, do not take the address of it.
5364 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5365 * removed mb-parser.jay and mb-tokenizer.cs
5367 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5369 * expression.cs: check against the building corlib void type.
5371 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
5373 * ecore.cs: fix for valuetype static readonly fields: when
5374 initializing them, we need their address, not the address of a copy.
5376 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
5378 * typemanager.cs: register also enum_type in corlib.
5380 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5382 * class.cs: allow calling this (but not base) initializers in structs.
5384 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
5386 * ecore.cs: make sure we compare against the building base types
5389 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
5391 * typemanager.cs: fix TypeToCoreType() to handle void and object
5392 (corlib gets no more typerefs after this change).
5394 2002-07-12 Miguel de Icaza <miguel@ximian.com>
5396 * expression.cs (ArrayCreation.EmitArrayArguments): use
5397 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
5399 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
5400 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
5401 array indexes, the runtime actually forbids them.
5403 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
5404 for array arguments here.
5406 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
5407 instead of the default for ValueTypes.
5409 (New.DoEmit): Use IsValueType instead of
5410 IsSubclassOf (value_type)
5411 (New.DoResolve): ditto.
5412 (Invocation.EmitCall): ditto.
5414 * assign.cs (Assign): ditto.
5416 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
5417 Statements *are* currently doing part of their resolution during
5420 Expressions do always resolve during resolve, but statements are
5421 only required to propagate resolution to their children.
5423 2002-07-11 Miguel de Icaza <miguel@ximian.com>
5425 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
5427 (LoadAssembly): Do not add the dll if it is already specified
5429 (MainDriver): Add the System directory to the link path at the end,
5430 after all the other -L arguments.
5432 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
5433 wrong opcode for loading bytes and bools (ldelem.i1 instead of
5434 ldelem.u1) and using the opposite for sbytes.
5436 This fixes Digger, and we can finally run it.
5438 * driver.cs (UnixParseOption): Move the option parsing here.
5439 (CSCParseOption): Implement CSC-like parsing of options.
5441 We now support both modes of operation, the old Unix way, and the
5442 new CSC-like way. This should help those who wanted to make cross
5445 The only thing broken is that /r:, /reference: and /lib: are not
5446 implemented, because I want to make those have the same semantics
5447 as the CSC compiler has, and kill once and for all the confussion
5448 around this. Will be doing this tomorrow.
5450 * statement.cs (Unsafe.Resolve): The state is checked during
5451 resolve, not emit, so we have to set the flags for IsUnsfe here.
5453 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5455 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
5456 not catch the Error_ObjectRefRequired in SimpleName (as it is
5457 possible to have a class/instance variable name that later gets
5458 deambiguated), we have to check this here.
5460 2002-07-10 Ravi Pratap <ravi@ximian.com>
5462 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
5463 make static and put into Expression.
5465 (Event.Define): Register the private field of the event with the
5466 TypeManager so that GetFieldFromEvent can get at it.
5468 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
5469 keep track of the private field associated with an event which
5472 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
5475 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
5477 2002-07-10 Miguel de Icaza <miguel@ximian.com>
5479 * expression.cs (Binary.EmitBranchable): this routine emits the
5480 Binary expression in a branchable context. This basically means:
5481 we need to branch somewhere, not just get the value on the stack.
5483 This works together with Statement.EmitBoolExpression.
5485 * statement.cs (Statement.EmitBoolExpression): Use
5488 2002-07-09 Miguel de Icaza <miguel@ximian.com>
5490 * statement.cs (For): Reduce the number of jumps in loops.
5492 (For): Implement loop inversion for the For statement.
5494 (Break): We can be breaking out of a Try/Catch controlled section
5495 (foreach might have an implicit try/catch clause), so we need to
5496 use Leave instead of Br.
5498 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
5499 now). If the instace expression supports IMemoryLocation, we use
5500 the AddressOf method from the IMemoryLocation to extract the
5501 address instead of emitting the instance.
5503 This showed up with `This', as we were emitting the instance
5504 always (Emit) instead of the Address of This. Particularly
5505 interesting when This is a value type, as we dont want the Emit
5506 effect (which was to load the object).
5508 2002-07-08 Miguel de Icaza <miguel@ximian.com>
5510 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
5512 * statement.cs (Checked): Set the CheckedState during the resolve
5513 process too, as the ConvCast operations track the checked state on
5514 the resolve process, and not emit.
5516 * cs-parser.jay (namespace_member_declaration): Flag that we have
5517 found a declaration when we do. This is used to flag error 1529
5519 * driver.cs: Report ok when we display the help only.
5521 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
5523 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
5525 2002-07-04 Miguel de Icaza <miguel@ximian.com>
5527 * cs-tokenizer.cs (define): We also have to track locally the
5528 defines. AllDefines is just used for the Conditional Attribute,
5529 but we also need the local defines for the current source code.
5531 2002-07-03 Miguel de Icaza <miguel@ximian.com>
5533 * statement.cs (While, For, Do): These loops can exit through a
5534 Break statement, use this information to tell whether the
5535 statement is the last piece of code.
5537 (Break): Flag that we break.
5539 * codegen.cs (EmitContexts): New `Breaks' state variable.
5541 2002-07-03 Martin Baulig <martin@gnome.org>
5543 * class.cs (TypeContainer.MethodModifiersValid): Allow override
5544 modifiers in method declarations in structs. Otherwise, you won't
5545 be able to override things like Object.Equals().
5547 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5549 * class.cs (Method, Property, Indexer): Do not allow the public
5550 modifier to be used in explicit interface implementations.
5552 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
5553 override modifiers in method declarations in structs
5555 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
5557 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
5558 integer or real overflow, report an error
5560 2002-07-02 Martin Baulig <martin@gnome.org>
5562 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
5563 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
5564 to tell the runtime about our newly created System.Object and
5565 System.ValueType types.
5567 2002-07-02 Miguel de Icaza <miguel@ximian.com>
5569 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
5570 struct instead of Ldarg/Starg.
5572 2002-07-02 Martin Baulig <martin@gnome.org>
5574 * expression.cs (Indirection.Indirection): Call
5575 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
5577 2002-07-02 Martin Baulig <martin@gnome.org>
5579 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
5580 ValueType, call TypeManager.TypeToCoreType() on it.
5581 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
5582 the OpCodes.Newarr argument.
5584 2002-07-02 Martin Baulig <martin@gnome.org>
5586 * expression.cs (Invocation.EmitCall): When compiling corlib,
5587 replace all calls to the system's System.Array type to calls to
5588 the newly created one.
5590 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
5591 System.Array methods.
5592 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
5593 from the system's System.Array type which must be replaced.
5595 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
5597 * typemanager.cs: load unverifiable_code_ctor so we can build
5598 corlib using the correct type. Avoid using GetTypeCode() with
5600 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
5601 TypeManager.object_type to allow building corlib.
5603 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
5605 * ecore.cs: handle System.Enum separately in LoadFromPtr().
5607 2002-07-01 Martin Baulig <martin@gnome.org>
5609 * class.cs: Make the last change actually work, we need to check
5610 whether `ifaces != null' to avoid a crash.
5612 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
5614 * class.cs: when we build structs without fields that implement
5615 interfaces, we need to add the interfaces separately, since there is
5616 no API to both set the size and add the interfaces at type creation
5619 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
5621 * expression.cs: the dimension arguments to the array constructors
5622 need to be converted if they are a long.
5624 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
5626 * class.cs: don't emit ldarg.0 if there is no parent constructor
5627 (fixes showstopper for corlib).
5629 2002-06-29 Martin Baulig <martin@gnome.org>
5631 MCS now compiles corlib on GNU/Linux :-)
5633 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
5634 ie. check for MethodImplOptions.InternalCall.
5636 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
5637 and TypeManager.attribute_type are null, so we must explicitly check
5638 whether parent is not null to find out whether it's an attribute type.
5639 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
5640 and SetBuilder, not only if the property is neither abstract nor external.
5641 This is necessary to set the MethodImplOptions on the accessor methods.
5642 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
5643 SetBuilder, see Property.Emit().
5645 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
5646 populate "System.Object", "System.ValueType" and "System.Attribute" since
5647 they've already been populated from BootCorlib_PopulateCoreTypes().
5649 2002-06-29 Martin Baulig <martin@gnome.org>
5651 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
5652 is the NullLiteral, we also need to make sure that target_type is not
5655 2002-06-29 Martin Baulig <martin@gnome.org>
5657 * rootcontext.cs (RootContext.ResolveCore): We must initialize
5658 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
5659 before calling BootstrapCorlib_ResolveDelegate ().
5661 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5663 * statement.cs: fixed build-breaker. All tests passed ok.
5665 2002-06-27 Martin Baulig <martin@gnome.org>
5667 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
5668 for System.Decimal when compiling corlib.
5670 2002-06-27 Martin Baulig <martin@gnome.org>
5672 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
5673 switch blocks which contain nothing but a default clause.
5675 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
5677 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
5679 2002-06-27 Martin Baulig <martin@gnome.org>
5681 * ecore.cs (PropertyExpr.PropertyExpr): Call
5682 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
5684 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
5685 is already a TypeBuilder.
5687 2002-06-27 Martin Baulig <martin@gnome.org>
5689 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
5690 `target_type == TypeManager.array_type', not IsAssignableFrom() in
5691 the "from an array-type to System.Array" case. This makes it work
5692 when compiling corlib.
5694 2002-06-27 Martin Baulig <martin@gnome.org>
5696 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
5697 non-static PropertyExpr, set its InstanceExpression. This makes
5698 the `ICollection.Count' property work in System/Array.cs.
5700 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
5702 * driver.cs: Made error handling more consistent. Errors now
5703 tracked by Report class, so many methods which used to return int
5704 now return void. Main() now prints success/failure and
5705 errors/warnings message.
5707 Renamed '--probe' compiler argument to '--expect-error'. Removed
5708 the magic number return values (123 and 124). Now, if the
5709 expected error occurs, the compiler exits with success (exit value
5710 0). If the compilation completes without seeing that particular
5711 error, the compiler exits with failure (exit value 1). The
5712 makefile in mcs/errors has been changed to handle the new behaviour.
5714 * report.cs: Made 'expected error' number a property and renamed
5715 it from 'Probe' to 'ExpectedError'.
5717 * genericparser.cs: Removed error handling support, since it is
5718 now all done by Report class.
5720 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
5721 class, so parse() no longer returns an int.
5723 * namespace.cs: Use Report.Error instead of GenericParser.error
5725 2002-06-22 Miguel de Icaza <miguel@ximian.com>
5727 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
5728 TypeContainer.AddOperator): At the front of the list put the
5729 explicit implementations, so they get resolved/defined first.
5731 2002-06-21 Miguel de Icaza <miguel@ximian.com>
5733 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
5734 interface type is implemented by this TypeContainer. Used during
5735 explicit interface implementation.
5737 (Property.Define, Indexer.Define, Method.Define): Validate that
5738 the given interface in the explicit implementation is one of the
5739 base classes for the containing type.
5741 Also if we are explicitly implementing an interface, but there is
5742 no match in the pending implementation table, report an error.
5744 (Property.Define): Only define the property if we are
5745 not explicitly implementing a property from an interface. Use the
5746 correct name also for those properties (the same CSC uses,
5747 although that is really not needed).
5749 (Property.Emit): Do not emit attributes for explicitly implemented
5750 properties, as there is no TypeBuilder.
5752 (Indexer.Emit): ditto.
5754 Hiding then means that we do not really *implement* a pending
5755 implementation, which makes code fail.
5757 2002-06-22 Martin Baulig <martin@gnome.org>
5759 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
5760 the return value of Object.GetType(). [FIXME: we need to do this whenever
5761 we get a type back from the reflection library].
5763 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
5765 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
5767 2002-06-20 Miguel de Icaza <miguel@ximian.com>
5769 * attribute.cs: Return null if we can not look up the type.
5771 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
5772 the interface types found.
5774 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
5775 interface types found.
5777 * typemanager.cs (GetInterfaces): Make this routine returns alll
5778 the interfaces and work around the lame differences between
5779 System.Type and System.Reflection.Emit.TypeBuilder in the results
5780 result for GetInterfaces.
5782 (ExpandInterfaces): Given an array of interface types, expand and
5783 eliminate repeated ocurrences of an interface. This expands in
5784 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
5787 2002-06-21 Martin Baulig <martin@gnome.org>
5789 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
5792 2002-06-21 Martin Baulig <martin@gnome.org>
5794 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
5795 and called with one of the core types, return the corresponding typebuilder for
5798 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
5801 2002-06-21 Martin Baulig <martin@gnome.org>
5803 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
5804 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
5805 (Expression.ConvertReferenceExplicit): Likewise.
5807 * expression.cs (ElementAccess.DoResolve): Likewise.
5808 (ElementAccess.DoResolveLValue): Likewise.
5810 2002-06-10 Martin Baulig <martin@gnome.org>
5812 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
5813 add the "value" parameter to the parameter list.
5815 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
5818 2002-06-19 Miguel de Icaza <miguel@ximian.com>
5820 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
5821 the argument to an int, uint, long or ulong, per the spec. Also
5822 catch negative constants in array creation.
5824 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
5826 * class.cs: do not allow the same interface to appear twice in
5827 the definition list.
5829 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
5831 * ecore.cs: don't use ldlen with System.Array.
5833 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
5835 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
5837 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
5839 * modifiers.cs: produce correct field attributes for protected
5840 internal. Easy fix so miguel can work on ther harder stuff:-)
5842 2002-06-18 Miguel de Icaza <miguel@ximian.com>
5844 * pending.cs: New file. Move the code from class.cs here.
5845 Support clearning the pending flag for all methods (when not doing
5846 explicit interface implementation).
5848 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
5850 * rootcontext.cs: added a couple more types needed to bootstrap.
5852 2002-06-17 Miguel de Icaza <miguel@ximian.com>
5854 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
5855 constructor in the type, instead of any constructor in the type
5856 hierarchy. Thanks to Paolo for finding this bug (it showed up as
5857 a bug in the Mono runtime when applying the params attribute).
5859 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
5860 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
5862 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
5864 * expression.cs (Unary.ResolveOperator): Use TypeManager
5865 to resolve the type.
5867 2002-06-13 Ravi Pratap <ravi@ximian.com>
5869 * cs-parser.jay (enum_member_declaration): Pass in the attributes
5872 * enum.cs (AddEnumMember): Add support to store the attributes associated
5873 with each member too.
5875 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
5876 field builders too - this takes care of the enum member case.
5878 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
5880 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
5881 address-of operator on both value types and pointers.
5883 2002-06-10 Martin Baulig <martin@gnome.org>
5885 * interface.cs (Interface.PopulateIndexer): Add the indexer's
5886 PropertyBuilder to the `property_builders' list.
5888 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
5889 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
5890 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
5891 find any indexers which are inherited from an interface.
5893 2002-06-09 Martin Baulig <martin@gnome.org>
5895 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
5896 the same type as the constant if necessary. There's also a test-130.cs
5899 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
5901 * typemanager.cs (TypeManager.ChangeType): Previously known as
5902 Enum.ChangeEnumType().
5904 2002-06-09 Martin Baulig <martin@gnome.org>
5906 * expression.cs (Cast.TryReduce): Added support for consts.
5908 2002-06-08 Ravi Pratap <ravi@ximian.com>
5910 * class.cs (Accessor): Hold attributes information so we can pass
5913 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
5914 Modify to pass in attributes attached to the methods.
5916 (add_accessor_declaration, remove_accessor_declaration): Ditto.
5918 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
5919 to handle the Accessor kind :-)
5921 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
5923 2002-06-08 Martin Baulig <martin@gnome.org>
5925 * expression.cs (Unary.TryReduceNegative): Added support for
5928 2002-06-08 Martin Baulig <martin@gnome.org>
5930 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
5931 name can't be found in the `defined_names' - the caller will do a
5932 MemberLookup in this case and thus find methods in System.Enum
5933 such as Enum.IsDefined().
5935 2002-06-08 Martin Baulig <martin@gnome.org>
5937 * enum.cs (Enum.ChangeEnumType): This is a custom version of
5938 Convert.ChangeType() which works with TypeBuilder created types.
5939 (Enum.LookupEnumValue, Enum.Define): Use it here.
5941 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
5942 `TypeBuilder.BaseType != null' check.
5943 (TypeContainer.FindMembers): Only lookup parent members if we
5944 actually have a parent.
5945 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
5946 (ConstructorInitializer.Resolve): Likewise.
5948 * interface.cs (Interface.FindMembers): Added
5949 `TypeBuilder.BaseType != null' check.
5951 * rootcontext.cs (RootContext.ResolveCore): Added
5952 "System.Runtime.CompilerServices.IndexerNameAttribute" to
5953 classes_second_stage.
5955 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
5956 debug_type and trace_type when compiling with --nostdlib.
5958 2002-06-07 Martin Baulig <martin@gnome.org>
5960 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
5961 (AddField): Set it to true when adding a non-static field.
5962 (DefineType): Use `have_nonstatic_fields' to find out whether we
5963 have non-static fields, not `Fields != null'.
5965 2002-06-02 Miguel de Icaza <miguel@ximian.com>
5967 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
5968 dereferencing a null on the static-field code path)
5970 2002-05-30 Martin Baulig <martin@gnome.org>
5972 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
5973 to take command line arguments. Use reflection to call the new
5974 custom `Initialize' function on the symbol writer and pass it the
5975 command line arguments.
5977 * driver.cs (--debug-args): New command line argument to pass command
5978 line arguments to the symbol writer.
5980 2002-05-28 Miguel de Icaza <miguel@ximian.com>
5982 * assign.cs (DoResolve): Forgot to do the implicit conversion to
5983 the target type for indexers and properties. Thanks to Joe for
5986 2002-05-27 Miguel de Icaza <miguel@ximian.com>
5988 * typemanager.cs (MethodFlags): returns the method flags
5989 (Obsolete/ShouldIgnore) that control warning emission and whether
5990 the invocation should be made, or ignored.
5992 * expression.cs (Invocation.Emit): Remove previous hack, we should
5993 not do this on matching a base type, we should do this based on an attribute
5995 Only emit calls to System.Diagnostics.Debug and
5996 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
5997 on the command line.
5999 * rootcontext.cs: Global settings for tracing and debugging.
6001 * cs-tokenizer.cs (define): New utility function to track
6002 defines. Set the global settings for TRACE and DEBUG if found.
6004 2002-05-25 Ravi Pratap <ravi@ximian.com>
6006 * interface.cs (Populate*): Pass in the TypeContainer as well as
6007 the DeclSpace as parameters so that we can create EmitContexts and
6008 then use that to apply attributes etc.
6010 (PopulateMethod, PopulateEvent, PopulateProperty)
6011 (PopulateIndexer): Apply attributes everywhere.
6013 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
6016 (ApplyAttributes): Update accordingly.
6018 We now apply interface attributes for all members too.
6020 2002-05-26 Miguel de Icaza <miguel@ximian.com>
6022 * class.cs (Indexer.Define); Correctly check if we are explicit
6023 implementation (instead of checking the Name for a ".", we
6024 directly look up if the InterfaceType was specified).
6026 Delay the creation of the PropertyBuilder.
6028 Only create the PropertyBuilder if we are not an explicit
6029 interface implementation. This means that explicit interface
6030 implementation members do not participate in regular function
6031 lookups, and hence fixes another major ambiguity problem in
6032 overload resolution (that was the visible effect).
6034 (DefineMethod): Return whether we are doing an interface
6037 * typemanager.cs: Temporary hack until we get attributes in
6038 interfaces (Ravi is working on that) and we get IndexerName
6039 support in interfaces.
6041 * interface.cs: Register the indexers as properties.
6043 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
6044 warning, I have verified that this is a bug in the .NET runtime
6045 (JavaScript suffers of the same problem).
6047 * typemanager.cs (MemberLookup): When looking up members for
6048 interfaces, the parent of an interface is the implicit
6049 System.Object (so we succeed in searches of Object methods in an
6050 interface method invocation. Example: IEnumerable x; x.ToString
6053 2002-05-25 Miguel de Icaza <miguel@ximian.com>
6055 * class.cs (Event): Events should also register if they do
6056 implement the methods that an interface requires.
6058 * typemanager.cs (MemberLookup); use the new GetInterfaces
6061 (GetInterfaces): The code used to lookup interfaces for a type is
6062 used in more than one place, factor it here.
6064 * driver.cs: Track the errors at the bottom of the file, we kept
6067 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
6068 instance if the method we are calling is static!
6070 2002-05-24 Miguel de Icaza <miguel@ximian.com>
6072 * attribute.cs (ApplyAttributes): Make this function filter out
6073 the IndexerName attribute (as that attribute in reality is never
6074 applied) and return the string constant for the IndexerName
6077 * class.cs (TypeContainer.Emit): Validate that all the indexers
6078 have the same IndexerName attribute, and if so, set the
6079 DefaultName attribute on the class.
6081 * typemanager.cs: The return value might contain other stuff (not
6082 only methods). For instance, consider a method with an "Item"
6083 property and an Item method.
6085 * class.cs: If there is a problem with the parameter types,
6088 2002-05-24 Ravi Pratap <ravi@ximian.com>
6090 * ecore.cs (ImplicitConversionExists): Wrapper function which also
6091 looks at user defined conversion after making a call to
6092 StandardConversionExists - we need this for overload resolution.
6094 * expression.cs : Update accordingly the various method calls.
6096 This fixes 2 bugs filed against implicit user defined conversions
6098 2002-05-22 Miguel de Icaza <miguel@ximian.com>
6100 * statement.cs: Track the result of the assignment.
6102 2002-05-21 Miguel de Icaza <miguel@ximian.com>
6104 * expression.cs (MemberAccess): Improved error reporting for
6105 inaccessible members.
6107 2002-05-22 Martin Baulig <martin@gnome.org>
6109 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
6110 itself with debugging support.
6112 2002-05-22 Martin Baulig <martin@gnome.org>
6114 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
6115 Removed, this isn't needed anymore.
6117 2002-05-20 Martin Baulig <martin@gnome.org>
6119 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
6120 be underlying type for an enum.
6122 2002-05-20 Miguel de Icaza <miguel@ximian.com>
6124 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
6125 that splits out the loading of just the core types.
6127 * rootcontext.cs (ResolveCore): Split the struct resolution in
6128 two, so we can load the enumeration underlying types before any
6131 * expression.cs (Is): Bandaid until we fix properly Switch (see
6132 bug #24985 for details).
6134 * typemanager.cs (ImplementsInterface): The hashtable will contain
6135 a null if there are no interfaces implemented.
6137 2002-05-18 Miguel de Icaza <miguel@ximian.com>
6139 * cs-parser.jay (indexer_declarator): It is fine to have array
6142 2002-05-17 Miguel de Icaza <miguel@ximian.com>
6144 * typemanager.cs: (RegisterBuilder): New function used to register
6145 TypeBuilders that implement interfaces. Since
6146 TypeBuilder.GetInterfaces (as usual) does not work with lame
6148 (AddUserType): register interfaces.
6150 (ImplementsInterface): Use the builder_to_ifaces hash if we are
6151 dealing with TypeBuilder. Also, arrays are showing up as
6152 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
6153 methods can not be invoked on them!
6155 * ecore.cs (ExplicitReferenceConversionExists): Made public.
6156 (ImplicitReferenceConversionExists): Split out from
6157 StandardConversionExists.
6159 * expression.cs (As): We were only implementing one of the three
6160 cases for the as operator. We now implement them all.
6161 (Is): Implement the various other cases for Is as well.
6163 * typemanager.cs (CACHE): New define used to control if we want or
6164 not the FindMembers cache. Seems to have a negative impact on
6165 performance currently
6167 (MemberLookup): Nested types have full acess to
6168 enclosing type members
6170 Remove code that coped with instance/static returns for events, we
6171 now catch this in RealFindMembers.
6173 (RealFindMembers): only perform static lookup if the instance
6174 lookup did not return a type or an event.
6176 2002-05-17 Miguel de Icaza <miguel@ximian.com>
6178 * assign.cs (CompoundAssign): We pass more semantic information
6179 now to Compound Assignments than we did before: now we have all
6180 the information at hand, and now we resolve the target *before* we
6181 do the expression expansion, which allows the "CacheValue" method
6182 to have the effect we intended (before, a [x] += 1 would generate
6183 two differen ArrayAccess expressions from the ElementAccess,
6184 during the resolution process).
6186 (CompoundAssign.DoResolve): Resolve target and original_source here.
6188 2002-05-16 Miguel de Icaza <miguel@ximian.com>
6190 * expression.cs (ArrayAccess): dropped debugging information.
6192 * typemanager.cs: Small bug fix: I was always returning i_members,
6193 instead of one of i_members or s_members (depending on which had
6196 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
6197 method is invoked before any code generation takes place, and it
6198 is a mechanism to inform that the expression will be invoked more
6199 than once, and that the method should use temporary values to
6200 avoid having side effects
6202 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
6204 * ecore.cs (Expression.CacheTemporaries): Provide empty default
6207 * expression.cs (Indirection, ArrayAccess): Add support for
6208 CacheTemporaries in these two bad boys.
6210 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
6212 (StoreFromPtr): Handle stobj as well.
6214 * expression.cs (UnaryMutator): Share more code.
6216 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
6217 down: I was not tracking the Filter function as well, which
6218 was affecting the results of the cache.
6220 2002-05-15 Miguel de Icaza <miguel@ximian.com>
6222 * attribute.cs: Remove the hack to handle the CharSet property on
6225 2002-05-14 Miguel de Icaza <miguel@ximian.com>
6227 * attribute.cs (DoResolve): More uglyness, we now only try to
6228 resolve the attribute partially, to extract the CharSet
6229 information (only if we are a StructLayout attribute). Otherwise
6231 (GetExtraTypeInfo): Add some code to conditionally kill in the
6232 future this. I am more and more convinced that the .NET
6233 framework has special code to handle the attribute setting on
6236 * expression.cs (IsParamsMethodApplicable): Revert my previous
6237 foreach change here, it was wrong.
6239 2002-05-13 Miguel de Icaza <miguel@ximian.com>
6241 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
6242 (pp_expr): do not abort on unknown input, just return.
6243 (eval): abort if there are pending chars.
6245 * attribute.cs (Attribute.Resolve): Positional parameters are
6246 optional. Deal with that case.
6248 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
6249 the Ansi/Unicode/Auto information for the type.
6251 (TypeContainer.DefineType): instantiate the EmitContext here, as
6252 we will be using it during the type definition (to resolve
6253 attributes) and during the emit phase.
6255 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
6256 to pull type information out of the attributes
6258 (Attribute.Resolve): track the constructor builder, and allow for
6259 multiple invocations (structs and classes will use this).
6261 * ecore.cs (MemberLookupFinal): new version with all the
6262 parameters customizable.
6264 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
6265 constructors. Return if the result value is null (as the error
6266 would have been flagged already by MemberLookupFinal)
6268 Do not allow instances of abstract classes or interfaces to be
6271 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
6272 We have to compare the assembly property here when dealing with
6273 FamANDAssem and Assembly access modifiers, because we might be
6274 creating an assembly from *modules* (that means that we are not
6275 getting TypeBuilders for types defined in other modules that are
6276 part of this assembly).
6278 (Method.Emit): If the method is marked abstract and has a body,
6281 (TypeContainer.DefineMembers): If both the defined member and the
6282 parent name match are methods, then do not emit any warnings: let
6283 the Method.Define routine take care of flagging warnings. But if
6284 there is a mismatch (method overrides something else, or method is
6285 overriwritten by something, then emit warning).
6287 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
6288 set to null, this means `do not check for the return type on the
6291 (Method.Define): set the return type for the method signature to
6292 null, so that we get methods with the same name and parameters and
6293 different return types. This is used to flag warning 114 (you are
6294 hiding a method, and you probably want to use the new/override
6297 * typemanager.cs (MemberLookup): Implemented proper access
6298 control, closing a long standing set of bug reports. The problem
6299 was that the Framework only has two bits: Public and NonPublic,
6300 and NonPublic includes private and protected methods, but we need
6301 to enforce the FamANDAssem, FamOrAssem and Family.
6303 2002-05-11 Miguel de Icaza <miguel@ximian.com>
6305 * statement.cs (GotoCase): Return true: Ammounts to giving up
6306 knowledge on whether we return or not, and letting the other case
6307 be responsible for it.
6309 2002-05-10 Miguel de Icaza <miguel@ximian.com>
6311 * driver.cs: Do not load directories for each file processed, only
6312 do it if there is a pattern.
6314 * ecore.cs: Report readonly assigns here as well, as we might have
6315 been resolved only by MemberAccess.
6317 (SimpleName.SimpleNameResolve): Also be useful for LValue
6318 resolution. We need this to propagate assign to local readonly variables
6320 * typemanager.cs: Use a ptrhashtable for the criteria, because we
6321 do not want to reuse potential criteria memory.
6323 * class.cs (MyEventBuilder): Set reflected_type;
6325 * ecore.cs (Constantify): Added support for constifying bools.
6327 (RootContext.LookupType): Added a cache for values looked up in
6328 the declaration space.
6330 * typemanager.cs (FindMembers): Now is a front-end to
6331 RealFindMembers, and provides a two-level hashtable-based cache to
6334 15% performance improvement: from 22.5 to 19.2 seconds.
6336 * expression.cs (IsParamsMethodApplicable): use foreach.
6337 (Invocation.DoResolve): ditto.
6338 (New.DoResolve): ditto.
6339 (ArrayCreation.DoResolve): ditto.
6341 * ecore.cs (FindMostEncompassingType): use foreach.
6343 * delegate.cs (NewDelegate.DoResolve): Use foreach
6345 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
6346 (RemoveMethods): use foreach.
6348 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
6349 nested foreach statements instead of for, and also break out of
6350 the inner loop once a match is found.
6352 (Invocation.OverloadResolve): Use foreach, simplify the code.
6354 2002-05-08 Miguel de Icaza <miguel@ximian.com>
6356 * cfold.cs (BinaryFold): During an enumeration evaluation context,
6357 we actually unwrap the expression to allow for extra information
6360 * expression.cs: Use Shr_Un on unsigned operations.
6362 2002-05-08 Ravi Pratap <ravi@ximian.com>
6364 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
6365 applicable operators was not being considered correctly. This closes
6366 the bug Miguel reported.
6368 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
6370 * attribute.cs: check that the type derives from System.Attribute
6371 and report the correct error in that case (moved the duplicate code to
6372 its own method, too).
6374 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
6376 * attribute.cs: lookup attribute type name as the spec says: first the
6377 bare attribute name and then name + "Attribute" (nant compiles with
6378 mcs after this fix).
6380 2002-05-07 Miguel de Icaza <miguel@ximian.com>
6382 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
6383 Because of the way we parse things, we should try to see if a
6384 UIntConstant can fit in an integer.
6386 2002-05-07 Ravi Pratap <ravi@ximian.com>
6388 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
6389 when we are in an explicit context.
6391 (ConvertReferenceExplicit): When converting from Iface type S to Class
6392 T make sure the rules are implemented as an OR.
6394 * parameter.cs (ParameterType): Make it a property for now although the
6395 purpose really isn't anything immediate.
6397 * expression.cs (Is*Applicable): Do better checking on the parameter type
6398 of a ref/out parameter. The ones from the system assemblies are already
6399 marked with the correct type so we don't need to do any correction.
6401 * ecore.cs (StandardConversionExists): Conversion from Interface types to
6402 the object type is standard too so include that.
6404 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6406 * ecore.cs (StandardConversionExists): Augment with missing code:
6407 deal with IntConstant, LongConstants and Enumerations.
6409 * assign.cs: Report the error, instead of failing silently
6411 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
6412 typecontainer that they are declared, because the
6413 typecontainer/namespace will have the list of using clauses that
6416 Assembly Attributes were escaping the normal registration
6419 (EmitCode): Apply attributes within an EmitContext that represents
6420 the container they were declared on.
6422 * cs-parser.jay: Track bases for structs. How did I get this wrong?
6424 2002-05-06 Ravi Pratap <ravi@ximian.com>
6426 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
6427 Revamp completely - make much cleaner as we now operate only
6430 (FindMostSpecificSource, FindMostSpecificTarget): New methods
6431 to implement the logic detailed in the spec more correctly.
6433 (UserDefinedConversion): Update accordingly.
6435 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6437 * statement.cs: Return flow analysis information up.
6439 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
6442 (token): Do not consume an extra character before calling
6445 2002-05-06 Piers Haken <piersh@friskit.com>
6447 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
6449 2002-05-06 Miguel de Icaza <miguel@ximian.com>
6451 * class.cs (Constructor.Emit): Set the IsStatic flag in the
6452 EmitContext during the instance constructor initializer
6453 resolution, to stop access to instance variables.
6455 This is mandated by the spec, last paragraph of the `constructor
6456 initializers' section.
6458 2002-05-05 Miguel de Icaza <miguel@ximian.com>
6460 * cs-parser.jay, class.cs (Accessor): new class used to represent
6461 an accessor (get or set). In the past we used `null' to represent
6462 a missing accessor. But this is ambiguous because there was no
6463 way to tell in abstract indexers/properties if one of them was
6466 Now there is a way of addressing that.
6468 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
6469 instead of FindMembers.
6471 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
6472 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
6474 * attribute.cs: Treat indexers and properties as the same in terms
6475 of applying attributes
6477 * ecore.cs (FindMostEncompassedType): Use statically initialized
6478 EmptyExpressions()s like we do elsewhere to avoid creating useless
6479 objects (and we take this out of the tight loop).
6481 (GetConversionOperators): Move the code to extract the actual
6482 operators to a separate routine to clean things up.
6484 2002-05-04 Miguel de Icaza <miguel@ximian.com>
6486 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
6487 events are always registered FieldBuilders.
6489 * class.cs (FieldBase): New class shared by Fields
6491 * delegate.cs: If we are a toplevel delegate, use our full name.
6492 If we are a nested delegate, then only use our tail name.
6494 2002-05-02 Ravi Pratap <ravi@ximian.com>
6496 * expression.cs (IsApplicable): Ensure that we add the "&" to
6497 ref/out types before comparing it with the type of the argument.
6499 (IsParamsMethodApplicable): Ditto.
6501 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
6504 * delegate.cs : Handle the case when we have more than one applicable
6505 method. Flag an error only when we finish checking all.
6507 2002-05-02 Miguel de Icaza <miguel@ximian.com>
6509 * expression.cs: Add support for boolean static initializers.
6511 2002-05-01 Miguel de Icaza <miguel@ximian.com>
6513 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
6515 * parameter.cs (ComputeParameterTypes,
6516 ComputeAndDefineParameterTypes): Better error handling: now we
6517 clear the `types' cache if we fail during any of the type lookups.
6518 We also return the status code correctly to our caller
6520 * delegate.cs: If we fail to define a delegate, abort the extra
6523 * expression.cs (Binary.ResolveOperator): for
6524 operator==(object,object) and operator !=(object, object) we also
6525 have to verify that there is an implicit conversion from one to
6528 (ArrayAccess.DoResolve): Array Access can operate on
6531 2002-04-30 Miguel de Icaza <miguel@ximian.com>
6533 * assign.cs (CompoundAssign): A new class used as a "flag" that
6534 the assignment actually is happening as part of a compound
6535 assignment operator.
6537 During compound assignment, a few new rules exist to enable things
6544 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
6545 to the type of x) if y is implicitly convertible to the type of x,
6546 and the operator is a builtin operator and the return type of the
6547 operator is explicitly convertible to the type of x.
6549 * rootcontext.cs: Reset warning level to 2. 4 catches various
6550 "interesting" features in mcs, we must clean this up at some
6551 point, but currently am trying to kill other bugs ;-)
6553 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
6554 in container classes as well.
6556 * expression.cs (Binary.ResolveOperator): Handle string case
6557 before anything else (as operator overloading does emit an error
6558 before doing anything else).
6560 This code could go away when we move to a table driven model, but
6561 i could not come up with a good plan last night.
6563 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
6565 * typemanager.cs (CSharpName): reimplementation using regex.
6566 * class.cs: added null check for fields in Emit
6567 * rootcontext.cs: set warninglevel to 4
6569 2002-04-29 Miguel de Icaza <miguel@ximian.com>
6571 * typemanager.cs (CSharpName): reimplemented with Lupus
6574 2002-04-28 Miguel de Icaza <miguel@ximian.com>
6576 * statement.cs (If): correclty implement Resolve, because we were
6577 not catching sem errors in there. The same process is needed
6579 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
6582 (Statement.Warning_DeadCodeFound): Factorize code.
6583 (While): Report dead code here too.
6585 (Statement): Added Resolve virtual method to allow
6586 for resolution split from the emit code.
6588 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6590 * statement.cs (EmitBoolExpression): No longer try to resolve the
6592 (MakeBoolean): New utility function that resolve, implicitly
6593 converts to boolean and tags the expression.
6596 (If, Do): Implement dead code elimination.
6597 (While): Implement loop inversion
6599 (Do, While, For, If): Resolve the expression prior to calling our
6602 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
6605 - added method Report28 (warning: program has more than one entry point)
6606 - added method IsEntryPoint, implements paragraph 10.1 of the spec
6607 - modified method Method.Define, the part at the end of the method
6609 * rootcontext.cs: added static public Location EntryPointLocation;
6611 * ../errors/cs0028.cs : Add test case for the above warning.
6614 - modified method CSharpName to allow arrays of primitive type to
6615 be printed nicely (e.g. instead of System.Int32[][] it now prints
6617 - added method CSharpSignature: returns the signature of a method
6618 in string format to be used in reporting errors, warnings, etc.
6620 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
6623 2002-04-26 Ravi Pratap <ravi@ximian.com>
6625 * delegate.cs (Define): Fix extremely silly bug where I was
6626 setting the type of the 'object' parameter of the BeginInvoke
6627 method to System.IAsyncResult instead of System.Object ;-)
6629 2002-04-26 Miguel de Icaza <miguel@ximian.com>
6631 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
6634 (Constructor.Emit): return if we fail to initialize the
6635 constructor. Another door closed!
6637 * expression.cs (New.DoResolve): Improve error message (from -6 to
6638 1501). Use DeclaredOnly lookup to find the exact constructor.
6640 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
6641 loop. This is useful.
6643 * cs-parser.jay: Adjust the default parameters so that destructors
6644 have the proper signature.
6646 2002-04-26 Martin Baulig <martin@gnome.org>
6648 * driver.cs (LoadAssembly): If `assembly' contains any characters
6649 which are only valid in path names and not in assembly names
6650 (currently slash, backslash and point), use Assembly.LoadFrom ()
6651 instead of Assembly.Load () on the `assembly' (before iteration
6652 over the link_paths).
6654 2002-04-26 Martin Baulig <martin@gnome.org>
6656 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
6658 2002-04-25 Miguel de Icaza <miguel@ximian.com>
6660 * class.cs (Property): use the new typemanager.MemberLookup
6662 (TypeContainer.MemberLookup): Implement using the
6663 TypeManager.MemberLookup now.
6665 * typemanager.cs: Make MemberLookup a function of the TypeManager,
6666 and return MemberInfos, so that these can be used without an
6667 EmitContext (what we had before).
6669 2002-04-24 Miguel de Icaza <miguel@ximian.com>
6671 * expression.cs: Fix the case where the argument to params if the
6672 type of the params. I omitted handling this before. Fixed
6674 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6676 * driver.cs: Call BootCorlib_PopulateCoreType
6678 * class.cs (Property.CheckBase): Check for properties only, not
6681 * interface.cs: Temporary hack: try/catch around the
6682 CustomAttributeBuilder, because I am getting an exception that I
6685 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
6686 types whose definitions are required to be there (attributes are
6687 defined before standard types).
6689 Compute definitions as we boot the various types, as they are used
6690 immediately (value_type class will need object_type, but if we do
6691 not initialize object_type, we will pass a null, which will let
6692 the runtime pick the System.Object from the existing corlib, which
6693 is not what we want).
6695 2002-04-22 Patrik Torstensson <totte@labs2.com>
6697 * cs-tokenizer.cs: fixed a number of trim() issues.
6699 2002-04-22 Ravi Pratap <ravi@ximian.com>
6701 * expression.cs (Argument.Type): Ensure that we return the correct
6702 type when we have out or ref parameters [in which case we
6705 2002-04-22 Miguel de Icaza <miguel@ximian.com>
6707 * class.cs (Property, Indexer): Allow extern modifier in there.
6709 * typemanager.cs (InitBaseTypes): Initializes object_type and
6710 value_type, since those will be used early on during the bootstrap
6711 process to compile corlib.
6713 (InitCoreTypes): Move code from here to InitBaseTypes.
6715 2002-04-21 Miguel de Icaza <miguel@ximian.com>
6717 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
6718 single-dimension arrays as using the ldlen opcode.
6720 Daniel Lewis discovered this optimization.
6722 * typemanager.cs: Add signature for System.Array::get_Length
6724 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6726 * statement.cs: report the error when the foreach does not apply to an
6727 array nor a collection.
6729 2002-04-19 Miguel de Icaza <miguel@ximian.com>
6731 * expression.cs: Add implicit conversions to the operator ~.
6733 * constant.cs (DecimalConstant.Emit): Emit decimal value.
6735 * typemanager.cs: Locate the decimal constructor.
6737 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6739 * attribute.cs: use the new property of TypeOf.
6740 * expression.cs: added 'get' property around typearg.
6742 These changes fix a build breaker reported by NickD. Is this the
6743 correct way to fix? If not, please, revert my changes and make it
6746 2002-04-17 Miguel de Icaza <miguel@ximian.com>
6748 * attribute.cs: Add support for typeof in attribute invocations.
6749 I am not sure that this is right though.
6751 2002-04-14 Duncan Mak <duncan@ximian.com>
6753 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
6754 Binary.Operator.Division case.
6756 2002-04-13 Ravi Pratap <ravi@ximian.com>
6758 * class.cs (DefineType): Ensure that we do a proper check on
6759 attribute types and also register it with the TypeManager.
6761 (TypeContainer.Targets): The default for attribute types is
6762 AttributeTargets.All.
6764 * attribute.cs (ApplyAttributes): Registering the attribute type
6765 is done elsewhere, not when we discover we have a Usage attribute.
6767 2002-04-12 Ravi Pratap <ravi@ximian.com>
6769 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
6770 and get rid of is_delegate parameter.
6772 * everywhere : update.
6774 2002-04-12 Ravi Pratap <ravi@ximian.com>
6776 * cs-parser.jay (compilation_unit): Revamp completely to use
6777 some new ideas that I got from Rhys' grammar to solve the problems
6778 with assembly level attributes.
6780 (outer_declaration): New grammar production.
6782 (attribute_sections): Add.
6784 (opt_attributes): Base on attribute_sections
6786 (namespace_declaration): Allow opt_attributes to tackle the case
6787 when we have assembly level attributes - we are clever in this
6790 * attribute.cs (ApplyAttributes): Do not worry about assembly
6791 attributes in the non-global context.
6793 * rootcontext.cs (AddGlobalAttributes): Go back to using this
6794 instead of SetGlobalAttributes.
6796 * class.cs, rootcontext.cs : Ensure we define and generate
6797 attribute types before anything else.
6799 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
6800 and flag the new error -20 for the case when the attribute type
6801 does not have valid targets specified. csc does not catch this.
6803 * ../errors/errors.txt : update for error # -20
6805 2002-04-11 Ravi Pratap <ravi@ximian.com>
6807 * support.cs (InternalParameters.ParameterModifier): Do some null
6808 checking and return sane values.
6810 * class.cs (Method.Define): If we are a PInvoke method, ensure
6811 that we are static and extern. Report error # 601
6813 * ../errors/cs0601.cs : Add test case for the above error.
6815 2002-04-07 Ravi Pratap <ravi@ximian.com>
6817 * rootcontext.cs (attribute_types): We need to keep type of
6818 all attribute types separately and emit code for them first.
6820 (RegisterAttribute) : Implement.
6822 * class.cs (DefineType): Check if the current Type is a custom
6823 attribute type and register it accordingly.
6825 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
6826 adding the first attribute twice and rename to
6828 (SetGlobalAttributes): this.
6830 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
6833 * attribute.cs (ApplyAttributes): Take an additional argument telling us
6834 if we are processing global arguments. Hmm, I am unsure of this.
6836 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
6838 * expression.cs: added static array of strings to avoid calling
6839 Enum.ToString () for Operator in Binary. Significant recover of
6842 2002-04-10 Miguel de Icaza <miguel@ximian.com>
6844 * class.cs (FindMembers): Allow the Builders of the various
6845 members to be null. If they are skip them. This only happens
6846 during the PInvoke declaration.
6848 2002-04-09 Miguel de Icaza <miguel@ximian.com>
6850 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
6851 failure, so we do not keep going afterwards.
6853 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
6854 wanted to pass `false' as the `is_delegate' argument. If this is
6855 the case, why not use delegate_type == null to mean `is_delegate =
6856 false' and anything else as is_delegate = true.
6858 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
6860 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
6861 code for the section, not the beginning of the tests.
6863 2002-04-08 Miguel de Icaza <miguel@ximian.com>
6865 * cfold.cs: Handle operator + (Enum x, Underlying x)
6867 * expression.cs (Binary): same. Warn about errors where we have
6868 Enum/Enum in operator + as well.
6870 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
6873 - added support for switch(bool)
6874 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
6875 - add TableSwitchEmit() to handle table-based switch statements
6877 2002-04-05 Ravi Pratap <ravi@ximian.com>
6879 * expression.cs (Invocation.OverloadResolve): Factor out code which
6880 does parameter compatibility checking with arguments so that we can
6881 re-use the code even from Delegate.VerifyApplicability
6883 (VerifyArgumentsCompat): Move above code here.
6885 * delegate.cs (VerifyApplicability): Get rid of duplicate code
6886 and instead make a call to the above method.
6888 2002-03-31 Ravi Pratap <ravi@ximian.com>
6890 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
6891 We use it to keep track of classes which are attribute types.
6893 2002-04-02 Miguel de Icaza <miguel@ximian.com>
6895 * delegate.cs (Delegate.Define): Correctly define the types in the
6896 presence of fixed and array parameters.
6898 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
6901 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
6902 include NonPublic after the first iteration.
6904 * class.cs (Indexer.CheckBase): Only check if both parents are
6907 * cs-parser.jay (accessor_body): If empty, set to null.
6909 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
6910 same code path here to resolve constants names that we did have in
6911 MemberAccess.DoResolve. There is too much code duplicated here.
6913 2002-04-01 Miguel de Icaza <miguel@ximian.com>
6915 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
6917 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
6920 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
6921 tokens, numbers and strings.
6923 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
6926 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
6927 asyncronous parameters and the regular parameters.
6929 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
6930 specify the target directory.
6932 * expression.cs: (This.DoResolve): Simplify
6933 (As.Emit): Optimize, do not generate IsInst if the expression is
6934 always of the given type.
6936 (Is.DoResolve): Bug fix, we were reporting both always/never for
6939 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
6940 creating too many unnecessary arrays.
6942 2002-03-31 Miguel de Icaza <miguel@ximian.com>
6944 * class.cs (EmitFieldInitializer): Use Assign expression to assign
6945 fields instead of rolling our own initializer. Takes care of all
6946 implicit conversions, and drops unnecessary static checks/argument.
6948 2002-03-31 Dick Porter <dick@ximian.com>
6950 * driver.cs: use the GetDirectories() return values properly, and
6951 use "/" as path separator.
6953 2002-03-30 Miguel de Icaza <miguel@ximian.com>
6955 * expression.cs (Unary): Optimize - - expr into expr.
6956 (Binary): Optimize a + (-b) into a -b.
6958 * codegen.cs (CodeGen): Made all methods static.
6960 2002-03-29 Miguel de Icaza <miguel@ximian.com>
6964 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
6965 TypeBuilder property.
6967 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
6970 * tree.cs: Removed the various RecordXXXX, and replaced with a
6971 single RecordDecl. Removed all the accessor methods, and just
6972 left a single access point Type
6974 * enum.cs: Rename DefineEnum to DefineType.
6976 * decl.cs: New abstract method `DefineType' used to unify the
6977 Defines for Enumerations, Interfaces, TypeContainers and
6980 (FindType): Moved LookupInterfaceOrClass here. Moved the
6981 LookupBaseClasses method that used to live in class.cs and
6982 interface.cs here, and renamed to FindType.
6984 * delegate.cs: Implement DefineType. Take advantage of the
6985 refactored pattern for locating the parent builder without taking
6986 the parent_builder argument (which we know does not work if we are
6987 nested, and triggering a toplevel definition).
6989 2002-03-28 Miguel de Icaza <miguel@ximian.com>
6991 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
6992 accessibility of a member has changed during override and report
6995 * class.cs (Method.Define, Property.Define): Only complain on
6996 overrides if the method is private, any other accessibility is
6997 fine (and since we just checked the permission is the same, we are
7000 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
7001 and elif are processed always. The other pre-processing
7002 directives are only processed if we are "taking" the path
7004 2002-03-29 Martin Baulig <martin@gnome.org>
7006 * class.cs (Method.Emit): Only emit symbolic debugging info if the
7007 current location is not Null.
7009 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
7010 a separate method so we can profile it.
7012 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
7013 `span.Seconds' are just seconds, but no minutes or hours.
7014 (MainDriver): Profile the CodeGen.SaveSymbols calls.
7016 2002-03-28 Miguel de Icaza <miguel@ximian.com>
7018 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
7019 Remove the gratuitous set of Final:
7021 // If an interface implementation, then we can set Final.
7022 if (((flags & MethodAttributes.Abstract) == 0) &&
7023 implementing.DeclaringType.IsInterface)
7024 flags |= MethodAttributes.Final;
7026 I do not know what I was smoking when I used that.
7029 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
7030 step into fixing the name resolution issues for delegates and
7031 unifying the toplevel name resolution.
7033 2002-03-28 Martin Baulig <martin@gnome.org>
7035 * class.cs (Method.Emit): If we have a symbol writer, call its
7036 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
7037 tell it about the current method.
7039 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
7040 writer that we're going to emit the first byte of IL code for a new
7041 statement (a new source line).
7042 (EmitContext.EmitTopBlock): If we have a symbol writer, call
7043 EmitContext.Mark() before emitting any code.
7045 * location.cs (SymbolDocument): Return null when we're Null.
7047 * statement.cs (Statement): Moved the `Location loc' variable here.
7048 (Statement.EmitBoolExpression): If we have a symbol writer, call
7049 ec.Mark() before emitting any code to tell it that we're at the
7050 beginning of a new statement.
7051 (StatementExpression): Added `Location' argument to the constructor.
7052 (Block): Added public readonly variable `StartLocation' and public
7053 variable `EndLocation'. The latter is to be set using SetEndLocation().
7054 (Block): Added constructor which takes a start and end location.
7055 (Block.SetEndLocation): New method. This sets the end location.
7056 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
7057 local variables we create.
7058 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
7059 each statement and do also mark the begin and end of the block.
7061 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
7062 tell it the current lexer.Location, use Location.Null for the end of the
7064 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
7065 current block, set its end location using SetEndLocation().
7066 (statement_expression): StatementExpression constructor now takes the
7067 lexer.Location as additional argument.
7068 (for_statement, declare_local_variables): Likewise.
7069 (declare_local_variables): When creating a new implicit block, use the
7070 new Block constructor and pass it the lexer.Location.
7072 2002-03-28 Miguel de Icaza <miguel@ximian.com>
7074 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
7075 members also on the parent interfaces recursively.
7077 2002-03-27 Miguel de Icaza <miguel@ximian.com>
7079 * report.cs: Use new formats, since Gonzalo finished the missing
7082 * expression.cs (Binary.ResolveOperator): added missing operator|
7083 operator& and operator^ for bool/bool.
7085 * cs-parser.jay: CheckDef now takes a Location argument that is
7086 used to report errors more precisly (instead of reporting the end
7087 of a definition, we try to track something which is a lot closer
7088 to the source of the problem).
7090 * cs-tokenizer.cs: Track global token use, so we can properly flag
7091 the use of #define/#undef after the first token has been seen.
7093 Also, rename the reportXXXX to Error_DescriptiveName
7095 * decl.cs (DeclSpace.IsTopLevel): Move property here from
7096 TypeContainer, so that Enum and Interface can use this too.
7098 * class.cs (TypeContainer.LookupInterfaceOrClass,
7099 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
7100 `builder' argument. Typically this was used to pass the parent
7101 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
7104 The problem is that a nested class could trigger the definition of
7105 a toplevel class, and the builder would be obviously wrong in that
7108 So we drop this argument, and we compute dynamically the
7109 TypeBuilder/ModuleBuilder (the correct information was available
7110 to us anyways from DeclSpace.Parent)
7112 * interface.cs (Interface.DefineInterface): Drop builder
7113 parameter cleanup like class.cs
7115 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
7118 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
7121 (Try.Emit): Propagate the returns value from the statement.
7123 (Return.Emit): Even if we are leavning
7125 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
7127 * modifiers.cs: Fix the computation of MethodAttributes flags.
7129 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
7131 * driver.cs: allow compilation of files that start with '/'.
7132 Add a default case when checking the argument of --target.
7134 2002-03-25 Miguel de Icaza <miguel@ximian.com>
7136 * interface.cs: Implement the same search algorithm for types in
7139 * delegate.cs: Do not allow multiple definition.
7141 * Recovered ChangeLog that got accidentally amputated
7143 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
7145 * rootcontext.cs: Load manually enum to allow core classes to
7146 contain enumerations.
7148 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
7149 Update to new static methods in TypeManager.
7151 * typemanager.cs (GetMethod, GetConstructor): Use our
7152 implementation of FindMembers to find the members, since during
7153 corlib compilation, the types are TypeBuilders and GetMethod and
7154 GetConstructor do not work.
7156 Make all methods in TypeManager static.
7158 (InitCodeHelpers): Split the functionality from
7159 the InitCodeTypes function.
7161 * driver.cs: Call InitCodeHelpers after we have populated the
7164 * cs-parser.jay (delegate_declaration): we did not used to compute
7165 the delegate name correctly for void delegates.
7167 2002-03-24 Miguel de Icaza <miguel@ximian.com>
7169 * rootcontext.cs (RootContext): Init the interface_resolve_order
7170 and type_container_resolve_order always.
7172 (ResolveCore, BootstrapCorlib_ResolveClass,
7173 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
7174 compiler when compiling with --nostdlib
7176 * class.cs (TypeContainer.DefineType): Check that our parent is
7177 not null. This test is most important when we are bootstraping
7180 * codegen.cs: Split out the symbol writing code.
7182 2002-03-25 Martin Baulig <martin@gnome.org>
7184 * driver.cs (-g): Made -g an alias for --debug.
7186 2002-03-24 Martin Baulig <martin@gnome.org>
7188 * codegen.cs (SymbolWriter): New public variable. Returns the
7189 current symbol writer.
7190 (CodeGen): Added `bool want_debugging_support' argument to the
7191 constructor. If true, tell the ModuleBuild that we want debugging
7192 support and ask it for the ISymbolWriter.
7193 (Save): If we have a symbol writer, call it's Close() method after
7194 saving the assembly.
7196 * driver.c (--debug): New command line argument to create a
7197 debugger information file.
7199 * location.cs (SymbolDocument): New public property. Returns an
7200 ISymbolDocumentWriter object for the current source file or null
7201 if we don't have a symbol writer.
7203 2002-03-21 Miguel de Icaza <miguel@ximian.com>
7205 * driver.cs (LoadAssembly): Correctly return when all the paths
7206 have been tried and not before.
7208 * statement.cs (Switch.Emit): return the actual coverage for this
7209 statement (returns/not-returns)
7211 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
7212 switch of the statement if we are the last switch section. That
7213 kills two problems: try/catch problems (we used to emit an empty
7214 nop at the end) and switch statements where all branches would
7217 2002-03-19 Miguel de Icaza <miguel@ximian.com>
7219 * driver.cs: Add default assemblies (the equivalent to the
7220 Microsoft CSC.RSP file)
7222 * cs-tokenizer.cs: When updating `cols and setting it to zero,
7223 also update tokens_seen and set it to false.
7225 * driver.cs: Implement --recurse for Mike.
7227 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
7228 correctly splitting out the paths.
7230 2002-03-18 Miguel de Icaza <miguel@ximian.com>
7232 * interface.cs (Interface.PopulateProperty): Instead of using
7233 `parent' as the declaration space for the set parameters, use
7236 * support.cs (InternalParameters): InternalParameters constructor
7237 takes a DeclSpace instead of a TypeContainer.
7239 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
7240 types are being initialized, load the address of it before calling
7243 (New): Provide a mechanism to disable the generation of local
7244 value type temporaries when the caller will be providing us with
7245 an address to store it.
7247 (ArrayCreation.EmitDynamicInitializers): Use it.
7249 2002-03-17 Miguel de Icaza <miguel@ximian.com>
7251 * expression.cs (Invocation.EmitArguments): Only probe for array
7252 property if there is more than one argument. Sorry about that.
7254 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
7257 * class.cs (Method.LabelParameters): Fix incorrect code path that
7258 prevented the `ParamArrayAttribute' from being applied to the
7261 2002-03-16 Miguel de Icaza <miguel@ximian.com>
7263 * support.cs (ReflectionParameters): Correctly compute whether the
7264 last argument is a params array. Fixes the problem with
7267 * typemanager.cs: Make the assemblies array always be non-null
7268 (empty, but non-null)
7270 * tree.cs (RecordDecl): New function that abstracts the recording
7271 of names. This reports error 101, and provides a pointer to the
7272 previous declaration. Fixes a crash in the compiler.
7274 * cs-parser.jay (constructor_declaration): Update to new grammar,
7275 and provide a constructor_body that can be empty.
7277 2002-03-15 Miguel de Icaza <miguel@ximian.com>
7279 * driver.cs: Add support for --resources.
7281 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
7282 Make all types for the various array helper methods be integer.
7284 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
7285 CheckState to ConvCast.
7287 (ConvCast): Now it takes a `checked' state argument, to avoid
7288 depending on the emit context for the conversion, and just using
7289 the resolve time setting.
7291 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
7292 instead of Invocation.EmitArguments. We do not emit the original
7293 arguments, instead we emit those which have been converted to
7294 unsigned int expressions.
7296 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
7298 * codegen.cs: ditto.
7300 * expression.cs (LocalVariableReference): Drop the use of the
7301 Store function that depended on the variable index.
7303 * statement.cs (VariableInfo): Drop the `Idx' property from this
7304 class, as this is not taking into account the indexes for
7305 temporaries tat we generate during the execution, getting the
7308 * class.cs: First emit class initializers, then call the parent
7311 * expression.cs (Binary): Fix opcode emision.
7312 (UnaryMutator.EmitCode): Support checked code generation
7314 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
7315 matches for events for both the Static and Instance scans,
7316 pointing to the same element. Fix that.
7318 2002-03-14 Miguel de Icaza <miguel@ximian.com>
7320 * rootcontext.cs (ResolveTree): Always set the
7321 interface_resolve_order, because nested interfaces will be calling
7324 * class.cs (GetInterfaceOrClass): Track the same resolution
7325 process used by TypeManager.LookupType. This fixes the nested
7326 type lookups in class declarations (separate path from
7329 (TypeContainer.DefineType): Also define nested interfaces.
7330 (TypeContainer.RegisterOrder): New public function used to
7331 register the order in which child interfaces need to be closed.
7333 Nested interfaces need to be closed after their parents have been
7336 * interface.cs (InterfaceAttr): Put all the logic for computing
7337 the interface attribute here.
7339 (DefineInterface): Register our interface order with the
7340 RootContext or with the TypeContainer depending on the case.
7342 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7344 * cs-parser.jay: rework foreach statement to work with the new
7345 changes to the policy on SimpleNames.
7347 * report.cs: support Stacktrace on warnings as well.
7349 * makefile: drop --unsafe and /unsafe from the compile.
7351 2002-03-13 Ravi Pratap <ravi@ximian.com>
7353 * ecore.cs (StandardConversionExists): Modify to take an Expression
7354 as the first parameter. Ensure we do null -> reference type conversion
7357 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
7358 temporary Expression objects.
7360 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
7362 * interface.cs: workaround bug in method overloading resolution
7363 (there is already a bugzilla bug for it).
7365 2002-03-12 Miguel de Icaza <miguel@ximian.com>
7367 We could also solve this problem by having a separate path for
7368 performing type lookups, instead of DoResolve, we could have a
7369 ResolveType entry point, and only participating pieces of the
7370 production (simplename, deref, array) would implement this.
7372 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
7373 signal SimpleName to only resolve type names and not attempt to
7374 resolve anything else.
7376 * expression.cs (Cast): Set the flag.
7378 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
7380 * class.cs: Only report 108 if there is no `new' modifier.
7382 * cs-parser.jay: rework foreach statement to work with the new
7383 changes to the policy on SimpleNames.
7385 * report.cs: support Stacktrace on warnings as well.
7387 * makefile: drop --unsafe and /unsafe from the compile.
7389 2002-03-11 Miguel de Icaza <miguel@ximian.com>
7391 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7392 lookups here, instead of doing that at parse time. This means
7393 that our grammar will not introduce `LocalVariableReferences' as
7394 expressions at this point. That solves the problem of code like
7402 This is only half the fix. The full fix requires parameters to
7403 also be handled in this way.
7405 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
7406 makes the use more obvious of the DeclSpace. The
7407 ec.TypeContainer.TypeBuilder is now only used to pull the
7410 My theory is that I can get rid of the TypeBuilder completely from
7411 the EmitContext, and have typecasts where it is used (from
7412 DeclSpace to where it matters).
7414 The only pending problem is that the code that implements Aliases
7415 is on TypeContainer, and probably should go in DeclSpace.
7417 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
7418 lookups here, instead of doing that at parse time. This means
7419 that our grammar will not introduce `LocalVariableReferences' as
7420 expressions at this point. That solves the problem of code like
7428 This is only half the fix. The full fix requires parameters to
7429 also be handled in this way.
7431 * class.cs (Property.DefineMethod): When implementing an interface
7432 method, set newslot, when implementing an abstract method, do not
7433 set the flag (before we tried never setting it, or always setting
7434 it, which is the difference).
7435 (Indexer.DefineMethod): same.
7436 (Method.DefineMethod): same.
7438 * ecore.cs: Only set the status used flag if we get back a Field.
7440 * attribute.cs: Temporary hack, so Paolo can keep working.
7442 2002-03-08 Ravi Pratap <ravi@ximian.com>
7444 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
7445 the unmanaged type in the case we have a MarshalAs attribute.
7447 (Resolve): Handle the case when we are parsing the special MarshalAs
7448 attribute [we need to store the unmanaged type to use later]
7450 * typemanager.cs (marshal_as_attr_type): Built in type for the
7451 MarshalAs Attribute.
7453 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
7454 on parameters and accordingly set the marshalling info.
7456 2002-03-09 Miguel de Icaza <miguel@ximian.com>
7458 * class.cs: Optimizing slightly by removing redundant code after
7459 we switched to the `NoTypes' return value.
7460 (Property.DefineMethod): use NoTypes here too.
7462 This fixes the bug I introduced in my last batch of changes.
7464 2002-03-05 Ravi Pratap <ravi@ximian.com>
7466 * tree.cs (RecordEnum): Add. We now keep track of enums too.
7468 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
7469 Enums since those are types too.
7471 * cs-parser.jay (enum_declaration): Record enums as we parse them.
7473 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
7474 thanks to a call during the lookup process.
7476 2002-03-07 Miguel de Icaza <miguel@ximian.com>
7478 * statement.cs (Foreach): Lots of work to accomodate a particular
7479 kind of foreach statement that I had not kept in mind. It is
7480 possible to have foreachs on classes that provide a GetEnumerator
7481 method that return objects that implement the "pattern" for using
7482 a foreach, there is no need to support GetEnumerator
7485 This is needed to compile nant.
7487 * decl.cs: Only report 114 if the member is not `Finalize' and if
7488 the warning level is at least 2.
7490 * class.cs: Moved the compare function from Method to
7493 (MethodSignature.InheritableMemberSignatureCompare): Add new
7494 filter function that is used to extract inheritable methods from a
7497 (Method.Define): Use the new `inheritable_method_signature_filter'
7500 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
7503 2002-03-06 Miguel de Icaza <miguel@ximian.com>
7505 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
7507 * cs-parser.jay: Add opt_semicolon to the interface declaration.
7509 * expression.cs: Pass location information to
7510 ConvertImplicitStandard.
7512 * class.cs: Added debugging code to track return values from
7515 2002-03-05 Miguel de Icaza <miguel@ximian.com>
7517 * expression.cs (Is.DoResolve): If either side of the `is' is an
7518 interface, do not flag the warning.
7520 * ecore.cs (ImplicitReferenceConversion): We need a separate test
7523 * report.cs: Allow for --fatal to be used with --probe.
7525 * typemanager.cs (NoTypes): Move the definition for the empty Type
7528 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
7530 (TypeContainer.DefineProxy): New function used to proxy to parent
7531 implementations when implementing interfaces.
7532 (TypeContainer.ParentImplements): used to lookup if our parent
7533 implements a public function that is required by an interface.
7534 (TypeContainer.VerifyPendingMethods): Hook this up.
7536 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
7537 `modules' and `assemblies' arraylists into arrays. We only grow
7538 these are the very early start up of the program, so this improves
7539 the speedof LookupType (nicely measured).
7541 * expression.cs (MakeByteBlob): Replaced unsafe code with
7542 BitConverter, as suggested by Paolo.
7544 * cfold.cs (ConstantFold.Binary): Special case: perform constant
7545 folding of string concatenation, but if either side is a string,
7546 and the other is not, then return null, and let the runtime use
7547 the concatenation on the string plus the object (using
7550 2002-03-04 Miguel de Icaza <miguel@ximian.com>
7552 Constant Folding has been implemented now.
7554 * expression.cs (Unary.Reduce): Do not throw an exception, catch
7555 the error instead on types that are not supported in one's
7558 * constant.cs (Constant and all children): New set of functions to
7559 perform implict and explicit conversions.
7561 * ecore.cs (EnumConstant): Implement the new functions to perform
7562 conversion by proxying to the child expression.
7564 * codegen.cs: (ConstantCheckState): Constant evaluation has its
7565 own separate setting that can not be turned off from the command
7566 line using --unchecked or --checked and is only controlled using
7567 the checked/unchecked statements and expressions. This setting is
7568 used by the constant folder to flag errors.
7570 * expression.cs (CheckedExpr, UncheckedExpr): Set the
7571 ConstantCheckState as well.
7573 During Resolve, they also have to flag the state, because the
7574 constant folder runs completely in the Resolve phase.
7576 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
7579 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7581 * cfold.cs: New file, this file contains the constant folder.
7583 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
7584 argument to track whether we are using the resulting address to
7585 load or store a value and provide better error messages.
7587 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
7588 new AddressOf arguments.
7590 * statement.cs (Foreach.EmitCollectionForeach): Update
7592 * expression.cs (Argument.Emit): Call AddressOf with proper
7593 arguments to track usage.
7595 (New.DoEmit): Call AddressOf with new arguments.
7597 (Unary.Emit): Adjust AddressOf call.
7599 2002-03-01 Ravi Pratap <ravi@ximian.com>
7601 * cs-parser.jay (member_access): Change the case for pre-defined types
7602 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
7605 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
7608 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
7609 essentially like methods and apply attributes like MethodImplOptions to them too.
7611 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
7614 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
7615 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
7618 * Update code everywhere accordingly.
7620 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
7622 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
7624 2002-02-28 Ravi Pratap <ravi@ximian.com>
7626 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
7627 try performing lookups against those instead of jumping straight into using
7628 the 'using' clauses.
7630 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
7632 (LookupType): Perform lookups in implicit parents too.
7634 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
7635 sequence as RootContext.LookupType.
7637 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
7638 the various cases of namespace lookups into this method.
7640 2002-03-01 Miguel de Icaza <miguel@ximian.com>
7642 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
7643 in positional arguments)
7645 * class.cs (Operator): Update the AllowedModifiers to contain
7648 * cs-parser.jay: Update operator declaration to allow for the
7649 operator body to be empty.
7651 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
7654 2002-02-27 Miguel de Icaza <miguel@ximian.com>
7656 * class.cs (Method.Emit): Label parameters.
7658 * driver.cs: Return 1 or 0 as the program exit code.
7660 2002-02-26 Miguel de Icaza <miguel@ximian.com>
7662 * expression.cs: Special case the `null' object when trying to
7663 auto-compute the type, as anything can be explicitly converted to
7666 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
7667 spotting this Paolo.
7669 (Expression.ImplicitNumericConversion): Perform comparissions of
7670 the type using the underlying type in the case of an enumeration
7671 rather than using the enumeration type for the compare.
7673 Cope with the underlying == type case, which is not possible to
7676 (Expression.ConvertNumericExplicit): Perform comparissions of
7677 the type using the underlying type in the case of an enumeration
7678 rather than using the enumeration type for the compare.
7680 * driver.cs: If the user does not supply an extension, assume .exe
7682 * cs-parser.jay (if_statement): Rewrote so that we can track the
7683 location for the if statement.
7685 * expression.cs (Binary.ConstantFold): Only concat strings when
7686 the operation is "+", not everything ;-)
7688 * statement.cs (Statement.EmitBoolExpression): Take a location
7690 (If, While, Do): Track location.
7692 * expression.cs (Binary.ResolveOperator): In the object + string
7693 case, I was missing a call to ConvertImplicit
7695 2002-02-25 Ravi Pratap <ravi@ximian.com>
7697 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
7698 Location arguments. Ensure we use RootContext.LookupType to do our work
7699 and not try to do a direct Type.GetType and ModuleBuilder.GetType
7701 * interface.cs (PopulateMethod): Handle the type of the parameter being
7704 * expression.cs (Invocation.BetterFunction): Handle the case when we
7705 have a params method with no fixed arguments and a call is made with no
7708 2002-02-25 Miguel de Icaza <miguel@ximian.com>
7710 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
7711 the verbatim-string-literal
7713 * support.cs (InternalParameters.ParameterModifier): handle null
7715 (InternalParameters.ParameterType): ditto.
7717 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
7718 duplicating the name of the variable parameter.
7719 (GetParameterByName): Fix bug where we were not looking up array
7720 paramters if they were the only present (thanks Paolo!).
7721 (GetParameterInfo): We only have an empty set of types if both
7722 fixed and array are set to null.
7723 (GetParameterInfo-idx): Handle FixedParameter == null
7725 * cs-parser.jay: Handle the case where there is no catch
7726 statements (missing null test).
7728 2002-02-22 Miguel de Icaza <miguel@ximian.com>
7730 * driver.cs (MainDriver): Be conservative on our command line
7733 Catch DirectoryNotFoundException when calling GetFiles.
7735 (SplitPathAndPattern): Used to split the input specification into
7736 a path and a pattern that we can feed to Directory.GetFiles.
7738 2002-02-21 Miguel de Icaza <miguel@ximian.com>
7740 * statement.cs (Fixed): Implement the last case of the Fixed
7741 statement (string handling).
7743 * expression.cs (StringPtr): New class used to return a char * to
7744 a string; Used by the Fixed statement.
7746 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
7748 * expression.cs (Binary.ResolveOperator): Remove redundant
7749 MemberLookup pn parent type.
7750 Optimize union call, we do not need a union if the types are the same.
7751 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
7754 Specialize the use of MemberLookup everywhere, instead of using
7755 the default settings.
7757 (StackAlloc): Implement stackalloc keyword.
7759 * cs-parser.jay: Add rule to parse stackalloc.
7761 * driver.cs: Handle /h, /help, /?
7763 * expression.cs (MakeByteBlob): Removed the hacks we had in place
7764 before we supported unsafe code.
7766 * makefile: add --unsafe to the self compilation of mcs.
7768 2002-02-20 Miguel de Icaza <miguel@ximian.com>
7770 * expression.cs (PointerArithmetic): New class that is used to
7771 perform pointer arithmetic.
7772 (Binary.Resolve): Handle pointer arithmetic
7773 Handle pointer comparission.
7774 (ArrayPtr): Utility expression class that is used to take the
7775 address of an array.
7777 (ElementAccess): Implement array access for pointers
7779 * statement.cs (Fixed): Implement fixed statement for arrays, we
7780 are missing one more case before we are done.
7782 * expression.cs (Indirection): Implement EmitAssign and set the
7783 ExprClass to Variable. This allows pointer dereferences to be
7784 treated as variables, and to have values assigned to them.
7786 * ecore.cs (Expression.StoreFromPtr): New utility function to
7787 store values dereferencing.
7789 2002-02-20 Ravi Pratap <ravi@ximian.com>
7791 * expression.cs (Binary.ResolveOperator): Ensure that we are
7792 not trying to operate on a void type - this fixes the reported
7795 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
7796 the parent implementation is sealed.
7798 * ../errors/cs0239.cs : Add.
7800 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
7802 * typemanager.cs (unverifiable_code_type): Corresponds to
7803 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
7804 which have unsafe code in them.
7806 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
7809 2002-02-19 Miguel de Icaza <miguel@ximian.com>
7811 * cs-tokenizer.cs: Add support for @"litreal strings"
7813 Make tokenizer accept pre-processor directives
7814 on any column (remove the old C-like limitation).
7816 * rootcontext.cs (EmitCode): Emit any global attributes.
7817 (AddGlobalAttributes): Used to keep track of assembly attributes.
7819 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
7821 * cs-parser.jay: Add support for global attributes.
7823 2002-02-17 Miguel de Icaza <miguel@ximian.com>
7825 * expression.cs (Indirection): New helper class. Unary will
7826 create Indirection classes to be able to implement the
7827 IMemoryLocation interface on it.
7829 2002-02-16 Miguel de Icaza <miguel@ximian.com>
7831 * cs-parser.jay (fixed_statement): reference the right statement.
7833 * statement.cs (Fixed.Emit): Finish implementing the fixed
7834 statement for the &x case.
7836 2002-02-14 Miguel de Icaza <miguel@ximian.com>
7838 * class.cs (Property.Define, Method.Define): Remove newslot when
7841 * modifiers.cs: My use of NewSlot when `Abstract' was set was
7842 wrong. NewSlot should only be used if the `new' keyword is present.
7844 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
7845 locating our system dir. Sorry about this.
7847 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7849 * driver.cs (GetSystemDir): Compute correctly the location of our
7850 system assemblies. I was using the compiler directory instead of
7851 the library directory.
7853 2002-02-13 Ravi Pratap <ravi@ximian.com>
7855 * expression.cs (BetterFunction): Put back in what Miguel commented out
7856 since it is the correct fix. The problem is elsewhere ;-)
7858 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
7859 parameters of the parms method are themselves compatible or not !
7861 (StandardConversionExists): Fix very dangerous bug where we were forgetting
7862 to check that a class implements an interface before saying that an implicit
7863 conversion was allowed. Use ImplementsInterface to do the checking.
7865 2002-02-13 Miguel de Icaza <miguel@ximian.com>
7867 * class.cs (Method.Define): Track whether we are an explicit
7868 implementation or not. And only call DefineMethodOverride if we
7869 are an explicit implementation.
7871 (Property.DefineMethod): Ditto.
7873 2002-02-11 Ravi Pratap <ravi@ximian.com>
7875 * expression.cs (BetterFunction): Catch hideous bug which was
7876 preventing us from detecting ambiguous calls due to implicit casts i.e
7879 2002-01-29 Miguel de Icaza <miguel@ximian.com>
7881 * support.cs (Pair): Remove un-needed method. I figured why I was
7882 getting the error in cs-parser.jay, the variable in a foreach loop
7883 is readonly, and the compiler does not really treat this as a variable.
7885 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
7886 instead of EQUALS in grammar.
7888 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
7890 * expression.cs (Unary.DoResolve): Check whether the argument is
7893 2002-01-28 Miguel de Icaza <miguel@ximian.com>
7895 * support.cs: Api for Pair to set a value. Despite the fact that
7896 the variables are public the MS C# compiler refuses to compile
7897 code that accesses the field if the variable is part of a foreach
7900 * statement.cs (Fixed): Begin implementation of the fixed
7903 (Block.AddVariable): Return the VariableInfo on success and null
7904 on failure instead of true/false.
7906 * cs-parser.jay (foreach): Catch errors on variables already
7907 defined (we were ignoring this value before) and properly unwind
7910 (fixed_statement): grammar for the fixed statement.
7912 2002-01-25 Miguel de Icaza <miguel@ximian.com>
7914 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
7915 pointer types to be incretemented.
7917 (SizeOf): Implement.
7919 * cs-parser.jay (pointer_member_access): Implement
7920 expr->IDENTIFIER production.
7922 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
7923 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
7926 (Unary): Implement indirection.
7928 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
7929 use in non-unsafe context).
7931 (SimpleName.DoResolve): Check for pointers in field access on safe
7934 (Expression.LoadFromPtr): Factor the load-indirect code in this
7935 function. This was duplicated in UnboxCast and ParameterReference
7937 2002-01-24 Miguel de Icaza <miguel@ximian.com>
7939 * expression.cs (ComposedCast): report an error if a pointer cast
7940 is used in a safe region.
7942 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
7943 pointer type casts in unsafe context.
7945 * codegen.cs (EmitContext): Set up IsUnsafe.
7947 * cs-parser.jay (non_expression_type): Add productions for pointer
7950 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
7951 code. We should not use force into static mode if the method is
7952 not virtual. Fixes bug in MIS
7954 * statement.cs (Do.Emit, While.Emit, For.Emit,
7955 Statement.EmitBoolExpression): Add support to Do and While to
7956 propagate infinite loop as `I do return' semantics.
7958 Improve the For case to also test for boolean constants.
7960 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
7961 to the list of attributes we can add.
7963 Remove `EmitContext' argument.
7965 * class.cs (Method.Define): Apply parameter attributes.
7966 (Constructor.Define): Apply parameter attributes.
7967 (MethodCore.LabelParameters): Move here the core of labeling
7970 * support.cs (ReflectionParameters.ParameterModifier,
7971 InternalParameters.ParameterModifier): Use IsByRef on the type and
7972 only return the OUT bit for these parameters instead of in/out/ref
7975 This is because I miss-understood things. The ParameterInfo.IsIn
7976 and IsOut represent whether the parameter has the [In] and [Out]
7979 2002-01-22 Miguel de Icaza <miguel@ximian.com>
7981 * ecore.cs (FieldExpr.Emit): Release temporaries.
7983 * assign.cs (LocalTemporary.Release): new function.
7985 * codegen.cs (EmitContext.GetTemporaryStorage,
7986 EmitContext.FreeTemporaryStorage): Rework the way we deal with
7987 temporary storage. Now we can "put back" localbuilders when we
7990 2002-01-21 Miguel de Icaza <miguel@ximian.com>
7992 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
7993 need to make a copy of the variable to generate verifiable code.
7995 2002-01-19 Miguel de Icaza <miguel@ximian.com>
7997 * driver.cs: Compute dynamically the system directory.
7999 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
8000 Slower, but more generally useful. Used by the abstract
8001 registering implementation.
8003 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
8004 the rules for the special rule on Type/instances. First check if
8005 we have the same name, and if so, try that special static path
8006 rather than the instance path.
8008 2002-01-18 Miguel de Icaza <miguel@ximian.com>
8010 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
8013 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
8014 Enum, ValueType, Delegate or Array for non-corlib compiles.
8016 * cs-tokenizer.cs: Catch long identifiers (645)
8018 * typemanager.cs (IndexerPropetyName): Ravi never tested this
8021 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
8022 fix, we were returning too early, so we were not registering
8023 pending methods from abstract classes.
8025 Do not register pending methods if the class is abstract.
8027 * expression.cs (Conditional.DoResolve): Report circular implicit
8028 conversions when we neecd to compute it for conditional
8031 (Is.DoResolve): If the expression is always of the provided type,
8032 flag warning 183. If the expression can not ever be of the
8033 provided type flag warning 184.
8035 * class.cs: Catch 169 as well.
8037 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
8040 2002-01-18 Nick Drochak <ndrochak@gol.com>
8042 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
8044 2002-01-17 Miguel de Icaza <miguel@ximian.com>
8046 * interface.cs: (PopulateMethod): Check for pointers being defined
8047 only if the unsafe context is active.
8048 (PopulateProperty): ditto.
8049 (PopulateIndexer): ditto.
8051 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
8052 specified. If pointers are present, make sure that they are
8053 present in an unsafe context.
8054 (Constructor, Constructor.Define): ditto.
8055 (Field, Field.Define): ditto.
8056 (Property, Property.Define): ditto.
8057 (Event, Event.Define): ditto.
8059 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
8060 hashtable if there are classes or structs defined.
8062 * expression.cs (LocalVariableReference.DoResolve): Simplify this
8063 code, as the constant resolution moved.
8065 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
8066 the metadata, so we can flag error 133.
8068 * decl.cs (MemberCore.UnsafeOK): New function to test that a
8069 pointer is being declared in an unsafe context.
8071 2002-01-16 Miguel de Icaza <miguel@ximian.com>
8073 * modifiers.cs (Modifiers.Check): Require a Location argument.
8074 Report error 227 for Unsafe use.
8076 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
8078 * statement.cs (For.Emit): If the test is null, then report that
8079 we do `return', as we wont reach anything afterwards.
8081 (Switch.SwitchGoverningType): Track the expression that matched
8084 * driver.cs: Allow negative numbers as an error code to flag.
8086 * cs-parser.jay: Handle 1551.
8088 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
8090 2002-01-15 Miguel de Icaza <miguel@ximian.com>
8092 * cs-parser.jay: Report 1518 (type declaration can only contain
8093 class, struct, interface, enum or delegate)
8095 (switch_label): Report 1523 (keywords `case' or `default' must
8098 (opt_switch_sections): Report 1522 (empty switch)
8100 * driver.cs: Report 1515 (response file specified multiple times)
8101 Report 1516 (Source file specified multiple times).
8103 * expression.cs (Argument.Resolve): Signal 1510
8105 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
8106 access not allowed in static code)
8108 2002-01-11 Ravi Pratap <ravi@ximian.com>
8110 * typemanager.cs (IsPointerType): Utility method which we are going
8113 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
8114 the object type, so we take care of that.
8116 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
8118 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
8119 added to non-params parameters :-)
8121 * typemanager.cs (CSharpName): Include 'void' type too.
8123 (void_ptr_type): Include in the set of core types.
8125 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
8128 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
8131 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
8132 completely forgotten about it.
8134 2002-01-10 Ravi Pratap <ravi@ximian.com>
8136 * cs-parser.jay (pointer_type): Add. This begins our implementation
8137 of parsing rules for unsafe code.
8139 (unsafe_statement): Implement.
8141 (embedded_statement): Modify to include the above.
8143 * statement.cs (Unsafe): Implement new class for unsafe blocks.
8145 * codegen.cs (EmitContext.InUnsafe): Add. This determines
8146 if the current context is an unsafe one.
8148 * cs-parser.jay (local_variable_pointer_type): Since local variable types
8149 are handled differently, we need separate rules for them.
8151 (local_variable_declaration): Update to use local_variable_pointer_type
8152 to allow variable declarations of unmanaged pointer types.
8154 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
8157 * ../errors/cs0214.cs : Add.
8159 2002-01-16 Nick Drochak <ndrochak@gol.com>
8161 * makefile: remove 'response' file when cleaning.
8163 2002-01-15 Miguel de Icaza <miguel@ximian.com>
8165 * cs-parser.jay: Report 1524.
8167 2002-01-14 Miguel de Icaza <miguel@ximian.com>
8169 * typemanager.cs (RegisterMethod): drop checking if we have
8170 registered this from here
8172 2002-01-12 Miguel de Icaza <miguel@ximian.com>
8174 * class.cs (Method.EmitDestructor): Implement calling our base
8177 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
8180 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
8181 this routine and will wrap the call in a try/catch block. Deal
8184 2002-01-11 Miguel de Icaza <miguel@ximian.com>
8186 * ecore.cs (Expression.MemberLookup): instead of taking a
8187 parameter `same_type' that was used to tell whether we could
8188 access private members we compute our containing type from the
8191 (FieldExpr): Added partial support for volatile fields. This does
8192 not work for volatile fields exposed from assemblies, as I can not
8193 figure out how to extract the modreq from it.
8195 Updated all the source files to use this.
8197 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
8198 because it is referenced by MemberLookup very often.
8200 2002-01-09 Ravi Pratap <ravi@ximian.com>
8202 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
8203 TypeBuilder.GetCustomAttributes to retrieve what we need.
8205 Get rid of redundant default_member_attr_type as this is the same as
8206 default_member_type which already exists.
8208 * interface.cs, attribute.cs : Update accordingly.
8210 2002-01-08 Miguel de Icaza <miguel@ximian.com>
8212 * typemanager.cs: Enable IndexerPropertyName again. It does not
8213 work for TYpeBuilders though. Ravi, can you please fix this?
8215 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
8217 * expression.cs (Argument.Emit): Handle the case of ref objects
8218 being passed to ref functions;
8220 (ParameterReference.EmitLoad): Loads the content of the pointer
8221 without dereferencing.
8223 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8225 * cs-tokenizer.cs: Implemented the pre-processing expressions.
8227 2002-01-08 Ravi Pratap <ravi@ximian.com>
8229 * class.cs (Indexer.DefineMethod): Incorporate the interface
8230 type in the name of the method if we are doing explicit interface
8233 * expression.cs (ConversionExists): Remove as it is completely obsolete.
8235 (BetterConversion): Fix extremely trivial bug where we were referring to
8236 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
8239 * ../errors/bug16.cs : Add although we have fixed it.
8241 2002-01-07 Miguel de Icaza <miguel@ximian.com>
8243 * expression.cs (BaseIndexer): Begin implementation.
8245 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
8247 * cs-parser.jay (indexer_declarator): Use qualified_identifier
8248 production directly to remove a shift/reduce, and implement
8249 explicit interface implementation.
8251 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
8252 after a floating point suffix.
8254 * expression.cs (DoNumericPromotions): Improved the conversion for
8255 uint/uint. If we have a constant, we avoid doing a typecast to a
8258 * class.cs (Indexer): Implement explicit interface implementation
8261 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
8263 * class.cs: make the default instance constructor public and hidebysig.
8265 2001-01-03 Ravi Pratap <ravi@ximian.com>
8267 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
8268 so we can call it from elsewhere.
8270 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
8271 we emit it internally if the class has a defined indexer; otherwise the user
8272 emits it by decorating the class definition with the DefaultMemberAttribute.
8274 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
8275 attribute is not used on a type which defines an indexer.
8277 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
8278 character when we skip whitespace.
8280 * ../errors/cs0646.cs : Add.
8282 2002-01-03 Miguel de Icaza <miguel@ximian.com>
8284 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
8287 * makefile: Add practical target `mcs3.exe' which builds the third
8288 generation compiler.
8290 * expression.cs (New): Fix structures constructor calling.
8292 * class.cs (Property, Method, Indexer): Emit Final flag on the
8293 method if we are an interface implementation and we are not
8296 * ecore.cs (PropertyExpr): New public field `IsBase', tells
8297 whether this property is referencing a `base' method.
8299 * expression.cs (Invocation.EmitCall): take an extra argument:
8300 is_base, this is used to determine whether the `call' or
8301 `callvirt' opcode should be used.
8304 * delegate.cs: update EmitCall.
8306 * class.cs (Method.Define): Set NewSlot for the cases where we are
8307 not implementing an interface method.
8309 (Property.Define): ditto.
8311 2002-01-02 Miguel de Icaza <miguel@ximian.com>
8313 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
8314 'r'. Allows mcs to parse itself fully.
8316 2002-01-02 Ravi Pratap <ravi@ximian.com>
8318 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
8319 of the number of initializers that require the InitializeArray method.
8321 (CheckIndices): Store the Expression in all cases - not the plain value. Also
8322 update the above field where necessary.
8324 (MakeByteBlob): Update accordingly.
8326 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
8329 (EmitDynamicInitializers): Update in accordance with the new optimization.
8331 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
8332 same OpCode applies.
8334 * cs-parser.jay : Fix some glaring errors I introduced.
8336 2002-01-01 Ravi Pratap <ravi@ximian.com>
8338 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
8339 so that we can check for name clashes there too.
8341 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
8342 for interface indexers.
8344 * interfaces.cs (Define): Emit the default member attribute.
8346 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
8347 variable was being referred to while setting the value ;-)
8349 2002-01-01 Miguel de Icaza <miguel@ximian.com>
8351 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
8352 byte-by-byte information when we know the data is zero.
8354 Make the block always a multiple of 4, because
8355 DefineInitializedData has a bug.
8357 * assign.cs: Fix, we should assign from the temporary, not from
8360 * expression.cs (MakeByteBlob): Fix my incorrect code.
8362 2001-12-31 Miguel de Icaza <miguel@ximian.com>
8364 * typemanager.cs (EnumToUnderlying): This function is used to get
8365 the underlying type from an enumeration, because it does not
8368 * constant.cs: Use the I4_S form for values between -128 and 127.
8370 * statement.cs (Block.LookupLabel): Looks up a label.
8371 (Block): Drop support for labeled blocks.
8373 (LabeledStatement): New kind of statement that represents a label
8376 (Goto): Finally implement this bad boy.
8378 * cs-parser.jay: Update to reflect new mechanism to implement
8381 2001-12-30 Miguel de Icaza <miguel@ximian.com>
8383 * codegen.cs (EmitContext.This): a codegen property that keeps the
8384 a single instance of this instead of creating many different this
8387 * delegate.cs (Delegate.DoResolve): Update to use the property;
8389 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
8391 * expression.cs (BaseAccess.DoResolve): Ditto.
8393 2001-12-29 Ravi Pratap <ravi@ximian.com>
8395 * typemanager.cs (methodimpl_attr_type): Add to hold the type
8396 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
8398 (InitCoreTypes): Update accordingly.
8400 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
8401 so we can quickly store the state.
8403 (ApplyAttributes): Set the correct implementation flags
8404 for InternalCall methods.
8406 2001-12-29 Miguel de Icaza <miguel@ximian.com>
8408 * expression.cs (EmitCall): if a method is not virtual, then do
8409 not use callvirt on it.
8411 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
8412 user defined stuff) requires the use of stobj, which takes an
8413 address on the stack instead of an array and an index. So emit
8414 the Ldelema operation for it.
8416 (EmitStoreOpcode): Use stobj for valuetypes.
8418 (UnaryMutator.EmitCode): Use the right 1 value depending on
8419 whether we are dealing with int64/uint64, float or doubles.
8421 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
8422 constructors that I implemented last night.
8424 (Constructor.IsDefault): Fix to work properly for static
8427 * cs-parser.jay (CheckDef): report method signature errors.
8428 Update error number 103 to be 132.
8430 * decl.cs: New AdditionResult enumeration value: MethodExists.
8431 Although we do this check for methods later on in the semantic
8432 analysis, catching repeated default constructors is so easy that
8433 we catch these here.
8435 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
8438 (ParameterReference.EmitAssign, Emit): handle
8441 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
8442 (ArrayAccess.EmitStoreOpcode): ditto.
8444 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
8446 * expression.cs (MakeByteBlob): Complete all the missing types
8447 (uint, short, ushort, byte, sbyte)
8449 * class.cs: Only init instance field initializers on instance
8452 Rename `constructors' to instance_constructors.
8454 (TypeContainer.AddConstructor): Only add constructors to the list
8455 if it is not static.
8457 Make sure that we handle default_static_constructor independently
8458 everywhere where we handle instance_constructors
8460 2001-12-28 Miguel de Icaza <miguel@ximian.com>
8462 * class.cs: Do not lookup or create a base initializer for a
8465 (ConstructorInitializer.Resolve): use the proper type to lookup
8468 * cs-parser.jay: Report error 1585 (modifiers between type and name).
8470 * enum.cs, interface.cs: Remove CloseType, this is taken care by
8473 * decl.cs: CloseType is now an virtual method, the default
8474 implementation just closes this type.
8476 2001-12-28 Ravi Pratap <ravi@ximian.com>
8478 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
8479 to PreserveSig by default. Also emit HideBySig on such methods.
8481 Basically, set the defaults to standard values.
8483 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
8484 argument, if candidate is better, it can't be worse than the best !
8486 (Invocation): Re-write bits to differentiate between methods being
8487 applicable in their expanded form and their normal form - for params
8490 Get rid of use_standard everywhere as only standard conversions are allowed
8491 in overload resolution.
8493 More spec conformance.
8495 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8497 * driver.cs: Add --timestamp, to see where the compiler spends
8500 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
8501 `this' in static code.
8503 (SimpleName.DoResolve): Implement in terms of a helper function
8504 that allows static-references to be passed upstream to
8507 (Expression.ResolveWithSimpleName): Resolve specially simple
8508 names when called by MemberAccess to implement the special
8511 (Expression.ImplicitReferenceConversion): Handle conversions from
8512 Null to reference types before others, as Null's type is
8515 * expression.cs (Invocation.EmitCall): Handle the special case of
8516 calling methods declared on a reference type from a ValueType
8517 (Base classes System.Object and System.Enum)
8519 (MemberAccess.Resolve): Only perform lookups on Enumerations if
8520 the left hand side is a TypeExpr, not on every enumeration.
8522 (Binary.Resolve): If types are reference types, then do a cast to
8523 object on operators != and == of both arguments.
8525 * typemanager.cs (FindMembers): Extract instance and static
8526 members if requested.
8528 * interface.cs (PopulateProperty): Use void_type instead of null
8529 as the return type for the setter method.
8531 (PopulateIndexer): ditto.
8533 2001-12-27 Ravi Pratap <ravi@ximian.com>
8535 * support.cs (ReflectionParameters): Fix minor bug where we
8536 were examining the wrong parameter for the ParamArray attribute.
8538 Cope with requests for the type of the parameter at position
8539 greater than the params parameter's. We now return the element
8540 type of the params array as that makes more sense.
8542 * expression.cs (Invocation.IsParamsMethodApplicable): Update
8543 accordingly as we no longer have to extract the element type
8546 (Invocation.OverloadResolve): Update.
8548 2001-12-27 Miguel de Icaza <miguel@ximian.com>
8550 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
8551 against IEnumerator, test whether the return value is a descendant
8552 of the IEnumerator interface.
8554 * class.cs (Indexer.Define): Use an auxiliary method to implement
8555 the other bits of the method definition. Begin support for
8556 explicit interface implementation.
8558 (Property.DefineMethod): Use TypeManager.void_type instead of null
8559 for an empty return value.
8561 2001-12-26 Miguel de Icaza <miguel@ximian.com>
8563 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
8564 dealing with a FieldExpr which is composed of a FieldBuilder, in
8565 the code path we did extract the constant, but we should have
8566 obtained the underlying value to be able to cast it (otherwise we
8567 end up in an infinite loop, this is what Ravi was running into).
8569 (ArrayCreation.UpdateIndices): Arrays might be empty.
8571 (MemberAccess.ResolveMemberAccess): Add support for section
8572 14.5.4.1 that deals with the special case of E.I when E is a type
8573 and something else, that I can be a reference to a static member.
8575 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
8576 handle a particular array type to create byte blobs, it is just
8577 something we dont generate byteblobs for.
8579 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
8582 * location.cs (Push): remove the key from the hashtable that we
8583 are about to add. This happens for empty files.
8585 * driver.cs: Dispose files after we have parsed them.
8587 (tokenize): new function that only runs the tokenizer on its
8588 input, for speed testing.
8590 2001-12-26 Ravi Pratap <ravi@ximian.com>
8592 * class.cs (Event.Define): Define the private field only if there
8593 are no accessors defined.
8595 * expression.cs (ResolveMemberAccess): If there is no associated
8596 field with the event, that means we have an event defined with its
8597 own accessors and we should flag error cs0070 since transforming
8598 ourselves into a field is not valid in that case.
8600 * ecore.cs (SimpleName.DoResolve): Same as above.
8602 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
8603 and charset to sane values.
8605 2001-12-25 Ravi Pratap <ravi@ximian.com>
8607 * assign.cs (DoResolve): Perform check on events only if they
8608 are being accessed outside the declaring type.
8610 * cs-parser.jay (event_declarations): Update rules to correctly
8611 set the type of the implicit parameter etc.
8613 (add_accessor, remove_accessor): Set current local parameters.
8615 * expression.cs (Binary): For delegate addition and subtraction,
8616 cast the return value from the method into the appropriate delegate
8619 2001-12-24 Ravi Pratap <ravi@ximian.com>
8621 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
8622 of these as the workaround is unnecessary.
8624 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
8625 delegate data - none of that is needed at all.
8627 Re-write bits to extract the instance expression and the delegate method
8630 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
8633 * attribute.cs (ApplyAttributes): New method to take care of common tasks
8634 of attaching attributes instead of duplicating code everywhere.
8636 * everywhere : Update code to do attribute emission using the above method.
8638 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8640 * expression.cs (IsParamsMethodApplicable): if there are not
8641 parameters, return immediately.
8643 * ecore.cs: The 0 literal can be implicity converted to an enum
8646 (SimpleName.DoResolve): First lookup the type, then lookup the
8649 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
8650 want to get its address. If the InstanceExpression is not
8651 addressable, store the result in a temporary variable, then get
8654 * codegen.cs: Only display 219 errors on warning level or above.
8656 * expression.cs (ArrayAccess): Make it implement the
8657 IMemoryLocation interface.
8659 (Binary.DoResolve): handle the operator == (object a, object b)
8660 and operator != (object a, object b) without incurring into a
8661 BoxedCast (because 5 != o should never be performed).
8663 Handle binary enumerator operators.
8665 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
8666 value type, otherwise use Ldelem_ref.
8668 Use precomputed names;
8670 (AddressOf): Implement address of
8672 * cs-parser.jay (labeled_statement): Fix recursive block
8673 addition by reworking the production.
8675 * expression.cs (New.DoEmit): New has a special case:
8677 If we are dealing with a ValueType, we have a few
8678 situations to deal with:
8680 * The target of New is a ValueType variable, that is
8681 easy, we just pass this as the variable reference
8683 * The target of New is being passed as an argument,
8684 to a boxing operation or a function that takes a
8687 In this case, we need to create a temporary variable
8688 that is the argument of New.
8691 2001-12-23 Ravi Pratap <ravi@ximian.com>
8693 * rootcontext.cs (LookupType): Check that current_type is not null before
8694 going about looking at nested types.
8696 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
8697 not implement the IAssignMethod interface any more.
8699 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
8700 where we tranform them into FieldExprs if they are being resolved from within
8703 * ecore.cs (SimpleName.DoResolve): Do the same here.
8705 * assign.cs (DoResolve, Emit): Clean up code considerably.
8707 * ../errors/bug10.cs : Add.
8709 * ../errors/cs0070.cs : Add.
8711 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
8713 * assign.cs : Get rid of EventIsLocal everywhere.
8715 2001-12-23 Miguel de Icaza <miguel@ximian.com>
8717 * ecore.cs (ConvertIntLiteral): finished the implementation.
8719 * statement.cs (SwitchLabel): Convert the value we are using as a
8720 key before looking up the table.
8722 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8724 * codegen.cs (EmitTopBlock): Require a Location argument now.
8726 * cs-parser.jay (constructor_declarator): We need to setup
8727 current_local_parameters before we parse the
8728 opt_constructor_initializer, to allow the variables to be bound
8729 to the constructor arguments.
8731 * rootcontext.cs (LookupType): First lookup nested classes in our
8732 class and our parents before we go looking outside our class.
8734 * expression.cs (ConstantFold): Extract/debox the values at the
8737 * rootcontext.cs (EmitCode): Resolve the constants first before we
8738 resolve the types. This is not really needed, but it helps debugging.
8740 * statement.cs: report location.
8742 * cs-parser.jay: pass location to throw statement.
8744 * driver.cs: Small bug fix.
8746 * report.cs: Updated format to be 4-zero filled digits.
8748 2001-12-22 Ravi Pratap <ravi@ximian.com>
8750 * expression.cs (CheckIndices): Fix minor bug where the wrong
8751 variable was being referred to ;-)
8753 (DoEmit): Do not call EmitStaticInitializers when the
8754 underlying type is System.Object.
8756 2001-12-21 Ravi Pratap <ravi@ximian.com>
8758 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
8759 and do the usual workaround for SRE.
8761 * class.cs (MyEventBuilder.EventType): New member to get at the type
8762 of the event, quickly.
8764 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
8766 * assign.cs (Assign.DoResolve): Handle the case when the target
8767 is an EventExpr and perform the necessary checks.
8769 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
8772 (SimpleName.MemberStaticCheck): Include check for EventExpr.
8774 (EventExpr): Set the type in the constructor itself since we
8775 are meant to be born fully resolved.
8777 (EventExpr.Define): Revert code I wrote earlier.
8779 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
8780 instance expression is null. The instance expression is a This in that case
8781 or a null, depending on whether it is a static method or not.
8783 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
8784 refers to more than one method.
8786 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
8787 and accordingly flag errors.
8789 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8791 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
8793 2001-12-22 Miguel de Icaza <miguel@ximian.com>
8795 * location.cs (ToString): Provide useful rutine.
8797 2001-12-21 Miguel de Icaza <miguel@ximian.com>
8799 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
8800 objects, return the actual integral boxed.
8802 * statement.cs (SwitchLabel): define an ILLabel for each
8805 (Switch.CheckSwitch): If the value is a Literal, extract
8806 the underlying literal.
8808 Also in the unused hashtable we had, add the SwitchLabel so we can
8809 quickly look this value up.
8811 * constant.cs: Implement a bunch of new constants. Rewrite
8812 Literal based on this. Made changes everywhere to adapt to this.
8814 * expression.cs (Expression.MakeByteBlob): Optimize routine by
8815 dereferencing array only once, and also copes with enumrations.
8817 bytes are two bytes wide, not one.
8819 (Cast): Perform constant conversions.
8821 * ecore.cs (TryImplicitIntConversion): Return literals instead of
8822 wrappers to the literals here.
8824 * expression.cs (DoNumericPromotions): long literals can converted
8825 to ulong implicity (this is taken care of elsewhere, but I was
8828 * ecore.cs (Expression.Literalize): Make the return type Literal,
8829 to improve type checking.
8831 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
8833 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8835 * literal.cs: Revert code from ravi that checked the bounds. The
8836 bounds are sane by the definition of the type itself.
8838 * typemanager.cs: Fix implementation of ImplementsInterface. We
8839 need to actually look up in our parent hierarchy for interfaces
8842 * const.cs: Use the underlying type for enumerations
8844 * delegate.cs: Compute the basename for the delegate creation,
8845 that should fix the delegate test case, and restore the correct
8846 Type Lookup semantics in rootcontext
8848 * rootcontext.cs: Revert Ravi's last patch. The correct way of
8849 referencing a nested type with the Reflection API is using the "+"
8852 * cs-parser.jay: Do not require EOF token at the end.
8854 2001-12-20 Ravi Pratap <ravi@ximian.com>
8856 * rootcontext.cs (LookupType): Concatenate type names with
8857 a '.' instead of a '+' The test suite passes again.
8859 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
8860 field of the enumeration.
8862 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
8863 the case when the member is an EventExpr.
8865 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
8866 static has an associated instance expression.
8868 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
8870 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
8872 * class.cs (Event.Define): Register event and perform appropriate checks
8875 We define the Add and Remove methods even if the use provides none because
8876 in that case, we provide default implementations ourselves.
8878 Define a private field of the type of the event. This is done by the CSC compiler
8879 and we should be doing it too ;-)
8881 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
8882 More methods we use in code we generate.
8884 (multicast_delegate_type, delegate_type): Two separate types since the distinction
8887 (InitCoreTypes): Update accordingly for the above.
8889 * class.cs (Event.Emit): Generate code for default accessors that we provide
8891 (EmitDefaultMethod): Do the job in the above.
8893 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
8896 2001-12-20 Miguel de Icaza <miguel@ximian.com>
8898 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
8899 builders even if we were missing one.
8901 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
8902 pass the Basename as our class name instead of the Name. The
8903 basename will be correctly composed for us.
8905 * parameter.cs (Paramters): Now takes a Location argument.
8907 * decl.cs (DeclSpace.LookupType): Removed convenience function and
8908 make all the code call directly LookupType in RootContext and take
8909 this chance to pass the Location information everywhere.
8911 * Everywhere: pass Location information.
8913 2001-12-19 Miguel de Icaza <miguel@ximian.com>
8915 * class.cs (Constructor.Define): Updated way of detecting the
8916 length of the parameters.
8918 (TypeContainer.DefineType): Use basename as the type name for
8921 (TypeContainer.Define): Do not recursively define types here, as
8922 definition is taken care in order by the RootContext.
8924 * tree.cs: Keep track of namespaces in a per-file basis.
8926 * parameter.cs (Parameter.ComputeSignature): Update to use
8929 (Parameters.GetSignature): ditto.
8931 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
8932 instead of a TypeContainer.
8934 (Interface.SemanticAnalysis): Use `this' instead of our parent to
8935 resolve names. Because we need to be resolve in our context, not
8938 * driver.cs: Implement response files.
8940 * class.cs (TypeContainer.DefineType): If we are defined, do not
8943 (Event.Emit): Emit the code for add/remove handlers.
8944 (Event.Define): Save the MethodBuilders for add/remove.
8946 * typemanager.cs: Use pair here too.
8948 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
8949 DictionaryEntry requires the first argument to be non-null.
8951 (enum_declaration): Compute full name for registering the
8954 (delegate_declaration): Instead of using
8955 formal_parameter_list, use opt_formal_parameter_list as the list
8958 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
8959 (EventParsing): New property that controls whether `add' and
8960 `remove' are returned as tokens or identifiers (for events);
8962 2001-12-19 Ravi Pratap <ravi@ximian.com>
8964 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
8965 use MyEventBuilder only and let it wrap the real builder for us.
8967 (MyEventBuilder): Revamp constructor etc.
8969 Implement all operations that we perform on EventBuilder in precisely the same
8972 (FindMembers): Update to use the EventBuilder member.
8974 (Event.Emit): Update accordingly.
8976 2001-12-18 Ravi Pratap <ravi@ximian.com>
8978 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
8979 by calling the appropriate methods.
8981 (GetCustomAttributes): Make stubs as they cannot possibly do anything
8984 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
8986 2001-12-17 Ravi Pratap <ravi@ximian.com>
8988 * delegate.cs (Delegate.Populate): Check that the return type
8989 and various parameters types are indeed accessible.
8991 * class.cs (Constructor.Define): Same here.
8993 (Field.Define): Ditto.
8995 (Event.Define): Ditto.
8997 (Operator.Define): Check that the underlying Method defined itself
8998 correctly - so it's MethodBuilder should not be null.
9000 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
9001 expression happens to be null.
9003 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
9004 members but as of now we don't seem to be able to do anything really useful with it.
9006 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
9007 not the EventBuilder.
9009 2001-12-18 Miguel de Icaza <miguel@ximian.com>
9011 * cs-tokenizer.cs: Add support for defines.
9012 Add support for #if, #elif, #else, #endif
9014 (eval_var): evaluates a variable.
9015 (eval): stubbed for evaluating functions.
9017 * cs-parser.jay: Pass the defines information
9019 * driver.cs: Add --define command line option.
9021 * decl.cs: Move MemberCore here.
9023 Make it the base class for DeclSpace. This allows us to catch and
9024 report 108 and 109 for everything now.
9026 * class.cs (TypeContainer.Define): Extract all the members
9027 before populating and emit the warning 108 (new keyword required
9028 to override) instead of having each member implement this.
9030 (MemberCore.Define): New abstract method, we will be using this in
9031 the warning reporting engine in Populate.
9033 (Operator.Define): Adjust to new MemberCore protocol.
9035 * const.cs (Const): This does not derive from Expression, it is a
9036 temporary object we use to create fields, it is a MemberCore.
9038 * class.cs (Method.Define): Allow the entry point to be in a
9041 * driver.cs: Rewrite the argument handler to clean it up a bit.
9043 * rootcontext.cs: Made it just an auxiliary namespace feature by
9044 making everything static.
9046 * driver.cs: Adapt code to use RootContext type name instead of
9049 * delegate.cs: Remove RootContext argument.
9051 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
9054 * class.cs (Event.Define): The lookup can fail.
9056 * cs-tokenizer.cs: Begin implementation of pre-procesor.
9058 * expression.cs: Resolve the this instance before invoking the code.
9060 2001-12-17 Miguel de Icaza <miguel@ximian.com>
9062 * cs-parser.jay: Add a production in element_access that allows
9063 the thing to become a "type" reference. This way we can parse
9064 things like "(string [])" as a type.
9066 Note that this still does not handle the more complex rules of
9070 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
9072 * ecore.cs: (CopyNewMethods): new utility function used to
9073 assemble the list of methods from running FindMembers.
9075 (MemberLookup): Rework FindMembers so that
9077 2001-12-16 Miguel de Icaza <miguel@ximian.com>
9079 * class.cs (TypeContainer): Remove Delegates who fail to be
9082 * delegate.cs (Populate): Verify that we dont get null return
9083 values. TODO: Check for AsAccessible.
9085 * cs-parser.jay: Use basename to emit error 574 (destructor should
9086 have the same name as container class), not the full name.
9088 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
9089 possible representation.
9091 Also implements integer type suffixes U and L.
9093 2001-12-15 Miguel de Icaza <miguel@ximian.com>
9095 * expression.cs (ArrayCreation.DoResolve): We need to do the
9096 argument resolution *always*.
9098 * decl.cs: Make this hold the namespace. Hold the root context as
9100 (LookupType): Move here.
9102 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
9104 * location.cs (Row, Name): Fixed the code, it was always returning
9105 references to the first file.
9107 * interface.cs: Register properties defined through interfaces.
9109 * driver.cs: Add support for globbing on the command line
9111 * class.cs (Field): Make it derive from MemberCore as well.
9114 2001-12-15 Ravi Pratap <ravi@ximian.com>
9116 * class.cs (Event::Define): Check that the type of the event is a delegate
9117 type else flag error #66.
9119 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
9122 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
9123 values of EntryPoint, CharSet etc etc.
9125 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
9127 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
9128 be null and we should ignore this. I am not sure if this is really clean. Apparently,
9129 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
9130 which needs this to do its work.
9132 * ../errors/cs0066.cs : Add.
9134 2001-12-14 Miguel de Icaza <miguel@ximian.com>
9136 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
9139 * class.cs: (MethodSignature.MethodSignature): Removed hack that
9140 clears out the parameters field.
9141 (MemberSignatureCompare): Cleanup
9143 (MemberCore): New base class used to share code between MethodCore
9146 (RegisterRequiredImplementations) BindingFlags.Public requires
9147 either BindingFlags.Instace or Static. Use instance here.
9149 (Property): Refactored code to cope better with the full spec.
9151 * parameter.cs (GetParameterInfo): Return an empty array instead
9154 * class.cs (Property): Abstract or extern properties have no bodies.
9156 * parameter.cs (GetParameterInfo): return a zero-sized array.
9158 * class.cs (TypeContainer.MethodModifiersValid): Move all the
9159 method modifier validation to the typecontainer so we can reuse
9162 (MethodCore.ParameterTypes): return an empty sized array of types.
9164 (Property.Define): Test property modifier validity.
9166 Add tests for sealed/override too.
9168 (Method.Emit): abstract or extern methods have no bodies.
9170 2001-12-14 Ravi Pratap <ravi@ximian.com>
9172 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
9175 (Method::Define, ::Emit): Modify accordingly.
9177 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
9179 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
9181 * makefile: Pass in /unsafe.
9183 2001-12-13 Miguel de Icaza <miguel@ximian.com>
9185 * class.cs (MakeKey): Kill routine.
9187 * class.cs (TypeContainer.Define): Correctly define explicit
9188 method implementations (they require the full interface name plus
9191 * typemanager.cs: Deply the PtrHashtable here and stop using the
9192 lame keys. Things work so much better.
9194 This of course broke everyone who depended on `RegisterMethod' to
9195 do the `test for existance' test. This has to be done elsewhere.
9197 * support.cs (PtrHashtable): A hashtable that avoid comparing with
9198 the object stupid Equals method (because, that like fails all over
9199 the place). We still do not use it.
9201 * class.cs (TypeContainer.SetRequiredInterface,
9202 TypeContainer.RequireMethods): Killed these two routines and moved
9203 all the functionality to RegisterRequiredImplementations.
9205 (TypeContainer.RegisterRequiredImplementations): This routine now
9206 registers all the implementations required in an array for the
9207 interfaces and abstract methods. We use an array of structures
9208 which can be computed ahead of time to reduce memory usage and we
9209 also assume that lookups are cheap as most classes will not
9210 implement too many interfaces.
9212 We also avoid creating too many MethodSignatures.
9214 (TypeContainer.IsInterfaceMethod): Update and optionally does not
9215 clear the "pending" bit if we find that there are problems with
9218 (TypeContainer.VerifyPendingMethods): Update to report errors of
9219 methods that look like implementations but are not.
9221 (TypeContainer.Define): Add support for explicit interface method
9224 2001-12-12 Miguel de Icaza <miguel@ximian.com>
9226 * typemanager.cs: Keep track of the parameters here instead of
9227 being a feature of the TypeContainer.
9229 * class.cs: Drop the registration of parameters here, as
9230 InterfaceMethods are also interface declarations.
9232 * delegate.cs: Register methods with the TypeManager not only with
9233 the TypeContainer. This code was buggy.
9235 * interface.cs: Full registation here.
9237 2001-12-11 Miguel de Icaza <miguel@ximian.com>
9239 * expression.cs: Remove reducer for binary expressions, it can not
9242 * const.cs: Put here the code that used to go into constant.cs
9244 * constant.cs: Put here the code for constants, this is a new base
9247 * literal.cs: Make Literal derive from Constant.
9249 2001-12-09 Miguel de Icaza <miguel@ximian.com>
9251 * statement.cs (Return.Emit): Report error 157 if the user
9252 attempts to return from a finally block.
9254 (Return.Emit): Instead of emitting a return, jump to the end of
9257 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
9258 LocalBuilder to store the result of the function. ReturnLabel is
9259 the target where we jump.
9262 2001-12-09 Radek Doulik <rodo@ximian.com>
9264 * cs-parser.jay: remember alias in current namespace
9266 * ecore.cs (SimpleName::DoResolve): use aliases for types or
9269 * class.cs (LookupAlias): lookup alias in my_namespace
9271 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
9273 (LookupAlias): lookup alias in this and if needed in parent
9276 2001-12-08 Miguel de Icaza <miguel@ximian.com>
9280 * rootcontext.cs: (ModuleBuilder) Made static, first step into
9281 making things static. I need this to avoid passing the
9282 TypeContainer when calling ParameterType.
9284 * support.cs (InternalParameters.ParameterType): Remove ugly hack
9285 that did string manipulation to compute the type and then call
9286 GetType. Use Parameter.ParameterType instead.
9288 * cs-tokenizer.cs: Consume the suffix for floating values.
9290 * expression.cs (ParameterReference): figure out whether this is a
9291 reference parameter or not. Kill an extra variable by computing
9292 the arg_idx during emission.
9294 * parameter.cs (Parameters.GetParameterInfo): New overloaded
9295 function that returns whether a parameter is an out/ref value or not.
9297 (Parameter.ParameterType): The type of the parameter (base,
9298 without ref/out applied).
9300 (Parameter.Resolve): Perform resolution here.
9301 (Parameter.ExternalType): The full type (with ref/out applied).
9303 * statement.cs (Using.Emit, Using.EmitExpression): Implement
9304 support for expressions on the using statement.
9306 2001-12-07 Miguel de Icaza <miguel@ximian.com>
9308 * statement.cs (Using.EmitLocalVariableDecls): Split the
9309 localvariable handling of the using statement.
9311 (Block.EmitMeta): Keep track of variable count across blocks. We
9312 were reusing slots on separate branches of blocks.
9314 (Try.Emit): Emit the general code block, we were not emitting it.
9316 Check the type of the declaration to be an IDisposable or
9317 something that can be implicity converted to it.
9319 Emit conversions if required.
9321 * ecore.cs (EmptyExpression): New utility class.
9322 (Expression.ImplicitConversionExists): New utility function.
9324 2001-12-06 Miguel de Icaza <miguel@ximian.com>
9326 * statement.cs (Using): Implement.
9328 * expression.cs (LocalVariableReference): Support read only variables.
9330 * statement.cs: Remove the explicit emit for the Leave opcode.
9331 (VariableInfo): Add a readonly field.
9333 2001-12-05 Miguel de Icaza <miguel@ximian.com>
9335 * ecore.cs (ConvCast): new class used to encapsulate the various
9336 explicit integer conversions that works in both checked and
9339 (Expression.ConvertNumericExplicit): Use new ConvCast class to
9340 properly generate the overflow opcodes.
9342 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9344 * statement.cs: The correct type for the EmptyExpression is the
9345 element_type, not the variable type. Ravi pointed this out.
9347 2001-12-04 Ravi Pratap <ravi@ximian.com>
9349 * class.cs (Method::Define): Handle PInvoke methods specially
9350 by using DefinePInvokeMethod instead of the usual one.
9352 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
9353 above to do the task of extracting information and defining the method.
9355 2001-12-04 Ravi Pratap <ravi@ximian.com>
9357 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
9358 of the condition for string type.
9360 (Emit): Move that here.
9362 (ArrayCreation::CheckIndices): Keep string literals in their expression
9365 (EmitDynamicInitializers): Handle strings appropriately.
9367 2001-12-04 Miguel de Icaza <miguel@ximian.com>
9369 * codegen.cs (EmitContext): Replace multiple variables with a
9370 single pointer to the current Switch statement.
9372 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
9375 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9379 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
9382 (Foreach.Emit): Foreach on arrays was not setting
9383 up the loop variables (for break/continue).
9385 (GotoCase): Semi-implented.
9387 2001-12-03 Ravi Pratap <ravi@ximian.com>
9389 * attribute.cs (CheckAttribute): Handle system attributes by using
9390 Attribute.GetAttributes to examine information we need.
9392 (GetValidPlaces): Same here.
9394 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
9396 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
9398 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
9400 (Method::Define): Set appropriate flags if we have a DllImport attribute.
9402 (Method::Emit): Handle the case when we are a PInvoke method.
9404 2001-12-03 Miguel de Icaza <miguel@ximian.com>
9406 * expression.cs: Use ResolveWithSimpleName on compound names.
9408 2001-12-02 Ravi Pratap <ravi@ximian.com>
9410 * constant.cs (EmitConstant): Make sure we resolve the associated expression
9411 before trying to reduce it.
9413 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
9415 * constant.cs (LookupConstantValue): Implement.
9417 (EmitConstant): Use the above in emitting the constant.
9419 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
9420 that are user-defined by doing a LookupConstantValue on them.
9422 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
9425 2001-11-29 Miguel de Icaza <miguel@ximian.com>
9427 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
9429 (BaseAccess.DoResolve): Implement.
9431 (MemberAccess.DoResolve): Split this routine into a
9432 ResolveMemberAccess routine that can be used independently
9434 2001-11-28 Miguel de Icaza <miguel@ximian.com>
9436 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
9437 As that share bits of the implementation. Is returns a boolean,
9438 while As returns the Type that is being probed.
9440 2001-12-01 Ravi Pratap <ravi@ximian.com>
9442 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
9443 instead of a Literal - much easier.
9445 (EnumInTransit): Remove - utterly useless :-)
9447 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
9449 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
9451 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
9452 chain when we have no associated expression.
9454 2001-11-30 Ravi Pratap <ravi@ximian.com>
9456 * constant.cs (Define): Use Location while reporting the errror.
9458 Also emit a warning when 'new' is used and there is no inherited
9461 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
9464 (LookupEnumValue): Implement to lookup an enum member's value and define it
9467 (Populate): Re-write accordingly to use the above routine.
9469 2001-11-27 Miguel de Icaza <miguel@ximian.com>
9471 * expression.cs (This): Fix prototype for DoResolveLValue to
9472 override the base class DoResolveLValue.
9474 * cs-parser.cs: Report errors cs574 and cs575 (destructor
9477 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
9478 (we need to load the address of the field here). This fixes
9481 (FieldExpr.DoResolveLValue): Call the DoResolve
9482 function to initialize the Instance expression.
9484 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
9485 correctly the GetEnumerator operation on a value type.
9487 * cs-parser.jay: Add more simple parsing error catches.
9489 * statement.cs (Switch): Add support for string switches.
9490 Handle null specially.
9492 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
9494 2001-11-28 Ravi Pratap <ravi@ximian.com>
9496 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
9498 (declare_local_constant): New helper function.
9500 * statement.cs (AddConstant): Keep a separate record of constants
9502 (IsConstant): Implement to determine if a variable is a constant.
9504 (GetConstantExpression): Implement.
9506 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
9508 * statement.cs (IsVariableDefined): Re-write.
9510 2001-11-27 Ravi Pratap <ravi@ximian.com>
9512 * class.cs (TypeContainer::FindMembers): Look for constants
9513 in the case when we are looking for MemberTypes.Field
9515 * expression.cs (MemberAccess::DoResolve): Check that in the
9516 case we are a FieldExpr and a Literal, we are not being accessed
9517 by an instance reference.
9519 * cs-parser.jay (local_constant_declaration): Implement.
9521 (declaration_statement): Implement for constant declarations.
9523 2001-11-26 Miguel de Icaza <miguel@ximian.com>
9525 * statement.cs (Switch): Catch double defaults.
9527 (Switch): More work on the switch() statement
9528 implementation. It works for integral values now, need to finish
9532 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9534 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
9535 integer literals into other integer literals. To be used by
9538 2001-11-24 Ravi Pratap <ravi@ximian.com>
9540 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
9543 (EmitDynamicInitializers): Cope with the above since we extract data
9544 directly from ArrayData now.
9546 (ExpectInitializers): Keep track of whether initializers are mandatory
9549 (Bounds): Make it a hashtable to prevent the same dimension being
9550 recorded for every element in that dimension.
9552 (EmitDynamicInitializers): Fix bug which prevented the Set array method
9555 Also fix bug which was causing the indices to be emitted in the reverse
9558 2001-11-24 Miguel de Icaza <miguel@ximian.com>
9560 * expression.cs (ArrayCreation): Implement the bits that Ravi left
9561 unfinished. They do not work, because the underlying code is
9564 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9566 * cs-parser.jay: Remove bogus fixme.
9568 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
9569 on Switch statement.
9571 2001-11-23 Ravi Pratap <ravi@ximian.com>
9573 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
9576 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
9577 parameter. Apparently, any expression is allowed.
9579 (ValidateInitializers): Update accordingly.
9581 (CheckIndices): Fix some tricky bugs thanks to recursion.
9583 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
9584 I was being completely brain-dead.
9586 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
9587 and re-write acordingly.
9589 (DelegateInvocation): Re-write accordingly.
9591 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
9593 (MakeByteBlob): Handle types more correctly.
9595 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
9596 initialization from expressions but it is incomplete because I am a complete
9599 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9601 * statement.cs (If.Emit): Fix a bug that generated incorrect code
9602 on If. Basically, we have to return `true' (ie, we do return to
9603 our caller) only if both branches of the if return.
9605 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
9606 short-circuit operators, handle them as short circuit operators.
9608 (Cast.DoResolve): Resolve type.
9609 (Cast.Cast): Take an expression as the target type.
9611 * cs-parser.jay (cast_expression): Remove old hack that only
9612 allowed a limited set of types to be handled. Now we take a
9613 unary_expression and we resolve to a type during semantic
9616 Use the grammar productions from Rhys to handle casts (this is
9617 not complete like Rhys syntax yet, we fail to handle that corner
9618 case that C# has regarding (-x), but we will get there.
9620 2001-11-22 Ravi Pratap <ravi@ximian.com>
9622 * class.cs (EmitFieldInitializer): Take care of the case when we have a
9623 field which is an array type.
9625 * cs-parser.jay (declare_local_variables): Support array initialization too.
9627 * typemanager.cs (MakeKey): Implement.
9629 (everywhere): Use the above appropriately.
9631 * cs-parser.jay (for_statement): Update for array initialization while
9632 declaring variables.
9634 * ecore.cs : The error message was correct, it's the variable's names that
9635 were misleading ;-) Make the code more readable.
9637 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
9638 the correct type etc.
9640 (ConvertExplicit): Handle Enum types by examining the underlying type.
9642 2001-11-21 Ravi Pratap <ravi@ximian.com>
9644 * parameter.cs (GetCallingConvention): Always return
9645 CallingConventions.Standard for now.
9647 2001-11-22 Miguel de Icaza <miguel@ximian.com>
9649 * expression.cs (Binary.ResolveOperator): Update the values of `l'
9650 and `r' after calling DoNumericPromotions.
9652 * ecore.cs: Fix error message (the types were in the wrong order).
9654 * statement.cs (Foreach.ProbeCollectionType): Need to pass
9655 BindingFlags.Instance as well
9657 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
9658 implicit int literal conversion in an empty cast so that we
9659 propagate the right type upstream.
9661 (UnboxCast): new class used to unbox value types.
9662 (Expression.ConvertExplicit): Add explicit type conversions done
9665 (Expression.ImplicitNumericConversion): Oops, forgot to test for
9666 the target type before applying the implicit LongLiterals to ULong
9669 2001-11-21 Miguel de Icaza <miguel@ximian.com>
9671 * cs-parser.jay (for_statement): Reworked the way For works: now
9672 we declare manually any variables that are introduced in
9673 for_initializer to solve the problem of having out-of-band code
9674 emition (that is what got for broken).
9676 (declaration_statement): Perform the actual variable declaration
9677 that used to be done in local_variable_declaration here.
9679 (local_variable_declaration): Do not declare anything, just pass
9680 the information on a DictionaryEntry
9682 2001-11-20 Ravi Pratap <ravi@ximian.com>
9684 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
9685 re-write of the logic to now make it recursive.
9687 (UpdateIndices): Re-write accordingly.
9689 Store element data in a separate ArrayData list in the above methods.
9691 (MakeByteBlob): Implement to dump the array data into a byte array.
9693 2001-11-19 Ravi Pratap <ravi@ximian.com>
9695 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
9698 * constant.cs (Define): Implement.
9700 (EmitConstant): Re-write fully.
9702 Pass in location info.
9704 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
9707 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
9708 DictionaryEntry since we need location info too.
9710 (constant_declaration): Update accordingly.
9712 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
9713 code into another method : UpdateIndices.
9715 2001-11-18 Ravi Pratap <ravi@ximian.com>
9717 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
9718 some type checking etc.
9720 2001-11-17 Ravi Pratap <ravi@ximian.com>
9722 * expression.cs (ArrayCreation::ValidateInitializers): Implement
9723 bits to provide dimension info if the user skips doing that.
9725 Update second constructor to store the rank correctly.
9727 2001-11-16 Ravi Pratap <ravi@ximian.com>
9729 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
9730 and try to implement.
9732 * ../errors/cs0150.cs : Add.
9734 * ../errors/cs0178.cs : Add.
9736 2001-11-16 Miguel de Icaza <miguel@ximian.com>
9738 * statement.cs: Implement foreach on multi-dimensional arrays.
9740 * parameter.cs (Parameters.GetParameterByName): Also lookup the
9741 name of the params argument.
9743 * expression.cs: Use EmitStoreOpcode to get the right opcode while
9744 initializing the array.
9746 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
9747 we can use this elsewhere.
9749 * statement.cs: Finish implementation of foreach for single
9752 * cs-parser.jay: Use an out-of-band stack to pass information
9753 around, I wonder why I need this.
9755 foreach_block: Make the new foreach_block the current_block.
9757 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
9758 function used to return a static Parameters structure. Used for
9759 empty parameters, as those are created very frequently.
9761 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
9763 2001-11-15 Ravi Pratap <ravi@ximian.com>
9765 * interface.cs : Default modifier is private, not public. The
9766 make verify test passes again.
9768 2001-11-15 Ravi Pratap <ravi@ximian.com>
9770 * support.cs (ReflectionParameters): Fix logic to determine
9771 whether the last parameter is a params one. Test 9 passes again.
9773 * delegate.cs (Populate): Register the builders we define with
9774 RegisterParameterForBuilder. Test 19 passes again.
9776 * cs-parser.jay (property_declaration): Reference $6 instead
9777 of $$ to get at the location.
9779 (indexer_declaration): Similar stuff.
9783 * class.cs (Property): Register parameters for the Get and Set methods
9784 if they exist. Test 23 passes again.
9786 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
9787 call to EmitArguments as we are sure there aren't any params arguments.
9788 Test 32 passes again.
9790 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
9791 IndexOutOfRangeException.
9793 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
9794 Test 33 now passes again.
9796 2001-11-15 Miguel de Icaza <miguel@ximian.com>
9798 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
9799 broke a bunch of things. Will have to come up with a better way
9800 of tracking locations.
9802 * statement.cs: Implemented foreach for single dimension arrays.
9804 2001-11-09 Miguel de Icaza <miguel@ximian.com>
9806 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
9807 an error. This removes the lookup from the critical path.
9809 * cs-parser.jay: Removed use of temporary_loc, which is completely
9812 2001-11-14 Miguel de Icaza <miguel@ximian.com>
9814 * support.cs (ReflectionParameters.ParameterModifier): Report
9815 whether the argument is a PARAMS argument or not.
9817 * class.cs: Set the attribute `ParamArrayAttribute' on the
9820 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
9821 and cons_param_array_attribute (ConstructorInfo for
9822 ParamArrayAttribute).,
9824 * codegen.cs: Emit the return using the `Return' statement, that
9825 way we can report the error correctly for missing return values.
9827 * class.cs (Method.Emit): Clean up.
9829 * expression.cs (Argument.Resolve): Take another argument: the
9830 location where this argument is used. Notice that this is not
9831 part of the "Argument" class as to reduce the size of the
9832 structure (we know the approximate location anyways).
9834 Test if the argument is a variable-reference, if not, then
9835 complain with a 206.
9837 (Argument.Emit): Emit addresses of variables.
9839 (Argument.FullDesc): Simplify.
9841 (Invocation.DoResolve): Update for Argument.Resolve.
9843 (ElementAccess.DoResolve): ditto.
9845 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
9846 method should be virtual, as this method is always virtual.
9848 (NewDelegate.DoResolve): Update for Argument.Resolve.
9850 * class.cs (ConstructorInitializer.DoResolve): ditto.
9852 * attribute.cs (Attribute.Resolve): ditto.
9854 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9856 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
9858 * expression.cs (ParameterReference): Drop IStackStorage and implement
9859 IAssignMethod instead.
9861 (LocalVariableReference): ditto.
9863 * ecore.cs (FieldExpr): Drop IStackStorage and implement
9864 IAssignMethod instead.
9866 2001-11-13 Miguel de Icaza <miguel@ximian.com>
9868 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
9869 enumerations that are used in heavily used structures derive from
9870 byte in a laughable and pathetic attempt to reduce memory usage.
9871 This is the kind of pre-optimzations that you should not do at
9872 home without adult supervision.
9874 * expression.cs (UnaryMutator): New class, used to handle ++ and
9875 -- separatedly from the other unary operators. Cleans up the
9876 code, and kills the ExpressionStatement dependency in Unary.
9878 (Unary): Removed `method' and `Arguments' from this class, making
9879 it smaller, and moving it all to SimpleCall, so I can reuse this
9880 code in other locations and avoid creating a lot of transient data
9881 strucutres when not required.
9883 * cs-parser.jay: Adjust for new changes.
9885 2001-11-11 Miguel de Icaza <miguel@ximian.com>
9887 * enum.cs (Enum.Populate): If there is a failure during
9890 * cs-parser.jay (opt_enum_base): we used to catch type errors
9891 here, but this is really incorrect. The type error should be
9892 catched during semantic analysis.
9894 2001-12-11 Ravi Pratap <ravi@ximian.com>
9896 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
9897 current_local_parameters as expected since I, in my stupidity, had forgotten
9900 * attribute.cs (GetValidPlaces): Fix stupid bug.
9902 * class.cs (Method::Emit): Perform check on applicability of attributes.
9904 (Constructor::Emit): Ditto.
9906 (Field::Emit): Ditto.
9908 (Field.Location): Store location information.
9910 (Property, Event, Indexer, Operator): Ditto.
9912 * cs-parser.jay (field_declaration): Pass in location for each field.
9914 * ../errors/cs0592.cs : Add.
9916 2001-11-12 Ravi Pratap <ravi@ximian.com>
9918 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
9920 (InitCoreTypes): Update accordingly.
9922 (RegisterAttrType, LookupAttr): Implement.
9924 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
9925 info about the same.
9927 (Resolve): Update to populate the above as necessary.
9931 (GetValidPlaces): Helper to the above.
9933 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
9935 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
9937 2001-11-12 Ravi Pratap <ravi@ximian.com>
9939 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
9941 * ../errors/cs0617.cs : Add.
9943 2001-11-11 Ravi Pratap <ravi@ximian.com>
9945 * enum.cs (Emit): Rename to Populate to be more consistent with what
9946 we expect it to do and when exactly it is called.
9948 * class.cs, rootcontext.cs : Update accordingly.
9950 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
9951 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
9953 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
9955 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
9956 of a fieldinfo using the above, when dealing with a FieldBuilder.
9958 2001-11-10 Ravi Pratap <ravi@ximian.com>
9960 * ../errors/cs0031.cs : Add.
9962 * ../errors/cs1008.cs : Add.
9964 * ../errrors/cs0543.cs : Add.
9966 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
9969 (FindMembers): Implement.
9971 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
9972 enums and delegates too.
9974 (enum_types): Rename to builder_to_enum.
9976 (delegate_types): Rename to builder_to_delegate.
9978 * delegate.cs (FindMembers): Implement.
9980 2001-11-09 Ravi Pratap <ravi@ximian.com>
9982 * typemanager.cs (IsEnumType): Implement.
9984 * enum.cs (Emit): Re-write parts to account for the underlying type
9985 better and perform checking etc.
9987 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
9988 of the underlying type.
9990 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
9993 * enum.cs (error31): Helper to report error #31.
9995 * cs-parser.jay (enum_declaration): Store location of each member too.
9997 * enum.cs (member_to_location): New hashtable.
9999 (AddEnumMember): Update location hashtable.
10001 (Emit): Use the location of each member while reporting errors.
10003 2001-11-09 Miguel de Icaza <miguel@ximian.com>
10005 * cs-parser.jay: A for_initializer if is a
10006 local_variable_declaration really ammount to have an implicit
10007 block with the variable declaration and no initializer for for.
10009 * statement.cs (For.Emit): Cope with null initializers.
10011 This fixes the infinite loop on for initializers.
10013 2001-11-08 Miguel de Icaza <miguel@ximian.com>
10015 * enum.cs: More cleanup.
10017 * ecore.cs: Remove dead code.
10019 * class.cs (Property.Emit): More simplification.
10020 (Event.Emit): ditto.
10022 Reworked to have less levels of indentation.
10024 2001-11-08 Ravi Pratap <ravi@ximian.com>
10026 * class.cs (Property): Emit attributes.
10036 * enum.cs (Emit): Ditto.
10038 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
10041 * class.cs (Field, Event, etc.): Move attribute generation into the
10042 Emit method everywhere.
10044 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
10045 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
10046 as we had no way of defining nested enums !
10048 * rootcontext.cs : Adjust code accordingly.
10050 * typemanager.cs (AddEnumType): To keep track of enum types separately.
10052 2001-11-07 Ravi Pratap <ravi@ximian.com>
10054 * expression.cs (EvalConstantExpression): Move into ecore.cs
10056 * enum.cs (Enum): Rename some members and make them public and readonly
10057 according to our convention.
10059 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
10062 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
10064 (Enum::Emit): Write a simple version for now which doesn't try to compute
10065 expressions. I shall modify this to be more robust in just a while.
10067 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
10069 (TypeContainer::CloseType): Create the Enum types too.
10071 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
10073 * expression.cs (EvalConstantExpression): Get rid of completely.
10075 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
10076 user-defined values and other cases.
10078 (IsValidEnumLiteral): Helper function.
10080 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
10081 out there in the case we had a literal FieldExpr.
10083 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
10085 (Literalize): Revamp a bit to take two arguments.
10087 (EnumLiteral): New class which derives from Literal to wrap enum literals.
10089 2001-11-06 Ravi Pratap <ravi@ximian.com>
10091 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
10093 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
10095 (Resolve): Use the above to ensure we have proper initializers.
10097 2001-11-05 Ravi Pratap <ravi@ximian.com>
10099 * expression.cs (Expression::EvalConstantExpression): New method to
10100 evaluate constant expressions.
10102 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
10104 2001-11-07 Miguel de Icaza <miguel@ximian.com>
10106 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
10109 (Binary.ResolveOperator): Handle operator != (object a, object b)
10110 and operator == (object a, object b);
10112 (Binary.DoNumericPromotions): Indicate whether the numeric
10113 promotion was possible.
10115 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
10118 Made the ArrayAccess implement interface IAssignMethod instead of
10119 IStackStore as the order in which arguments are passed reflects
10122 * assign.cs: Instead of using expr.ExprClass to select the way of
10123 assinging, probe for the IStackStore/IAssignMethod interfaces.
10125 * typemanager.cs: Load InitializeArray definition.
10127 * rootcontext.cs (RootContext.MakeStaticData): Used to define
10128 static data that can be used to initialize arrays.
10130 2001-11-05 Miguel de Icaza <miguel@ximian.com>
10132 * expression.cs: Handle operator== and operator!= for booleans.
10134 (Conditioal.Reduce): Implement reducer for the ?: operator.
10136 (Conditional.Resolve): Implement dead code elimination.
10138 (Binary.Resolve): Catch string literals and return a new
10139 concatenated string.
10141 (Unary.Reduce): Implement reduction of unary expressions.
10143 * ecore.cs: Split out the expression core handling here.
10145 (Expression.Reduce): New method used to perform constant folding
10146 and CSE. This is needed to support constant-expressions.
10148 * statement.cs (Statement.EmitBoolExpression): Pass true and false
10149 targets, and optimize for !x.
10151 2001-11-04 Ravi Pratap <ravi@ximian.com>
10153 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
10154 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
10155 set custom atttributes.
10157 * literal.cs (Literal::GetValue): New abstract method to return the actual
10158 value of the literal, cast as an object.
10160 (*Literal): Implement GetValue method.
10162 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
10163 expressions to the arraylist but objects of type Argument.
10165 * class.cs (TypeContainer::Emit): Emit our attributes too.
10167 (Method::Emit, Constructor::Emit): Ditto.
10169 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
10170 to be ignoring earlier.
10172 2001-11-03 Ravi Pratap <ravi@ximian.com>
10174 * attribute.cs (AttributeSection::Define): Implement to do the business
10175 of constructing a CustomAttributeBuilder.
10177 (Attribute): New trivial class. Increases readability of code.
10179 * cs-parser.jay : Update accordingly.
10181 (positional_argument_list, named_argument_list, named_argument): New rules
10183 (attribute_arguments): Use the above so that we are more correct.
10185 2001-11-02 Ravi Pratap <ravi@ximian.com>
10187 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
10188 to perform all checks for a method with a params parameter.
10190 (Invocation::OverloadResolve): Update to use the above method and therefore
10191 cope correctly with params method invocations.
10193 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
10196 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
10197 constructors in our parent too because we can't afford to miss out on
10200 * attribute.cs (AttributeSection): New name for the class Attribute
10202 Other trivial changes to improve readability.
10204 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
10205 use the new class names.
10207 2001-11-01 Ravi Pratap <ravi@ximian.com>
10209 * class.cs (Method::Define): Complete definition for params types too
10211 (Indexer::Define): Ditto.
10213 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
10214 Cope everywhere with a request for info about the array parameter.
10216 2001-11-01 Ravi Pratap <ravi@ximian.com>
10218 * tree.cs (RecordNamespace): Fix up to check for the correct key.
10220 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
10221 local_variable_type to extract the string corresponding to the type.
10223 (local_variable_type): Fixup the action to use the new helper method.
10225 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
10228 * expression.cs : Clean out code which uses the above.
10230 2001-10-31 Ravi Pratap <ravi@ximian.com>
10232 * typemanager.cs (RegisterMethod): Check if we already have an existing key
10233 and bale out if necessary by returning a false.
10235 (RegisterProperty): Ditto.
10237 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
10238 and print out appropriate error messages.
10240 * interface.cs (everywhere): Ditto.
10242 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
10243 location to constructor.
10245 * class.cs (Property, Event, Indexer): Update accordingly.
10247 * ../errors/cs111.cs : Added.
10249 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
10250 of a method, as laid down by the spec.
10252 (Invocation::OverloadResolve): Use the above method.
10254 2001-10-31 Ravi Pratap <ravi@ximian.com>
10256 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
10257 now take a TypeContainer and a Parameters object.
10259 (ParameterData): Modify return type of ParameterModifier method to be
10260 Parameter.Modifier and not a string.
10262 (ReflectionParameters, InternalParameters): Update accordingly.
10264 * expression.cs (Argument::GetParameterModifier): Same here.
10266 * support.cs (InternalParameters::ParameterType): Find a better way of determining
10267 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
10268 symbol in it at all so maybe this is only for now.
10270 2001-10-30 Ravi Pratap <ravi@ximian.com>
10272 * support.cs (InternalParameters): Constructor now takes an extra argument
10273 which is the actual Parameters class.
10275 (ParameterDesc): Update to provide info on ref/out modifiers.
10277 * class.cs (everywhere): Update call to InternalParameters to pass in
10278 the second argument too.
10280 * support.cs (ParameterData): Add ParameterModifier, which is a method
10281 to return the modifier info [ref/out etc]
10283 (InternalParameters, ReflectionParameters): Implement the above.
10285 * expression.cs (Argument::ParameterModifier): Similar function to return
10286 info about the argument's modifiers.
10288 (Invocation::OverloadResolve): Update to take into account matching modifiers
10291 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
10292 a new SetFormalParameters object which we pass to InternalParameters.
10294 2001-10-30 Ravi Pratap <ravi@ximian.com>
10296 * expression.cs (NewArray): Merge into the ArrayCreation class.
10298 2001-10-29 Ravi Pratap <ravi@ximian.com>
10300 * expression.cs (NewArray): Merge classes NewBuiltinArray and
10301 NewUserdefinedArray into one as there wasn't much of a use in having
10304 * expression.cs (Argument): Change field's name to ArgType from Type.
10306 (Type): New readonly property which returns the proper type, taking into
10307 account ref/out modifiers.
10309 (everywhere): Adjust code accordingly for the above.
10311 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
10312 whether we are emitting for a ref or out parameter.
10314 * expression.cs (Argument::Emit): Use the above field to set the state.
10316 (LocalVariableReference::Emit): Update to honour the flag and emit the
10319 * parameter.cs (Attributes): Set the correct flags for ref parameters.
10321 * expression.cs (Argument::FullDesc): New function to provide a full desc.
10323 * support.cs (ParameterData): Add method ParameterDesc to the interface.
10325 (ReflectionParameters, InternalParameters): Implement the above method.
10327 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
10330 (Invocation::FullMethodDesc): Ditto.
10332 2001-10-29 Miguel de Icaza <miguel@ximian.com>
10334 * cs-parser.jay: Add extra production for the second form of array
10337 * expression.cs (ArrayCreation): Update to reflect the above
10340 * Small changes to prepare for Array initialization.
10342 2001-10-28 Miguel de Icaza <miguel@ximian.com>
10344 * typemanager.cs (ImplementsInterface): interface might be null;
10345 Deal with this problem;
10347 Also, we do store negative hits on the cache (null values), so use
10348 this instead of calling t.GetInterfaces on the type everytime.
10350 2001-10-28 Ravi Pratap <ravi@ximian.com>
10352 * typemanager.cs (IsBuiltinType): New method to help determine the same.
10354 * expression.cs (New::DoResolve): Get rid of array creation code and instead
10355 split functionality out into different classes.
10357 (New::FormArrayType): Move into NewBuiltinArray.
10359 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
10362 (NewBuiltinArray): New class to handle creation of built-in arrays.
10364 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
10365 account creation of one-dimensional arrays.
10367 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
10369 (NewUserdefinedArray::DoResolve): Implement.
10371 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
10373 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
10374 we maintain inside the TypeManager. This is necessary to perform lookups on the
10377 (LookupType): Update to perform GetType on the module builders too.
10379 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
10381 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
10383 2001-10-23 Ravi Pratap <ravi@ximian.com>
10385 * expression.cs (New::DoResolve): Implement guts of array creation.
10387 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
10389 2001-10-27 Miguel de Icaza <miguel@ximian.com>
10391 * expression.cs: Fix bug I introduced lsat night that broke
10394 (Expression.Resolve): Report a 246 error (can not resolve name)
10395 if we find a SimpleName in the stream.
10397 (Expression.ResolveLValue): Ditto.
10399 (Expression.ResolveWithSimpleName): This function is a variant of
10400 ResolveName, this one allows SimpleNames to be returned without a
10401 warning. The only consumer of SimpleNames is MemberAccess
10403 2001-10-26 Miguel de Icaza <miguel@ximian.com>
10405 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
10406 might arrive here. I have my doubts that this is correct.
10408 * statement.cs (Lock): Implement lock statement.
10410 * cs-parser.jay: Small fixes to support `lock' and `using'
10412 * cs-tokenizer.cs: Remove extra space
10414 * driver.cs: New flag --checked, allows to turn on integer math
10417 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
10418 Threading.Monitor.Exit
10420 2001-10-23 Miguel de Icaza <miguel@ximian.com>
10422 * expression.cs (IndexerAccess::DoResolveLValue): Set the
10423 Expression Class to be IndexerAccess.
10425 Notice that Indexer::DoResolve sets the eclass to Value.
10427 2001-10-22 Miguel de Icaza <miguel@ximian.com>
10429 * class.cs (TypeContainer::Emit): Emit code for indexers.
10431 * assign.cs (IAssignMethod): New interface implemented by Indexers
10432 and Properties for handling assignment.
10434 (Assign::Emit): Simplify and reuse code.
10436 * expression.cs (IndexerAccess, PropertyExpr): Implement
10437 IAssignMethod, clean up old code.
10439 2001-10-22 Ravi Pratap <ravi@ximian.com>
10441 * typemanager.cs (ImplementsInterface): New method to determine if a type
10442 implements a given interface. Provides a nice cache too.
10444 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
10447 (ConvertReferenceExplicit): Ditto.
10449 * delegate.cs (Delegate::Populate): Update to define the parameters on the
10450 various methods, with correct names etc.
10452 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
10453 Operator.UnaryNegation.
10455 * cs-parser.jay (operator_declarator): Be a little clever in the case where
10456 we have a unary plus or minus operator.
10458 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
10461 * everywhere : update accordingly.
10463 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
10466 * class.cs (Method::Define): For the case where we are implementing a method
10467 inherited from an interface, we need to set the MethodAttributes.Final flag too.
10468 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
10470 2001-10-21 Ravi Pratap <ravi@ximian.com>
10472 * interface.cs (FindMembers): Implement to work around S.R.E
10475 * typemanager.cs (IsInterfaceType): Implement.
10477 (FindMembers): Update to handle interface types too.
10479 * expression.cs (ImplicitReferenceConversion): Re-write bits which
10480 use IsAssignableFrom as that is not correct - it doesn't work.
10482 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
10483 and accordingly override EmitStatement.
10485 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
10486 using the correct logic :-)
10488 2001-10-19 Ravi Pratap <ravi@ximian.com>
10490 * ../errors/cs-11.cs : Add to demonstrate error -11
10492 2001-10-17 Miguel de Icaza <miguel@ximian.com>
10494 * assign.cs (Assign::Resolve): Resolve right hand side first, and
10495 then pass this as a hint to ResolveLValue.
10497 * expression.cs (FieldExpr): Add Location information
10499 (FieldExpr::LValueResolve): Report assignment to readonly
10502 (Expression::ExprClassFromMemberInfo): Pass location information.
10504 (Expression::ResolveLValue): Add new method that resolves an
10507 (Expression::DoResolveLValue): Default invocation calls
10510 (Indexers): New class used to keep track of indexers in a given
10513 (IStackStore): Renamed from LValue, as it did not really describe
10514 what this did. Also ResolveLValue is gone from this interface and
10515 now is part of Expression.
10517 (ElementAccess): Depending on the element access type
10519 * typemanager.cs: Add `indexer_name_type' as a Core type
10520 (System.Runtime.CompilerServices.IndexerNameAttribute)
10522 * statement.cs (Goto): Take a location.
10524 2001-10-18 Ravi Pratap <ravi@ximian.com>
10526 * delegate.cs (Delegate::VerifyDelegate): New method to verify
10527 if two delegates are compatible.
10529 (NewDelegate::DoResolve): Update to take care of the case when
10530 we instantiate a delegate from another delegate.
10532 * typemanager.cs (FindMembers): Don't even try to look up members
10533 of Delegate types for now.
10535 2001-10-18 Ravi Pratap <ravi@ximian.com>
10537 * delegate.cs (NewDelegate): New class to take care of delegate
10540 * expression.cs (New): Split the delegate related code out into
10541 the NewDelegate class.
10543 * delegate.cs (DelegateInvocation): New class to handle delegate
10546 * expression.cs (Invocation): Split out delegate related code into
10547 the DelegateInvocation class.
10549 2001-10-17 Ravi Pratap <ravi@ximian.com>
10551 * expression.cs (New::DoResolve): Implement delegate creation fully
10552 and according to the spec.
10554 (New::DoEmit): Update to handle delegates differently.
10556 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
10557 because of which we were printing out arguments in reverse order !
10559 * delegate.cs (VerifyMethod): Implement to check if the given method
10560 matches the delegate.
10562 (FullDelegateDesc): Implement.
10564 (VerifyApplicability): Implement.
10566 * expression.cs (Invocation::DoResolve): Update to accordingly handle
10567 delegate invocations too.
10569 (Invocation::Emit): Ditto.
10571 * ../errors/cs1593.cs : Added.
10573 * ../errors/cs1594.cs : Added.
10575 * delegate.cs (InstanceExpression, TargetMethod): New properties.
10577 2001-10-16 Ravi Pratap <ravi@ximian.com>
10579 * typemanager.cs (intptr_type): Core type for System.IntPtr
10581 (InitCoreTypes): Update for the same.
10583 (iasyncresult_type, asynccallback_type): Ditto.
10585 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
10588 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
10591 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
10592 the builders for the 4 members of a delegate type :-)
10594 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
10597 * expression.cs (New::DoResolve): Implement guts for delegate creation.
10599 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
10601 2001-10-15 Miguel de Icaza <miguel@ximian.com>
10603 * statement.cs (Break::Emit): Implement.
10604 (Continue::Emit): Implement.
10606 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
10607 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
10608 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
10609 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
10612 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
10613 properties that track the label for the current loop (begin of the
10614 loop and end of the loop).
10616 2001-10-15 Ravi Pratap <ravi@ximian.com>
10618 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
10619 use of emitting anything at all.
10621 * class.cs, rootcontext.cs : Get rid of calls to the same.
10623 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
10625 (Populate): Define the constructor correctly and set the implementation
10628 * typemanager.cs (delegate_types): New hashtable to hold delegates that
10631 (AddDelegateType): Implement.
10633 (IsDelegateType): Implement helper method.
10635 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
10637 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
10638 and accordingly handle it.
10640 * delegate.cs (Populate): Take TypeContainer argument.
10641 Implement bits to define the Invoke method. However, I still haven't figured out
10642 how to take care of the native int bit :-(
10644 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
10645 Qualify the name of the delegate, not its return type !
10647 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
10650 (StandardConversionExists): Checking for array types turns out to be recursive.
10652 (ConvertReferenceExplicit): Implement array conversion.
10654 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
10656 2001-10-12 Ravi Pratap <ravi@ximian.com>
10658 * cs-parser.jay (delegate_declaration): Store the fully qualified
10659 name as it is a type declaration.
10661 * delegate.cs (ReturnType, Name): Rename members to these. Make them
10664 (DefineDelegate): Renamed from Define. Does the same thing essentially,
10665 as TypeContainer::DefineType.
10667 (Populate): Method in which all the definition of the various methods (Invoke)
10670 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
10673 (CloseDelegate): Finally creates the delegate.
10675 * class.cs (TypeContainer::DefineType): Update to define delegates.
10676 (Populate, Emit and CloseType): Do the same thing here too.
10678 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
10679 delegates in all these operations.
10681 2001-10-14 Miguel de Icaza <miguel@ximian.com>
10683 * expression.cs: LocalTemporary: a new expression used to
10684 reference a temporary that has been created.
10686 * assign.cs: Handle PropertyAccess back here, so that we can
10687 provide the proper semantic access to properties.
10689 * expression.cs (Expression::ConvertReferenceExplicit): Implement
10690 a few more explicit conversions.
10692 * modifiers.cs: `NEW' modifier maps to HideBySig.
10694 * expression.cs (PropertyExpr): Make this into an
10695 ExpressionStatement, and support the EmitStatement code path.
10697 Perform get/set error checking, clean up the interface.
10699 * assign.cs: recognize PropertyExprs as targets, and if so, turn
10700 them into toplevel access objects.
10702 2001-10-12 Miguel de Icaza <miguel@ximian.com>
10704 * expression.cs: PropertyExpr::PropertyExpr: use work around the
10707 * typemanager.cs: Keep track here of our PropertyBuilders again to
10708 work around lameness in SRE.
10710 2001-10-11 Miguel de Icaza <miguel@ximian.com>
10712 * expression.cs (LValue::LValueResolve): New method in the
10713 interface, used to perform a second resolution pass for LValues.
10715 (This::DoResolve): Catch the use of this in static methods.
10717 (This::LValueResolve): Implement.
10719 (This::Store): Remove warning, assigning to `this' in structures
10722 (Invocation::Emit): Deal with invocation of
10723 methods on value types. We need to pass the address to structure
10724 methods rather than the object itself. (The equivalent code to
10725 emit "this" for structures leaves the entire structure on the
10726 stack instead of a pointer to it).
10728 (ParameterReference::DoResolve): Compute the real index for the
10729 argument based on whether the method takes or not a `this' pointer
10730 (ie, the method is static).
10732 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
10733 value types returned from functions when we need to invoke a
10734 method on the sturcture.
10737 2001-10-11 Ravi Pratap <ravi@ximian.com>
10739 * class.cs (TypeContainer::DefineType): Method to actually do the business of
10740 defining the type in the Modulebuilder or Typebuilder. This is to take
10741 care of nested types which need to be defined on the TypeBuilder using
10742 DefineNestedMethod.
10744 (TypeContainer::GetClassBases): Implement. Essentially the code from the
10745 methods in RootContext, only ported to be part of TypeContainer.
10747 (TypeContainer::GetInterfaceOrClass): Ditto.
10749 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
10751 * interface.cs (Interface::DefineInterface): New method. Does exactly
10752 what RootContext.CreateInterface did earlier, only it takes care of nested types
10755 (Interface::GetInterfaces): Move from RootContext here and port.
10757 (Interface::GetInterfaceByName): Same here.
10759 * rootcontext.cs (ResolveTree): Re-write.
10761 (PopulateTypes): Re-write.
10763 * class.cs (TypeContainer::Populate): Populate nested types too.
10764 (TypeContainer::Emit): Emit nested members too.
10766 * typemanager.cs (AddUserType): Do not make use of the FullName property,
10767 instead just use the name argument passed in as it is already fully
10770 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
10771 to TypeContainer mapping to see if a type is user-defined.
10773 * class.cs (TypeContainer::CloseType): Implement.
10775 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
10776 the default constructor.
10778 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
10781 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
10783 * interface.cs (CloseType): Create the type here.
10785 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
10788 Remove all the methods which are now in TypeContainer.
10790 2001-10-10 Ravi Pratap <ravi@ximian.com>
10792 * delegate.cs (Define): Re-write bits to define the delegate
10795 2001-10-10 Miguel de Icaza <miguel@ximian.com>
10797 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
10799 * expression.cs (ImplicitReferenceConversion): handle null as well
10800 as a source to convert to any reference type.
10802 * statement.cs (Return): Perform any implicit conversions to
10803 expected return type.
10805 Validate use of return statement.
10807 * codegen.cs (EmitContext): Pass the expected return type here.
10809 * class.cs (Method, Constructor, Property): Pass expected return
10810 type to EmitContext.
10812 2001-10-09 Miguel de Icaza <miguel@ximian.com>
10814 * expression.cs: Make DoResolve take an EmitContext instead of a
10817 Replaced `l' and `location' for `loc', for consistency.
10819 (Error, Warning): Remove unneeded Tc argument.
10821 * assign.cs, literal.cs, constant.cs: Update to new calling
10824 * codegen.cs: EmitContext now contains a flag indicating whether
10825 code is being generated in a static method or not.
10827 * cs-parser.jay: DecomposeQI, new function that replaces the old
10828 QualifiedIdentifier. Now we always decompose the assembled
10829 strings from qualified_identifier productions into a group of
10832 2001-10-08 Miguel de Icaza <miguel@ximian.com>
10834 * rootcontext.cs: Deal with field-less struct types correctly now
10835 by passing the size option to Define Type.
10837 * class.cs: Removed hack that created one static field.
10839 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10841 * statement.cs: Moved most of the code generation here.
10843 2001-10-09 Ravi Pratap <ravi@ximian.com>
10845 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
10848 (ElementAccess): Remove useless bits for now - keep checks as the spec
10851 2001-10-08 Ravi Pratap <ravi@ximian.com>
10853 * expression.cs (ElementAccess::DoResolve): Remove my crap code
10854 and start performing checks according to the spec.
10856 2001-10-07 Ravi Pratap <ravi@ximian.com>
10858 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
10859 rank_specifiers instead.
10861 (rank_specifiers): Change the order in which the rank specifiers are stored
10863 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
10865 * expression.cs (ElementAccess): Implement the LValue interface too.
10867 2001-10-06 Ravi Pratap <ravi@ximian.com>
10869 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
10870 except that user defined conversions are not included.
10872 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
10873 perform the conversion of the return type, if necessary.
10875 (New::DoResolve): Check whether we are creating an array or an object
10876 and accordingly do the needful.
10878 (New::Emit): Same here.
10880 (New::DoResolve): Implement guts of array creation.
10882 (New::FormLookupType): Helper function.
10884 2001-10-07 Miguel de Icaza <miguel@ximian.com>
10886 * codegen.cs: Removed most of the code generation here, and move the
10887 corresponding code generation bits to the statement classes.
10889 Added support for try/catch/finalize and throw.
10891 * cs-parser.jay: Added support for try/catch/finalize.
10893 * class.cs: Catch static methods having the flags override,
10894 virtual or abstract.
10896 * expression.cs (UserCast): This user cast was not really doing
10897 what it was supposed to do. Which is to be born in fully resolved
10898 state. Parts of the resolution were being performed at Emit time!
10902 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10904 * expression.cs: Implicity convert the result from UserCast.
10906 2001-10-05 Ravi Pratap <ravi@ximian.com>
10908 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
10909 prevented it from working correctly.
10911 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
10912 merely ConvertImplicit.
10914 2001-10-05 Miguel de Icaza <miguel@ximian.com>
10916 * typemanager.cs: Make the LookupTypeContainer function static,
10917 and not per-instance.
10919 * class.cs: Make static FindMembers (the one that takes a Type
10922 * codegen.cs: Add EmitForeach here.
10924 * cs-parser.jay: Make foreach a toplevel object instead of the
10925 inline expansion, as we need to perform semantic analysis on it.
10927 2001-10-05 Ravi Pratap <ravi@ximian.com>
10929 * expression.cs (Expression::ImplicitUserConversion): Rename to
10930 UserDefinedConversion.
10932 (Expression::UserDefinedConversion): Take an extra argument specifying
10933 whether we look for explicit user conversions too.
10935 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
10937 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
10939 (ExplicitUserConversion): Make it a call to UserDefinedConversion
10940 with the appropriate arguments.
10942 * cs-parser.jay (cast_expression): Record location too.
10944 * expression.cs (Cast): Record location info.
10946 (Expression::ConvertExplicit): Take location argument.
10948 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
10949 to determine if we are doing explicit conversions.
10951 (UserCast::Emit): Update accordingly.
10953 (Expression::ConvertExplicit): Report an error if everything fails.
10955 * ../errors/cs0030.cs : Add.
10957 2001-10-04 Miguel de Icaza <miguel@ximian.com>
10959 * modifiers.cs: If the ABSTRACT keyword is present, also set the
10960 virtual and newslot bits.
10962 * class.cs (TypeContainer::RegisterRequiredImplementations):
10963 Record methods we need.
10965 (TypeContainer::MakeKey): Helper function to make keys for
10966 MethodBases, since the Methodbase key is useless.
10968 (TypeContainer::Populate): Call RegisterRequiredImplementations
10969 before defining the methods.
10971 Create a mapping for method_builders_to_methods ahead of time
10972 instead of inside a tight loop.
10974 (::RequireMethods): Accept an object as the data to set into the
10975 hashtable so we can report interface vs abstract method mismatch.
10977 2001-10-03 Miguel de Icaza <miguel@ximian.com>
10979 * report.cs: Make all of it static.
10981 * rootcontext.cs: Drop object_type and value_type computations, as
10982 we have those in the TypeManager anyways.
10984 Drop report instance variable too, now it is a global.
10986 * driver.cs: Use try/catch on command line handling.
10988 Add --probe option to debug the error reporting system with a test
10991 * report.cs: Add support for exiting program when a probe
10992 condition is reached.
10994 2001-10-03 Ravi Pratap <ravi@ximian.com>
10996 * expression.cs (Binary::DoNumericPromotions): Fix the case when
10997 we do a forcible conversion regardless of type, to check if
10998 ForceConversion returns a null.
11000 (Binary::error19): Use location to report error.
11002 (Unary::error23): Use location here too.
11004 * ../errors/cs0019.cs : Check in.
11006 * ../errors/cs0023.cs : Check in.
11008 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
11009 case of a non-null MethodInfo object with a length of 0 !
11011 (Binary::ResolveOperator): Flag error if overload resolution fails to find
11012 an applicable member - according to the spec :-)
11013 Also fix logic to find members in base types.
11015 (Unary::ResolveOperator): Same here.
11017 (Unary::report23): Change name to error23 and make first argument a TypeContainer
11018 as I was getting thoroughly confused between this and error19 :-)
11020 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
11021 (::FindMostEncompassedType): Implement.
11022 (::FindMostEncompassingType): Implement.
11023 (::StandardConversionExists): Implement.
11025 (UserImplicitCast): Re-vamp. We now need info about most specific
11026 source and target types so that we can do the necessary conversions.
11028 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
11029 mathematical union with no duplicates.
11031 2001-10-03 Miguel de Icaza <miguel@ximian.com>
11033 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
11034 in order from base classes to child classes, so that we can in
11035 child classes look up in our parent for method names and
11036 attributes (required for handling abstract, virtual, new, override
11037 constructs: we need to instrospect our base class, and if we dont
11038 populate the classes in order, the introspection might be
11039 incorrect. For example, a method could query its parent before
11040 the parent has any methods and would determine that the parent has
11041 no abstract methods (while it could have had them)).
11043 (RootContext::CreateType): Record the order in which we define the
11046 2001-10-02 Miguel de Icaza <miguel@ximian.com>
11048 * class.cs (TypeContainer::Populate): Also method definitions can
11049 fail now, keep track of this.
11051 (TypeContainer::FindMembers): Implement support for
11052 DeclaredOnly/noDeclaredOnly flag.
11054 (Constructor::Emit) Return the ConstructorBuilder.
11056 (Method::Emit) Return the MethodBuilder.
11057 Check for abstract or virtual methods to be public.
11059 * rootcontext.cs (RootContext::CreateType): Register all the
11060 abstract methods required for the class to be complete and the
11061 interface methods that must be implemented.
11063 * cs-parser.jay: Report error 501 (method requires body if it is
11064 not marked abstract or extern).
11066 * expression.cs (TypeOf::Emit): Implement.
11068 * typemanager.cs: runtime_handle_type, new global type.
11070 * class.cs (Property::Emit): Generate code for properties.
11072 2001-10-02 Ravi Pratap <ravi@ximian.com>
11074 * expression.cs (Unary::ResolveOperator): Find operators on base type
11075 too - we now conform exactly to the spec.
11077 (Binary::ResolveOperator): Same here.
11079 * class.cs (Operator::Define): Fix minor quirk in the tests.
11081 * ../errors/cs0215.cs : Added.
11083 * ../errors/cs0556.cs : Added.
11085 * ../errors/cs0555.cs : Added.
11087 2001-10-01 Miguel de Icaza <miguel@ximian.com>
11089 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
11090 single integer which is really efficient
11092 2001-10-01 Ravi Pratap <ravi@ximian.com>
11094 * expression.cs (Expression::ImplicitUserConversion): Use location
11095 even in the case when we are examining True operators.
11097 * class.cs (Operator::Define): Perform extensive checks to conform
11098 with the rules for operator overloading in the spec.
11100 * expression.cs (Expression::ImplicitReferenceConversion): Implement
11101 some of the other conversions mentioned in the spec.
11103 * typemanager.cs (array_type): New static member for the System.Array built-in
11106 (cloneable_interface): For System.ICloneable interface.
11108 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
11109 we start resolving the tree and populating types.
11111 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
11113 2001-10-01 Miguel de Icaza <miguel@ximian.com>
11115 * expression.cs (Expression::ExprClassFromMemberInfo,
11116 Expression::Literalize): Create literal expressions from
11117 FieldInfos which are literals.
11119 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
11120 type casts, because they were wrong. The test suite in tests
11123 (ImplicitNumericConversion): ushort to ulong requires a widening
11126 Int32 constant to long requires widening cast as well.
11128 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
11129 for integers because the type on the stack is not i4.
11131 2001-09-30 Miguel de Icaza <miguel@ximian.com>
11133 * expression.cs (report118): require location argument.
11135 * parameter.cs: Do not dereference potential null value.
11137 * class.cs: Catch methods that lack the `new' keyword when
11138 overriding a name. Report warnings when `new' is used without
11139 anything being there to override.
11141 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
11143 * class.cs: Only add constructor to hashtable if it is non-null
11144 (as now constructors can fail on define).
11146 (TypeManager, Class, Struct): Take location arguments.
11148 Catch field instance initialization in structs as errors.
11150 accepting_filter: a new filter for FindMembers that is static so
11151 that we dont create an instance per invocation.
11153 (Constructor::Define): Catch errors where a struct constructor is
11156 * cs-parser.jay: Pass location information for various new
11159 * delegate.cs (Delegate): take a location argument.
11161 * driver.cs: Do not call EmitCode if there were problesm in the
11162 Definition of the types, as many Builders wont be there.
11164 * decl.cs (Decl::Decl): Require a location argument.
11166 * cs-tokenizer.cs: Handle properly hex constants that can not fit
11167 into integers, and find the most appropiate integer for it.
11169 * literal.cs: Implement ULongLiteral.
11171 * rootcontext.cs: Provide better information about the location of
11172 failure when CreateType fails.
11174 2001-09-29 Miguel de Icaza <miguel@ximian.com>
11176 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
11179 * expression.cs (Binary::CheckShiftArguments): Add missing type
11181 (Binary::ResolveOperator): Add type to the logical and and logical
11182 or, Bitwise And/Or and Exclusive Or code paths, it was missing
11185 (Binary::DoNumericPromotions): In the case where either argument
11186 is ulong (and most signed types combined with ulong cause an
11187 error) perform implicit integer constant conversions as well.
11189 2001-09-28 Miguel de Icaza <miguel@ximian.com>
11191 * expression.cs (UserImplicitCast): Method should always be
11193 (Invocation::BetterConversion): Simplified test for IntLiteral.
11195 (Expression::ImplicitNumericConversion): Split this routine out.
11196 Put the code that performs implicit constant integer conversions
11199 (Expression::Resolve): Become a wrapper around DoResolve so we can
11200 check eclass and type being set after resolve.
11202 (Invocation::Badness): Remove this dead function
11204 (Binary::ResolveOperator): Do not compute the expensive argumnets
11205 unless we have a union for it.
11207 (Probe::Emit): Is needs to do an isinst and then
11208 compare against null.
11210 (::CanConvert): Added Location argument. If the Location argument
11211 is null (Location.Null), then we do not report errors. This is
11212 used by the `probe' mechanism of the Explicit conversion. We do
11213 not want to generate an error for something that the user
11214 explicitly requested to be casted. But the pipeline for an
11215 explicit cast first tests for potential implicit casts.
11217 So for now, if the Location is null, it means `Probe only' to
11218 avoid adding another argument. Might have to revise this
11221 (ClassCast): New class used to type cast objects into arbitrary
11222 classes (used in Explicit Reference Conversions).
11224 Implement `as' as well.
11226 Reverted all the patches from Ravi below: they were broken:
11228 * The use of `level' as a mechanism to stop recursive
11229 invocations is wrong. That was there just to catch the
11230 bug with a strack trace but not as a way of addressing
11233 To fix the problem we have to *understand* what is going
11234 on and the interactions and come up with a plan, not
11235 just get things going.
11237 * The use of the type conversion cache that I proposed
11238 last night had an open topic: How does this work across
11239 protection domains. A user defined conversion might not
11240 be public in the location where we are applying the
11241 conversion, a different conversion might be selected
11242 (ie, private A->B (better) but public B->A (worse),
11243 inside A, A->B applies, but outside it, B->A will
11246 * On top of that (ie, even if the above is solved),
11247 conversions in a cache need to be abstract. Ie, `To
11248 convert from an Int to a Short use an OpcodeCast', not
11249 `To convert from an Int to a Short use the OpcodeCast on
11250 the variable 5' (which is what this patch was doing).
11252 2001-09-28 Ravi Pratap <ravi@ximian.com>
11254 * expression.cs (Invocation::ConversionExists): Re-write to use
11255 the conversion cache
11257 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
11258 cache all conversions done, not just user-defined ones.
11260 (Invocation::BetterConversion): The real culprit. Use ConversionExists
11261 to determine if a conversion exists instead of acutually trying to
11262 perform the conversion. It's faster too.
11264 (Expression::ConvertExplicit): Modify to use ConversionExists to check
11265 and only then attempt the implicit conversion.
11267 2001-09-28 Ravi Pratap <ravi@ximian.com>
11269 * expression.cs (ConvertImplicit): Use a cache for conversions
11270 already found. Check level of recursion and bail out if necessary.
11272 2001-09-28 Miguel de Icaza <miguel@ximian.com>
11274 * typemanager.cs (string_concat_string_string, string_concat_object_object):
11275 Export standard methods that we expect for string operations.
11277 * statement.cs (Block::UsageWarning): Track usage of variables and
11278 report the errors for not used variables.
11280 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
11283 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11285 * codegen.cs: remove unnneded code
11287 * expression.cs: Removed BuiltinTypeAccess class
11289 Fix the order in which implicit conversions are
11292 The previous fixed dropped support for boxed conversions (adding a
11293 test to the test suite now)
11295 (UserImplicitCast::CanConvert): Remove test for source being null,
11296 that code is broken. We should not feed a null to begin with, if
11297 we do, then we should track the bug where the problem originates
11298 and not try to cover it up here.
11300 Return a resolved expression of type UserImplicitCast on success
11301 rather than true/false. Ravi: this is what I was talking about,
11302 the pattern is to use a static method as a "constructor" for
11305 Also, do not create arguments until the very last minute,
11306 otherwise we always create the arguments even for lookups that
11307 will never be performed.
11309 (UserImplicitCast::Resolve): Eliminate, objects of type
11310 UserImplicitCast are born in a fully resolved state.
11312 * typemanager.cs (InitCoreTypes): Init also value_type
11313 (System.ValueType).
11315 * expression.cs (Cast::Resolve): First resolve the child expression.
11317 (LValue): Add new method AddressOf to be used by
11320 Change the argument of Store to take an EmitContext instead of an
11321 ILGenerator, because things like FieldExpr need to be able to call
11322 their children expression to generate the instance code.
11324 (Expression::Error, Expression::Warning): Sugar functions for
11327 (Expression::MemberLookup): Accept a TypeContainer instead of a
11328 Report as the first argument.
11330 (Expression::ResolvePrimary): Killed. I still want to improve
11331 this as currently the code is just not right.
11333 (Expression::ResolveMemberAccess): Simplify, but it is still
11336 (Unary::Resolve): Catch errors in AddressOf operators.
11338 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
11339 index to a byte for the short-version, or the compiler will choose
11340 the wrong Emit call, which generates the wrong data.
11342 (ParameterReference::Emit, ::Store): same.
11344 (FieldExpr::AddressOf): Implement.
11346 * typemanager.cs: TypeManager: made public variable instead of
11349 * driver.cs: document --fatal.
11351 * report.cs (ErrorMessage, WarningMessage): new names for the old
11352 Error and Warning classes.
11354 * cs-parser.jay (member_access): Turn built-in access to types
11355 into a normal simplename
11357 2001-09-27 Ravi Pratap <ravi@ximian.com>
11359 * expression.cs (Invocation::BetterConversion): Fix to cope
11360 with q being null, since this was introducing a bug.
11362 * expression.cs (ConvertImplicit): Do built-in conversions first.
11364 2001-09-27 Ravi Pratap <ravi@ximian.com>
11366 * expression.cs (UserImplicitCast::Resolve): Fix bug.
11368 2001-09-27 Ravi Pratap <ravi@ximian.com>
11370 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
11371 I had introduced long ago (what's new ?).
11373 * expression.cs (UserImplicitCast::CanConvert): Static method to do
11374 the work of all the checking.
11375 (ConvertImplicit): Call CanConvert and only then create object if necessary.
11376 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
11378 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
11379 that is the right way.
11381 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
11382 overloading resolution. Use everywhere instead of cutting and pasting code.
11384 (Binary::ResolveOperator): Use MakeUnionSet.
11386 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
11387 we have to convert to bool types. Not complete yet.
11389 2001-09-27 Miguel de Icaza <miguel@ximian.com>
11391 * typemanager.cs (TypeManager::CSharpName): support ushort.
11393 * expression.cs (Expression::TryImplicitIntConversion): Attempts
11394 to provide an expression that performsn an implicit constant int
11395 conversion (section 6.1.6).
11396 (Expression::ConvertImplicitRequired): Reworked to include
11397 implicit constant expression conversions.
11399 (Expression::ConvertNumericExplicit): Finished.
11401 (Invocation::Emit): If InstanceExpression is null, then it means
11402 that we perform a call on this.
11404 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11406 * expression.cs (Unary::Emit): Remove some dead code.
11407 (Probe): Implement Resolve and Emit for `is'.
11408 (Expression::ConvertImplicitRequired): Attempt to do constant
11409 expression conversions here. Maybe should be moved to
11410 ConvertImplicit, but I am not sure.
11411 (Expression::ImplicitLongConstantConversionPossible,
11412 Expression::ImplicitIntConstantConversionPossible): New functions
11413 that tell whether is it possible to apply an implicit constant
11414 expression conversion.
11416 (ConvertNumericExplicit): Started work on explicit numeric
11419 * cs-parser.jay: Update operator constants.
11421 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
11422 (Parameters::GetSignature): Hook up VerifyArgs here.
11423 (Parameters::VerifyArgs): Verifies that no two arguments have the
11426 * class.cs (Operator): Update the operator names to reflect the
11427 ones that the spec expects (as we are just stringizing the
11430 * expression.cs (Unary::ResolveOperator): Fix bug: Use
11431 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
11432 previous usage did only work for our methods.
11433 (Expression::ConvertImplicit): Handle decimal implicit numeric
11434 conversions as well.
11435 (Expression::InternalTypeConstructor): Used to invoke constructors
11436 on internal types for default promotions.
11438 (Unary::Emit): Implement special handling for the pre/post
11439 increment/decrement for overloaded operators, as they need to have
11440 the same semantics as the other operators.
11442 (Binary::ResolveOperator): ditto.
11443 (Invocation::ConversionExists): ditto.
11444 (UserImplicitCast::Resolve): ditto.
11446 2001-09-26 Ravi Pratap <ravi@ximian.com>
11448 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
11449 operator, return after emitting body. Regression tests pass again !
11451 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
11452 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
11453 (Invocation::OverloadResolve): Ditto.
11454 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
11456 * everywhere : update calls to the above methods accordingly.
11458 2001-09-26 Miguel de Icaza <miguel@ximian.com>
11460 * assign.cs (Assign): Make it inherit from ExpressionStatement.
11462 * expression.cs (ExpressionStatement): New base class used for
11463 expressions that can appear in statements, so that we can provide
11464 an alternate path to generate expression that do not leave a value
11467 (Expression::Emit, and all the derivatives): We no longer return
11468 whether a value is left on the stack or not. Every expression
11469 after being emitted leaves a single value on the stack.
11471 * codegen.cs (EmitContext::EmitStatementExpression): Use the
11472 facilties of ExpressionStatement if possible.
11474 * cs-parser.jay: Update statement_expression.
11476 2001-09-25 Miguel de Icaza <miguel@ximian.com>
11478 * driver.cs: Change the wording of message
11480 2001-09-25 Ravi Pratap <ravi@ximian.com>
11482 * expression.cs (Binary::ResolveOperator): Had forgottten to set
11483 the type of the expression to the return type of the method if
11484 we have an overloaded operator match ! The regression tests pass again !
11485 (Unary::ResolveOperator): Ditto.
11487 * expression.cs (Invocation::ConversionExists): Correct the member lookup
11488 to find "op_Implicit", not "implicit" ;-)
11489 (UserImplicitCast): New class to take care of user-defined implicit conversions.
11490 (ConvertImplicit, ForceConversion): Take TypeContainer argument
11492 * everywhere : Correct calls to the above accordingly.
11494 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
11495 (ConvertImplicit): Do user-defined conversion if it exists.
11497 2001-09-24 Miguel de Icaza <miguel@ximian.com>
11499 * assign.cs: track location.
11500 (Resolve): Use implicit conversions on assignment.
11502 * literal.cs: Oops. Not good, Emit of short access values should
11503 pass (Bytes) or the wrong argument will be selected.
11505 * expression.cs (Unary::Emit): Emit code for -expr.
11507 (Unary::ResolveOperator): Handle `Substract' for non-constants
11508 (substract from zero from the non-constants).
11509 Deal with Doubles as well.
11511 (Expression::ConvertImplicitRequired): New routine that reports an
11512 error if no implicit conversion exists.
11514 (Invocation::OverloadResolve): Store the converted implicit
11515 expressions if we make them
11517 2001-09-24 Ravi Pratap <ravi@ximian.com>
11519 * class.cs (ConstructorInitializer): Take a Location argument.
11520 (ConstructorBaseInitializer): Same here.
11521 (ConstructorThisInitializer): Same here.
11523 * cs-parser.jay : Update all calls accordingly.
11525 * expression.cs (Unary, Binary, New): Take location argument.
11526 Update accordingly everywhere.
11528 * cs-parser.jay : Update all calls to the above to take a location
11531 * class.cs : Ditto.
11533 2001-09-24 Ravi Pratap <ravi@ximian.com>
11535 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
11536 (Invocation::BetterConversion): Same here
11537 (Invocation::ConversionExists): Ditto.
11539 (Invocation::ConversionExists): Implement.
11541 2001-09-22 Ravi Pratap <ravi@ximian.com>
11543 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
11544 Also take an additional TypeContainer argument.
11546 * All over : Pass in TypeContainer as argument to OverloadResolve.
11548 * typemanager.cs (CSharpName): Update to check for the string type and return
11551 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
11554 2001-09-21 Ravi Pratap <ravi@ximian.com>
11556 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
11557 (Invocation::BetterFunction): Implement.
11558 (Invocation::BetterConversion): Implement.
11559 (Invocation::ConversionExists): Skeleton, no implementation yet.
11561 Okay, things work fine !
11563 2001-09-21 Miguel de Icaza <miguel@ximian.com>
11565 * typemanager.cs: declare and load enum_type, delegate_type and
11568 * expression.cs (Expression::Emit): Now emit returns a value that
11569 tells whether a value is left on the stack or not. This strategy
11570 might be reveted tomorrow with a mechanism that would address
11571 multiple assignments.
11572 (Expression::report118): Utility routine to report mismatches on
11575 (Unary::Report23): Report impossible type/operator combination
11578 (Unary::IsIncrementableNumber): Whether the type can be
11579 incremented or decremented with add.
11580 (Unary::ResolveOperator): Also allow enumerations to be bitwise
11582 (Unary::ResolveOperator): Implement ++, !, ~,
11584 (Invocation::Emit): Deal with new Emit convetion.
11586 * All Expression derivatives: Updated their Emit method to return
11587 whether they leave values on the stack or not.
11589 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
11590 stack for expressions that are statements.
11592 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11594 * expression.cs (LValue): New interface. Must be implemented by
11596 (LocalVariableReference, ParameterReference, FieldExpr): Implement
11599 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
11600 interface for generating code, simplifies the code.
11602 2001-09-20 Ravi Pratap <ravi@ximian.com>
11604 * expression.cs (everywhere): Comment out return statements in ::Resolve
11605 methods to avoid the warnings.
11607 2001-09-20 Miguel de Icaza <miguel@ximian.com>
11609 * driver.cs (parse): Report error 2001 if we can not open the
11612 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
11615 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
11618 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
11619 otherwise nested blocks end up with the same index.
11621 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
11623 * expression.cs: Instead of having FIXMEs in the Resolve
11624 functions, throw exceptions so it is obvious that we are facing a
11627 * cs-parser.jay (invocation_expression): Pass Location information.
11629 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
11630 Use a basename for those routines because .NET does not like paths
11633 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
11636 2001-09-19 Miguel de Icaza <miguel@ximian.com>
11638 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
11639 are loading the correct data types (throws an exception if not).
11640 (TypeManager::InitCoreTypes): Use CoreLookupType
11642 * expression.cs (Unary::ResolveOperator): return the child
11643 expression for expressions which are just +expr.
11644 (Unary::ResolveOperator): Return negative literals for -LITERAL
11645 expressions (otherwise they are Unary {Literal}).
11646 (Invocation::Badness): Take into account `Implicit constant
11647 expression conversions'.
11649 * literal.cs (LongLiteral): Implement long literal class.
11650 (IntLiteral): export the `Value' of the intliteral.
11652 2001-09-19 Ravi Pratap <ravi@ximian.com>
11654 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
11656 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
11657 instead of 'Operator'
11659 * expression.cs (Binary::ResolveOperator): Update accordingly.
11660 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
11663 * cs-parser.jay (unary_expression): Update to use the new names.
11665 * gen-treedump.cs (GetUnary): Same here.
11667 * expression.cs (Unary::Resolve): Implement.
11668 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
11669 operators are found instead of making noise ;-)
11670 (Unary::ResolveOperator): New method to do precisely the same thing which
11671 Binary::ResolveOperator does for Binary expressions.
11672 (Unary.method, .Arguments): Add.
11673 (Unary::OperName): Implement.
11674 (Unary::ForceConversion): Copy and Paste !
11676 * class.cs (Operator::Define): Fix a small bug for the case when we have
11679 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
11680 for the inbuilt operators. Only overloading works for now ;-)
11682 2001-09-18 Miguel de Icaza <miguel@ximian.com>
11684 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
11685 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
11687 * expression.cs (This::Emit): Implement.
11688 (This::Resolve): Implement.
11689 (TypeOf:Resolve): Implement.
11690 (Expression::ResolveSimpleName): Add an implicit this to instance
11692 (MemberAccess::Resolve): Deal with Parameters and Fields.
11693 Bind instance variable to Field expressions.
11694 (FieldExpr::Instance): New field used to track the expression that
11695 represents the object instance.
11696 (FieldExpr::Resolve): Track potential errors from MemberLookup not
11698 (FieldExpr::Emit): Implement.
11700 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
11701 the last instruction contains a return opcode to avoid generating
11702 the last `ret' instruction (this generates correct code, and it is
11703 nice to pass the peverify output).
11705 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
11706 initializer for static and instance variables.
11707 (Constructor::Emit): Allow initializer to be null in the case of
11708 static constructors. Only emit initializer for instance
11711 (TypeContainer::FindMembers): Return a null array if there are no
11714 Also fix the code for the MemberTypes.Method branch, as it was not
11715 scanning that for operators (or tried to access null variables before).
11717 * assign.cs (Assign::Emit): Handle instance and static fields.
11721 * driver.cs: Stop compilation if there are parse errors.
11723 * cs-parser.jay (constructor_declaration): Provide default base
11724 initializer for non-static constructors.
11725 (constructor_declarator): Do not provide a default base
11726 initializers if none was specified.
11727 Catch the fact that constructors should not have parameters.
11729 * class.cs: Do not emit parent class initializers for static
11730 constructors, that should be flagged as an error.
11732 2001-09-18 Ravi Pratap <ravi@ximian.com>
11734 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
11735 Move back code into TypeContainer::Populate.
11737 2001-09-18 Ravi Pratap <ravi@ximian.com>
11739 * class.cs (TypeContainer::AddConstructor): Fix the check to
11740 compare against Name, not Basename.
11741 (Operator::OpType): Change Plus and Minus to Add and Subtract.
11743 * cs-parser.jay : Update accordingly.
11745 * class.cs (TypeContainer::FindMembers): For the case where we are searching
11746 for methods, don't forget to look into the operators too.
11747 (RegisterMethodBuilder): Helper method to take care of this for
11748 methods, constructors and operators.
11749 (Operator::Define): Completely revamp.
11750 (Operator.OperatorMethod, MethodName): New fields.
11751 (TypeContainer::Populate): Move the registering of builders into
11752 RegisterMethodBuilder.
11753 (Operator::Emit): Re-write.
11755 * expression.cs (Binary::Emit): Comment out code path to emit method
11756 invocation stuff for the case when we have a user defined operator. I am
11757 just not able to get it right !
11759 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11761 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
11764 (Expression::MemberLookup): Provide a version that allows to
11765 specify the MemberTypes and BindingFlags.
11767 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
11768 so it was not fetching variable information from outer blocks.
11770 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
11771 Beforefieldinit as it was buggy.
11773 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
11774 that Ravi put here.
11776 * class.cs (Constructor::Emit): Only emit if block is not null.
11777 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
11778 deal with this by semantically definining it as if the user had
11781 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
11782 constructors as we now "emit" them at a higher level.
11784 (TypeContainer::DefineDefaultConstructor): Used to define the
11785 default constructors if none was provided.
11787 (ConstructorInitializer): Add methods Resolve and Emit.
11789 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
11791 2001-09-17 Ravi Pratap <ravi@ximian.com>
11793 * class.cs (TypeContainer::EmitDefaultConstructor): Register
11794 the default constructor builder with our hashtable for methodbuilders
11797 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
11798 and argument_count is 0 in which case we have a match.
11799 (Binary::ResolveOperator): More null checking and miscellaneous coding
11802 2001-09-17 Ravi Pratap <ravi@ximian.com>
11804 * rootcontext.cs (IsNameSpace): Compare against null.
11806 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
11808 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
11809 and Unary::Operator.
11811 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
11814 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
11815 we have overloaded operators.
11816 (Binary::ResolveOperator): Implement the part which does the operator overload
11819 * class.cs (Operator::Emit): Implement.
11820 (TypeContainer::Emit): Emit the operators we have too.
11822 * expression.cs (Binary::Emit): Update to emit the appropriate code for
11823 the case when we have a user-defined operator.
11825 2001-09-17 Miguel de Icaza <miguel@ximian.com>
11827 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
11829 2001-09-16 Ravi Pratap <ravi@ximian.com>
11831 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
11832 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
11833 (Constructor::Emit): Implement.
11834 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
11835 if we have no work to do.
11836 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
11839 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
11840 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
11842 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
11845 2001-09-15 Ravi Pratap <ravi@ximian.com>
11847 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
11849 (Tree::RecordNamespace): Method to do what the name says ;-)
11850 (Tree::Namespaces): Property to get at the namespaces hashtable.
11852 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
11855 * rootcontext.cs (IsNamespace): Fixed it :-)
11857 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11859 * class.cs (TypeContainer::FindMembers): Add support for
11861 (MethodCore): New class that encapsulates both the shared aspects
11862 of a Constructor and a Method.
11863 (Method, Constructor): Factored pieces into MethodCore.
11865 * driver.cs: Added --fatal which makes errors throw exceptions.
11866 Load System assembly as well as part of the standard library.
11868 * report.cs: Allow throwing exceptions on errors for debugging.
11870 * modifiers.cs: Do not use `parent', instead use the real type
11871 container to evaluate permission settings.
11873 * class.cs: Put Ravi's patch back in. He is right, and we will
11874 have to cope with the
11876 2001-09-14 Ravi Pratap <ravi@ximian.com>
11878 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
11879 FamORAssem, not FamANDAssem.
11881 2001-09-14 Miguel de Icaza <miguel@ximian.com>
11883 * driver.cs: Added --parse option that only parses its input files
11886 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
11887 incorrect. IsTopLevel is not used to tell whether an object is
11888 root_types or not (that can be achieved by testing this ==
11889 root_types). But to see if this is a top-level *class* (not
11890 necessarly our "toplevel" container).
11892 2001-09-14 Ravi Pratap <ravi@ximian.com>
11894 * enum.cs (Enum::Define): Modify to call the Lookup method on the
11895 parent instead of a direct call to GetType.
11897 2001-09-14 Ravi Pratap <ravi@ximian.com>
11899 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
11900 Modifiers.TypeAttr. This should just be a call to that method.
11902 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
11903 object so that we can determine if we are top-level or not.
11905 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
11908 * enum.cs (Enum::Define): Ditto.
11910 * modifiers.cs (FieldAttr): Re-write.
11912 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
11913 (TypeContainer::HaveStaticConstructor): New property to provide access
11914 to precisely that info.
11916 * modifiers.cs (MethodAttr): Re-write.
11917 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
11919 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
11920 of top-level types as claimed.
11922 2001-09-13 Miguel de Icaza <miguel@ximian.com>
11924 * expression.cs (MemberLookup): Fruitless attempt to lookup
11925 constructors. Maybe I need to emit default constructors? That
11926 might be it (currently .NET emits this for me automatically).
11927 (Invocation::OverloadResolve): Cope with Arguments == null.
11928 (Invocation::EmitArguments): new function, shared by the new
11929 constructor and us.
11930 (Invocation::Emit): Handle static and instance methods. Emit
11931 proper call instruction for virtual or non-virtual invocations.
11932 (New::Emit): Implement.
11933 (New::Resolve): Implement.
11934 (MemberAccess:Resolve): Implement.
11935 (MethodGroupExpr::InstanceExpression): used conforming to the spec
11936 to track instances.
11937 (FieldExpr::Resolve): Set type.
11939 * support.cs: Handle empty arguments.
11941 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
11942 SimpleLookup): Auxiliary routines to help parse a qualifier
11945 Update qualifier_identifier rule.
11947 * codegen.cs: Removed debugging messages.
11949 * class.cs: Make this a global thing, this acts just as a "key" to
11950 objects that we might have around.
11952 (Populate): Only initialize method_builders_to_methods once.
11954 * expression.cs (PropertyExpr): Initialize type from the
11957 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
11958 Resolve pattern. Attempt to implicitly convert value to boolean.
11961 * expression.cs: Set the type for the int32/int32 argument case.
11962 (Binary::ResolveOperator): Set the return type to boolean for
11963 comparission operators
11965 * typemanager.cs: Remove debugging print code.
11967 (Invocation::Resolve): resolve type.
11969 * class.cs: Allocate a MemberInfo of the correct size, as the code
11970 elsewhere depends on the test to reflect the correct contents.
11972 (Method::) Keep track of parameters, due to System.Reflection holes
11974 (TypeContainer::Populate): Keep track of MethodBuilders to Method
11977 (TypeContainer::FindMembers): Use ArrayList and then copy an array
11978 of the exact size and return that.
11980 (Class::LookupMethodByBuilder): New function that maps
11981 MethodBuilders to its methods. Required to locate the information
11982 on methods because System.Reflection bit us again.
11984 * support.cs: New file, contains an interface ParameterData and
11985 two implementations: ReflectionParameters and InternalParameters
11986 used to access Parameter information. We will need to grow this
11989 * expression.cs (Invocation::GetParameterData): implement a cache
11990 and a wrapper around the ParameterData creation for methods.
11991 (Invocation::OverloadResolve): Use new code.
11993 2001-09-13 Ravi Pratap <ravi@ximian.com>
11995 * class.cs (TypeContainer::EmitField): Remove and move into
11996 (Field::Define): here and modify accordingly.
11997 (Field.FieldBuilder): New member.
11998 (TypeContainer::Populate): Update accordingly.
11999 (TypeContainer::FindMembers): Implement.
12001 2001-09-13 Miguel de Icaza <miguel@ximian.com>
12003 * statement.cs: (VariableInfo::VariableType): New field to be
12004 initialized with the full type once it is resolved.
12006 2001-09-12 Miguel de Icaza <miguel@ximian.com>
12008 * parameter.cs (GetParameterInfo): Use a type cache to compute
12009 things only once, and to reuse this information
12011 * expression.cs (LocalVariableReference::Emit): Implement.
12012 (OpcodeCast::Emit): fix.
12014 (ParameterReference::Resolve): Implement.
12015 (ParameterReference::Emit): Implement.
12017 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
12018 that are expressions need to stay as Expressions.
12020 * typemanager.cs (CSharpName): Returns the C# name of a type if
12023 * expression.cs (Expression::ConvertImplicit): New function that
12024 implements implicit type conversions.
12026 (Expression::ImplicitReferenceConversion): Implements implicit
12027 reference conversions.
12029 (EmptyCast): New type for transparent casts.
12031 (OpcodeCast): New type for casts of types that are performed with
12032 a sequence of bytecodes.
12034 (BoxedCast): New type used for casting value types into reference
12035 types. Emits a box opcode.
12037 (Binary::DoNumericPromotions): Implements numeric promotions of
12038 and computation of the Binary::Type.
12040 (Binary::EmitBranchable): Optimization.
12042 (Binary::Emit): Implement code emission for expressions.
12044 * typemanager.cs (TypeManager): Added two new core types: sbyte
12047 2001-09-12 Ravi Pratap <ravi@ximian.com>
12049 * class.cs (TypeContainer::FindMembers): Method which does exactly
12050 what Type.FindMembers does, only we don't have to use reflection. No
12051 implementation yet.
12053 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
12054 typecontainer objects as we need to get at them.
12055 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
12057 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
12058 typecontainer object.
12060 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
12061 of just a Report object.
12063 2001-09-11 Ravi Pratap <ravi@ximian.com>
12065 * class.cs (Event::Define): Go back to using the prefixes "add_" and
12067 (TypeContainer::Populate): Now define the delegates of the type too.
12068 (TypeContainer.Delegates): Property to access the list of delegates defined
12071 * delegates.cs (Delegate::Define): Implement partially.
12073 * modifiers.cs (TypeAttr): Handle more flags.
12075 2001-09-11 Ravi Pratap <ravi@ximian.com>
12077 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
12079 (Operator::Define): Re-write logic to get types by using the LookupType method
12080 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
12081 (Indexer::Define): Ditto.
12082 (Event::Define): Ditto.
12083 (Property::Define): Ditto.
12085 2001-09-10 Ravi Pratap <ravi@ximian.com>
12087 * class.cs (TypeContainer::Populate): Now define operators too.
12088 (TypeContainer.Operators): New property to access the list of operators
12090 (Operator.OperatorMethodBuilder): New member to hold the method builder
12091 for the operator we are defining.
12092 (Operator::Define): Implement.
12094 2001-09-10 Ravi Pratap <ravi@ximian.com>
12096 * class.cs (Event::Define): Make the prefixes of the accessor methods
12097 addOn_ and removeOn_
12099 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
12100 of the location being passed in too. Ideally, this should go later since all
12101 error reporting should be done through the Report object.
12103 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
12104 (Populate): Iterate thru the indexers we have and define them too.
12105 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
12106 for the get and set accessors.
12107 (Indexer::Define): Implement.
12109 2001-09-09 Miguel de Icaza <miguel@ximian.com>
12111 * expression.cs (Binary::Resolve): Beginning of it. I scratched
12112 my previous implementation, did not work.
12114 * typemanager.cs: Add a couple of missing types (the longs).
12116 * literal.cs: Use TypeManager.bool_type instead of getting it.
12118 * expression.cs (EventExpr): New kind of expressions.
12119 (Expressio::ExprClassFromMemberInfo): finish
12121 2001-09-08 Miguel de Icaza <miguel@ximian.com>
12123 * assign.cs: Emit stores to static fields differently.
12125 2001-09-08 Ravi Pratap <ravi@ximian.com>
12127 * Merge in changes and adjust code to tackle conflicts. Backed out my
12128 code in Assign::Resolve ;-)
12130 2001-09-08 Ravi Pratap <ravi@ximian.com>
12132 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
12133 instead Report.Error and also pass in the location.
12134 (CSharpParser::Lexer): New readonly property to return the reference
12135 to the Tokenizer object.
12136 (declare_local_variables): Use Report.Error with location instead of plain
12140 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
12141 (Operator.CheckBinaryOperator): Ditto.
12143 * cs-parser.jay (operator_declarator): Update accordingly.
12145 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
12146 (CheckBinaryOperator): Same here.
12148 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
12149 on the name without any prefixes of namespace names etc. This is because we
12150 already might have something already fully qualified like
12151 'System.Console.WriteLine'
12153 * assign.cs (Resolve): Begin implementation. Stuck ;-)
12155 2001-09-07 Ravi Pratap <ravi@ximian.com>
12157 * cs-tokenizer.cs (location): Return a string which also contains
12160 * expression.cs (ElementAccess): New class for expressions of the
12161 type 'element access.'
12162 (BaseAccess): New class for expressions of the type 'base access.'
12163 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
12166 * cs-parser.jay (element_access): Implement action.
12167 (base_access): Implement actions.
12168 (checked_expression, unchecked_expression): Implement.
12170 * cs-parser.jay (local_variable_type): Correct and implement.
12171 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
12173 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
12175 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
12176 name and the specifiers.
12178 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
12180 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
12181 making them all public ;-)
12183 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
12186 2001-09-07 Miguel de Icaza <miguel@ximian.com>
12188 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
12190 (FieldExpr, PropertyExprs): New resolved expressions.
12191 (SimpleName::MemberStaticCheck): Perform static checks for access
12192 to non-static fields on static methods. Maybe this should be
12193 generalized for MemberAccesses.
12194 (SimpleName::ResolveSimpleName): More work on simple name
12197 * cs-parser.jay (primary_expression/qualified_identifier): track
12198 the parameter index.
12200 * codegen.cs (CodeGen::Save): Catch save exception, report error.
12201 (EmitContext::EmitBoolExpression): Chain to expression generation
12202 instead of temporary hack.
12203 (::EmitStatementExpression): Put generic expression code generation.
12205 * assign.cs (Assign::Emit): Implement variable assignments to
12206 local variables, parameters and fields.
12208 2001-09-06 Miguel de Icaza <miguel@ximian.com>
12210 * statement.cs (Block::GetVariableInfo): New method, returns the
12211 VariableInfo for a variable name in a block.
12212 (Block::GetVariableType): Implement in terms of GetVariableInfo
12214 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
12215 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
12217 2001-09-06 Ravi Pratap <ravi@ximian.com>
12219 * cs-parser.jay (operator_declaration): Continue on my quest : update
12220 to take attributes argument.
12221 (event_declaration): Ditto.
12222 (enum_declaration): Ditto.
12223 (indexer_declaration): Ditto.
12225 * class.cs (Operator::Operator): Update constructor accordingly.
12226 (Event::Event): Ditto.
12228 * delegate.cs (Delegate::Delegate): Same here.
12230 * enum.cs (Enum::Enum): Same here.
12232 2001-09-05 Ravi Pratap <ravi@ximian.com>
12234 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
12236 * ../tests/cs0658.cs : New file to demonstrate error 0658.
12238 * attribute.cs (Attributes): New class to encapsulate all attributes which were
12239 being passed around as an arraylist.
12240 (Attributes::AddAttribute): Method to add attribute sections.
12242 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
12243 (struct_declaration): Update accordingly.
12244 (constant_declaration): Update.
12245 (field_declaration): Update.
12246 (method_header): Update.
12247 (fixed_parameter): Update.
12248 (parameter_array): Ditto.
12249 (property_declaration): Ditto.
12250 (destructor_declaration): Ditto.
12252 * class.cs (Struct::Struct): Update constructors accordingly.
12253 (Class::Class): Ditto.
12254 (Field::Field): Ditto.
12255 (Method::Method): Ditto.
12256 (Property::Property): Ditto.
12257 (TypeContainer::OptAttribute): update property's return type.
12259 * interface.cs (Interface.opt_attributes): New member.
12260 (Interface::Interface): Update to take the extra Attributes argument.
12262 * parameter.cs (Parameter::Parameter): Ditto.
12264 * constant.cs (Constant::Constant): Ditto.
12266 * interface.cs (InterfaceMemberBase): New OptAttributes field.
12267 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
12268 the attributes as a parameter.
12269 (InterfaceProperty): Update constructor call.
12270 (InterfaceEvent): Ditto.
12271 (InterfaceMethod): Ditto.
12272 (InterfaceIndexer): Ditto.
12274 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
12275 pass the attributes too.
12276 (interface_event_declaration): Ditto.
12277 (interface_property_declaration): Ditto.
12278 (interface_method_declaration): Ditto.
12279 (interface_declaration): Ditto.
12281 2001-09-05 Miguel de Icaza <miguel@ximian.com>
12283 * class.cs (Method::Define): Track the "static Main" definition to
12284 create an entry point.
12286 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
12287 EntryPoint if we find it.
12289 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
12290 (EmitContext::ig): Make this variable public.
12292 * driver.cs: Make the default output file be the first file name
12293 with the .exe extension.
12295 Detect empty compilations
12297 Handle various kinds of output targets. Handle --target and
12298 rename -t to --dumper.
12300 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
12301 methods inherited from Expression return now an Expression. This
12302 will is used during the tree rewriting as we resolve them during
12305 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
12306 the spec. Missing entirely is the information about
12307 accessability of elements of it.
12309 (Expression::ExprClassFromMemberInfo): New constructor for
12310 Expressions that creates a fully initialized Expression based on
12311 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
12314 (Invocation::Resolve): Begin implementing resolution of invocations.
12316 * literal.cs (StringLiteral): Implement Emit.
12318 2001-09-05 Ravi Pratap <ravi@ximian.com>
12320 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
12323 2001-09-04 Ravi Pratap <ravi@ximian.com>
12325 * cs-parser.jay (attribute_arguments): Implement actions.
12326 (attribute): Fix bug in production. Implement action.
12327 (attribute_list): Implement.
12328 (attribute_target): Implement.
12329 (attribute_target_specifier, opt_target_specifier): Implement
12330 (CheckAttributeTarget): New method to check if the attribute target
12332 (attribute_section): Implement.
12333 (opt_attributes): Implement.
12335 * attribute.cs : New file to handle attributes.
12336 (Attribute): Class to hold attribute info.
12338 * cs-parser.jay (opt_attribute_target_specifier): Remove production
12339 (attribute_section): Modify production to use 2 different rules to
12340 achieve the same thing. 1 s/r conflict down !
12341 Clean out commented, useless, non-reducing dimension_separator rules.
12343 * class.cs (TypeContainer.attributes): New member to hold list
12344 of attributes for a type.
12345 (Struct::Struct): Modify to take one more argument, the attribute list.
12346 (Class::Class): Ditto.
12347 (Field::Field): Ditto.
12348 (Method::Method): Ditto.
12349 (Property::Property): Ditto.
12351 * cs-parser.jay (struct_declaration): Update constructor call to
12352 pass in the attributes too.
12353 (class_declaration): Ditto.
12354 (constant_declaration): Ditto.
12355 (field_declaration): Ditto.
12356 (method_header): Ditto.
12357 (fixed_parameter): Ditto.
12358 (parameter_array): Ditto.
12359 (property_declaration): Ditto.
12361 * constant.cs (Constant::Constant): Update constructor similarly.
12362 Use System.Collections.
12364 * parameter.cs (Parameter::Parameter): Update as above.
12366 2001-09-02 Ravi Pratap <ravi@ximian.com>
12368 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
12369 (TypeContainer.delegates): New member to hold list of delegates.
12371 * cs-parser.jay (delegate_declaration): Implement the action correctly
12372 this time as I seem to be on crack ;-)
12374 2001-09-02 Miguel de Icaza <miguel@ximian.com>
12376 * rootcontext.cs (RootContext::IsNamespace): new function, used to
12377 tell whether an identifier represents a namespace.
12379 * expression.cs (NamespaceExpr): A namespace expression, used only
12380 temporarly during expression resolution.
12381 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
12382 utility functions to resolve names on expressions.
12384 2001-09-01 Miguel de Icaza <miguel@ximian.com>
12386 * codegen.cs: Add hook for StatementExpressions.
12388 * class.cs: Fix inverted test for static flag in methods.
12390 2001-09-02 Ravi Pratap <ravi@ximian.com>
12392 * class.cs (Operator::CheckUnaryOperator): Correct error number used
12393 to make it coincide with MS' number.
12394 (Operator::CheckBinaryOperator): Ditto.
12396 * ../errors/errors.txt : Remove error numbers added earlier.
12398 * ../errors/cs1019.cs : Test case for error # 1019
12400 * ../errros/cs1020.cs : Test case for error # 1020
12402 * cs-parser.jay : Clean out commented cruft.
12403 (dimension_separators, dimension_separator): Comment out. Ostensibly not
12404 used anywhere - non-reducing rule.
12405 (namespace_declarations): Non-reducing rule - comment out.
12407 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
12408 with TypeContainer::AddEnum.
12410 * delegate.cs : New file for delegate handling classes.
12411 (Delegate): Class for declaring delegates.
12413 * makefile : Update.
12415 * cs-parser.jay (delegate_declaration): Implement.
12417 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
12419 * class.cs (Event::Define): Implement.
12420 (Event.EventBuilder): New member.
12422 * class.cs (TypeContainer::Populate): Update to define all enums and events
12424 (Events): New property for the events arraylist we hold. Shouldn't we move to using
12425 readonly fields for all these cases ?
12427 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12429 * class.cs (Property): Revamp to use the convention of making fields readonly.
12430 Accordingly modify code elsewhere.
12432 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
12433 the Define method of the Property class.
12435 * class.cs : Clean up applied patch and update references to variables etc. Fix
12437 (TypeContainer::Populate): Update to define all the properties we have. Also
12438 define all enumerations.
12440 * enum.cs (Define): Implement.
12442 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
12444 * cs-parser.jay (overloadable_operator): The semantic value is an
12445 enum of the Operator class.
12446 (operator_declarator): Implement actions.
12447 (operator_declaration): Implement.
12449 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
12450 validity of definitions.
12451 (Operator::CheckBinaryOperator): Static method to check for binary operators
12452 (TypeContainer::AddOperator): New method to add an operator to a type.
12454 * cs-parser.jay (indexer_declaration): Added line to actually call the
12455 AddIndexer method so it gets added ;-)
12457 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
12458 already taken care of by the MS compiler ?
12460 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12462 * class.cs (Operator): New class for operator declarations.
12463 (Operator::OpType): Enum for the various operators.
12465 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
12467 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
12468 ostensibly handle this in semantic analysis.
12470 * cs-parser.jay (general_catch_clause): Comment out
12471 (specific_catch_clauses, specific_catch_clause): Ditto.
12472 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
12473 (catch_args, opt_catch_args): New productions.
12474 (catch_clause): Rewrite to use the new productions above
12475 (catch_clauses): Modify accordingly.
12476 (opt_catch_clauses): New production to use in try_statement
12477 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
12478 and re-write the code in the actions to extract the specific and
12479 general catch clauses by being a little smart ;-)
12481 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
12482 Hooray, try and catch statements parse fine !
12484 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12486 * statement.cs (Block::GetVariableType): Fix logic to extract the type
12487 string from the hashtable of variables.
12489 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
12490 I end up making that mistake ;-)
12491 (catch_clauses): Fixed gross error which made Key and Value of the
12492 DictionaryEntry the same : $1 !!
12494 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12496 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
12498 * cs-parser.jay (event_declaration): Correct to remove the semicolon
12499 when the add and remove accessors are specified.
12501 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
12503 * cs-parser.jay (IndexerDeclaration): New helper class to hold
12504 information about indexer_declarator.
12505 (indexer_declarator): Implement actions.
12506 (parsing_indexer): New local boolean used to keep track of whether
12507 we are parsing indexers or properties. This is necessary because
12508 implicit_parameters come into picture even for the get accessor in the
12509 case of an indexer.
12510 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
12512 * class.cs (Indexer): New class for indexer declarations.
12513 (TypeContainer::AddIndexer): New method to add an indexer to a type.
12514 (TypeContainer::indexers): New member to hold list of indexers for the
12517 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12519 * cs-parser.jay (add_accessor_declaration): Implement action.
12520 (remove_accessor_declaration): Implement action.
12521 (event_accessors_declaration): Implement
12522 (variable_declarators): swap statements for first rule - trivial.
12524 * class.cs (Event): New class to hold information about event
12526 (TypeContainer::AddEvent): New method to add an event to a type
12527 (TypeContainer::events): New member to hold list of events.
12529 * cs-parser.jay (event_declaration): Implement actions.
12531 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
12533 * cs-parser.jay (dim_separators): Implement. Make it a string
12534 concatenating all the commas together, just as they appear.
12535 (opt_dim_separators): Modify accordingly
12536 (rank_specifiers): Update accordingly. Basically do the same
12537 thing - instead, collect the brackets here.
12538 (opt_rank_sepcifiers): Modify accordingly.
12539 (array_type): Modify to actually return the complete type string
12540 instead of ignoring the rank_specifiers.
12541 (expression_list): Implement to collect the expressions
12542 (variable_initializer): Implement. We make it a list of expressions
12543 essentially so that we can handle the array_initializer case neatly too.
12544 (variable_initializer_list): Implement.
12545 (array_initializer): Make it a list of variable_initializers
12546 (opt_array_initializer): Modify accordingly.
12548 * expression.cs (New::NType): Add enumeration to help us
12549 keep track of whether we have an object/delegate creation
12550 or an array creation.
12551 (New:NewType, New::Rank, New::Indices, New::Initializers): New
12552 members to hold data about array creation.
12553 (New:New): Modify to update NewType
12554 (New:New): New Overloaded contructor for the array creation
12557 * cs-parser.jay (array_creation_expression): Implement to call
12558 the overloaded New constructor.
12560 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
12562 * class.cs (TypeContainer::Constructors): Return member
12563 constructors instead of returning null.
12565 2001-08-26 Miguel de Icaza <miguel@ximian.com>
12567 * typemanager.cs (InitCoreTypes): Initialize the various core
12568 types after we have populated the type manager with the user
12569 defined types (this distinction will be important later while
12570 compiling corlib.dll)
12572 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
12573 on Expression Classification. Now all expressions have a method
12574 `Resolve' and a method `Emit'.
12576 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
12577 generation from working. Also add some temporary debugging
12580 2001-08-24 Miguel de Icaza <miguel@ximian.com>
12582 * codegen.cs: Lots of code generation pieces. This is only the
12583 beginning, will continue tomorrow with more touches of polish. We
12584 handle the fundamentals of if, while, do, for, return. Others are
12585 trickier and I need to start working on invocations soon.
12587 * gen-treedump.cs: Bug fix, use s.Increment here instead of
12590 * codegen.cs (EmitContext): New struct, used during code
12591 emission to keep a context. Most of the code generation will be
12594 * cs-parser.jay: Add embedded blocks to the list of statements of
12595 this block. So code generation proceeds in a top down fashion.
12597 2001-08-23 Miguel de Icaza <miguel@ximian.com>
12599 * statement.cs: Add support for multiple child blocks.
12601 2001-08-22 Miguel de Icaza <miguel@ximian.com>
12603 * codegen.cs (EmitCode): New function, will emit the code for a
12604 Block of code given a TypeContainer and its ILGenerator.
12606 * statement.cs (Block): Standard public readonly optimization.
12607 (Block::Block constructors): Link children.
12608 (Block::Child): Child Linker.
12609 (Block::EmitVariables): Emits IL variable declarations.
12611 * class.cs: Drop support for MethodGroups here, delay until
12613 (Method::): Applied the same simplification that I did before, and
12614 move from Properties to public readonly fields.
12615 (Method::ParameterTypes): Returns the parameter types for the
12616 function, and implements a cache that will be useful later when I
12617 do error checking and the semantic analysis on the methods is
12619 (Constructor::GetCallingConvention): Renamed from CallingConvetion
12620 and made a method, optional argument tells whether this is a class
12621 or a structure to apply the `has-this' bit.
12622 (Method::GetCallingConvention): Implement, returns the calling
12624 (Method::Define): Defines the type, a second pass is performed
12625 later to populate the methods.
12627 (Constructor::ParameterTypes): implement a cache similar to the
12628 one on Method::ParameterTypes, useful later when we do semantic
12631 (TypeContainer::EmitMethod): New method. Emits methods.
12633 * expression.cs: Removed MethodGroup class from here.
12635 * parameter.cs (Parameters::GetCallingConvention): new method.
12637 2001-08-21 Miguel de Icaza <miguel@ximian.com>
12639 * class.cs (TypeContainer::Populate): Drop RootContext from the
12642 (Constructor::CallingConvention): Returns the calling convention.
12643 (Constructor::ParameterTypes): Returns the constructor parameter
12646 (TypeContainer::AddConstructor): Keep track of default constructor
12647 and the default static constructor.
12649 (Constructor::) Another class that starts using `public readonly'
12650 instead of properties.
12652 (Constructor::IsDefault): Whether this is a default constructor.
12654 (Field::) use readonly public fields instead of properties also.
12656 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
12657 track of static constructors; If none is used, turn on
12658 BeforeFieldInit in the TypeAttributes.
12660 * cs-parser.jay (opt_argument_list): now the return can be null
12661 for the cases where there are no arguments.
12663 (constructor_declarator): If there is no implicit `base' or
12664 `this', then invoke the default parent constructor.
12666 * modifiers.cs (MethodAttr): New static function maps a set of
12667 modifiers flags into a MethodAttributes enum
12668 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
12669 MethodAttr, TypeAttr to represent the various mappings where the
12670 modifiers are used.
12671 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
12673 2001-08-19 Miguel de Icaza <miguel@ximian.com>
12675 * parameter.cs (GetParameterInfo): Fix bug where there would be no
12678 * interface.cs (PopulateIndexer): Implemented the code generator
12679 for interface indexers.
12681 2001-08-17 Miguel de Icaza <miguel@ximian.com>
12683 * interface.cs (InterfaceMemberBase): Now we track the new status
12686 (PopulateProperty): Implement property population. Woohoo! Got
12687 Methods and Properties going today.
12689 Removed all the properties for interfaces, and replaced them with
12690 `public readonly' fields.
12692 2001-08-16 Miguel de Icaza <miguel@ximian.com>
12694 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
12695 initialize their hashtables/arraylists only when they are needed
12696 instead of doing this always.
12698 * parameter.cs: Handle refs and out parameters.
12700 * cs-parser.jay: Use an ArrayList to construct the arguments
12701 instead of the ParameterCollection, and then cast that to a
12704 * parameter.cs: Drop the use of ParameterCollection and use
12705 instead arrays of Parameters.
12707 (GetParameterInfo): Use the Type, not the Name when resolving
12710 2001-08-13 Miguel de Icaza <miguel@ximian.com>
12712 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
12713 and instead use public readonly fields.
12715 * class.cs: Put back walking code for type containers.
12717 2001-08-11 Miguel de Icaza <miguel@ximian.com>
12719 * class.cs (MakeConstant): Code to define constants.
12721 * rootcontext.cs (LookupType): New function. Used to locate types
12724 2001-08-08 Miguel de Icaza <miguel@ximian.com>
12726 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
12727 this System.Reflection code is. Kudos to Microsoft
12729 * typemanager.cs: Implement a type cache and avoid loading all
12730 types at boot time. Wrap in LookupType the internals. This made
12731 the compiler so much faster. Wow. I rule!
12733 * driver.cs: Make sure we always load mscorlib first (for
12734 debugging purposes, nothing really important).
12736 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
12737 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
12739 * rootcontext.cs: Lookup types on their namespace; Lookup types
12740 on namespaces that have been imported using the `using' keyword.
12742 * class.cs (TypeContainer::TypeAttr): Virtualize.
12743 (Class::TypeAttr): Return attributes suitable for this bad boy.
12744 (Struct::TypeAttr): ditto.
12745 Handle nested classes.
12746 (TypeContainer::) Remove all the type visiting code, it is now
12747 replaced with the rootcontext.cs code
12749 * rootcontext.cs (GetClassBases): Added support for structs.
12751 2001-08-06 Miguel de Icaza <miguel@ximian.com>
12753 * interface.cs, statement.cs, class.cs, parameter.cs,
12754 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
12755 Drop use of TypeRefs, and use strings instead.
12757 2001-08-04 Miguel de Icaza <miguel@ximian.com>
12761 * class.cs (Struct::Struct): set the SEALED flags after
12762 checking the modifiers.
12763 (TypeContainer::TypeAttr): new property, returns the
12764 TypeAttributes for a class.
12766 * cs-parser.jay (type_list): Oops, list production was creating a
12767 new list of base types.
12769 * rootcontext.cs (StdLib): New property.
12770 (GetInterfaceTypeByName): returns an interface by type name, and
12771 encapsulates error handling here.
12772 (GetInterfaces): simplified.
12773 (ResolveTree): Encapsulated all the tree resolution here.
12774 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
12777 * driver.cs: Add support for --nostdlib, to avoid loading the
12778 default assemblies.
12779 (Main): Do not put tree resolution here.
12781 * rootcontext.cs: Beginning of the class resolution.
12783 2001-08-03 Miguel de Icaza <miguel@ximian.com>
12785 * rootcontext.cs: Provide better error reporting.
12787 * cs-parser.jay (interface_base): set our $$ to be interfaces.
12789 * rootcontext.cs (CreateInterface): Handle the case where there
12790 are no parent interfaces.
12792 (CloseTypes): Routine to flush types at the end.
12793 (CreateInterface): Track types.
12794 (GetInterfaces): Returns an array of Types from the list of
12795 defined interfaces.
12797 * typemanager.c (AddUserType): Mechanism to track user types (puts
12798 the type on the global type hash, and allows us to close it at the
12801 2001-08-02 Miguel de Icaza <miguel@ximian.com>
12803 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
12804 RecordInterface instead.
12806 * cs-parser.jay: Updated to reflect changes above.
12808 * decl.cs (Definition): Keep track of the TypeBuilder type that
12809 represents this type here. Not sure we will use it in the long
12810 run, but wont hurt for now.
12812 * driver.cs: Smaller changes to accomodate the new code.
12814 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
12817 * rootcontext.cs (CreateInterface): New method, used to create
12818 the System.TypeBuilder type for interfaces.
12819 (ResolveInterfaces): new entry point to resolve the interface
12821 (CodeGen): Property, used to keep track of the code generator.
12823 2001-07-26 Miguel de Icaza <miguel@ximian.com>
12825 * cs-parser.jay: Add a second production for delegate_declaration
12828 (enum_body): Put an opt_comma here instead of putting it on
12829 enum_body or enum_member_declarations so we can handle trailing
12830 commas on enumeration members. Gets rid of a shift/reduce.
12832 (type_list): Need a COMMA in the middle.
12834 (indexer_declaration): Tell tokenizer to recognize get/set
12836 * Remove old targets.
12838 * Re-add the parser target.
12840 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12842 * cs-parser.jay: Add precendence rules for a number of operators
12843 ot reduce the number of shift/reduce conflicts in the grammar.
12845 2001-07-17 Miguel de Icaza <miguel@ximian.com>
12847 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
12850 Get rid of old crufty code.
12852 * rootcontext.cs: Use this to keep track of the parsed
12853 representation and the defined types available to the program.
12855 * gen-treedump.cs: adjust for new convention.
12857 * type.cs: Split out the type manager, and the assembly builder
12860 * typemanager.cs: the type manager will live here now.
12862 * cil-codegen.cs: And the code generator here.
12864 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
12866 * makefile: Fixed up for easy making.
12868 2001-07-13 Simon Cozens <simon@simon-cozens.org>
12870 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
12873 (unary_expression): Expand pre_increment_expression and
12874 post_decrement_expression to reduce a shift/reduce.
12876 2001-07-11 Simon Cozens
12878 * cs-tokenizer.cs: Hex numbers should begin with a 0.
12880 Improve allow_keyword_as_indent name.
12882 2001-06-19 Miguel de Icaza <miguel@ximian.com>
12884 * Adjustments for Beta2.
12886 2001-06-13 Miguel de Icaza <miguel@ximian.com>
12888 * decl.cs: Added `Define' abstract method.
12889 (InTransit): new property, used to catch recursive definitions.
12891 * interface.cs: Implement `Define'.
12893 * modifiers.cs: Map Modifiers.constants to
12894 System.Reflection.TypeAttribute flags.
12896 * class.cs: Keep track of types and user-defined types.
12897 (BuilderInit): New method for creating an assembly
12898 (ResolveType): New function to launch the resolution process, only
12899 used by interfaces for now.
12901 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
12902 that are inserted into the name space.
12904 2001-06-08 Miguel de Icaza <miguel@ximian.com>
12906 * ARGH. I have screwed up my tree so many times due to the use of
12907 rsync rather than using CVS. Going to fix this at once.
12909 * driver.cs: Objetify driver. Load assemblies, use assemblies to
12912 2001-06-07 Miguel de Icaza <miguel@ximian.com>
12914 * Experiment successful: Use System.Type rather that our own
12917 2001-05-25 Miguel de Icaza <miguel@ximian.com>
12919 * cs-parser.jay: Removed nsAliases from here.
12921 Use new namespaces, handle `using XXX;'
12923 * namespace.cs: Reimplemented namespace handling, use a recursive
12924 definition of the class. Now we can keep track of using clauses
12925 and catch invalid using clauses.
12927 2001-05-24 Miguel de Icaza <miguel@ximian.com>
12929 * gen-treedump.cs: Adapted for all the renaming.
12931 * expression.cs (Expression): this class now has a Type property
12932 which returns an expression Type.
12934 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
12935 `Type', as this has a different meaning now in the base
12937 2001-05-22 Miguel de Icaza <miguel@ximian.com>
12939 * interface.cs, class.cs: Removed from all the sources the
12940 references to signature computation, as we can not do method
12941 signature computation during the parsing time, as we are not
12942 trying to solve at that point distinguishing:
12946 void a (NS.Blah x) {}
12949 Which depending on the context might be valid or not, as we do not
12950 know if Blah is the same thing as NS.Blah at that point.
12952 * Redid everything so the code uses TypeRefs now instead of
12953 Types. TypeRefs are just temporary type placeholders, that need
12954 to be resolved. They initially have a pointer to a string and the
12955 current scope in which they are used. This is used later by the
12956 compiler to resolve the reference to an actual Type.
12958 * DeclSpace is no longer a CIR.Type, and neither are
12959 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
12960 are all DeclSpaces, but no Types.
12962 * type.cs (TypeRefManager): This implements the TypeRef manager,
12963 which keeps track of all the types that need to be resolved after
12964 the parsing has finished.
12966 2001-05-13 Miguel de Icaza <miguel@ximian.com>
12968 * ARGH. We are going to have to store `foreach' as a class rather
12969 than resolving it, as we need to verify error 1579 after name
12970 resolution. *OR* we could keep a flag that says `This request to
12971 IEnumerator comes from a foreach statement' which we can then use
12972 to generate the error.
12974 2001-05-10 Miguel de Icaza <miguel@ximian.com>
12976 * class.cs (TypeContainer.AddMethod): we now add methods to the
12977 MethodGroup instead of the method hashtable.
12979 * expression.cs: Add MethodGroup abstraction, which gets us one
12980 step closer to the specification in the way we handle method
12983 * cs-parser.jay (primary_expression): qualified_identifier now
12984 tried to match up an identifier to a local variable reference or
12985 to a parameter reference.
12987 current_local_parameters is now a parser global variable that
12988 points to the current parameters for the block, used during name
12991 (property_declaration): Now creates an implicit `value' argument to
12994 2001-05-09 Miguel de Icaza <miguel@ximian.com>
12996 * parameter.cs: Do not use `param' arguments as part of the
12997 signature, per the spec.
12999 2001-05-08 Miguel de Icaza <miguel@ximian.com>
13001 * decl.cs: Base class for classes, structs and interfaces. This
13002 is the "Declaration Space"
13004 * cs-parser.jay: Use CheckDef for checking declaration errors
13005 instead of having one on each function.
13007 * class.cs: Factor out some code for handling error handling in
13008 accordance to the "Declarations" section in the "Basic Concepts"
13009 chapter in the ECMA C# spec.
13011 * interface.cs: Make all interface member classes derive from
13012 InterfaceMemberBase.
13014 2001-05-07 Miguel de Icaza <miguel@ximian.com>
13016 * Many things: all interfaces are parsed and generated in
13017 gen-treedump. Support for member variables, constructors,
13018 destructors, properties, constants is there.
13020 Beginning of the IL backend, but very little done, just there for
13023 2001-04-29 Miguel de Icaza <miguel@ximian.com>
13025 * cs-parser.jay: Fix labeled statement.
13027 * cs-tokenizer.cs (escape): Escape " and ' always.
13028 ref_line, ref_name: keep track of the line/filename as instructed
13029 by #line by the compiler.
13032 2001-04-27 Miguel de Icaza <miguel@ximian.com>
13034 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
13035 to match the values in System.CodeDOM.
13037 Divid renamed to Divide.
13039 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
13041 (Statements.set): remove.
13043 * System.CodeDOM/CodeCatchClause.cs: always have a valid
13046 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
13047 falseStatements always have valid values.
13049 * cs-parser.jay: Use System.CodeDOM now.