1 2002-10-21 Miguel de Icaza <miguel@ximian.com>
3 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
5 2002-10-20 Mark Crichton <crichton@gimp.org>
7 * cfold.cs: Fixed compile blocker. Really fixed it this time.
9 2002-10-20 Nick Drochak <ndrochak@gol.com>
11 * cfold.cs: Fixed compile blocker.
13 2002-10-20 Miguel de Icaza <miguel@ximian.com>
15 * driver.cs: I was chekcing the key, not the file.
17 2002-10-19 Ravi Pratap <ravi@ximian.com>
19 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
20 message that we were generating - we just need to silently return
23 2002-10-19 Miguel de Icaza <miguel@ximian.com>
25 * class.cs (Event.Define): Change my previous commit, as this
26 breaks the debugger. This is a temporary hack, as it seems like
27 the compiler is generating events incorrectly to begin with.
29 * expression.cs (Binary.ResolveOperator): Added support for
30 "U operator - (E x, E y)"
32 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
35 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
36 init-only variables, but this path did not take into account that
37 there might be also instance readonly variables. Correct this
42 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
45 * driver.cs: Change the extension for modules to `netmodule'
47 * cs-parser.jay: Improved slightly the location tracking for
50 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
51 modifiers that were specified instead of the hardcoded value
52 (FamAndAssem). This was basically ignoring the static modifier,
53 and others. Fixes 32429.
55 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
56 fixed a bug in the process (32476)
58 * expression.cs (ArrayAccess.EmitAssign): Patch from
59 hwang_rob@yahoo.ca that fixes bug 31834.3
61 2002-10-18 Miguel de Icaza <miguel@ximian.com>
63 * driver.cs: Make the module extension .netmodule.
65 2002-10-16 Miguel de Icaza <miguel@ximian.com>
67 * driver.cs: Report an error if the resource file is not found
70 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
71 false, like Emit does.
73 2002-10-16 Nick Drochak <ndrochak@gol.com>
75 * typemanager.cs: Remove unused private member. Also reported mcs
76 bug to report this as a warning like csc.
78 2002-10-15 Martin Baulig <martin@gnome.org>
80 * statement.cs (Statement.Emit): Made this a virtual method; emits
81 the line number info and calls DoEmit().
82 (Statement.DoEmit): New protected abstract method, formerly knows
85 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
87 2002-10-11 Miguel de Icaza <miguel@ximian.com>
89 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
90 have fixed a remaining problem: not every AddXXXX was adding a
93 Now everyone registers a fully qualified name in the DeclSpace as
94 being defined instead of the partial name.
96 Downsides: we are slower than we need to be due to the excess
97 copies and the names being registered this way.
99 The reason for this is that we currently depend (on the corlib
100 bootstrap for instance) that types are fully qualified, because
101 we dump all the types in the namespace, and we should really have
102 types inserted into the proper namespace, so we can only store the
103 basenames in the defined_names array.
105 2002-10-10 Martin Baulig <martin@gnome.org>
107 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
108 from bug #31834, see the bug report for a testcase which is
111 2002-10-10 Martin Baulig <martin@gnome.org>
113 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
114 flow analysis code for this.
116 * statement.cs (Do, While, For): Tell the flow analysis code about
118 (FlowBranching.UsageVector): Added support for infinite loops.
119 (Block.Resolve): Moved the dead code elimination here and use flow
122 2002-10-09 Miguel de Icaza <miguel@ximian.com>
124 * class.cs (Field.Define): Catch cycles on struct type
127 * typemanager.cs (IsUnmanagedtype): Do not recursively check
128 fields if the fields are static. We only need to check instance
131 * expression.cs (As.DoResolve): Test for reference type.
133 * statement.cs (Using.ResolveExpression): Use
134 ConvertImplicitRequired, not ConvertImplicit which reports an
136 (Using.ResolveLocalVariableDecls): ditto.
138 * expression.cs (Binary.ResolveOperator): Report errors in a few
139 places where we had to.
141 * typemanager.cs (IsUnmanagedtype): Finish implementation.
143 2002-10-08 Miguel de Icaza <miguel@ximian.com>
145 * expression.cs: Use StoreFromPtr instead of extracting the type
146 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
148 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
149 an enumeration value to a System.Enum, but System.Enum is not a
150 value type, but an class type, so we need to box.
152 (Expression.ConvertExplicit): One codepath could return
153 errors but not flag them. Fix this. Fixes #31853
155 * parameter.cs (Resolve): Do not allow void as a parameter type.
157 2002-10-06 Martin Baulig <martin@gnome.org>
159 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
160 if it's a class type and not a struct. Fixes #31815.
162 2002-10-06 Martin Baulig <martin@gnome.org>
164 * statement.cs: Reworked the flow analysis code a bit to make it
165 usable for dead code elimination.
167 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
169 * cs-parser.jay: allow empty source files. Fixes bug #31781.
171 2002-10-04 Miguel de Icaza <miguel@ximian.com>
173 * expression.cs (ComposedCast.DoResolveType): A quick workaround
174 to fix the test 165, will investigate deeper.
176 2002-10-04 Martin Baulig <martin@gnome.org>
178 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
179 finally blocks actually work.
180 (Try.Resolve): We don't need to create a sibling for `finally' if
181 there is no finally block.
183 2002-10-04 Martin Baulig <martin@gnome.org>
185 * class.cs (Constructor.Define): The default accessibility for a
186 non-default constructor is private, not public.
188 2002-10-04 Miguel de Icaza <miguel@ximian.com>
190 * class.cs (Constructor): Make AllowedModifiers public, add
193 * cs-parser.jay: Perform the modifiers test here, as the
194 constructor for the Constructor class usually receives a zero
195 because of the way we create it (first we create, later we
196 customize, and we were never checking the modifiers).
198 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
199 is a version of LookupTypeReflection that includes the type-name
200 cache. This can be used as a fast path for functions that know
201 the fully qualified name and are only calling into *.GetType() to
202 obtain a composed type.
204 This is also used by TypeManager.LookupType during its type
207 (LookupType): We now also track the real type name, as sometimes
208 we can get a quey for the real type name from things like
209 ComposedCast. This fixes bug 31422.
211 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
212 complete type fullname, it does not have to go through the type
213 resolution system to obtain the composed version of the type (for
214 obtaining arrays or pointers).
216 (Conditional.Emit): Use the EmitBoolExpression to
217 generate nicer code, as requested by Paolo.
219 (ArrayCreation.CheckIndices): Use the patch from
220 hwang_rob@yahoo.ca to validate the array initializers.
222 2002-10-03 Miguel de Icaza <miguel@ximian.com>
224 * class.cs (ConstructorInitializer.Emit): simplify code by using
225 Invocation.EmitCall, and at the same time, fix the bugs in calling
226 parent constructors that took variable arguments.
228 * ecore.cs (Expression.ConvertNumericExplicit,
229 Expression.ImplicitNumericConversion): Remove the code that
230 manually wrapped decimal (InternalTypeConstructor call is now gone
233 * expression.cs (Cast.TryReduce): Also handle decimal types when
234 trying to perform a constant fold on the type.
236 * typemanager.cs (IsUnmanagedtype): Partially implemented.
238 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
239 that only turned off an error report, and did nothing else.
241 2002-10-02 Miguel de Icaza <miguel@ximian.com>
243 * driver.cs: Handle and ignore /fullpaths
245 2002-10-01 Miguel de Icaza <miguel@ximian.com>
247 * expression.cs (Binary.ResolveOperator): Catch the case where
248 DoNumericPromotions returns true,
250 (Binary.DoNumericPromotions): Simplify the code, and the tests.
252 2002-09-27 Miguel de Icaza <miguel@ximian.com>
254 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
257 2002-09-26 Miguel de Icaza <miguel@ximian.com>
259 * ecore.cs (ConvertNumericExplicit): It is not enough that the
260 conversion exists, but it is also required that the conversion be
261 performed. This manifested in "(Type64Enum) 2".
263 * class.cs (TypeManager.AddMethod): The fix is not to change
264 AddEnum, because that one was using a fully qualified name (every
265 DeclSpace derivative does), but to change the AddMethod routine
266 that was using an un-namespaced name. This now correctly reports
269 Revert patch until I can properly fix it. The issue
270 is that we have a shared Type space across all namespaces
271 currently, which is wrong.
273 Options include making the Namespace a DeclSpace, and merge
274 current_namespace/current_container in the parser.
276 2002-09-25 Miguel de Icaza <miguel@ximian.com>
278 * cs-parser.jay: Improve error reporting when we get a different
279 kind of expression in local_variable_type and
280 local_variable_pointer_type.
282 Propagate this to avoid missleading errors being reported.
284 * ecore.cs (ImplicitReferenceConversion): treat
285 TypeManager.value_type as a target just like object_type. As
290 Is valid, and needs to result in the int 1 being boxed before it
291 is assigned to the value type v.
293 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
294 to validate the enumeration name.
296 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
297 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
298 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
300 * ecore.cs (TryImplicitIntConversion): When doing an
301 implicit-enumeration-conversion, check if the type is 64-bits and
302 perform a conversion before passing to EnumConstant.
304 2002-09-23 Miguel de Icaza <miguel@ximian.com>
306 * decl.cs (Error_AmbiguousTypeReference); New routine used to
307 report ambiguous type references. Unlike the MS version, we
308 report what the ambiguity is. Innovation at work ;-)
310 (DeclSpace.FindType): Require a location argument to
311 display when we display an ambiguous error.
313 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
315 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
317 * expression.cs (EmitDynamicInitializers): Apply patch from
318 hwang_rob@yahoo.ca that fixes the order in which we emit our
321 2002-09-21 Martin Baulig <martin@gnome.org>
323 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
324 delegate takes no arguments.
326 2002-09-20 Miguel de Icaza <miguel@ximian.com>
328 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
331 * expression.cs: Extract the underlying type.
333 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
335 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
337 2002-09-19 Miguel de Icaza <miguel@ximian.com>
339 * class.cs (TypeContainer.DefineType): We can not use the nice
340 PackingSize with the size set to 1 DefineType method, because it
341 will not allow us to define the interfaces that the struct
344 This completes the fixing of bug 27287
346 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
347 means also structs. This fixes part of the problem.
348 (Expresion.ImplicitReferenceConversionExists): ditto.
350 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
351 error if there were no errors reported during the type lookup
352 process, to avoid duplicates or redundant errors. Without this
353 you would get an ambiguous errors plus a type not found. We have
354 beaten the user enough with the first error.
356 (DeclSparce.FindType): Emit a warning if we have an ambiguous
359 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
360 during the resolution process, stop the lookup, this avoids
361 repeated error reports (same error twice).
363 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
365 * typemanager.cs (LookupType): Redo the type lookup code to match
366 the needs of System.Reflection.
368 The issue is that System.Reflection requires references to nested
369 types to begin with a "+" sign instead of a dot. So toplevel
370 types look like: "NameSpace.TopLevelClass", and nested ones look
371 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
374 2002-09-19 Martin Baulig <martin@gnome.org>
376 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
377 says that a method always returns or always throws an exception,
378 don't report the CS0161.
380 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
381 set `Returns = new_returns'.
383 2002-09-19 Martin Baulig <martin@gnome.org>
385 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
386 to an enum constant, check for a CS0176.
388 2002-09-18 Miguel de Icaza <miguel@ximian.com>
390 * class.cs (TypeContainer.CheckPairedOperators): Now we check
391 for operators that must be in pairs and report errors.
393 * ecore.cs (SimpleName.DoResolveType): During the initial type
394 resolution process, when we define types recursively, we must
395 check first for types in our current scope before we perform
396 lookups in the enclosing scopes.
398 * expression.cs (MakeByteBlob): Handle Decimal blobs.
400 (Invocation.VerifyArgumentsCompat): Call
401 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
402 I thought we were supposed to always call this, but there are a
403 few places in the code where we dont do it.
405 2002-09-17 Miguel de Icaza <miguel@ximian.com>
407 * driver.cs: Add support in -linkres and -resource to specify the
408 name of the identifier.
410 2002-09-16 Miguel de Icaza <miguel@ximian.com>
412 * ecore.cs (StandardConversionExists): Sync with the conversion
413 code: allow anything-* to void* conversions.
415 (FindMostSpecificSource): Use an Expression argument
416 instead of a Type, because we might be handed over a Literal which
417 gets a few more implicit conversions that plain types do not. So
418 this information was being lost.
420 Also, we drop the temporary type-holder expression when not
423 2002-09-17 Martin Baulig <martin@gnome.org>
425 * class.cs (PropertyBase.CheckBase): Don't check the base class if
426 this is an explicit interface implementation.
428 2002-09-17 Martin Baulig <martin@gnome.org>
430 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
431 different `IndexerName' attributes.
433 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
434 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
435 virtual CommonResolve().
437 2002-09-16 Miguel de Icaza <miguel@ximian.com>
439 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
440 and convert that to the UnderlyingType.
442 * statement.cs (Foreach.Resolve): Indexers are just like variables
445 * cs-tokenizer.cs (consume_string): Track line numbers and columns
446 inside quoted strings, we were not doing this before.
448 2002-09-16 Martin Baulig <martin@gnome.org>
450 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
451 resolve it. This is needed for the definite assignment check of the
452 instance expression, fixes bug #29846.
453 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
455 2002-09-16 Nick Drochak <ndrochak@gol.com>
457 * parameter.cs: Fix compile error. Cannot reference static member
458 from an instance object. Is this an mcs bug?
460 2002-09-14 Martin Baulig <martin@gnome.org>
462 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
463 multiple times. Fixes bug #30295, added test-166.cs.
465 2002-09-14 Martin Baulig <martin@gnome.org>
467 * statement.cs (Block.Emit): Don't emit unreachable code.
468 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
470 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
472 2002-09-14 Martin Baulig <martin@gnome.org>
474 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
477 2002-09-14 Martin Baulig <martin@gnome.org>
479 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
480 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
481 be false on the ms runtime.
483 2002-09-13 Martin Baulig <martin@gnome.org>
485 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
486 the CS0038 error message.
488 2002-09-12 Miguel de Icaza <miguel@ximian.com>
490 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
491 constant inside, return it.
493 2002-09-12 Martin Baulig <martin@gnome.org>
495 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
496 implicit conversion can be done between enum types.
498 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
499 check whether an implicit conversion to the current enum's UnderlyingType
500 exists and report an error if not.
502 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
503 without debugging support.
505 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
506 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
508 2002-09-12 Martin Baulig <martin@gnome.org>
510 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
512 * ecore.cs (IMemberExpr.DeclaringType): New property.
513 (SimpleName.SimpleNameResolve): Check whether we're accessing a
514 nonstatic member of an outer type (CS0038).
516 2002-09-11 Miguel de Icaza <miguel@ximian.com>
518 * driver.cs: Activate the using-error detector at warning level
519 4 (at least for MS-compatible APIs).
521 * namespace.cs (VerifyUsing): Small buglett fix.
523 * pending.cs (PendingImplementation): pass the container pointer.
525 * interface.cs (GetMethods): Allow for recursive definition. Long
526 term, I would like to move every type to support recursive
527 definitions, not the current ordering mechanism that we have right
530 The situation is this: Attributes are handled before interfaces,
531 so we can apply attributes to interfaces. But some attributes
532 implement interfaces, we will now handle the simple cases
533 (recursive definitions will just get an error).
535 * parameter.cs: Only invalidate types at the end if we fail to
538 2002-09-09 Martin Baulig <martin@gnome.org>
540 * ecore.cs (PropertyExpr.Emit): Also check for
541 TypeManager.system_int_array_get_length so this'll also work when
542 compiling corlib. Fixes #30003.
544 2002-09-09 Martin Baulig <martin@gnome.org>
546 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
547 and throw an exception if we can't get the type's size. Fixed #30040,
550 2002-09-09 Martin Baulig <martin@gnome.org>
552 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
554 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
555 context. Fixes bug #30027.
557 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
558 virtual functions. Fixes bug #30043, added test-164.cs.
560 2002-09-08 Ravi Pratap <ravi@ximian.com>
562 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
564 2002-09-08 Nick Drochak <ndrochak@gol.com>
566 * driver.cs: Use an object to get the windows codepage since it's not a
569 2002-09-08 Miguel de Icaza <miguel@ximian.com>
571 * statement.cs (For.Emit): for infinite loops (test == null)
572 return whether there is a break inside, not always "true".
574 * namespace.cs (UsingEntry): New struct to hold the name of the
575 using definition, the location where it is defined, and whether it
576 has been used in a successful type lookup.
578 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
583 2002-09-06 Ravi Pratap <ravi@ximian.com>
585 * attribute.cs : Fix incorrect code which relied on catching
586 a NullReferenceException to detect a null being passed in
587 where an object was expected.
589 2002-09-06 Miguel de Icaza <miguel@ximian.com>
591 * statement.cs (Try): flag the catch variable as assigned
593 * expression.cs (Cast): Simplified by using ResolveType instead of
596 * statement.cs (Catch): Fix bug by using ResolveType.
598 2002-09-06 Ravi Pratap <ravi@ximian.com>
600 * expression.cs (BetterConversion): Special case for when we have
601 a NullLiteral as the argument and we have to choose between string
602 and object types - we choose string the way csc does.
604 * attribute.cs (Attribute.Resolve): Catch the
605 NullReferenceException and report error #182 since the Mono
606 runtime no more has the bug and having this exception raised means
607 we tried to select a constructor which takes an object and is
610 2002-09-05 Ravi Pratap <ravi@ximian.com>
612 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
613 message (1502, 1503) when we can't locate a method after overload
614 resolution. This is much more informative and closes the bug
617 * interface.cs (PopulateMethod): Return if there are no argument
618 types. Fixes a NullReferenceException bug.
620 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
621 expressions too. Previously we were checking only in one place for
622 positional arguments leaving out named arguments.
624 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
625 type to the enum type is not allowed. Remove code corresponding to
628 (ConvertNumericExplicit): Allow explicit conversions from
629 the underlying type to enum type. This precisely follows the spec
630 and closes a bug filed by Gonzalo.
632 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
635 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
637 2002-09-03 Miguel de Icaza <miguel@ximian.com>
639 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
640 it was important that we stored the right value after the
641 reduction in `converted'.
643 2002-09-04 Martin Baulig <martin@gnome.org>
645 * location.cs (Location.SymbolDocument): Use full pathnames for the
648 2002-08-30 Miguel de Icaza <miguel@ximian.com>
650 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
651 of the expression resolve mechanism, because that will catch the
652 SimpleName error failures.
654 (Conditional): If we can not resolve the
655 expression, return, do not crash.
657 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
660 (location): display token name instead of its number.
662 2002-08-28 Martin Baulig <martin@gnome.org>
664 * expression.cs (Binary.ResolveOperator): Don't silently return
665 but return an error if an operator cannot be applied between two
668 2002-08-28 Martin Baulig <martin@gnome.org>
670 * class.cs (Constructor.Define): Set the permission attributes
671 correctly instead of making all constructors public.
673 2002-08-28 Martin Baulig <martin@gnome.org>
675 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
676 for private members before reporting a CS0103; if we find anything,
679 2002-08-28 Martin Baulig <martin@gnome.org>
681 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
682 to check whether `closure_start_type == closure_invocation_type',
683 we also need to check whether `m.DeclaringType == closure_invocation_type'
684 before bypassing the permission checks. We might be accessing
685 protected/private members from the base class.
686 (TypeManager.RealMemberLookup): Only set private_ok if private
687 members were requested via BindingFlags.NonPublic.
689 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
691 * expression.cs (MemberAccess.ResolveMemberAccess): Set
692 MethodGroupExpr.IsExplicitImpl if appropriate.
693 (Invocation.DoResolve): Don't report the CS0120 for explicit
694 interface implementations.
696 2002-08-27 Martin Baulig <martin@gnome.org>
698 * expression.cs (Invocation.DoResolve): If this is a static
699 method and we don't have an InstanceExpression, we must report
702 2002-08-25 Martin Baulig <martin@gnome.org>
704 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
705 `==' between a valuetype and an object.
707 2002-08-25 Miguel de Icaza <miguel@ximian.com>
709 * ecore.cs (TypeExpr): Provide a ToString method.
711 2002-08-24 Martin Baulig <martin@gnome.org>
713 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
714 now called proggie.dbg and it's a binary file.
716 2002-08-23 Martin Baulig <martin@gnome.org>
718 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
720 2002-08-23 Martin Baulig <martin@gnome.org>
722 * struct.cs (MyStructInfo.ctor): Make this work with empty
723 structs; it's not allowed to use foreach() on null.
725 2002-08-23 Martin Baulig <martin@gnome.org>
727 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
728 writer the full pathname of the generated assembly.
730 2002-08-23 Martin Baulig <martin@gnome.org>
732 * statements.cs (FlowBranching.UsageVector.MergeChildren):
733 A `finally' block never returns or breaks; improved handling of
736 2002-08-23 Martin Baulig <martin@gnome.org>
738 * statement.cs (Throw.Resolve): Allow `throw null'.
740 2002-08-23 Martin Baulig <martin@gnome.org>
742 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
743 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
744 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
745 MemberLookup would return a wrong event if this is an explicit
746 interface implementation and the class has an event with the same
749 2002-08-23 Martin Baulig <martin@gnome.org>
751 * statement.cs (Block.AddChildVariableNames): New public method.
752 (Block.AddChildVariableName): Likewise.
753 (Block.IsVariableNameUsedInChildBlock): Likewise.
754 (Block.AddVariable): Check whether a variable name has already
755 been used in a child block.
757 * cs-parser.jay (declare_local_variables): Mark all variable names
758 from the current block as being used in a child block in the
761 2002-08-23 Martin Baulig <martin@gnome.org>
763 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
764 find the symbol writer.
766 * driver.cs: csc also allows the arguments to /define being
767 separated by commas, not only by semicolons.
769 2002-08-23 Martin Baulig <martin@gnome.org>
771 * interface.cs (Interface.GetMembers): Added static check for events.
773 2002-08-15 Martin Baulig <martin@gnome.org>
775 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
776 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
778 * ecore.cs (Expression.MemberLookup): Added documentation and explained
779 why the MethodData.EmitDestructor() change was necessary.
781 2002-08-20 Martin Baulig <martin@gnome.org>
783 * class.cs (TypeContainer.FindMembers): Added static check for events.
785 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
787 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
788 use Type.GetEvents(), not Type.FindMembers().
790 2002-08-20 Martin Baulig <martin@gnome.org>
792 * decl.cs (MemberCache): Added a special method cache which will
793 be used for method-only searched. This ensures that a method
794 search will return a MethodInfo with the correct ReflectedType for
797 2002-08-20 Martin Baulig <martin@gnome.org>
799 * decl.cs (DeclSpace.FindMembers): Made this public.
801 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
803 * delegate.cs: fixed build on windows.
804 [FIXME: Filed as bug #29150: MCS must report these errors.]
806 2002-08-19 Ravi Pratap <ravi@ximian.com>
808 * ecore.cs (StandardConversionExists): Return a false
809 if we are trying to convert the void type to anything else
810 since that is not allowed.
812 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
813 we flag error 70 in the event an event is trying to be accessed
814 directly from outside the declaring type.
816 2002-08-20 Martin Baulig <martin@gnome.org>
818 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
819 MemberCache from typemanager.cs to decl.cs.
821 2002-08-19 Martin Baulig <martin@gnome.org>
823 * class.cs (TypeContainer): Implement IMemberContainer.
824 (TypeContainer.DefineMembers): Create the MemberCache.
825 (TypeContainer.FindMembers): Do better BindingFlags checking; only
826 return public members if BindingFlags.Public was given, check
827 whether members are static.
829 2002-08-16 Martin Baulig <martin@gnome.org>
831 * decl.cs (DeclSpace.Define): Splitted this in Define and
832 DefineMembers. DefineMembers is called first and initializes the
835 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
836 DefineMembers() on all our DeclSpaces.
838 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
839 but call DefineMembers() on all nested interfaces. We call their
840 Define() in our new Define() function.
842 * interface.cs (Interface): Implement IMemberContainer.
843 (Interface.Define): Moved all code except the attribute stuf to
845 (Interface.DefineMembers): Initialize the member cache.
847 * typemanager.cs (IMemberFinder): Removed this interface, we don't
848 need this anymore since we can use MemberCache.FindMembers directly.
850 2002-08-19 Martin Baulig <martin@gnome.org>
852 * typemanager.cs (MemberCache): When creating the cache for an
853 interface type, add all inherited members.
854 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
855 to `out bool used_cache' and documented it.
856 (TypeManager.MemberLookup): If we already used the cache in the first
857 iteration, we don't need to do the interfaces check.
859 2002-08-19 Martin Baulig <martin@gnome.org>
861 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
862 here from IMemberFinder and don't implement this interface anymore.
863 (DeclSpace.MemberCache): Moved here from IMemberFinder.
865 * typemanager.cs (IMemberFinder): This interface is now only used by
866 classes which actually support the member cache.
867 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
868 since we only put DeclSpaces into this Hashtable.
869 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
870 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
872 2002-08-16 Martin Baulig <martin@gnome.org>
874 * typemanager.cs (ICachingMemberFinder): Removed.
875 (IMemberFinder.MemberCache): New property.
876 (TypeManager.FindMembers): Merged this with RealFindMembers().
877 This function will never be called from TypeManager.MemberLookup()
878 so we can't use the cache here, just the IMemberFinder.
879 (TypeManager.MemberLookup_FindMembers): Check whether the
880 IMemberFinder has a MemberCache and call the cache's FindMembers
882 (MemberCache): Rewrote larger parts of this yet another time and
885 2002-08-15 Miguel de Icaza <miguel@ximian.com>
887 * driver.cs (LoadArgs): Support quoting.
889 (Usage): Show the CSC-like command line arguments.
891 Improved a few error messages.
893 2002-08-15 Martin Baulig <martin@gnome.org>
895 * typemanager.cs (IMemberContainer.Type): New property.
896 (IMemberContainer.IsInterface): New property.
898 The following changes are conditional to BROKEN_RUNTIME, which is
899 defined at the top of the file.
901 * typemanager.cs (MemberCache.MemberCache): Don't add the base
902 class'es members, but add all members from TypeHandle.ObjectType
903 if we're an interface.
904 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
906 (MemberCache.CacheEntry.Container): Removed this field.
907 (TypeHandle.GetMembers): Include inherited members.
909 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
911 * typemanager.cs: fixed compilation and added a comment on a field that
914 2002-08-15 Martin Baulig <martin@gnome.org>
916 * class.cs (ConstructorInitializer.Resolve): In the
917 Expression.MemberLookup call, use the queried_type as
920 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
921 declared' attribute, it's always true.
922 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
923 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
924 temporary wrapper for FindMembers which tells MemberLookup whether
925 members from the base classes are included in the return value.
926 This will go away soon.
927 (TypeManager.MemberLookup): Use this temporary hack here; once the
928 new MemberCache is completed, we don't need to do the DeclaredOnly
929 looping here anymore since the MemberCache will take care of this.
930 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
931 (MemberCache): When creating the MemberCache for a class, get
932 members from the current class and all its base classes.
933 (MemberCache.CacheEntry.Container): New field. This is a
934 temporary hack until the Mono runtime is fixed to distinguish
935 between ReflectedType and DeclaringType. It allows us to use MCS
936 with both the MS runtime and the unfixed Mono runtime without
937 problems and without accecting performance.
938 (MemberCache.SearchMembers): The DeclaredOnly looping from
939 TypeManager.MemberLookup is now done here.
941 2002-08-14 Martin Baulig <martin@gnome.org>
943 * statement.cs (MyStructInfo.MyStructInfo): Don't call
944 Type.GetFields on dynamic types but get the fields from the
945 corresponding TypeContainer.
946 (MyStructInfo.GetStructInfo): Added check for enum types.
948 * typemanager.cs (MemberList.IsSynchronized): Implemented.
949 (MemberList.SyncRoot): Implemented.
950 (TypeManager.FilterWithClosure): No need to check permissions if
951 closure_start_type == closure_invocation_type, don't crash if
952 closure_invocation_type is null.
954 2002-08-13 Martin Baulig <martin@gnome.org>
956 Rewrote TypeContainer.FindMembers to use a member cache. This
957 gives us a speed increase of about 35% for the self-hosting MCS
958 build and of about 15-20% for the class libs (both on GNU/Linux).
960 * report.cs (Timer): New class to get enhanced profiling. This
961 whole class is "TIMER" conditional since it remarkably slows down
964 * class.cs (MemberList): New class. This is an IList wrapper
965 which we're now using instead of passing MemberInfo[]'s around to
966 avoid copying this array unnecessarily.
967 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
968 (ICachingMemberFinder, IMemberContainer): New interface.
969 (TypeManager.FilterWithClosure): If `criteria' is null, the name
970 has already been checked, otherwise use it for the name comparision.
971 (TypeManager.FindMembers): Renamed to RealMemberFinder and
972 provided wrapper which tries to use ICachingMemberFinder.FindMembers
973 if possible. Returns a MemberList, not a MemberInfo [].
974 (TypeHandle): New class, implements IMemberContainer. We create
975 one instance of this class per type, it contains a MemberCache
976 which is used to do the member lookups.
977 (MemberCache): New class. Each instance of this class contains
978 all members of a type and a name-based hash table.
979 (MemberCache.FindMembers): This is our new member lookup
980 function. First, it looks up all members of the requested name in
981 the hash table. Then, it walks this list and sorts out all
982 applicable members and returns them.
984 2002-08-13 Martin Baulig <martin@gnome.org>
986 In addition to a nice code cleanup, this gives us a performance
987 increase of about 1.4% on GNU/Linux - not much, but it's already
988 half a second for the self-hosting MCS compilation.
990 * typemanager.cs (IMemberFinder): New interface. It is used by
991 TypeManager.FindMembers to call FindMembers on a TypeContainer,
992 Enum, Delegate or Interface.
993 (TypeManager.finder_to_member_finder): New PtrHashtable.
994 (TypeManager.finder_to_container): Removed.
995 (TypeManager.finder_to_delegate): Removed.
996 (TypeManager.finder_to_interface): Removed.
997 (TypeManager.finder_to_enum): Removed.
999 * interface.cs (Interface): Implement IMemberFinder.
1001 * delegate.cs (Delegate): Implement IMemberFinder.
1003 * enum.cs (Enum): Implement IMemberFinder.
1005 * class.cs (TypeContainer): Implement IMemberFinder.
1007 2002-08-12 Martin Baulig <martin@gnome.org>
1009 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
1011 2002-08-12 Martin Baulig <martin@gnome.org>
1013 * ecore.cs (ITypeExpression): New interface for expressions which
1015 (TypeExpression): Renamed to TypeLookupExpression.
1016 (Expression.DoResolve): If we're doing a types-only lookup, the
1017 expression must implement the ITypeExpression interface and we
1018 call DoResolveType() on it.
1019 (SimpleName): Implement the new ITypeExpression interface.
1020 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
1021 hack, the situation that we're only looking up types can't happen
1022 anymore when this method is called. Moved the type lookup code to
1023 DoResolveType() and call it.
1024 (SimpleName.DoResolveType): This ITypeExpression interface method
1025 is now doing the types-only lookup.
1026 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
1027 (ResolveFlags): Added MaskExprClass.
1029 * expression.cs (MemberAccess): Implement the ITypeExpression
1031 (MemberAccess.DoResolve): Added support for a types-only lookup
1032 when we're called via ITypeExpression.DoResolveType().
1033 (ComposedCast): Implement the ITypeExpression interface.
1035 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
1036 Expression.Resolve() with ResolveFlags.Type instead.
1038 2002-08-12 Martin Baulig <martin@gnome.org>
1040 * interface.cs (Interface.Define): Apply attributes.
1042 * attribute.cs (Attribute.ApplyAttributes): Added support for
1043 interface attributes.
1045 2002-08-11 Martin Baulig <martin@gnome.org>
1047 * statement.cs (Block.Emit): Only check the "this" variable if we
1048 do not always throw an exception.
1050 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
1051 whether the property has a set accessor.
1053 2002-08-11 Martin Baulig <martin@gnome.org>
1055 Added control flow analysis support for structs.
1057 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
1058 with control flow analysis turned off.
1059 (IVariable): New interface.
1060 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
1061 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
1062 (FieldExpr.DoResolve): Resolve the instance expression with flow
1063 analysis turned off and do the definite assignment check after the
1064 resolving when we know what the expression will resolve to.
1066 * expression.cs (LocalVariableReference, ParameterReference):
1067 Implement the new IVariable interface, only call the flow analysis
1068 code if ec.DoFlowAnalysis is true.
1069 (This): Added constructor which takes a Block argument. Implement
1070 the new IVariable interface.
1071 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
1072 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
1073 This does the definite assignment checks for struct members.
1075 * class.cs (Constructor.Emit): If this is a non-static `struct'
1076 constructor which doesn't have any initializer, call
1077 Block.AddThisVariable() to tell the flow analysis code that all
1078 struct elements must be initialized before control returns from
1081 * statement.cs (MyStructInfo): New public class.
1082 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
1083 argument to this indexer. If non-zero, check an individual struct
1084 member, not the whole struct.
1085 (FlowBranching.CheckOutParameters): Check struct members.
1086 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
1087 overloaded versions of these methods which take an additional
1088 `int field_idx' argument to check struct members.
1089 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
1090 overloaded versions of these methods which take an additional
1091 `string field_name' argument to check struct member.s
1092 (VariableInfo): Implement the IVariable interface.
1093 (VariableInfo.StructInfo): New public property. Returns the
1094 MyStructInfo instance of the variable if it's a struct or null.
1095 (Block.AddThisVariable): New public method. This is called from
1096 Constructor.Emit() for non-static `struct' constructor which do
1097 not have any initializer. It creates a special variable for the
1098 "this" instance variable which will be checked by the flow
1099 analysis code to ensure that all of the struct's fields are
1100 initialized before control returns from the constructor.
1101 (UsageVector): Added support for struct members. If a
1102 variable/parameter is a struct with N members, we reserve a slot
1103 in the usage vector for each member. A struct is considered fully
1104 initialized if either the struct itself (slot 0) or all its
1105 members are initialized.
1107 2002-08-08 Martin Baulig <martin@gnome.org>
1109 * driver.cs (Driver.MainDriver): Only report an error CS5001
1110 if there were no compilation errors.
1112 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
1113 `UnsafeContext' property to determine whether the parent is in
1114 unsafe context rather than checking the parent's ModFlags:
1115 classes nested in an unsafe class are unsafe as well.
1117 2002-08-08 Martin Baulig <martin@gnome.org>
1119 * statement.cs (UsageVector.MergeChildren): Distinguish between
1120 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
1121 we return. Added test17() and test18() to test-154.cs.
1123 2002-08-08 Martin Baulig <martin@gnome.org>
1125 * typemanager.cs (TypeManager.FilterWithClosure): If we have
1126 Family access, make sure the invoking type isn't a subclass of the
1127 queried type (that'd be a CS1540).
1129 * ecore.cs (Expression.MemberLookup): Added overloaded version of
1130 this method which takes an additional `Type invocation_type'.
1132 * expression.cs (BaseAccess.DoResolve): Use the base type as
1133 invocation and query type.
1134 (MemberAccess.DoResolve): If the lookup failed and we're about to
1135 report a CS0122, try a lookup with the ec.ContainerType - if this
1136 succeeds, we must report a CS1540.
1138 2002-08-08 Martin Baulig <martin@gnome.org>
1140 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
1141 (MethodGroupExpr): Implement the IMemberExpr interface.
1143 * expression (MemberAccess.ResolveMemberAccess): No need to have
1144 any special code for MethodGroupExprs anymore, they're now
1147 2002-08-08 Martin Baulig <martin@gnome.org>
1149 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
1150 Family, FamANDAssem and FamORAssem permissions.
1151 (TypeManager.IsSubclassOrNestedChildOf): New public method.
1153 2002-08-08 Martin Baulig <martin@gnome.org>
1155 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
1156 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
1159 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
1161 * driver.cs: implemented /resource option to embed managed resources.
1163 2002-08-07 Martin Baulig <martin@gnome.org>
1165 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
1166 (FieldBase.HasFieldInitializer): New public property.
1167 (FieldBase.GetInitializerExpression): New public method. Resolves and
1168 returns the field initializer and makes sure it is only resolved once.
1169 (TypeContainer.EmitFieldInitializers): Call
1170 FieldBase.GetInitializerExpression to get the initializer, this ensures
1171 that it isn't resolved multiple times.
1173 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
1174 the resolving process (SimpleName/MemberLookup) that we're currently
1175 emitting a field initializer (which must not access any instance members,
1176 this is an error CS0236).
1178 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
1179 argument, if the `IsFieldInitializer' flag is set, we must report and
1180 error CS0236 and not an error CS0120.
1182 2002-08-07 Martin Baulig <martin@gnome.org>
1184 * ecore.cs (IMemberExpr): New public interface.
1185 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
1186 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
1187 if the expression is an IMemberExpr.
1189 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
1190 to be null, implicitly default to `this' if we're non-static in
1191 this case. Simplified the code a lot by using the new IMemberExpr
1192 interface. Also fixed bug #28176 here.
1194 2002-08-06 Martin Baulig <martin@gnome.org>
1196 * cs-parser.jay (SimpleLookup): Removed. We need to create
1197 ParameterReferences during semantic analysis so that we can do a
1198 type-only search when resolving Cast, TypeOf and SizeOf.
1199 (block): Pass the `current_local_parameters' to the Block's
1202 * class.cs (ConstructorInitializer): Added `Parameters parameters'
1203 argument to the constructor.
1204 (ConstructorInitializer.Resolve): Create a temporary implicit
1205 block with the parameters.
1207 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
1208 references here if we aren't doing a type-only search.
1210 * statement.cs (Block): Added constructor which takes a
1211 `Parameters parameters' argument.
1212 (Block.Parameters): New public property.
1214 * support.cs (InternalParameters.Parameters): Renamed `parameters'
1215 to `Parameters' and made it public readonly.
1217 2002-08-06 Martin Baulig <martin@gnome.org>
1219 * ecore.cs (Expression.Warning): Made this public as well.
1221 * report.cs (Report.Debug): Print the contents of collections.
1223 2002-08-06 Martin Baulig <martin@gnome.org>
1225 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
1226 used to tell Resolve() which kinds of expressions it may return.
1227 (Expression.Resolve): Added overloaded version of this method which
1228 takes a `ResolveFlags flags' argument. This can be used to tell
1229 Resolve() which kinds of expressions it may return. Reports a
1231 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
1232 ResolveFlags.SimpleName.
1233 (Expression.Error118): Added overloaded version of this method which
1234 takes a `ResolveFlags flags' argument. It uses the flags to determine
1235 which kinds of expressions are allowed.
1237 * expression.cs (Argument.ResolveMethodGroup): New public method.
1238 Resolves an argument, but allows a MethodGroup to be returned.
1239 This is used when invoking a delegate.
1241 * TODO: Updated a bit.
1243 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1245 Fixed compilation with csc.
1247 * ecore.cs: Expression.Error made public. Is this correct? Should
1248 Warning be made public too?
1250 * expression.cs: use ea.Location instead of ea.loc.
1251 [FIXME: Filed as bug #28607: MCS must report these errors.]
1253 2002-08-06 Martin Baulig <martin@gnome.org>
1255 * ecore.cs (Expression.loc): Moved the location here instead of
1256 duplicating it in all derived classes.
1257 (Expression.Location): New public property.
1258 (Expression.Error, Expression.Warning): Made them non-static and
1259 removed the location argument.
1260 (Expression.Warning): Added overloaded version which takes an
1261 `int level' argument.
1262 (Expression.Error118): Make this non-static and removed the
1263 expression and location arguments.
1264 (TypeExpr): Added location argument to the constructor.
1266 * expression.cs (StaticCallExpr): Added location argument to
1268 (Indirection, PointerArithmetic): Likewise.
1269 (CheckedExpr, UnCheckedExpr): Likewise.
1270 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
1271 (StringPtr): Likewise.
1274 2002-08-05 Martin Baulig <martin@gnome.org>
1276 * expression.cs (BaseAccess.DoResolve): Actually report errors.
1278 * assign.cs (Assign.DoResolve): Check whether the source
1279 expression is a value or variable.
1281 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
1282 while resolving the corresponding blocks.
1284 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
1285 an error, don't silently return null.
1287 * statement.cs (Block.AddVariable): Do the error reporting here
1288 and distinguish between CS0128 and CS0136.
1289 (Block.DoResolve): Report all unused labels (warning CS0164).
1290 (LabeledStatement): Pass the location to the constructor.
1291 (LabeledStatement.HasBeenReferenced): New property.
1292 (LabeledStatement.Resolve): Set it to true here.
1294 * statement.cs (Return.Emit): Return success even after reporting
1295 a type mismatch error (CS0126 or CS0127), this is what csc does and
1296 it avoids confusing the users with any consecutive errors.
1298 2002-08-05 Martin Baulig <martin@gnome.org>
1300 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
1302 * const.cs (Const.LookupConstantValue): Catch circular definitions.
1304 * expression.cs (MemberAccess.DoResolve): Silently return if an
1305 error has already been reported.
1307 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
1308 error has already been reported.
1310 2002-08-05 Martin Baulig <martin@gnome.org>
1312 * statement.cs (UsageVector): Only initialize the `parameters'
1313 vector if we actually have any "out" parameters.
1315 2002-08-05 Martin Baulig <martin@gnome.org>
1317 * expression.cs (Binary.ResolveOperator): When combining delegates,
1318 they must have the same type.
1320 2002-08-05 Martin Baulig <martin@gnome.org>
1322 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
1323 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
1324 work with the ms runtime and we also don't need it: if we're a
1325 PropertyBuilder and not in the `indexer_arguments' hash, then we
1326 are a property and not an indexer.
1328 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
1329 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
1330 since the latter one doesn't work with the ms runtime.
1332 2002-08-03 Martin Baulig <martin@gnome.org>
1334 Fixed bugs #27998 and #22735.
1336 * class.cs (Method.IsOperator): New public field.
1337 (Method.CheckBase): Report CS0111 if there's already a method
1338 with the same parameters in the current class. Report CS0508 when
1339 attempting to change the return type of an inherited method.
1340 (MethodData.Emit): Report CS0179 if a method doesn't have a body
1341 and it's not marked abstract or extern.
1342 (PropertyBase): New abstract base class for Property and Indexer.
1343 (PropertyBase.CheckBase): Moved here from Property and made it work
1345 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
1346 the same so we can reuse it there.
1347 (Property, Indexer): Derive from PropertyBase.
1348 (MethodSignature.inheritable_property_signature_filter): New delegate
1349 to find properties and indexers.
1351 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
1352 argument and improved error reporting.
1354 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
1355 EmptyReadOnlyParameters and made it a property.
1357 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
1358 version of this method which takes a `PropertyInfo indexer'.
1359 (TypeManager.RegisterIndexer): New method.
1361 * class.cs: Added myself as author of this file :-)
1363 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1365 * class.cs: fixed compilation on windoze.
1367 2002-08-03 Martin Baulig <martin@gnome.org>
1369 * interface.cs (Interface.GetInterfaceBases): Check whether all
1370 base interfaces are at least as accessible than the current one.
1372 * class.cs (TypeContainer.GetClassBases): Check whether base types
1373 are at least as accessible than the current type.
1374 (TypeContainer.AsAccessible): Implemented and made non-static.
1375 (MemberBase.CheckParameters): Report errors if the accessibility
1378 * delegate.cs (Delegate.Delegate): The default visibility is
1379 internal for top-level types and private for nested types.
1380 (Delegate.Define): Report errors if the accessibility checks fail.
1382 * enum.cs (Enum.Enum): The default visibility is internal for
1383 top-level types and private for nested types.
1384 (Enum.DefineType): Compute the correct visibility.
1386 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
1387 function which takes a `bool is_toplevel' instead of a TypeContainer.
1389 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
1392 2002-08-02 Martin Baulig <martin@gnome.org>
1394 * expression.cs (LocalVariableReferenc): Added constructor which
1395 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
1396 (LocalVariableReference.IsReadOnly): New property.
1397 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
1398 variable is readonly, use our own readonly flag to do this; you can
1399 use the new constructor to get a writable reference to a read-only
1402 * cs-parser.jay (foreach_statement, using_statement): Get a writable
1403 reference to the local variable.
1405 2002-08-01 Miguel de Icaza <miguel@ximian.com>
1407 * rootcontext.cs (ResolveCore): Also include System.Exception
1409 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
1410 we reach an EmptyStatement.
1412 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
1415 * expression.cs (Binary.ResolveOperator): Check error result in
1418 use brtrue/brfalse directly and avoid compares to null.
1420 2002-08-02 Martin Baulig <martin@gnome.org>
1422 * class.cs (TypeContainer.Define): Define all nested interfaces here.
1423 Fixes bug #28407, added test-155.cs.
1425 2002-08-01 Martin Baulig <martin@gnome.org>
1427 * class.cs (Event.EmitDefaultMethod): Make this work with static
1428 events. Fixes #28311, added verify-3.cs.
1430 2002-08-01 Martin Baulig <martin@gnome.org>
1432 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
1433 `is_disposable' fields.
1434 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
1435 `hm.is_disposable' if we're using the collection pattern.
1436 (Foreach.EmitCollectionForeach): Use the correct type for the
1437 enumerator's local variable, only emit the try/finally block if
1438 necessary (fixes #27713).
1440 2002-08-01 Martin Baulig <martin@gnome.org>
1442 * ecore.cs (Expression.report118): Renamed to Error118 and made
1445 * statement.cs (Throw.Resolve): Check whether the expression is of
1446 the correct type (CS0118) and whether the type derives from
1447 System.Exception (CS0155).
1448 (Catch.Resolve): New method. Do the type lookup here and check
1449 whether it derives from System.Exception (CS0155).
1450 (Catch.CatchType, Catch.IsGeneral): New public properties.
1452 * typemanager.cs (TypeManager.exception_type): Added.
1454 2002-07-31 Miguel de Icaza <miguel@ximian.com>
1456 * driver.cs: Updated About function.
1458 2002-07-31 Martin Baulig <martin@gnome.org>
1460 Implemented Control Flow Analysis.
1462 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
1463 (EmitContext.CurrentBranching): Added.
1464 (EmitContext.StartFlowBranching): Added.
1465 (EmitContext.EndFlowBranching): Added.
1466 (EmitContext.KillFlowBranching): Added.
1467 (EmitContext.IsVariableAssigned): Added.
1468 (EmitContext.SetVariableAssigned): Added.
1469 (EmitContext.IsParameterAssigned): Added.
1470 (EmitContext.SetParameterAssigned): Added.
1471 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
1472 Added control flow analysis stuff here.
1474 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
1475 resolve the expression as lvalue.
1476 (LocalVariableReference.DoResolve): Check whether the variable has
1477 already been assigned.
1478 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
1479 the parameter as assigned here.
1480 (ParameterReference.DoResolve): Check whether the parameter has already
1482 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
1483 expression as lvalue.
1485 * statement.cs (FlowBranching): New class for the flow analysis code.
1486 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
1487 (LabeledStatement.IsDefined): New public property.
1488 (LabeledStatement.AddUsageVector): New public method to tell flow
1489 analyis that the label may be reached via a forward jump.
1490 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
1492 (VariableInfo.Number): New public field. This is used by flow analysis
1493 to number all locals of a block.
1494 (Block.CountVariables): New public property. This is the number of
1495 local variables in this block (including the locals from all parent
1497 (Block.EmitMeta): Number all the variables.
1499 * statement.cs: Added flow analysis support to all classes.
1501 2002-07-31 Martin Baulig <martin@gnome.org>
1503 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
1504 To get debugging messages, compile mcs with /define:MCS_DEBUG and
1505 then use this argument.
1507 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
1509 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
1510 use this to specify /define options.
1512 2002-07-29 Martin Baulig <martin@gnome.org>
1514 * statement.cs (Fixed): Moved all code that does variable lookups
1515 and resolvings from Emit to Resolve.
1517 * statement.cs (For): Moved all code that does variable lookups
1518 and resolvings from Emit to Resolve.
1520 * statement.cs (Using): Moved all code that does variable lookups
1521 and resolvings from Emit to Resolve.
1523 2002-07-29 Martin Baulig <martin@gnome.org>
1525 * attribute.cs (Attribute.Resolve): Explicitly catch a
1526 System.NullReferenceException when creating the
1527 CustromAttributeBuilder and report a different warning message.
1529 2002-07-29 Martin Baulig <martin@gnome.org>
1531 * support.cs (ParameterData.ParameterName): Added method to
1532 get the name of a parameter.
1534 * typemanager.cs (TypeManager.IsValueType): New public method.
1536 2002-07-29 Martin Baulig <martin@gnome.org>
1538 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
1539 is a flag which specifies that it's either ref or out.
1540 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
1541 the out parameter to `out Parameter.Modifier mod', also set the
1542 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
1544 * support.cs (InternalParameters.ParameterModifier): Distinguish
1545 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
1546 Parameter.Modifier.ISBYREF flag if it's either ref or out.
1548 * expression.cs (Argument.GetParameterModifier): Distinguish
1549 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
1550 Parameter.Modifier.ISBYREF flag if it's either ref or out.
1552 2002-07-29 Martin Baulig <martin@gnome.org>
1554 * expression.cs (ParameterReference.ParameterReference): Added
1555 `Location loc' argument to the constructor.
1557 * cs-parser.jay: Pass location to ParameterReference.
1559 2002-07-28 Miguel de Icaza <miguel@ximian.com>
1561 * statement.cs (Try): Initialize the location.
1563 * cs-parser.jay: pass location to Try.
1565 * expression.cs (Unary.Reduce): Change the prototype to return
1566 whether a constant fold could be performed or not. The result is
1567 returned in an out parameters. In the case of Indirection and
1568 AddressOf, we want to perform the full tests.
1570 2002-07-26 Miguel de Icaza <miguel@ximian.com>
1572 * statement.cs (Statement.Emit): Flag dead code.
1574 2002-07-27 Andrew Birkett <andy@nobugs.org>
1576 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
1578 2002-07-27 Martin Baulig <martin@gnome.org>
1580 * class.cs (MethodData.Define): Put back call to
1581 TypeManager.AddMethod(), accidentally commented this out.
1583 * report.cs (Debug): New public method to print debugging information,
1584 this is `[Conditional ("DEBUG")]'.
1586 2002-07-26 Martin Baulig <martin@gnome.org>
1588 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
1589 (switch_statement): Push the current_block to the switch_stack and
1590 pop it again when we're done with the switch.
1591 (switch_section): The new block is a child of the current_block.
1592 Fixes bug #24007, added test-152.cs.
1594 2002-07-27 Martin Baulig <martin@gnome.org>
1596 * expression.cs (Invocation.EmitArguments): When calling a varargs
1597 function with only its fixed arguments, we need to pass an empty
1600 2002-07-27 Martin Baulig <martin@gnome.org>
1602 Mono 0.13 has been released.
1604 2002-07-25 Miguel de Icaza <miguel@ximian.com>
1606 * driver.cs: Rename --resource to --linkres, because that is what
1607 we do currently, we dont support --resource yet.
1609 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
1611 2002-07-25 Martin Baulig <martin@gnome.org>
1613 * class.cs (MethodData): New public class. This is a `method builder'
1614 class for a method or one accessor of a Property/Indexer/Event.
1615 (MethodData.GetMethodFlags): Moved here from MemberBase.
1616 (MethodData.ApplyAttributes): Likewise.
1617 (MethodData.ApplyObsoleteAttribute): Likewise.
1618 (MethodData.ApplyConditionalAttribute): Likewise.
1619 (MethodData.ApplyDllImportAttribute): Likewise.
1620 (MethodData.CheckAbstractAndExternal): Likewise.
1621 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
1622 (MethodData.Emit): Formerly known as Method.Emit().
1623 (MemberBase): Moved everything which was specific to a single
1624 accessor/method to MethodData.
1625 (Method): Create a new MethodData and call Define() and Emit() on it.
1626 (Property, Indexer, Event): Create a new MethodData objects for each
1627 accessor and call Define() and Emit() on them.
1629 2002-07-25 Martin Baulig <martin@gnome.org>
1631 Made MethodCore derive from MemberBase to reuse the code from there.
1632 MemberBase now also checks for attributes.
1634 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
1635 (MemberBase.GetMethodFlags): Moved here from class Method and marked
1637 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
1638 `CallingConventions cc' and `Attributes opt_attrs' arguments.
1639 (MemberBase.ApplyAttributes): New virtual method; applies the
1640 attributes to a method or accessor.
1641 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
1642 (MemberBase.ApplyConditionalAttribute): Likewise.
1643 (MemberBase.ApplyDllImportAttribute): Likewise.
1644 (MemberBase.CheckAbstractAndExternal): Likewise.
1645 (MethodCore.ParameterTypes): This is now a property instead of a
1646 method, it's initialized from DoDefineParameters().
1647 (MethodCore.ParameterInfo): Removed the set accessor.
1648 (MethodCore.DoDefineParameters): New protected virtual method to
1649 initialize ParameterTypes and ParameterInfo.
1650 (Method.GetReturnType): We can now simply return the MemberType.
1651 (Method.GetMethodFlags): Override the MemberBase version and add
1652 the conditional flags.
1653 (Method.CheckBase): Moved some code from Define() here, call
1654 DoDefineParameters() here.
1655 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
1656 here to avoid some larger code duplication.
1657 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
1658 ensure that abstract and external accessors don't declare a body.
1660 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
1661 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
1662 lookup in the attribute's parent classes, so we need to abort as soon
1663 as we found the first match.
1664 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
1665 the attribute has no arguments.
1667 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
1670 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1672 * cs-parser.jay: reverted previous patch.
1674 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1676 * cs-parser.jay: fixed bug #22119.
1678 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1680 * attribute.cs: fixed compilation. The error was:
1681 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
1682 be assigned to before control leaves the current method."
1683 [FIXME: Filed as bug #28186: MCS must report this error.]
1685 2002-07-25 Martin Baulig <martin@gnome.org>
1687 * attribute.cs (Attribute.Conditional_GetConditionName): New static
1688 method to pull the condition name ouf of a Conditional attribute.
1689 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
1690 the obsolete message and error flag out of an Obsolete attribute.
1692 * class.cs (Method.GetMethodFlags): New public method to get the
1693 TypeManager.MethodFlags for this method.
1694 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
1696 (Method.Define): Get and apply the Obsolete and Conditional attributes;
1697 if we're overriding a virtual function, set the new private variable
1698 `parent_method'; call the new TypeManager.AddMethod().
1700 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
1701 the MethodBuilder and the Method in a PtrHashtable.
1702 (TypeManager.builder_to_method): Added for this purpose.
1703 (TypeManager.MethodFlags): Added IsObsoleteError.
1704 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
1705 Obsolete and Conditional arguments in MethodBuilders. If we discover
1706 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
1707 the message from the attribute.
1709 2002-07-24 Martin Baulig <martin@gnome.org>
1711 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
1712 preprocessor directives, ensure that the argument to #define/#undef is
1713 exactly one identifier and that it's actually an identifier.
1715 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
1718 2002-07-24 Martin Baulig <martin@gnome.org>
1720 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
1721 initialize it to TypeManager.object_type in the constructor.
1722 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
1723 of the `hm.get_current' method if we're using the collection pattern.
1724 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
1725 for the explicit conversion to make it work when we're using the collection
1726 pattern and the `Current' property has a different return type than `object'.
1729 2002-07-24 Martin Baulig <martin@gnome.org>
1731 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
1732 does not match, but don't report any errors. This method is called in
1733 order for all methods in a MethodGroupExpr until a matching method is
1734 found, so we don't want to bail out if the first method doesn't match.
1735 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
1736 matches, report the 123. Fixes #28070.
1738 2002-07-24 Martin Baulig <martin@gnome.org>
1740 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
1741 TypeManager.TypeToCoreType() to the top of the method so the
1742 following equality checks will work. Fixes #28107.
1744 2002-07-24 Martin Baulig <martin@gnome.org>
1746 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
1747 operand is of type uint, and the other operand is of type sbyte,
1748 short or int, the operands are converted to type long." -
1749 Actually do what this comment already told us. Fixes bug #28106,
1752 2002-07-24 Martin Baulig <martin@gnome.org>
1754 * class.cs (MethodBase): New abstract class. This is now a base
1755 class for Property, Indexer and Event to avoid some code duplication
1756 in their Define() and DefineMethods() methods.
1757 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
1758 generic methods for Define() and DefineMethods().
1759 (FieldBase): Derive from MemberBase, not MemberCore.
1760 (Property): Derive from MemberBase, not MemberCore.
1761 (Property.DefineMethod): Moved all the code from this method to the
1762 new MethodBase.DefineAccessor(), just call it with appropriate
1764 (Property.Define): Call the new Property.DoDefine(), this does some
1765 sanity checks and we don't need to duplicate the code everywhere.
1766 (Event): Derive from MemberBase, not MemberCore.
1767 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
1768 accessors, this will also make them work with interface events.
1769 (Indexer): Derive from MemberBase, not MemberCore.
1770 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
1771 (Indexer.Define): Use the new MethodBase functions.
1773 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
1774 argument to the constructor.
1775 (Interface.FindMembers): Added support for interface events.
1776 (Interface.PopluateEvent): Implemented.
1778 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
1780 2002-07-22 Miguel de Icaza <miguel@ximian.com>
1782 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
1783 but this is required to check for a method name being the same as
1784 the containing class.
1788 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1790 * interface.cs: initialize variable.
1792 2002-07-23 Martin Baulig <martin@gnome.org>
1794 Implemented the IndexerName attribute in interfaces.
1796 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
1797 name if this is an explicit interface implementation.
1798 (Indexer.InterfaceIndexerName): New public variable. If we're
1799 implementing an interface indexer, this is the IndexerName in that
1800 interface. Otherwise, it's the IndexerName.
1801 (Indexer.DefineMethod): If we're implementing interface indexer,
1802 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
1803 and Pending.ImplementIndexer methods.
1804 (Indexer.Define): Also define the PropertyBuilder if we're
1805 implementing an interface indexer and this is neither an explicit
1806 interface implementation nor do the IndexerName match the one in
1809 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
1810 If a method is defined here, then we always need to create a proxy
1811 for it. This is used when implementing interface indexers.
1812 (Pending.IsInterfaceIndexer): New public method.
1813 (Pending.ImplementIndexer): New public method.
1814 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
1815 This is used when implementing interface indexers to define a proxy
1817 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
1818 define a proxy if necessary.
1820 * interface.cs (Interface.IndexerName): New public variable.
1821 (Interface.PopulateIndexer): Set the IndexerName.
1822 (Interface.DefineIndexers): New private method. Populate all the
1823 indexers and make sure their IndexerNames match.
1825 * typemanager.cs (IndexerPropertyName): Added support for interface
1828 2002-07-22 Martin Baulig <martin@gnome.org>
1830 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
1831 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
1832 ret if HasReturnLabel.
1833 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
1836 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
1837 and set the ec.LoopBeginTryCatchLevel.
1838 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
1839 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
1840 the current ec.TryCatchLevel, the branch goes out of an exception
1841 block. In this case, we need to use Leave and not Br.
1843 2002-07-22 Martin Baulig <martin@gnome.org>
1845 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
1846 block unless the block does not always return or it is contained in
1847 another try { ... } catch { ... } block. Fixes bug #26506.
1848 Added verify-1.cs to the test suite.
1850 2002-07-22 Martin Baulig <martin@gnome.org>
1852 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
1853 then we do not always return. Fixes bug #24985.
1855 2002-07-22 Martin Baulig <martin@gnome.org>
1857 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
1858 lookup on a per-class level; ie. walk up the class hierarchy until we
1859 found at least one applicable method, then choose the best among them.
1860 Fixes bug #24463 and test-29.cs.
1862 2002-07-22 Martin Baulig <martin@gnome.org>
1864 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
1865 return types of the methods. The return type is not part of the
1866 signature and we must not check it to make the `new' modifier work.
1867 Fixes bug #27999, also added test-147.cs.
1868 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
1870 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
1871 on the method's return type.
1873 2002-07-21 Martin Baulig <martin@gnome.org>
1875 * assign.cs: Make this work if the rightmost source is a constant and
1876 we need to do an implicit type conversion. Also adding a few more tests
1877 to test-38.cs which should have caught this.
1879 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
1880 target in the makefile for this. The makefile.gnu is primarily intended
1881 for end-users who don't want to debug the compiler.
1883 2002-07-21 Martin Baulig <martin@gnome.org>
1885 * assign.cs: Improved the Assign class so it can now handle embedded
1886 assignments (X = Y = Z = something). As a side-effect this'll now also
1887 consume less local variables. test-38.cs now passes with MCS, added
1888 a few new test cases to that test.
1890 2002-07-20 Martin Baulig <martin@gnome.org>
1892 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
1893 instructions. Fixes bug #27977, also added test-146.cs.
1895 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1897 * cs-tokenizer.cs: fixed getHex ().
1899 2002-07-19 Martin Baulig <martin@gnome.org>
1901 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
1902 not Type.GetType() to lookup the array type. This is needed when
1903 we're constructing an array of a user-defined type.
1904 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
1905 single-dimensional arrays, but also for single-dimensial arrays of
1908 2002-07-19 Martin Baulig <martin@gnome.org>
1910 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
1911 this function is called, it's not allowed to share LocalBuilders
1914 2002-07-19 Martin Baulig <martin@gnome.org>
1916 * expression.cs (Argument.Resolve): Report an error 118 when trying
1917 to pass a type as argument.
1919 2002-07-18 Martin Baulig <martin@gnome.org>
1921 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
1922 Conv_R_Un for the signed `long' type.
1924 2002-07-15 Miguel de Icaza <miguel@ximian.com>
1926 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
1927 `expr' for the temporary result, as that will fail if we do
1928 multiple resolves on the same expression.
1930 2002-07-05 Miguel de Icaza <miguel@ximian.com>
1932 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
1933 ec.TypeContainer for looking up aliases.
1935 * class.cs (TypeContainer): Remove LookupAlias from here.
1937 * decl.cs (DeclSpace); Move here.
1939 2002-07-01 Miguel de Icaza <miguel@ximian.com>
1941 * class.cs (FindMembers): Only call filter if the constructor
1942 bulider is not null.
1944 Also handle delegates in `NestedTypes' now. Now we will perform
1945 type lookups using the standard resolution process. This also
1948 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
1949 This uses Expressions (the limited kind that can be parsed by the
1950 tree) instead of strings.
1952 * expression.cs (ComposedCast.ToString): Implement, used to flag
1953 errors since now we have to render expressions.
1955 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
1958 * ecore.cs (SimpleName.ToString): ditto.
1960 * cs-parser.jay: Instead of using strings to assemble types, use
1961 Expressions to assemble the type (using SimpleName, ComposedCast,
1962 MemberAccess). This should fix the type lookups in declarations,
1963 because we were using a different code path for this.
1965 * statement.cs (Block.Resolve): Continue processing statements
1966 even when there is an error.
1968 2002-07-17 Miguel de Icaza <miguel@ximian.com>
1970 * class.cs (Event.Define): Also remove the `remove' method from
1971 the list of pending items.
1973 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
1974 generate more compact code.
1976 2002-07-17 Martin Baulig <martin@gnome.org>
1978 * const.cs (Const.LookupConstantValue): Add support for constant
1979 `unchecked' and `checked' expressions.
1980 Also adding test case test-140.cs for this.
1982 2002-07-17 Martin Baulig <martin@gnome.org>
1984 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
1985 check whether mi.ReturnType implements the IEnumerator interface; the
1986 `==' and the IsAssignableFrom() will fail in this situation.
1988 2002-07-16 Ravi Pratap <ravi@ximian.com>
1990 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
1993 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1995 * expression.cs: fixed bug #27811.
1997 2002-07-14 Miguel de Icaza <miguel@ximian.com>
1999 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
2000 Molaro: when we are a ref, the value already contains a pointer
2001 value, do not take the address of it.
2003 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
2004 * removed mb-parser.jay and mb-tokenizer.cs
2006 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
2008 * expression.cs: check against the building corlib void type.
2010 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
2012 * ecore.cs: fix for valuetype static readonly fields: when
2013 initializing them, we need their address, not the address of a copy.
2015 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
2017 * typemanager.cs: register also enum_type in corlib.
2019 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
2021 * class.cs: allow calling this (but not base) initializers in structs.
2023 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
2025 * ecore.cs: make sure we compare against the building base types
2028 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
2030 * typemanager.cs: fix TypeToCoreType() to handle void and object
2031 (corlib gets no more typerefs after this change).
2033 2002-07-12 Miguel de Icaza <miguel@ximian.com>
2035 * expression.cs (ArrayCreation.EmitArrayArguments): use
2036 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
2038 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
2039 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
2040 array indexes, the runtime actually forbids them.
2042 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
2043 for array arguments here.
2045 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
2046 instead of the default for ValueTypes.
2048 (New.DoEmit): Use IsValueType instead of
2049 IsSubclassOf (value_type)
2050 (New.DoResolve): ditto.
2051 (Invocation.EmitCall): ditto.
2053 * assign.cs (Assign): ditto.
2055 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
2056 Statements *are* currently doing part of their resolution during
2059 Expressions do always resolve during resolve, but statements are
2060 only required to propagate resolution to their children.
2062 2002-07-11 Miguel de Icaza <miguel@ximian.com>
2064 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
2066 (LoadAssembly): Do not add the dll if it is already specified
2068 (MainDriver): Add the System directory to the link path at the end,
2069 after all the other -L arguments.
2071 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
2072 wrong opcode for loading bytes and bools (ldelem.i1 instead of
2073 ldelem.u1) and using the opposite for sbytes.
2075 This fixes Digger, and we can finally run it.
2077 * driver.cs (UnixParseOption): Move the option parsing here.
2078 (CSCParseOption): Implement CSC-like parsing of options.
2080 We now support both modes of operation, the old Unix way, and the
2081 new CSC-like way. This should help those who wanted to make cross
2084 The only thing broken is that /r:, /reference: and /lib: are not
2085 implemented, because I want to make those have the same semantics
2086 as the CSC compiler has, and kill once and for all the confussion
2087 around this. Will be doing this tomorrow.
2089 * statement.cs (Unsafe.Resolve): The state is checked during
2090 resolve, not emit, so we have to set the flags for IsUnsfe here.
2092 2002-07-10 Miguel de Icaza <miguel@ximian.com>
2094 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
2095 not catch the Error_ObjectRefRequired in SimpleName (as it is
2096 possible to have a class/instance variable name that later gets
2097 deambiguated), we have to check this here.
2099 2002-07-10 Ravi Pratap <ravi@ximian.com>
2101 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
2102 make static and put into Expression.
2104 (Event.Define): Register the private field of the event with the
2105 TypeManager so that GetFieldFromEvent can get at it.
2107 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
2108 keep track of the private field associated with an event which
2111 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
2114 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
2116 2002-07-10 Miguel de Icaza <miguel@ximian.com>
2118 * expression.cs (Binary.EmitBranchable): this routine emits the
2119 Binary expression in a branchable context. This basically means:
2120 we need to branch somewhere, not just get the value on the stack.
2122 This works together with Statement.EmitBoolExpression.
2124 * statement.cs (Statement.EmitBoolExpression): Use
2127 2002-07-09 Miguel de Icaza <miguel@ximian.com>
2129 * statement.cs (For): Reduce the number of jumps in loops.
2131 (For): Implement loop inversion for the For statement.
2133 (Break): We can be breaking out of a Try/Catch controlled section
2134 (foreach might have an implicit try/catch clause), so we need to
2135 use Leave instead of Br.
2137 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
2138 now). If the instace expression supports IMemoryLocation, we use
2139 the AddressOf method from the IMemoryLocation to extract the
2140 address instead of emitting the instance.
2142 This showed up with `This', as we were emitting the instance
2143 always (Emit) instead of the Address of This. Particularly
2144 interesting when This is a value type, as we dont want the Emit
2145 effect (which was to load the object).
2147 2002-07-08 Miguel de Icaza <miguel@ximian.com>
2149 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
2151 * statement.cs (Checked): Set the CheckedState during the resolve
2152 process too, as the ConvCast operations track the checked state on
2153 the resolve process, and not emit.
2155 * cs-parser.jay (namespace_member_declaration): Flag that we have
2156 found a declaration when we do. This is used to flag error 1529
2158 * driver.cs: Report ok when we display the help only.
2160 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
2162 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
2164 2002-07-04 Miguel de Icaza <miguel@ximian.com>
2166 * cs-tokenizer.cs (define): We also have to track locally the
2167 defines. AllDefines is just used for the Conditional Attribute,
2168 but we also need the local defines for the current source code.
2170 2002-07-03 Miguel de Icaza <miguel@ximian.com>
2172 * statement.cs (While, For, Do): These loops can exit through a
2173 Break statement, use this information to tell whether the
2174 statement is the last piece of code.
2176 (Break): Flag that we break.
2178 * codegen.cs (EmitContexts): New `Breaks' state variable.
2180 2002-07-03 Martin Baulig <martin@gnome.org>
2182 * class.cs (TypeContainer.MethodModifiersValid): Allow override
2183 modifiers in method declarations in structs. Otherwise, you won't
2184 be able to override things like Object.Equals().
2186 2002-07-02 Miguel de Icaza <miguel@ximian.com>
2188 * class.cs (Method, Property, Indexer): Do not allow the public
2189 modifier to be used in explicit interface implementations.
2191 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
2192 override modifiers in method declarations in structs
2194 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
2196 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
2197 integer or real overflow, report an error
2199 2002-07-02 Martin Baulig <martin@gnome.org>
2201 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
2202 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
2203 to tell the runtime about our newly created System.Object and
2204 System.ValueType types.
2206 2002-07-02 Miguel de Icaza <miguel@ximian.com>
2208 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
2209 struct instead of Ldarg/Starg.
2211 2002-07-02 Martin Baulig <martin@gnome.org>
2213 * expression.cs (Indirection.Indirection): Call
2214 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
2216 2002-07-02 Martin Baulig <martin@gnome.org>
2218 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
2219 ValueType, call TypeManager.TypeToCoreType() on it.
2220 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
2221 the OpCodes.Newarr argument.
2223 2002-07-02 Martin Baulig <martin@gnome.org>
2225 * expression.cs (Invocation.EmitCall): When compiling corlib,
2226 replace all calls to the system's System.Array type to calls to
2227 the newly created one.
2229 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
2230 System.Array methods.
2231 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
2232 from the system's System.Array type which must be replaced.
2234 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
2236 * typemanager.cs: load unverifiable_code_ctor so we can build
2237 corlib using the correct type. Avoid using GetTypeCode() with
2239 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
2240 TypeManager.object_type to allow building corlib.
2242 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
2244 * ecore.cs: handle System.Enum separately in LoadFromPtr().
2246 2002-07-01 Martin Baulig <martin@gnome.org>
2248 * class.cs: Make the last change actually work, we need to check
2249 whether `ifaces != null' to avoid a crash.
2251 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
2253 * class.cs: when we build structs without fields that implement
2254 interfaces, we need to add the interfaces separately, since there is
2255 no API to both set the size and add the interfaces at type creation
2258 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
2260 * expression.cs: the dimension arguments to the array constructors
2261 need to be converted if they are a long.
2263 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
2265 * class.cs: don't emit ldarg.0 if there is no parent constructor
2266 (fixes showstopper for corlib).
2268 2002-06-29 Martin Baulig <martin@gnome.org>
2270 MCS now compiles corlib on GNU/Linux :-)
2272 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
2273 ie. check for MethodImplOptions.InternalCall.
2275 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
2276 and TypeManager.attribute_type are null, so we must explicitly check
2277 whether parent is not null to find out whether it's an attribute type.
2278 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
2279 and SetBuilder, not only if the property is neither abstract nor external.
2280 This is necessary to set the MethodImplOptions on the accessor methods.
2281 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
2282 SetBuilder, see Property.Emit().
2284 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
2285 populate "System.Object", "System.ValueType" and "System.Attribute" since
2286 they've already been populated from BootCorlib_PopulateCoreTypes().
2288 2002-06-29 Martin Baulig <martin@gnome.org>
2290 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
2291 is the NullLiteral, we also need to make sure that target_type is not
2294 2002-06-29 Martin Baulig <martin@gnome.org>
2296 * rootcontext.cs (RootContext.ResolveCore): We must initialize
2297 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
2298 before calling BootstrapCorlib_ResolveDelegate ().
2300 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2302 * statement.cs: fixed build-breaker. All tests passed ok.
2304 2002-06-27 Martin Baulig <martin@gnome.org>
2306 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
2307 for System.Decimal when compiling corlib.
2309 2002-06-27 Martin Baulig <martin@gnome.org>
2311 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
2312 switch blocks which contain nothing but a default clause.
2314 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
2316 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
2318 2002-06-27 Martin Baulig <martin@gnome.org>
2320 * ecore.cs (PropertyExpr.PropertyExpr): Call
2321 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
2323 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
2324 is already a TypeBuilder.
2326 2002-06-27 Martin Baulig <martin@gnome.org>
2328 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
2329 `target_type == TypeManager.array_type', not IsAssignableFrom() in
2330 the "from an array-type to System.Array" case. This makes it work
2331 when compiling corlib.
2333 2002-06-27 Martin Baulig <martin@gnome.org>
2335 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
2336 non-static PropertyExpr, set its InstanceExpression. This makes
2337 the `ICollection.Count' property work in System/Array.cs.
2339 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
2341 * driver.cs: Made error handling more consistent. Errors now
2342 tracked by Report class, so many methods which used to return int
2343 now return void. Main() now prints success/failure and
2344 errors/warnings message.
2346 Renamed '--probe' compiler argument to '--expect-error'. Removed
2347 the magic number return values (123 and 124). Now, if the
2348 expected error occurs, the compiler exits with success (exit value
2349 0). If the compilation completes without seeing that particular
2350 error, the compiler exits with failure (exit value 1). The
2351 makefile in mcs/errors has been changed to handle the new behaviour.
2353 * report.cs: Made 'expected error' number a property and renamed
2354 it from 'Probe' to 'ExpectedError'.
2356 * genericparser.cs: Removed error handling support, since it is
2357 now all done by Report class.
2359 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
2360 class, so parse() no longer returns an int.
2362 * namespace.cs: Use Report.Error instead of GenericParser.error
2364 2002-06-22 Miguel de Icaza <miguel@ximian.com>
2366 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
2367 TypeContainer.AddOperator): At the front of the list put the
2368 explicit implementations, so they get resolved/defined first.
2370 2002-06-21 Miguel de Icaza <miguel@ximian.com>
2372 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
2373 interface type is implemented by this TypeContainer. Used during
2374 explicit interface implementation.
2376 (Property.Define, Indexer.Define, Method.Define): Validate that
2377 the given interface in the explicit implementation is one of the
2378 base classes for the containing type.
2380 Also if we are explicitly implementing an interface, but there is
2381 no match in the pending implementation table, report an error.
2383 (Property.Define): Only define the property if we are
2384 not explicitly implementing a property from an interface. Use the
2385 correct name also for those properties (the same CSC uses,
2386 although that is really not needed).
2388 (Property.Emit): Do not emit attributes for explicitly implemented
2389 properties, as there is no TypeBuilder.
2391 (Indexer.Emit): ditto.
2393 Hiding then means that we do not really *implement* a pending
2394 implementation, which makes code fail.
2396 2002-06-22 Martin Baulig <martin@gnome.org>
2398 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
2399 the return value of Object.GetType(). [FIXME: we need to do this whenever
2400 we get a type back from the reflection library].
2402 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
2404 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
2406 2002-06-20 Miguel de Icaza <miguel@ximian.com>
2408 * attribute.cs: Return null if we can not look up the type.
2410 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
2411 the interface types found.
2413 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
2414 interface types found.
2416 * typemanager.cs (GetInterfaces): Make this routine returns alll
2417 the interfaces and work around the lame differences between
2418 System.Type and System.Reflection.Emit.TypeBuilder in the results
2419 result for GetInterfaces.
2421 (ExpandInterfaces): Given an array of interface types, expand and
2422 eliminate repeated ocurrences of an interface. This expands in
2423 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
2426 2002-06-21 Martin Baulig <martin@gnome.org>
2428 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
2431 2002-06-21 Martin Baulig <martin@gnome.org>
2433 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
2434 and called with one of the core types, return the corresponding typebuilder for
2437 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
2440 2002-06-21 Martin Baulig <martin@gnome.org>
2442 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
2443 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
2444 (Expression.ConvertReferenceExplicit): Likewise.
2446 * expression.cs (ElementAccess.DoResolve): Likewise.
2447 (ElementAccess.DoResolveLValue): Likewise.
2449 2002-06-10 Martin Baulig <martin@gnome.org>
2451 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
2452 add the "value" parameter to the parameter list.
2454 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
2457 2002-06-19 Miguel de Icaza <miguel@ximian.com>
2459 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
2460 the argument to an int, uint, long or ulong, per the spec. Also
2461 catch negative constants in array creation.
2463 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
2465 * class.cs: do not allow the same interface to appear twice in
2466 the definition list.
2468 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
2470 * ecore.cs: don't use ldlen with System.Array.
2472 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
2474 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
2476 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
2478 * modifiers.cs: produce correct field attributes for protected
2479 internal. Easy fix so miguel can work on ther harder stuff:-)
2481 2002-06-18 Miguel de Icaza <miguel@ximian.com>
2483 * pending.cs: New file. Move the code from class.cs here.
2484 Support clearning the pending flag for all methods (when not doing
2485 explicit interface implementation).
2487 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
2489 * rootcontext.cs: added a couple more types needed to bootstrap.
2491 2002-06-17 Miguel de Icaza <miguel@ximian.com>
2493 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
2494 constructor in the type, instead of any constructor in the type
2495 hierarchy. Thanks to Paolo for finding this bug (it showed up as
2496 a bug in the Mono runtime when applying the params attribute).
2498 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
2499 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
2501 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
2503 * expression.cs (Unary.ResolveOperator): Use TypeManager
2504 to resolve the type.
2506 2002-06-13 Ravi Pratap <ravi@ximian.com>
2508 * cs-parser.jay (enum_member_declaration): Pass in the attributes
2511 * enum.cs (AddEnumMember): Add support to store the attributes associated
2512 with each member too.
2514 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
2515 field builders too - this takes care of the enum member case.
2517 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
2519 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
2520 address-of operator on both value types and pointers.
2522 2002-06-10 Martin Baulig <martin@gnome.org>
2524 * interface.cs (Interface.PopulateIndexer): Add the indexer's
2525 PropertyBuilder to the `property_builders' list.
2527 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
2528 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
2529 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
2530 find any indexers which are inherited from an interface.
2532 2002-06-09 Martin Baulig <martin@gnome.org>
2534 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
2535 the same type as the constant if necessary. There's also a test-130.cs
2538 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
2540 * typemanager.cs (TypeManager.ChangeType): Previously known as
2541 Enum.ChangeEnumType().
2543 2002-06-09 Martin Baulig <martin@gnome.org>
2545 * expression.cs (Cast.TryReduce): Added support for consts.
2547 2002-06-08 Ravi Pratap <ravi@ximian.com>
2549 * class.cs (Accessor): Hold attributes information so we can pass
2552 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
2553 Modify to pass in attributes attached to the methods.
2555 (add_accessor_declaration, remove_accessor_declaration): Ditto.
2557 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
2558 to handle the Accessor kind :-)
2560 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
2562 2002-06-08 Martin Baulig <martin@gnome.org>
2564 * expression.cs (Unary.TryReduceNegative): Added support for
2567 2002-06-08 Martin Baulig <martin@gnome.org>
2569 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
2570 name can't be found in the `defined_names' - the caller will do a
2571 MemberLookup in this case and thus find methods in System.Enum
2572 such as Enum.IsDefined().
2574 2002-06-08 Martin Baulig <martin@gnome.org>
2576 * enum.cs (Enum.ChangeEnumType): This is a custom version of
2577 Convert.ChangeType() which works with TypeBuilder created types.
2578 (Enum.LookupEnumValue, Enum.Define): Use it here.
2580 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
2581 `TypeBuilder.BaseType != null' check.
2582 (TypeContainer.FindMembers): Only lookup parent members if we
2583 actually have a parent.
2584 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
2585 (ConstructorInitializer.Resolve): Likewise.
2587 * interface.cs (Interface.FindMembers): Added
2588 `TypeBuilder.BaseType != null' check.
2590 * rootcontext.cs (RootContext.ResolveCore): Added
2591 "System.Runtime.CompilerServices.IndexerNameAttribute" to
2592 classes_second_stage.
2594 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
2595 debug_type and trace_type when compiling with --nostdlib.
2597 2002-06-07 Martin Baulig <martin@gnome.org>
2599 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
2600 (AddField): Set it to true when adding a non-static field.
2601 (DefineType): Use `have_nonstatic_fields' to find out whether we
2602 have non-static fields, not `Fields != null'.
2604 2002-06-02 Miguel de Icaza <miguel@ximian.com>
2606 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
2607 dereferencing a null on the static-field code path)
2609 2002-05-30 Martin Baulig <martin@gnome.org>
2611 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
2612 to take command line arguments. Use reflection to call the new
2613 custom `Initialize' function on the symbol writer and pass it the
2614 command line arguments.
2616 * driver.cs (--debug-args): New command line argument to pass command
2617 line arguments to the symbol writer.
2619 2002-05-28 Miguel de Icaza <miguel@ximian.com>
2621 * assign.cs (DoResolve): Forgot to do the implicit conversion to
2622 the target type for indexers and properties. Thanks to Joe for
2625 2002-05-27 Miguel de Icaza <miguel@ximian.com>
2627 * typemanager.cs (MethodFlags): returns the method flags
2628 (Obsolete/ShouldIgnore) that control warning emission and whether
2629 the invocation should be made, or ignored.
2631 * expression.cs (Invocation.Emit): Remove previous hack, we should
2632 not do this on matching a base type, we should do this based on an attribute
2634 Only emit calls to System.Diagnostics.Debug and
2635 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
2636 on the command line.
2638 * rootcontext.cs: Global settings for tracing and debugging.
2640 * cs-tokenizer.cs (define): New utility function to track
2641 defines. Set the global settings for TRACE and DEBUG if found.
2643 2002-05-25 Ravi Pratap <ravi@ximian.com>
2645 * interface.cs (Populate*): Pass in the TypeContainer as well as
2646 the DeclSpace as parameters so that we can create EmitContexts and
2647 then use that to apply attributes etc.
2649 (PopulateMethod, PopulateEvent, PopulateProperty)
2650 (PopulateIndexer): Apply attributes everywhere.
2652 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
2655 (ApplyAttributes): Update accordingly.
2657 We now apply interface attributes for all members too.
2659 2002-05-26 Miguel de Icaza <miguel@ximian.com>
2661 * class.cs (Indexer.Define); Correctly check if we are explicit
2662 implementation (instead of checking the Name for a ".", we
2663 directly look up if the InterfaceType was specified).
2665 Delay the creation of the PropertyBuilder.
2667 Only create the PropertyBuilder if we are not an explicit
2668 interface implementation. This means that explicit interface
2669 implementation members do not participate in regular function
2670 lookups, and hence fixes another major ambiguity problem in
2671 overload resolution (that was the visible effect).
2673 (DefineMethod): Return whether we are doing an interface
2676 * typemanager.cs: Temporary hack until we get attributes in
2677 interfaces (Ravi is working on that) and we get IndexerName
2678 support in interfaces.
2680 * interface.cs: Register the indexers as properties.
2682 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
2683 warning, I have verified that this is a bug in the .NET runtime
2684 (JavaScript suffers of the same problem).
2686 * typemanager.cs (MemberLookup): When looking up members for
2687 interfaces, the parent of an interface is the implicit
2688 System.Object (so we succeed in searches of Object methods in an
2689 interface method invocation. Example: IEnumerable x; x.ToString
2692 2002-05-25 Miguel de Icaza <miguel@ximian.com>
2694 * class.cs (Event): Events should also register if they do
2695 implement the methods that an interface requires.
2697 * typemanager.cs (MemberLookup); use the new GetInterfaces
2700 (GetInterfaces): The code used to lookup interfaces for a type is
2701 used in more than one place, factor it here.
2703 * driver.cs: Track the errors at the bottom of the file, we kept
2706 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
2707 instance if the method we are calling is static!
2709 2002-05-24 Miguel de Icaza <miguel@ximian.com>
2711 * attribute.cs (ApplyAttributes): Make this function filter out
2712 the IndexerName attribute (as that attribute in reality is never
2713 applied) and return the string constant for the IndexerName
2716 * class.cs (TypeContainer.Emit): Validate that all the indexers
2717 have the same IndexerName attribute, and if so, set the
2718 DefaultName attribute on the class.
2720 * typemanager.cs: The return value might contain other stuff (not
2721 only methods). For instance, consider a method with an "Item"
2722 property and an Item method.
2724 * class.cs: If there is a problem with the parameter types,
2727 2002-05-24 Ravi Pratap <ravi@ximian.com>
2729 * ecore.cs (ImplicitConversionExists): Wrapper function which also
2730 looks at user defined conversion after making a call to
2731 StandardConversionExists - we need this for overload resolution.
2733 * expression.cs : Update accordingly the various method calls.
2735 This fixes 2 bugs filed against implicit user defined conversions
2737 2002-05-22 Miguel de Icaza <miguel@ximian.com>
2739 * statement.cs: Track the result of the assignment.
2741 2002-05-21 Miguel de Icaza <miguel@ximian.com>
2743 * expression.cs (MemberAccess): Improved error reporting for
2744 inaccessible members.
2746 2002-05-22 Martin Baulig <martin@gnome.org>
2748 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
2749 itself with debugging support.
2751 2002-05-22 Martin Baulig <martin@gnome.org>
2753 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
2754 Removed, this isn't needed anymore.
2756 2002-05-20 Martin Baulig <martin@gnome.org>
2758 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
2759 be underlying type for an enum.
2761 2002-05-20 Miguel de Icaza <miguel@ximian.com>
2763 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
2764 that splits out the loading of just the core types.
2766 * rootcontext.cs (ResolveCore): Split the struct resolution in
2767 two, so we can load the enumeration underlying types before any
2770 * expression.cs (Is): Bandaid until we fix properly Switch (see
2771 bug #24985 for details).
2773 * typemanager.cs (ImplementsInterface): The hashtable will contain
2774 a null if there are no interfaces implemented.
2776 2002-05-18 Miguel de Icaza <miguel@ximian.com>
2778 * cs-parser.jay (indexer_declarator): It is fine to have array
2781 2002-05-17 Miguel de Icaza <miguel@ximian.com>
2783 * typemanager.cs: (RegisterBuilder): New function used to register
2784 TypeBuilders that implement interfaces. Since
2785 TypeBuilder.GetInterfaces (as usual) does not work with lame
2787 (AddUserType): register interfaces.
2789 (ImplementsInterface): Use the builder_to_ifaces hash if we are
2790 dealing with TypeBuilder. Also, arrays are showing up as
2791 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
2792 methods can not be invoked on them!
2794 * ecore.cs (ExplicitReferenceConversionExists): Made public.
2795 (ImplicitReferenceConversionExists): Split out from
2796 StandardConversionExists.
2798 * expression.cs (As): We were only implementing one of the three
2799 cases for the as operator. We now implement them all.
2800 (Is): Implement the various other cases for Is as well.
2802 * typemanager.cs (CACHE): New define used to control if we want or
2803 not the FindMembers cache. Seems to have a negative impact on
2804 performance currently
2806 (MemberLookup): Nested types have full acess to
2807 enclosing type members
2809 Remove code that coped with instance/static returns for events, we
2810 now catch this in RealFindMembers.
2812 (RealFindMembers): only perform static lookup if the instance
2813 lookup did not return a type or an event.
2815 2002-05-17 Miguel de Icaza <miguel@ximian.com>
2817 * assign.cs (CompoundAssign): We pass more semantic information
2818 now to Compound Assignments than we did before: now we have all
2819 the information at hand, and now we resolve the target *before* we
2820 do the expression expansion, which allows the "CacheValue" method
2821 to have the effect we intended (before, a [x] += 1 would generate
2822 two differen ArrayAccess expressions from the ElementAccess,
2823 during the resolution process).
2825 (CompoundAssign.DoResolve): Resolve target and original_source here.
2827 2002-05-16 Miguel de Icaza <miguel@ximian.com>
2829 * expression.cs (ArrayAccess): dropped debugging information.
2831 * typemanager.cs: Small bug fix: I was always returning i_members,
2832 instead of one of i_members or s_members (depending on which had
2835 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
2836 method is invoked before any code generation takes place, and it
2837 is a mechanism to inform that the expression will be invoked more
2838 than once, and that the method should use temporary values to
2839 avoid having side effects
2841 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
2843 * ecore.cs (Expression.CacheTemporaries): Provide empty default
2846 * expression.cs (Indirection, ArrayAccess): Add support for
2847 CacheTemporaries in these two bad boys.
2849 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
2851 (StoreFromPtr): Handle stobj as well.
2853 * expression.cs (UnaryMutator): Share more code.
2855 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
2856 down: I was not tracking the Filter function as well, which
2857 was affecting the results of the cache.
2859 2002-05-15 Miguel de Icaza <miguel@ximian.com>
2861 * attribute.cs: Remove the hack to handle the CharSet property on
2864 2002-05-14 Miguel de Icaza <miguel@ximian.com>
2866 * attribute.cs (DoResolve): More uglyness, we now only try to
2867 resolve the attribute partially, to extract the CharSet
2868 information (only if we are a StructLayout attribute). Otherwise
2870 (GetExtraTypeInfo): Add some code to conditionally kill in the
2871 future this. I am more and more convinced that the .NET
2872 framework has special code to handle the attribute setting on
2875 * expression.cs (IsParamsMethodApplicable): Revert my previous
2876 foreach change here, it was wrong.
2878 2002-05-13 Miguel de Icaza <miguel@ximian.com>
2880 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
2881 (pp_expr): do not abort on unknown input, just return.
2882 (eval): abort if there are pending chars.
2884 * attribute.cs (Attribute.Resolve): Positional parameters are
2885 optional. Deal with that case.
2887 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
2888 the Ansi/Unicode/Auto information for the type.
2890 (TypeContainer.DefineType): instantiate the EmitContext here, as
2891 we will be using it during the type definition (to resolve
2892 attributes) and during the emit phase.
2894 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
2895 to pull type information out of the attributes
2897 (Attribute.Resolve): track the constructor builder, and allow for
2898 multiple invocations (structs and classes will use this).
2900 * ecore.cs (MemberLookupFinal): new version with all the
2901 parameters customizable.
2903 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
2904 constructors. Return if the result value is null (as the error
2905 would have been flagged already by MemberLookupFinal)
2907 Do not allow instances of abstract classes or interfaces to be
2910 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
2911 We have to compare the assembly property here when dealing with
2912 FamANDAssem and Assembly access modifiers, because we might be
2913 creating an assembly from *modules* (that means that we are not
2914 getting TypeBuilders for types defined in other modules that are
2915 part of this assembly).
2917 (Method.Emit): If the method is marked abstract and has a body,
2920 (TypeContainer.DefineMembers): If both the defined member and the
2921 parent name match are methods, then do not emit any warnings: let
2922 the Method.Define routine take care of flagging warnings. But if
2923 there is a mismatch (method overrides something else, or method is
2924 overriwritten by something, then emit warning).
2926 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
2927 set to null, this means `do not check for the return type on the
2930 (Method.Define): set the return type for the method signature to
2931 null, so that we get methods with the same name and parameters and
2932 different return types. This is used to flag warning 114 (you are
2933 hiding a method, and you probably want to use the new/override
2936 * typemanager.cs (MemberLookup): Implemented proper access
2937 control, closing a long standing set of bug reports. The problem
2938 was that the Framework only has two bits: Public and NonPublic,
2939 and NonPublic includes private and protected methods, but we need
2940 to enforce the FamANDAssem, FamOrAssem and Family.
2942 2002-05-11 Miguel de Icaza <miguel@ximian.com>
2944 * statement.cs (GotoCase): Return true: Ammounts to giving up
2945 knowledge on whether we return or not, and letting the other case
2946 be responsible for it.
2948 2002-05-10 Miguel de Icaza <miguel@ximian.com>
2950 * driver.cs: Do not load directories for each file processed, only
2951 do it if there is a pattern.
2953 * ecore.cs: Report readonly assigns here as well, as we might have
2954 been resolved only by MemberAccess.
2956 (SimpleName.SimpleNameResolve): Also be useful for LValue
2957 resolution. We need this to propagate assign to local readonly variables
2959 * typemanager.cs: Use a ptrhashtable for the criteria, because we
2960 do not want to reuse potential criteria memory.
2962 * class.cs (MyEventBuilder): Set reflected_type;
2964 * ecore.cs (Constantify): Added support for constifying bools.
2966 (RootContext.LookupType): Added a cache for values looked up in
2967 the declaration space.
2969 * typemanager.cs (FindMembers): Now is a front-end to
2970 RealFindMembers, and provides a two-level hashtable-based cache to
2973 15% performance improvement: from 22.5 to 19.2 seconds.
2975 * expression.cs (IsParamsMethodApplicable): use foreach.
2976 (Invocation.DoResolve): ditto.
2977 (New.DoResolve): ditto.
2978 (ArrayCreation.DoResolve): ditto.
2980 * ecore.cs (FindMostEncompassingType): use foreach.
2982 * delegate.cs (NewDelegate.DoResolve): Use foreach
2984 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
2985 (RemoveMethods): use foreach.
2987 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
2988 nested foreach statements instead of for, and also break out of
2989 the inner loop once a match is found.
2991 (Invocation.OverloadResolve): Use foreach, simplify the code.
2993 2002-05-08 Miguel de Icaza <miguel@ximian.com>
2995 * cfold.cs (BinaryFold): During an enumeration evaluation context,
2996 we actually unwrap the expression to allow for extra information
2999 * expression.cs: Use Shr_Un on unsigned operations.
3001 2002-05-08 Ravi Pratap <ravi@ximian.com>
3003 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
3004 applicable operators was not being considered correctly. This closes
3005 the bug Miguel reported.
3007 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
3009 * attribute.cs: check that the type derives from System.Attribute
3010 and report the correct error in that case (moved the duplicate code to
3011 its own method, too).
3013 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
3015 * attribute.cs: lookup attribute type name as the spec says: first the
3016 bare attribute name and then name + "Attribute" (nant compiles with
3017 mcs after this fix).
3019 2002-05-07 Miguel de Icaza <miguel@ximian.com>
3021 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
3022 Because of the way we parse things, we should try to see if a
3023 UIntConstant can fit in an integer.
3025 2002-05-07 Ravi Pratap <ravi@ximian.com>
3027 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
3028 when we are in an explicit context.
3030 (ConvertReferenceExplicit): When converting from Iface type S to Class
3031 T make sure the rules are implemented as an OR.
3033 * parameter.cs (ParameterType): Make it a property for now although the
3034 purpose really isn't anything immediate.
3036 * expression.cs (Is*Applicable): Do better checking on the parameter type
3037 of a ref/out parameter. The ones from the system assemblies are already
3038 marked with the correct type so we don't need to do any correction.
3040 * ecore.cs (StandardConversionExists): Conversion from Interface types to
3041 the object type is standard too so include that.
3043 2002-05-06 Miguel de Icaza <miguel@ximian.com>
3045 * ecore.cs (StandardConversionExists): Augment with missing code:
3046 deal with IntConstant, LongConstants and Enumerations.
3048 * assign.cs: Report the error, instead of failing silently
3050 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
3051 typecontainer that they are declared, because the
3052 typecontainer/namespace will have the list of using clauses that
3055 Assembly Attributes were escaping the normal registration
3058 (EmitCode): Apply attributes within an EmitContext that represents
3059 the container they were declared on.
3061 * cs-parser.jay: Track bases for structs. How did I get this wrong?
3063 2002-05-06 Ravi Pratap <ravi@ximian.com>
3065 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
3066 Revamp completely - make much cleaner as we now operate only
3069 (FindMostSpecificSource, FindMostSpecificTarget): New methods
3070 to implement the logic detailed in the spec more correctly.
3072 (UserDefinedConversion): Update accordingly.
3074 2002-05-06 Miguel de Icaza <miguel@ximian.com>
3076 * statement.cs: Return flow analysis information up.
3078 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
3081 (token): Do not consume an extra character before calling
3084 2002-05-06 Piers Haken <piersh@friskit.com>
3086 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
3088 2002-05-06 Miguel de Icaza <miguel@ximian.com>
3090 * class.cs (Constructor.Emit): Set the IsStatic flag in the
3091 EmitContext during the instance constructor initializer
3092 resolution, to stop access to instance variables.
3094 This is mandated by the spec, last paragraph of the `constructor
3095 initializers' section.
3097 2002-05-05 Miguel de Icaza <miguel@ximian.com>
3099 * cs-parser.jay, class.cs (Accessor): new class used to represent
3100 an accessor (get or set). In the past we used `null' to represent
3101 a missing accessor. But this is ambiguous because there was no
3102 way to tell in abstract indexers/properties if one of them was
3105 Now there is a way of addressing that.
3107 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
3108 instead of FindMembers.
3110 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
3111 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
3113 * attribute.cs: Treat indexers and properties as the same in terms
3114 of applying attributes
3116 * ecore.cs (FindMostEncompassedType): Use statically initialized
3117 EmptyExpressions()s like we do elsewhere to avoid creating useless
3118 objects (and we take this out of the tight loop).
3120 (GetConversionOperators): Move the code to extract the actual
3121 operators to a separate routine to clean things up.
3123 2002-05-04 Miguel de Icaza <miguel@ximian.com>
3125 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
3126 events are always registered FieldBuilders.
3128 * class.cs (FieldBase): New class shared by Fields
3130 * delegate.cs: If we are a toplevel delegate, use our full name.
3131 If we are a nested delegate, then only use our tail name.
3133 2002-05-02 Ravi Pratap <ravi@ximian.com>
3135 * expression.cs (IsApplicable): Ensure that we add the "&" to
3136 ref/out types before comparing it with the type of the argument.
3138 (IsParamsMethodApplicable): Ditto.
3140 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
3143 * delegate.cs : Handle the case when we have more than one applicable
3144 method. Flag an error only when we finish checking all.
3146 2002-05-02 Miguel de Icaza <miguel@ximian.com>
3148 * expression.cs: Add support for boolean static initializers.
3150 2002-05-01 Miguel de Icaza <miguel@ximian.com>
3152 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
3154 * parameter.cs (ComputeParameterTypes,
3155 ComputeAndDefineParameterTypes): Better error handling: now we
3156 clear the `types' cache if we fail during any of the type lookups.
3157 We also return the status code correctly to our caller
3159 * delegate.cs: If we fail to define a delegate, abort the extra
3162 * expression.cs (Binary.ResolveOperator): for
3163 operator==(object,object) and operator !=(object, object) we also
3164 have to verify that there is an implicit conversion from one to
3167 (ArrayAccess.DoResolve): Array Access can operate on
3170 2002-04-30 Miguel de Icaza <miguel@ximian.com>
3172 * assign.cs (CompoundAssign): A new class used as a "flag" that
3173 the assignment actually is happening as part of a compound
3174 assignment operator.
3176 During compound assignment, a few new rules exist to enable things
3183 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
3184 to the type of x) if y is implicitly convertible to the type of x,
3185 and the operator is a builtin operator and the return type of the
3186 operator is explicitly convertible to the type of x.
3188 * rootcontext.cs: Reset warning level to 2. 4 catches various
3189 "interesting" features in mcs, we must clean this up at some
3190 point, but currently am trying to kill other bugs ;-)
3192 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
3193 in container classes as well.
3195 * expression.cs (Binary.ResolveOperator): Handle string case
3196 before anything else (as operator overloading does emit an error
3197 before doing anything else).
3199 This code could go away when we move to a table driven model, but
3200 i could not come up with a good plan last night.
3202 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
3204 * typemanager.cs (CSharpName): reimplementation using regex.
3205 * class.cs: added null check for fields in Emit
3206 * rootcontext.cs: set warninglevel to 4
3208 2002-04-29 Miguel de Icaza <miguel@ximian.com>
3210 * typemanager.cs (CSharpName): reimplemented with Lupus
3213 2002-04-28 Miguel de Icaza <miguel@ximian.com>
3215 * statement.cs (If): correclty implement Resolve, because we were
3216 not catching sem errors in there. The same process is needed
3218 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
3221 (Statement.Warning_DeadCodeFound): Factorize code.
3222 (While): Report dead code here too.
3224 (Statement): Added Resolve virtual method to allow
3225 for resolution split from the emit code.
3227 2002-04-26 Miguel de Icaza <miguel@ximian.com>
3229 * statement.cs (EmitBoolExpression): No longer try to resolve the
3231 (MakeBoolean): New utility function that resolve, implicitly
3232 converts to boolean and tags the expression.
3235 (If, Do): Implement dead code elimination.
3236 (While): Implement loop inversion
3238 (Do, While, For, If): Resolve the expression prior to calling our
3241 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
3244 - added method Report28 (warning: program has more than one entry point)
3245 - added method IsEntryPoint, implements paragraph 10.1 of the spec
3246 - modified method Method.Define, the part at the end of the method
3248 * rootcontext.cs: added static public Location EntryPointLocation;
3250 * ../errors/cs0028.cs : Add test case for the above warning.
3253 - modified method CSharpName to allow arrays of primitive type to
3254 be printed nicely (e.g. instead of System.Int32[][] it now prints
3256 - added method CSharpSignature: returns the signature of a method
3257 in string format to be used in reporting errors, warnings, etc.
3259 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
3262 2002-04-26 Ravi Pratap <ravi@ximian.com>
3264 * delegate.cs (Define): Fix extremely silly bug where I was
3265 setting the type of the 'object' parameter of the BeginInvoke
3266 method to System.IAsyncResult instead of System.Object ;-)
3268 2002-04-26 Miguel de Icaza <miguel@ximian.com>
3270 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
3273 (Constructor.Emit): return if we fail to initialize the
3274 constructor. Another door closed!
3276 * expression.cs (New.DoResolve): Improve error message (from -6 to
3277 1501). Use DeclaredOnly lookup to find the exact constructor.
3279 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
3280 loop. This is useful.
3282 * cs-parser.jay: Adjust the default parameters so that destructors
3283 have the proper signature.
3285 2002-04-26 Martin Baulig <martin@gnome.org>
3287 * driver.cs (LoadAssembly): If `assembly' contains any characters
3288 which are only valid in path names and not in assembly names
3289 (currently slash, backslash and point), use Assembly.LoadFrom ()
3290 instead of Assembly.Load () on the `assembly' (before iteration
3291 over the link_paths).
3293 2002-04-26 Martin Baulig <martin@gnome.org>
3295 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
3297 2002-04-25 Miguel de Icaza <miguel@ximian.com>
3299 * class.cs (Property): use the new typemanager.MemberLookup
3301 (TypeContainer.MemberLookup): Implement using the
3302 TypeManager.MemberLookup now.
3304 * typemanager.cs: Make MemberLookup a function of the TypeManager,
3305 and return MemberInfos, so that these can be used without an
3306 EmitContext (what we had before).
3308 2002-04-24 Miguel de Icaza <miguel@ximian.com>
3310 * expression.cs: Fix the case where the argument to params if the
3311 type of the params. I omitted handling this before. Fixed
3313 2002-04-22 Miguel de Icaza <miguel@ximian.com>
3315 * driver.cs: Call BootCorlib_PopulateCoreType
3317 * class.cs (Property.CheckBase): Check for properties only, not
3320 * interface.cs: Temporary hack: try/catch around the
3321 CustomAttributeBuilder, because I am getting an exception that I
3324 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
3325 types whose definitions are required to be there (attributes are
3326 defined before standard types).
3328 Compute definitions as we boot the various types, as they are used
3329 immediately (value_type class will need object_type, but if we do
3330 not initialize object_type, we will pass a null, which will let
3331 the runtime pick the System.Object from the existing corlib, which
3332 is not what we want).
3334 2002-04-22 Patrik Torstensson <totte@labs2.com>
3336 * cs-tokenizer.cs: fixed a number of trim() issues.
3338 2002-04-22 Ravi Pratap <ravi@ximian.com>
3340 * expression.cs (Argument.Type): Ensure that we return the correct
3341 type when we have out or ref parameters [in which case we
3344 2002-04-22 Miguel de Icaza <miguel@ximian.com>
3346 * class.cs (Property, Indexer): Allow extern modifier in there.
3348 * typemanager.cs (InitBaseTypes): Initializes object_type and
3349 value_type, since those will be used early on during the bootstrap
3350 process to compile corlib.
3352 (InitCoreTypes): Move code from here to InitBaseTypes.
3354 2002-04-21 Miguel de Icaza <miguel@ximian.com>
3356 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
3357 single-dimension arrays as using the ldlen opcode.
3359 Daniel Lewis discovered this optimization.
3361 * typemanager.cs: Add signature for System.Array::get_Length
3363 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3365 * statement.cs: report the error when the foreach does not apply to an
3366 array nor a collection.
3368 2002-04-19 Miguel de Icaza <miguel@ximian.com>
3370 * expression.cs: Add implicit conversions to the operator ~.
3372 * constant.cs (DecimalConstant.Emit): Emit decimal value.
3374 * typemanager.cs: Locate the decimal constructor.
3376 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3378 * attribute.cs: use the new property of TypeOf.
3379 * expression.cs: added 'get' property around typearg.
3381 These changes fix a build breaker reported by NickD. Is this the
3382 correct way to fix? If not, please, revert my changes and make it
3385 2002-04-17 Miguel de Icaza <miguel@ximian.com>
3387 * attribute.cs: Add support for typeof in attribute invocations.
3388 I am not sure that this is right though.
3390 2002-04-14 Duncan Mak <duncan@ximian.com>
3392 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
3393 Binary.Operator.Division case.
3395 2002-04-13 Ravi Pratap <ravi@ximian.com>
3397 * class.cs (DefineType): Ensure that we do a proper check on
3398 attribute types and also register it with the TypeManager.
3400 (TypeContainer.Targets): The default for attribute types is
3401 AttributeTargets.All.
3403 * attribute.cs (ApplyAttributes): Registering the attribute type
3404 is done elsewhere, not when we discover we have a Usage attribute.
3406 2002-04-12 Ravi Pratap <ravi@ximian.com>
3408 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
3409 and get rid of is_delegate parameter.
3411 * everywhere : update.
3413 2002-04-12 Ravi Pratap <ravi@ximian.com>
3415 * cs-parser.jay (compilation_unit): Revamp completely to use
3416 some new ideas that I got from Rhys' grammar to solve the problems
3417 with assembly level attributes.
3419 (outer_declaration): New grammar production.
3421 (attribute_sections): Add.
3423 (opt_attributes): Base on attribute_sections
3425 (namespace_declaration): Allow opt_attributes to tackle the case
3426 when we have assembly level attributes - we are clever in this
3429 * attribute.cs (ApplyAttributes): Do not worry about assembly
3430 attributes in the non-global context.
3432 * rootcontext.cs (AddGlobalAttributes): Go back to using this
3433 instead of SetGlobalAttributes.
3435 * class.cs, rootcontext.cs : Ensure we define and generate
3436 attribute types before anything else.
3438 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
3439 and flag the new error -20 for the case when the attribute type
3440 does not have valid targets specified. csc does not catch this.
3442 * ../errors/errors.txt : update for error # -20
3444 2002-04-11 Ravi Pratap <ravi@ximian.com>
3446 * support.cs (InternalParameters.ParameterModifier): Do some null
3447 checking and return sane values.
3449 * class.cs (Method.Define): If we are a PInvoke method, ensure
3450 that we are static and extern. Report error # 601
3452 * ../errors/cs0601.cs : Add test case for the above error.
3454 2002-04-07 Ravi Pratap <ravi@ximian.com>
3456 * rootcontext.cs (attribute_types): We need to keep type of
3457 all attribute types separately and emit code for them first.
3459 (RegisterAttribute) : Implement.
3461 * class.cs (DefineType): Check if the current Type is a custom
3462 attribute type and register it accordingly.
3464 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
3465 adding the first attribute twice and rename to
3467 (SetGlobalAttributes): this.
3469 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
3472 * attribute.cs (ApplyAttributes): Take an additional argument telling us
3473 if we are processing global arguments. Hmm, I am unsure of this.
3475 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3477 * expression.cs: added static array of strings to avoid calling
3478 Enum.ToString () for Operator in Binary. Significant recover of
3481 2002-04-10 Miguel de Icaza <miguel@ximian.com>
3483 * class.cs (FindMembers): Allow the Builders of the various
3484 members to be null. If they are skip them. This only happens
3485 during the PInvoke declaration.
3487 2002-04-09 Miguel de Icaza <miguel@ximian.com>
3489 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
3490 failure, so we do not keep going afterwards.
3492 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
3493 wanted to pass `false' as the `is_delegate' argument. If this is
3494 the case, why not use delegate_type == null to mean `is_delegate =
3495 false' and anything else as is_delegate = true.
3497 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
3499 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
3500 code for the section, not the beginning of the tests.
3502 2002-04-08 Miguel de Icaza <miguel@ximian.com>
3504 * cfold.cs: Handle operator + (Enum x, Underlying x)
3506 * expression.cs (Binary): same. Warn about errors where we have
3507 Enum/Enum in operator + as well.
3509 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
3512 - added support for switch(bool)
3513 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
3514 - add TableSwitchEmit() to handle table-based switch statements
3516 2002-04-05 Ravi Pratap <ravi@ximian.com>
3518 * expression.cs (Invocation.OverloadResolve): Factor out code which
3519 does parameter compatibility checking with arguments so that we can
3520 re-use the code even from Delegate.VerifyApplicability
3522 (VerifyArgumentsCompat): Move above code here.
3524 * delegate.cs (VerifyApplicability): Get rid of duplicate code
3525 and instead make a call to the above method.
3527 2002-03-31 Ravi Pratap <ravi@ximian.com>
3529 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
3530 We use it to keep track of classes which are attribute types.
3532 2002-04-02 Miguel de Icaza <miguel@ximian.com>
3534 * delegate.cs (Delegate.Define): Correctly define the types in the
3535 presence of fixed and array parameters.
3537 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
3540 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
3541 include NonPublic after the first iteration.
3543 * class.cs (Indexer.CheckBase): Only check if both parents are
3546 * cs-parser.jay (accessor_body): If empty, set to null.
3548 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
3549 same code path here to resolve constants names that we did have in
3550 MemberAccess.DoResolve. There is too much code duplicated here.
3552 2002-04-01 Miguel de Icaza <miguel@ximian.com>
3554 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
3556 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
3559 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
3560 tokens, numbers and strings.
3562 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
3565 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
3566 asyncronous parameters and the regular parameters.
3568 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
3569 specify the target directory.
3571 * expression.cs: (This.DoResolve): Simplify
3572 (As.Emit): Optimize, do not generate IsInst if the expression is
3573 always of the given type.
3575 (Is.DoResolve): Bug fix, we were reporting both always/never for
3578 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
3579 creating too many unnecessary arrays.
3581 2002-03-31 Miguel de Icaza <miguel@ximian.com>
3583 * class.cs (EmitFieldInitializer): Use Assign expression to assign
3584 fields instead of rolling our own initializer. Takes care of all
3585 implicit conversions, and drops unnecessary static checks/argument.
3587 2002-03-31 Dick Porter <dick@ximian.com>
3589 * driver.cs: use the GetDirectories() return values properly, and
3590 use "/" as path separator.
3592 2002-03-30 Miguel de Icaza <miguel@ximian.com>
3594 * expression.cs (Unary): Optimize - - expr into expr.
3595 (Binary): Optimize a + (-b) into a -b.
3597 * codegen.cs (CodeGen): Made all methods static.
3599 2002-03-29 Miguel de Icaza <miguel@ximian.com>
3603 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
3604 TypeBuilder property.
3606 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
3609 * tree.cs: Removed the various RecordXXXX, and replaced with a
3610 single RecordDecl. Removed all the accessor methods, and just
3611 left a single access point Type
3613 * enum.cs: Rename DefineEnum to DefineType.
3615 * decl.cs: New abstract method `DefineType' used to unify the
3616 Defines for Enumerations, Interfaces, TypeContainers and
3619 (FindType): Moved LookupInterfaceOrClass here. Moved the
3620 LookupBaseClasses method that used to live in class.cs and
3621 interface.cs here, and renamed to FindType.
3623 * delegate.cs: Implement DefineType. Take advantage of the
3624 refactored pattern for locating the parent builder without taking
3625 the parent_builder argument (which we know does not work if we are
3626 nested, and triggering a toplevel definition).
3628 2002-03-28 Miguel de Icaza <miguel@ximian.com>
3630 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
3631 accessibility of a member has changed during override and report
3634 * class.cs (Method.Define, Property.Define): Only complain on
3635 overrides if the method is private, any other accessibility is
3636 fine (and since we just checked the permission is the same, we are
3639 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
3640 and elif are processed always. The other pre-processing
3641 directives are only processed if we are "taking" the path
3643 2002-03-29 Martin Baulig <martin@gnome.org>
3645 * class.cs (Method.Emit): Only emit symbolic debugging info if the
3646 current location is not Null.
3648 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
3649 a separate method so we can profile it.
3651 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
3652 `span.Seconds' are just seconds, but no minutes or hours.
3653 (MainDriver): Profile the CodeGen.SaveSymbols calls.
3655 2002-03-28 Miguel de Icaza <miguel@ximian.com>
3657 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
3658 Remove the gratuitous set of Final:
3660 // If an interface implementation, then we can set Final.
3661 if (((flags & MethodAttributes.Abstract) == 0) &&
3662 implementing.DeclaringType.IsInterface)
3663 flags |= MethodAttributes.Final;
3665 I do not know what I was smoking when I used that.
3668 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
3669 step into fixing the name resolution issues for delegates and
3670 unifying the toplevel name resolution.
3672 2002-03-28 Martin Baulig <martin@gnome.org>
3674 * class.cs (Method.Emit): If we have a symbol writer, call its
3675 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
3676 tell it about the current method.
3678 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
3679 writer that we're going to emit the first byte of IL code for a new
3680 statement (a new source line).
3681 (EmitContext.EmitTopBlock): If we have a symbol writer, call
3682 EmitContext.Mark() before emitting any code.
3684 * location.cs (SymbolDocument): Return null when we're Null.
3686 * statement.cs (Statement): Moved the `Location loc' variable here.
3687 (Statement.EmitBoolExpression): If we have a symbol writer, call
3688 ec.Mark() before emitting any code to tell it that we're at the
3689 beginning of a new statement.
3690 (StatementExpression): Added `Location' argument to the constructor.
3691 (Block): Added public readonly variable `StartLocation' and public
3692 variable `EndLocation'. The latter is to be set using SetEndLocation().
3693 (Block): Added constructor which takes a start and end location.
3694 (Block.SetEndLocation): New method. This sets the end location.
3695 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
3696 local variables we create.
3697 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
3698 each statement and do also mark the begin and end of the block.
3700 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
3701 tell it the current lexer.Location, use Location.Null for the end of the
3703 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
3704 current block, set its end location using SetEndLocation().
3705 (statement_expression): StatementExpression constructor now takes the
3706 lexer.Location as additional argument.
3707 (for_statement, declare_local_variables): Likewise.
3708 (declare_local_variables): When creating a new implicit block, use the
3709 new Block constructor and pass it the lexer.Location.
3711 2002-03-28 Miguel de Icaza <miguel@ximian.com>
3713 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
3714 members also on the parent interfaces recursively.
3716 2002-03-27 Miguel de Icaza <miguel@ximian.com>
3718 * report.cs: Use new formats, since Gonzalo finished the missing
3721 * expression.cs (Binary.ResolveOperator): added missing operator|
3722 operator& and operator^ for bool/bool.
3724 * cs-parser.jay: CheckDef now takes a Location argument that is
3725 used to report errors more precisly (instead of reporting the end
3726 of a definition, we try to track something which is a lot closer
3727 to the source of the problem).
3729 * cs-tokenizer.cs: Track global token use, so we can properly flag
3730 the use of #define/#undef after the first token has been seen.
3732 Also, rename the reportXXXX to Error_DescriptiveName
3734 * decl.cs (DeclSpace.IsTopLevel): Move property here from
3735 TypeContainer, so that Enum and Interface can use this too.
3737 * class.cs (TypeContainer.LookupInterfaceOrClass,
3738 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
3739 `builder' argument. Typically this was used to pass the parent
3740 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
3743 The problem is that a nested class could trigger the definition of
3744 a toplevel class, and the builder would be obviously wrong in that
3747 So we drop this argument, and we compute dynamically the
3748 TypeBuilder/ModuleBuilder (the correct information was available
3749 to us anyways from DeclSpace.Parent)
3751 * interface.cs (Interface.DefineInterface): Drop builder
3752 parameter cleanup like class.cs
3754 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
3757 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
3760 (Try.Emit): Propagate the returns value from the statement.
3762 (Return.Emit): Even if we are leavning
3764 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
3766 * modifiers.cs: Fix the computation of MethodAttributes flags.
3768 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
3770 * driver.cs: allow compilation of files that start with '/'.
3771 Add a default case when checking the argument of --target.
3773 2002-03-25 Miguel de Icaza <miguel@ximian.com>
3775 * interface.cs: Implement the same search algorithm for types in
3778 * delegate.cs: Do not allow multiple definition.
3780 * Recovered ChangeLog that got accidentally amputated
3782 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
3784 * rootcontext.cs: Load manually enum to allow core classes to
3785 contain enumerations.
3787 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
3788 Update to new static methods in TypeManager.
3790 * typemanager.cs (GetMethod, GetConstructor): Use our
3791 implementation of FindMembers to find the members, since during
3792 corlib compilation, the types are TypeBuilders and GetMethod and
3793 GetConstructor do not work.
3795 Make all methods in TypeManager static.
3797 (InitCodeHelpers): Split the functionality from
3798 the InitCodeTypes function.
3800 * driver.cs: Call InitCodeHelpers after we have populated the
3803 * cs-parser.jay (delegate_declaration): we did not used to compute
3804 the delegate name correctly for void delegates.
3806 2002-03-24 Miguel de Icaza <miguel@ximian.com>
3808 * rootcontext.cs (RootContext): Init the interface_resolve_order
3809 and type_container_resolve_order always.
3811 (ResolveCore, BootstrapCorlib_ResolveClass,
3812 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
3813 compiler when compiling with --nostdlib
3815 * class.cs (TypeContainer.DefineType): Check that our parent is
3816 not null. This test is most important when we are bootstraping
3819 * codegen.cs: Split out the symbol writing code.
3821 2002-03-25 Martin Baulig <martin@gnome.org>
3823 * driver.cs (-g): Made -g an alias for --debug.
3825 2002-03-24 Martin Baulig <martin@gnome.org>
3827 * codegen.cs (SymbolWriter): New public variable. Returns the
3828 current symbol writer.
3829 (CodeGen): Added `bool want_debugging_support' argument to the
3830 constructor. If true, tell the ModuleBuild that we want debugging
3831 support and ask it for the ISymbolWriter.
3832 (Save): If we have a symbol writer, call it's Close() method after
3833 saving the assembly.
3835 * driver.c (--debug): New command line argument to create a
3836 debugger information file.
3838 * location.cs (SymbolDocument): New public property. Returns an
3839 ISymbolDocumentWriter object for the current source file or null
3840 if we don't have a symbol writer.
3842 2002-03-21 Miguel de Icaza <miguel@ximian.com>
3844 * driver.cs (LoadAssembly): Correctly return when all the paths
3845 have been tried and not before.
3847 * statement.cs (Switch.Emit): return the actual coverage for this
3848 statement (returns/not-returns)
3850 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
3851 switch of the statement if we are the last switch section. That
3852 kills two problems: try/catch problems (we used to emit an empty
3853 nop at the end) and switch statements where all branches would
3856 2002-03-19 Miguel de Icaza <miguel@ximian.com>
3858 * driver.cs: Add default assemblies (the equivalent to the
3859 Microsoft CSC.RSP file)
3861 * cs-tokenizer.cs: When updating `cols and setting it to zero,
3862 also update tokens_seen and set it to false.
3864 * driver.cs: Implement --recurse for Mike.
3866 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
3867 correctly splitting out the paths.
3869 2002-03-18 Miguel de Icaza <miguel@ximian.com>
3871 * interface.cs (Interface.PopulateProperty): Instead of using
3872 `parent' as the declaration space for the set parameters, use
3875 * support.cs (InternalParameters): InternalParameters constructor
3876 takes a DeclSpace instead of a TypeContainer.
3878 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
3879 types are being initialized, load the address of it before calling
3882 (New): Provide a mechanism to disable the generation of local
3883 value type temporaries when the caller will be providing us with
3884 an address to store it.
3886 (ArrayCreation.EmitDynamicInitializers): Use it.
3888 2002-03-17 Miguel de Icaza <miguel@ximian.com>
3890 * expression.cs (Invocation.EmitArguments): Only probe for array
3891 property if there is more than one argument. Sorry about that.
3893 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
3896 * class.cs (Method.LabelParameters): Fix incorrect code path that
3897 prevented the `ParamArrayAttribute' from being applied to the
3900 2002-03-16 Miguel de Icaza <miguel@ximian.com>
3902 * support.cs (ReflectionParameters): Correctly compute whether the
3903 last argument is a params array. Fixes the problem with
3906 * typemanager.cs: Make the assemblies array always be non-null
3907 (empty, but non-null)
3909 * tree.cs (RecordDecl): New function that abstracts the recording
3910 of names. This reports error 101, and provides a pointer to the
3911 previous declaration. Fixes a crash in the compiler.
3913 * cs-parser.jay (constructor_declaration): Update to new grammar,
3914 and provide a constructor_body that can be empty.
3916 2002-03-15 Miguel de Icaza <miguel@ximian.com>
3918 * driver.cs: Add support for --resources.
3920 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
3921 Make all types for the various array helper methods be integer.
3923 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
3924 CheckState to ConvCast.
3926 (ConvCast): Now it takes a `checked' state argument, to avoid
3927 depending on the emit context for the conversion, and just using
3928 the resolve time setting.
3930 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
3931 instead of Invocation.EmitArguments. We do not emit the original
3932 arguments, instead we emit those which have been converted to
3933 unsigned int expressions.
3935 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
3937 * codegen.cs: ditto.
3939 * expression.cs (LocalVariableReference): Drop the use of the
3940 Store function that depended on the variable index.
3942 * statement.cs (VariableInfo): Drop the `Idx' property from this
3943 class, as this is not taking into account the indexes for
3944 temporaries tat we generate during the execution, getting the
3947 * class.cs: First emit class initializers, then call the parent
3950 * expression.cs (Binary): Fix opcode emision.
3951 (UnaryMutator.EmitCode): Support checked code generation
3953 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
3954 matches for events for both the Static and Instance scans,
3955 pointing to the same element. Fix that.
3957 2002-03-14 Miguel de Icaza <miguel@ximian.com>
3959 * rootcontext.cs (ResolveTree): Always set the
3960 interface_resolve_order, because nested interfaces will be calling
3963 * class.cs (GetInterfaceOrClass): Track the same resolution
3964 process used by TypeManager.LookupType. This fixes the nested
3965 type lookups in class declarations (separate path from
3968 (TypeContainer.DefineType): Also define nested interfaces.
3969 (TypeContainer.RegisterOrder): New public function used to
3970 register the order in which child interfaces need to be closed.
3972 Nested interfaces need to be closed after their parents have been
3975 * interface.cs (InterfaceAttr): Put all the logic for computing
3976 the interface attribute here.
3978 (DefineInterface): Register our interface order with the
3979 RootContext or with the TypeContainer depending on the case.
3981 2002-03-12 Miguel de Icaza <miguel@ximian.com>
3983 * cs-parser.jay: rework foreach statement to work with the new
3984 changes to the policy on SimpleNames.
3986 * report.cs: support Stacktrace on warnings as well.
3988 * makefile: drop --unsafe and /unsafe from the compile.
3990 2002-03-13 Ravi Pratap <ravi@ximian.com>
3992 * ecore.cs (StandardConversionExists): Modify to take an Expression
3993 as the first parameter. Ensure we do null -> reference type conversion
3996 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
3997 temporary Expression objects.
3999 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
4001 * interface.cs: workaround bug in method overloading resolution
4002 (there is already a bugzilla bug for it).
4004 2002-03-12 Miguel de Icaza <miguel@ximian.com>
4006 We could also solve this problem by having a separate path for
4007 performing type lookups, instead of DoResolve, we could have a
4008 ResolveType entry point, and only participating pieces of the
4009 production (simplename, deref, array) would implement this.
4011 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
4012 signal SimpleName to only resolve type names and not attempt to
4013 resolve anything else.
4015 * expression.cs (Cast): Set the flag.
4017 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
4019 * class.cs: Only report 108 if there is no `new' modifier.
4021 * cs-parser.jay: rework foreach statement to work with the new
4022 changes to the policy on SimpleNames.
4024 * report.cs: support Stacktrace on warnings as well.
4026 * makefile: drop --unsafe and /unsafe from the compile.
4028 2002-03-11 Miguel de Icaza <miguel@ximian.com>
4030 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
4031 lookups here, instead of doing that at parse time. This means
4032 that our grammar will not introduce `LocalVariableReferences' as
4033 expressions at this point. That solves the problem of code like
4041 This is only half the fix. The full fix requires parameters to
4042 also be handled in this way.
4044 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
4045 makes the use more obvious of the DeclSpace. The
4046 ec.TypeContainer.TypeBuilder is now only used to pull the
4049 My theory is that I can get rid of the TypeBuilder completely from
4050 the EmitContext, and have typecasts where it is used (from
4051 DeclSpace to where it matters).
4053 The only pending problem is that the code that implements Aliases
4054 is on TypeContainer, and probably should go in DeclSpace.
4056 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
4057 lookups here, instead of doing that at parse time. This means
4058 that our grammar will not introduce `LocalVariableReferences' as
4059 expressions at this point. That solves the problem of code like
4067 This is only half the fix. The full fix requires parameters to
4068 also be handled in this way.
4070 * class.cs (Property.DefineMethod): When implementing an interface
4071 method, set newslot, when implementing an abstract method, do not
4072 set the flag (before we tried never setting it, or always setting
4073 it, which is the difference).
4074 (Indexer.DefineMethod): same.
4075 (Method.DefineMethod): same.
4077 * ecore.cs: Only set the status used flag if we get back a Field.
4079 * attribute.cs: Temporary hack, so Paolo can keep working.
4081 2002-03-08 Ravi Pratap <ravi@ximian.com>
4083 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
4084 the unmanaged type in the case we have a MarshalAs attribute.
4086 (Resolve): Handle the case when we are parsing the special MarshalAs
4087 attribute [we need to store the unmanaged type to use later]
4089 * typemanager.cs (marshal_as_attr_type): Built in type for the
4090 MarshalAs Attribute.
4092 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
4093 on parameters and accordingly set the marshalling info.
4095 2002-03-09 Miguel de Icaza <miguel@ximian.com>
4097 * class.cs: Optimizing slightly by removing redundant code after
4098 we switched to the `NoTypes' return value.
4099 (Property.DefineMethod): use NoTypes here too.
4101 This fixes the bug I introduced in my last batch of changes.
4103 2002-03-05 Ravi Pratap <ravi@ximian.com>
4105 * tree.cs (RecordEnum): Add. We now keep track of enums too.
4107 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
4108 Enums since those are types too.
4110 * cs-parser.jay (enum_declaration): Record enums as we parse them.
4112 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
4113 thanks to a call during the lookup process.
4115 2002-03-07 Miguel de Icaza <miguel@ximian.com>
4117 * statement.cs (Foreach): Lots of work to accomodate a particular
4118 kind of foreach statement that I had not kept in mind. It is
4119 possible to have foreachs on classes that provide a GetEnumerator
4120 method that return objects that implement the "pattern" for using
4121 a foreach, there is no need to support GetEnumerator
4124 This is needed to compile nant.
4126 * decl.cs: Only report 114 if the member is not `Finalize' and if
4127 the warning level is at least 2.
4129 * class.cs: Moved the compare function from Method to
4132 (MethodSignature.InheritableMemberSignatureCompare): Add new
4133 filter function that is used to extract inheritable methods from a
4136 (Method.Define): Use the new `inheritable_method_signature_filter'
4139 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
4142 2002-03-06 Miguel de Icaza <miguel@ximian.com>
4144 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
4146 * cs-parser.jay: Add opt_semicolon to the interface declaration.
4148 * expression.cs: Pass location information to
4149 ConvertImplicitStandard.
4151 * class.cs: Added debugging code to track return values from
4154 2002-03-05 Miguel de Icaza <miguel@ximian.com>
4156 * expression.cs (Is.DoResolve): If either side of the `is' is an
4157 interface, do not flag the warning.
4159 * ecore.cs (ImplicitReferenceConversion): We need a separate test
4162 * report.cs: Allow for --fatal to be used with --probe.
4164 * typemanager.cs (NoTypes): Move the definition for the empty Type
4167 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
4169 (TypeContainer.DefineProxy): New function used to proxy to parent
4170 implementations when implementing interfaces.
4171 (TypeContainer.ParentImplements): used to lookup if our parent
4172 implements a public function that is required by an interface.
4173 (TypeContainer.VerifyPendingMethods): Hook this up.
4175 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
4176 `modules' and `assemblies' arraylists into arrays. We only grow
4177 these are the very early start up of the program, so this improves
4178 the speedof LookupType (nicely measured).
4180 * expression.cs (MakeByteBlob): Replaced unsafe code with
4181 BitConverter, as suggested by Paolo.
4183 * cfold.cs (ConstantFold.Binary): Special case: perform constant
4184 folding of string concatenation, but if either side is a string,
4185 and the other is not, then return null, and let the runtime use
4186 the concatenation on the string plus the object (using
4189 2002-03-04 Miguel de Icaza <miguel@ximian.com>
4191 Constant Folding has been implemented now.
4193 * expression.cs (Unary.Reduce): Do not throw an exception, catch
4194 the error instead on types that are not supported in one's
4197 * constant.cs (Constant and all children): New set of functions to
4198 perform implict and explicit conversions.
4200 * ecore.cs (EnumConstant): Implement the new functions to perform
4201 conversion by proxying to the child expression.
4203 * codegen.cs: (ConstantCheckState): Constant evaluation has its
4204 own separate setting that can not be turned off from the command
4205 line using --unchecked or --checked and is only controlled using
4206 the checked/unchecked statements and expressions. This setting is
4207 used by the constant folder to flag errors.
4209 * expression.cs (CheckedExpr, UncheckedExpr): Set the
4210 ConstantCheckState as well.
4212 During Resolve, they also have to flag the state, because the
4213 constant folder runs completely in the Resolve phase.
4215 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
4218 2002-03-01 Miguel de Icaza <miguel@ximian.com>
4220 * cfold.cs: New file, this file contains the constant folder.
4222 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
4223 argument to track whether we are using the resulting address to
4224 load or store a value and provide better error messages.
4226 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
4227 new AddressOf arguments.
4229 * statement.cs (Foreach.EmitCollectionForeach): Update
4231 * expression.cs (Argument.Emit): Call AddressOf with proper
4232 arguments to track usage.
4234 (New.DoEmit): Call AddressOf with new arguments.
4236 (Unary.Emit): Adjust AddressOf call.
4238 2002-03-01 Ravi Pratap <ravi@ximian.com>
4240 * cs-parser.jay (member_access): Change the case for pre-defined types
4241 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
4244 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
4247 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
4248 essentially like methods and apply attributes like MethodImplOptions to them too.
4250 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
4253 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
4254 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
4257 * Update code everywhere accordingly.
4259 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
4261 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
4263 2002-02-28 Ravi Pratap <ravi@ximian.com>
4265 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
4266 try performing lookups against those instead of jumping straight into using
4267 the 'using' clauses.
4269 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
4271 (LookupType): Perform lookups in implicit parents too.
4273 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
4274 sequence as RootContext.LookupType.
4276 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
4277 the various cases of namespace lookups into this method.
4279 2002-03-01 Miguel de Icaza <miguel@ximian.com>
4281 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
4282 in positional arguments)
4284 * class.cs (Operator): Update the AllowedModifiers to contain
4287 * cs-parser.jay: Update operator declaration to allow for the
4288 operator body to be empty.
4290 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
4293 2002-02-27 Miguel de Icaza <miguel@ximian.com>
4295 * class.cs (Method.Emit): Label parameters.
4297 * driver.cs: Return 1 or 0 as the program exit code.
4299 2002-02-26 Miguel de Icaza <miguel@ximian.com>
4301 * expression.cs: Special case the `null' object when trying to
4302 auto-compute the type, as anything can be explicitly converted to
4305 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
4306 spotting this Paolo.
4308 (Expression.ImplicitNumericConversion): Perform comparissions of
4309 the type using the underlying type in the case of an enumeration
4310 rather than using the enumeration type for the compare.
4312 Cope with the underlying == type case, which is not possible to
4315 (Expression.ConvertNumericExplicit): Perform comparissions of
4316 the type using the underlying type in the case of an enumeration
4317 rather than using the enumeration type for the compare.
4319 * driver.cs: If the user does not supply an extension, assume .exe
4321 * cs-parser.jay (if_statement): Rewrote so that we can track the
4322 location for the if statement.
4324 * expression.cs (Binary.ConstantFold): Only concat strings when
4325 the operation is "+", not everything ;-)
4327 * statement.cs (Statement.EmitBoolExpression): Take a location
4329 (If, While, Do): Track location.
4331 * expression.cs (Binary.ResolveOperator): In the object + string
4332 case, I was missing a call to ConvertImplicit
4334 2002-02-25 Ravi Pratap <ravi@ximian.com>
4336 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
4337 Location arguments. Ensure we use RootContext.LookupType to do our work
4338 and not try to do a direct Type.GetType and ModuleBuilder.GetType
4340 * interface.cs (PopulateMethod): Handle the type of the parameter being
4343 * expression.cs (Invocation.BetterFunction): Handle the case when we
4344 have a params method with no fixed arguments and a call is made with no
4347 2002-02-25 Miguel de Icaza <miguel@ximian.com>
4349 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
4350 the verbatim-string-literal
4352 * support.cs (InternalParameters.ParameterModifier): handle null
4354 (InternalParameters.ParameterType): ditto.
4356 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
4357 duplicating the name of the variable parameter.
4358 (GetParameterByName): Fix bug where we were not looking up array
4359 paramters if they were the only present (thanks Paolo!).
4360 (GetParameterInfo): We only have an empty set of types if both
4361 fixed and array are set to null.
4362 (GetParameterInfo-idx): Handle FixedParameter == null
4364 * cs-parser.jay: Handle the case where there is no catch
4365 statements (missing null test).
4367 2002-02-22 Miguel de Icaza <miguel@ximian.com>
4369 * driver.cs (MainDriver): Be conservative on our command line
4372 Catch DirectoryNotFoundException when calling GetFiles.
4374 (SplitPathAndPattern): Used to split the input specification into
4375 a path and a pattern that we can feed to Directory.GetFiles.
4377 2002-02-21 Miguel de Icaza <miguel@ximian.com>
4379 * statement.cs (Fixed): Implement the last case of the Fixed
4380 statement (string handling).
4382 * expression.cs (StringPtr): New class used to return a char * to
4383 a string; Used by the Fixed statement.
4385 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
4387 * expression.cs (Binary.ResolveOperator): Remove redundant
4388 MemberLookup pn parent type.
4389 Optimize union call, we do not need a union if the types are the same.
4390 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
4393 Specialize the use of MemberLookup everywhere, instead of using
4394 the default settings.
4396 (StackAlloc): Implement stackalloc keyword.
4398 * cs-parser.jay: Add rule to parse stackalloc.
4400 * driver.cs: Handle /h, /help, /?
4402 * expression.cs (MakeByteBlob): Removed the hacks we had in place
4403 before we supported unsafe code.
4405 * makefile: add --unsafe to the self compilation of mcs.
4407 2002-02-20 Miguel de Icaza <miguel@ximian.com>
4409 * expression.cs (PointerArithmetic): New class that is used to
4410 perform pointer arithmetic.
4411 (Binary.Resolve): Handle pointer arithmetic
4412 Handle pointer comparission.
4413 (ArrayPtr): Utility expression class that is used to take the
4414 address of an array.
4416 (ElementAccess): Implement array access for pointers
4418 * statement.cs (Fixed): Implement fixed statement for arrays, we
4419 are missing one more case before we are done.
4421 * expression.cs (Indirection): Implement EmitAssign and set the
4422 ExprClass to Variable. This allows pointer dereferences to be
4423 treated as variables, and to have values assigned to them.
4425 * ecore.cs (Expression.StoreFromPtr): New utility function to
4426 store values dereferencing.
4428 2002-02-20 Ravi Pratap <ravi@ximian.com>
4430 * expression.cs (Binary.ResolveOperator): Ensure that we are
4431 not trying to operate on a void type - this fixes the reported
4434 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
4435 the parent implementation is sealed.
4437 * ../errors/cs0239.cs : Add.
4439 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
4441 * typemanager.cs (unverifiable_code_type): Corresponds to
4442 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
4443 which have unsafe code in them.
4445 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
4448 2002-02-19 Miguel de Icaza <miguel@ximian.com>
4450 * cs-tokenizer.cs: Add support for @"litreal strings"
4452 Make tokenizer accept pre-processor directives
4453 on any column (remove the old C-like limitation).
4455 * rootcontext.cs (EmitCode): Emit any global attributes.
4456 (AddGlobalAttributes): Used to keep track of assembly attributes.
4458 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
4460 * cs-parser.jay: Add support for global attributes.
4462 2002-02-17 Miguel de Icaza <miguel@ximian.com>
4464 * expression.cs (Indirection): New helper class. Unary will
4465 create Indirection classes to be able to implement the
4466 IMemoryLocation interface on it.
4468 2002-02-16 Miguel de Icaza <miguel@ximian.com>
4470 * cs-parser.jay (fixed_statement): reference the right statement.
4472 * statement.cs (Fixed.Emit): Finish implementing the fixed
4473 statement for the &x case.
4475 2002-02-14 Miguel de Icaza <miguel@ximian.com>
4477 * class.cs (Property.Define, Method.Define): Remove newslot when
4480 * modifiers.cs: My use of NewSlot when `Abstract' was set was
4481 wrong. NewSlot should only be used if the `new' keyword is present.
4483 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
4484 locating our system dir. Sorry about this.
4486 2002-02-13 Miguel de Icaza <miguel@ximian.com>
4488 * driver.cs (GetSystemDir): Compute correctly the location of our
4489 system assemblies. I was using the compiler directory instead of
4490 the library directory.
4492 2002-02-13 Ravi Pratap <ravi@ximian.com>
4494 * expression.cs (BetterFunction): Put back in what Miguel commented out
4495 since it is the correct fix. The problem is elsewhere ;-)
4497 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
4498 parameters of the parms method are themselves compatible or not !
4500 (StandardConversionExists): Fix very dangerous bug where we were forgetting
4501 to check that a class implements an interface before saying that an implicit
4502 conversion was allowed. Use ImplementsInterface to do the checking.
4504 2002-02-13 Miguel de Icaza <miguel@ximian.com>
4506 * class.cs (Method.Define): Track whether we are an explicit
4507 implementation or not. And only call DefineMethodOverride if we
4508 are an explicit implementation.
4510 (Property.DefineMethod): Ditto.
4512 2002-02-11 Ravi Pratap <ravi@ximian.com>
4514 * expression.cs (BetterFunction): Catch hideous bug which was
4515 preventing us from detecting ambiguous calls due to implicit casts i.e
4518 2002-01-29 Miguel de Icaza <miguel@ximian.com>
4520 * support.cs (Pair): Remove un-needed method. I figured why I was
4521 getting the error in cs-parser.jay, the variable in a foreach loop
4522 is readonly, and the compiler does not really treat this as a variable.
4524 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
4525 instead of EQUALS in grammar.
4527 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
4529 * expression.cs (Unary.DoResolve): Check whether the argument is
4532 2002-01-28 Miguel de Icaza <miguel@ximian.com>
4534 * support.cs: Api for Pair to set a value. Despite the fact that
4535 the variables are public the MS C# compiler refuses to compile
4536 code that accesses the field if the variable is part of a foreach
4539 * statement.cs (Fixed): Begin implementation of the fixed
4542 (Block.AddVariable): Return the VariableInfo on success and null
4543 on failure instead of true/false.
4545 * cs-parser.jay (foreach): Catch errors on variables already
4546 defined (we were ignoring this value before) and properly unwind
4549 (fixed_statement): grammar for the fixed statement.
4551 2002-01-25 Miguel de Icaza <miguel@ximian.com>
4553 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
4554 pointer types to be incretemented.
4556 (SizeOf): Implement.
4558 * cs-parser.jay (pointer_member_access): Implement
4559 expr->IDENTIFIER production.
4561 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
4562 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
4565 (Unary): Implement indirection.
4567 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
4568 use in non-unsafe context).
4570 (SimpleName.DoResolve): Check for pointers in field access on safe
4573 (Expression.LoadFromPtr): Factor the load-indirect code in this
4574 function. This was duplicated in UnboxCast and ParameterReference
4576 2002-01-24 Miguel de Icaza <miguel@ximian.com>
4578 * expression.cs (ComposedCast): report an error if a pointer cast
4579 is used in a safe region.
4581 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
4582 pointer type casts in unsafe context.
4584 * codegen.cs (EmitContext): Set up IsUnsafe.
4586 * cs-parser.jay (non_expression_type): Add productions for pointer
4589 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
4590 code. We should not use force into static mode if the method is
4591 not virtual. Fixes bug in MIS
4593 * statement.cs (Do.Emit, While.Emit, For.Emit,
4594 Statement.EmitBoolExpression): Add support to Do and While to
4595 propagate infinite loop as `I do return' semantics.
4597 Improve the For case to also test for boolean constants.
4599 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
4600 to the list of attributes we can add.
4602 Remove `EmitContext' argument.
4604 * class.cs (Method.Define): Apply parameter attributes.
4605 (Constructor.Define): Apply parameter attributes.
4606 (MethodCore.LabelParameters): Move here the core of labeling
4609 * support.cs (ReflectionParameters.ParameterModifier,
4610 InternalParameters.ParameterModifier): Use IsByRef on the type and
4611 only return the OUT bit for these parameters instead of in/out/ref
4614 This is because I miss-understood things. The ParameterInfo.IsIn
4615 and IsOut represent whether the parameter has the [In] and [Out]
4618 2002-01-22 Miguel de Icaza <miguel@ximian.com>
4620 * ecore.cs (FieldExpr.Emit): Release temporaries.
4622 * assign.cs (LocalTemporary.Release): new function.
4624 * codegen.cs (EmitContext.GetTemporaryStorage,
4625 EmitContext.FreeTemporaryStorage): Rework the way we deal with
4626 temporary storage. Now we can "put back" localbuilders when we
4629 2002-01-21 Miguel de Icaza <miguel@ximian.com>
4631 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
4632 need to make a copy of the variable to generate verifiable code.
4634 2002-01-19 Miguel de Icaza <miguel@ximian.com>
4636 * driver.cs: Compute dynamically the system directory.
4638 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
4639 Slower, but more generally useful. Used by the abstract
4640 registering implementation.
4642 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
4643 the rules for the special rule on Type/instances. First check if
4644 we have the same name, and if so, try that special static path
4645 rather than the instance path.
4647 2002-01-18 Miguel de Icaza <miguel@ximian.com>
4649 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
4652 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
4653 Enum, ValueType, Delegate or Array for non-corlib compiles.
4655 * cs-tokenizer.cs: Catch long identifiers (645)
4657 * typemanager.cs (IndexerPropetyName): Ravi never tested this
4660 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
4661 fix, we were returning too early, so we were not registering
4662 pending methods from abstract classes.
4664 Do not register pending methods if the class is abstract.
4666 * expression.cs (Conditional.DoResolve): Report circular implicit
4667 conversions when we neecd to compute it for conditional
4670 (Is.DoResolve): If the expression is always of the provided type,
4671 flag warning 183. If the expression can not ever be of the
4672 provided type flag warning 184.
4674 * class.cs: Catch 169 as well.
4676 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
4679 2002-01-18 Nick Drochak <ndrochak@gol.com>
4681 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
4683 2002-01-17 Miguel de Icaza <miguel@ximian.com>
4685 * interface.cs: (PopulateMethod): Check for pointers being defined
4686 only if the unsafe context is active.
4687 (PopulateProperty): ditto.
4688 (PopulateIndexer): ditto.
4690 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
4691 specified. If pointers are present, make sure that they are
4692 present in an unsafe context.
4693 (Constructor, Constructor.Define): ditto.
4694 (Field, Field.Define): ditto.
4695 (Property, Property.Define): ditto.
4696 (Event, Event.Define): ditto.
4698 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
4699 hashtable if there are classes or structs defined.
4701 * expression.cs (LocalVariableReference.DoResolve): Simplify this
4702 code, as the constant resolution moved.
4704 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
4705 the metadata, so we can flag error 133.
4707 * decl.cs (MemberCore.UnsafeOK): New function to test that a
4708 pointer is being declared in an unsafe context.
4710 2002-01-16 Miguel de Icaza <miguel@ximian.com>
4712 * modifiers.cs (Modifiers.Check): Require a Location argument.
4713 Report error 227 for Unsafe use.
4715 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
4717 * statement.cs (For.Emit): If the test is null, then report that
4718 we do `return', as we wont reach anything afterwards.
4720 (Switch.SwitchGoverningType): Track the expression that matched
4723 * driver.cs: Allow negative numbers as an error code to flag.
4725 * cs-parser.jay: Handle 1551.
4727 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
4729 2002-01-15 Miguel de Icaza <miguel@ximian.com>
4731 * cs-parser.jay: Report 1518 (type declaration can only contain
4732 class, struct, interface, enum or delegate)
4734 (switch_label): Report 1523 (keywords `case' or `default' must
4737 (opt_switch_sections): Report 1522 (empty switch)
4739 * driver.cs: Report 1515 (response file specified multiple times)
4740 Report 1516 (Source file specified multiple times).
4742 * expression.cs (Argument.Resolve): Signal 1510
4744 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
4745 access not allowed in static code)
4747 2002-01-11 Ravi Pratap <ravi@ximian.com>
4749 * typemanager.cs (IsPointerType): Utility method which we are going
4752 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
4753 the object type, so we take care of that.
4755 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
4757 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
4758 added to non-params parameters :-)
4760 * typemanager.cs (CSharpName): Include 'void' type too.
4762 (void_ptr_type): Include in the set of core types.
4764 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
4767 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
4770 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
4771 completely forgotten about it.
4773 2002-01-10 Ravi Pratap <ravi@ximian.com>
4775 * cs-parser.jay (pointer_type): Add. This begins our implementation
4776 of parsing rules for unsafe code.
4778 (unsafe_statement): Implement.
4780 (embedded_statement): Modify to include the above.
4782 * statement.cs (Unsafe): Implement new class for unsafe blocks.
4784 * codegen.cs (EmitContext.InUnsafe): Add. This determines
4785 if the current context is an unsafe one.
4787 * cs-parser.jay (local_variable_pointer_type): Since local variable types
4788 are handled differently, we need separate rules for them.
4790 (local_variable_declaration): Update to use local_variable_pointer_type
4791 to allow variable declarations of unmanaged pointer types.
4793 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
4796 * ../errors/cs0214.cs : Add.
4798 2002-01-16 Nick Drochak <ndrochak@gol.com>
4800 * makefile: remove 'response' file when cleaning.
4802 2002-01-15 Miguel de Icaza <miguel@ximian.com>
4804 * cs-parser.jay: Report 1524.
4806 2002-01-14 Miguel de Icaza <miguel@ximian.com>
4808 * typemanager.cs (RegisterMethod): drop checking if we have
4809 registered this from here
4811 2002-01-12 Miguel de Icaza <miguel@ximian.com>
4813 * class.cs (Method.EmitDestructor): Implement calling our base
4816 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
4819 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
4820 this routine and will wrap the call in a try/catch block. Deal
4823 2002-01-11 Miguel de Icaza <miguel@ximian.com>
4825 * ecore.cs (Expression.MemberLookup): instead of taking a
4826 parameter `same_type' that was used to tell whether we could
4827 access private members we compute our containing type from the
4830 (FieldExpr): Added partial support for volatile fields. This does
4831 not work for volatile fields exposed from assemblies, as I can not
4832 figure out how to extract the modreq from it.
4834 Updated all the source files to use this.
4836 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
4837 because it is referenced by MemberLookup very often.
4839 2002-01-09 Ravi Pratap <ravi@ximian.com>
4841 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
4842 TypeBuilder.GetCustomAttributes to retrieve what we need.
4844 Get rid of redundant default_member_attr_type as this is the same as
4845 default_member_type which already exists.
4847 * interface.cs, attribute.cs : Update accordingly.
4849 2002-01-08 Miguel de Icaza <miguel@ximian.com>
4851 * typemanager.cs: Enable IndexerPropertyName again. It does not
4852 work for TYpeBuilders though. Ravi, can you please fix this?
4854 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
4856 * expression.cs (Argument.Emit): Handle the case of ref objects
4857 being passed to ref functions;
4859 (ParameterReference.EmitLoad): Loads the content of the pointer
4860 without dereferencing.
4862 2002-01-07 Miguel de Icaza <miguel@ximian.com>
4864 * cs-tokenizer.cs: Implemented the pre-processing expressions.
4866 2002-01-08 Ravi Pratap <ravi@ximian.com>
4868 * class.cs (Indexer.DefineMethod): Incorporate the interface
4869 type in the name of the method if we are doing explicit interface
4872 * expression.cs (ConversionExists): Remove as it is completely obsolete.
4874 (BetterConversion): Fix extremely trivial bug where we were referring to
4875 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
4878 * ../errors/bug16.cs : Add although we have fixed it.
4880 2002-01-07 Miguel de Icaza <miguel@ximian.com>
4882 * expression.cs (BaseIndexer): Begin implementation.
4884 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
4886 * cs-parser.jay (indexer_declarator): Use qualified_identifier
4887 production directly to remove a shift/reduce, and implement
4888 explicit interface implementation.
4890 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
4891 after a floating point suffix.
4893 * expression.cs (DoNumericPromotions): Improved the conversion for
4894 uint/uint. If we have a constant, we avoid doing a typecast to a
4897 * class.cs (Indexer): Implement explicit interface implementation
4900 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
4902 * class.cs: make the default instance constructor public and hidebysig.
4904 2001-01-03 Ravi Pratap <ravi@ximian.com>
4906 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
4907 so we can call it from elsewhere.
4909 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
4910 we emit it internally if the class has a defined indexer; otherwise the user
4911 emits it by decorating the class definition with the DefaultMemberAttribute.
4913 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
4914 attribute is not used on a type which defines an indexer.
4916 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
4917 character when we skip whitespace.
4919 * ../errors/cs0646.cs : Add.
4921 2002-01-03 Miguel de Icaza <miguel@ximian.com>
4923 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
4926 * makefile: Add practical target `mcs3.exe' which builds the third
4927 generation compiler.
4929 * expression.cs (New): Fix structures constructor calling.
4931 * class.cs (Property, Method, Indexer): Emit Final flag on the
4932 method if we are an interface implementation and we are not
4935 * ecore.cs (PropertyExpr): New public field `IsBase', tells
4936 whether this property is referencing a `base' method.
4938 * expression.cs (Invocation.EmitCall): take an extra argument:
4939 is_base, this is used to determine whether the `call' or
4940 `callvirt' opcode should be used.
4943 * delegate.cs: update EmitCall.
4945 * class.cs (Method.Define): Set NewSlot for the cases where we are
4946 not implementing an interface method.
4948 (Property.Define): ditto.
4950 2002-01-02 Miguel de Icaza <miguel@ximian.com>
4952 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
4953 'r'. Allows mcs to parse itself fully.
4955 2002-01-02 Ravi Pratap <ravi@ximian.com>
4957 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
4958 of the number of initializers that require the InitializeArray method.
4960 (CheckIndices): Store the Expression in all cases - not the plain value. Also
4961 update the above field where necessary.
4963 (MakeByteBlob): Update accordingly.
4965 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
4968 (EmitDynamicInitializers): Update in accordance with the new optimization.
4970 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
4971 same OpCode applies.
4973 * cs-parser.jay : Fix some glaring errors I introduced.
4975 2002-01-01 Ravi Pratap <ravi@ximian.com>
4977 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
4978 so that we can check for name clashes there too.
4980 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
4981 for interface indexers.
4983 * interfaces.cs (Define): Emit the default member attribute.
4985 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
4986 variable was being referred to while setting the value ;-)
4988 2002-01-01 Miguel de Icaza <miguel@ximian.com>
4990 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
4991 byte-by-byte information when we know the data is zero.
4993 Make the block always a multiple of 4, because
4994 DefineInitializedData has a bug.
4996 * assign.cs: Fix, we should assign from the temporary, not from
4999 * expression.cs (MakeByteBlob): Fix my incorrect code.
5001 2001-12-31 Miguel de Icaza <miguel@ximian.com>
5003 * typemanager.cs (EnumToUnderlying): This function is used to get
5004 the underlying type from an enumeration, because it does not
5007 * constant.cs: Use the I4_S form for values between -128 and 127.
5009 * statement.cs (Block.LookupLabel): Looks up a label.
5010 (Block): Drop support for labeled blocks.
5012 (LabeledStatement): New kind of statement that represents a label
5015 (Goto): Finally implement this bad boy.
5017 * cs-parser.jay: Update to reflect new mechanism to implement
5020 2001-12-30 Miguel de Icaza <miguel@ximian.com>
5022 * codegen.cs (EmitContext.This): a codegen property that keeps the
5023 a single instance of this instead of creating many different this
5026 * delegate.cs (Delegate.DoResolve): Update to use the property;
5028 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
5030 * expression.cs (BaseAccess.DoResolve): Ditto.
5032 2001-12-29 Ravi Pratap <ravi@ximian.com>
5034 * typemanager.cs (methodimpl_attr_type): Add to hold the type
5035 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
5037 (InitCoreTypes): Update accordingly.
5039 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
5040 so we can quickly store the state.
5042 (ApplyAttributes): Set the correct implementation flags
5043 for InternalCall methods.
5045 2001-12-29 Miguel de Icaza <miguel@ximian.com>
5047 * expression.cs (EmitCall): if a method is not virtual, then do
5048 not use callvirt on it.
5050 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
5051 user defined stuff) requires the use of stobj, which takes an
5052 address on the stack instead of an array and an index. So emit
5053 the Ldelema operation for it.
5055 (EmitStoreOpcode): Use stobj for valuetypes.
5057 (UnaryMutator.EmitCode): Use the right 1 value depending on
5058 whether we are dealing with int64/uint64, float or doubles.
5060 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
5061 constructors that I implemented last night.
5063 (Constructor.IsDefault): Fix to work properly for static
5066 * cs-parser.jay (CheckDef): report method signature errors.
5067 Update error number 103 to be 132.
5069 * decl.cs: New AdditionResult enumeration value: MethodExists.
5070 Although we do this check for methods later on in the semantic
5071 analysis, catching repeated default constructors is so easy that
5072 we catch these here.
5074 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
5077 (ParameterReference.EmitAssign, Emit): handle
5080 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
5081 (ArrayAccess.EmitStoreOpcode): ditto.
5083 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
5085 * expression.cs (MakeByteBlob): Complete all the missing types
5086 (uint, short, ushort, byte, sbyte)
5088 * class.cs: Only init instance field initializers on instance
5091 Rename `constructors' to instance_constructors.
5093 (TypeContainer.AddConstructor): Only add constructors to the list
5094 if it is not static.
5096 Make sure that we handle default_static_constructor independently
5097 everywhere where we handle instance_constructors
5099 2001-12-28 Miguel de Icaza <miguel@ximian.com>
5101 * class.cs: Do not lookup or create a base initializer for a
5104 (ConstructorInitializer.Resolve): use the proper type to lookup
5107 * cs-parser.jay: Report error 1585 (modifiers between type and name).
5109 * enum.cs, interface.cs: Remove CloseType, this is taken care by
5112 * decl.cs: CloseType is now an virtual method, the default
5113 implementation just closes this type.
5115 2001-12-28 Ravi Pratap <ravi@ximian.com>
5117 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
5118 to PreserveSig by default. Also emit HideBySig on such methods.
5120 Basically, set the defaults to standard values.
5122 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
5123 argument, if candidate is better, it can't be worse than the best !
5125 (Invocation): Re-write bits to differentiate between methods being
5126 applicable in their expanded form and their normal form - for params
5129 Get rid of use_standard everywhere as only standard conversions are allowed
5130 in overload resolution.
5132 More spec conformance.
5134 2001-12-27 Miguel de Icaza <miguel@ximian.com>
5136 * driver.cs: Add --timestamp, to see where the compiler spends
5139 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
5140 `this' in static code.
5142 (SimpleName.DoResolve): Implement in terms of a helper function
5143 that allows static-references to be passed upstream to
5146 (Expression.ResolveWithSimpleName): Resolve specially simple
5147 names when called by MemberAccess to implement the special
5150 (Expression.ImplicitReferenceConversion): Handle conversions from
5151 Null to reference types before others, as Null's type is
5154 * expression.cs (Invocation.EmitCall): Handle the special case of
5155 calling methods declared on a reference type from a ValueType
5156 (Base classes System.Object and System.Enum)
5158 (MemberAccess.Resolve): Only perform lookups on Enumerations if
5159 the left hand side is a TypeExpr, not on every enumeration.
5161 (Binary.Resolve): If types are reference types, then do a cast to
5162 object on operators != and == of both arguments.
5164 * typemanager.cs (FindMembers): Extract instance and static
5165 members if requested.
5167 * interface.cs (PopulateProperty): Use void_type instead of null
5168 as the return type for the setter method.
5170 (PopulateIndexer): ditto.
5172 2001-12-27 Ravi Pratap <ravi@ximian.com>
5174 * support.cs (ReflectionParameters): Fix minor bug where we
5175 were examining the wrong parameter for the ParamArray attribute.
5177 Cope with requests for the type of the parameter at position
5178 greater than the params parameter's. We now return the element
5179 type of the params array as that makes more sense.
5181 * expression.cs (Invocation.IsParamsMethodApplicable): Update
5182 accordingly as we no longer have to extract the element type
5185 (Invocation.OverloadResolve): Update.
5187 2001-12-27 Miguel de Icaza <miguel@ximian.com>
5189 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
5190 against IEnumerator, test whether the return value is a descendant
5191 of the IEnumerator interface.
5193 * class.cs (Indexer.Define): Use an auxiliary method to implement
5194 the other bits of the method definition. Begin support for
5195 explicit interface implementation.
5197 (Property.DefineMethod): Use TypeManager.void_type instead of null
5198 for an empty return value.
5200 2001-12-26 Miguel de Icaza <miguel@ximian.com>
5202 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
5203 dealing with a FieldExpr which is composed of a FieldBuilder, in
5204 the code path we did extract the constant, but we should have
5205 obtained the underlying value to be able to cast it (otherwise we
5206 end up in an infinite loop, this is what Ravi was running into).
5208 (ArrayCreation.UpdateIndices): Arrays might be empty.
5210 (MemberAccess.ResolveMemberAccess): Add support for section
5211 14.5.4.1 that deals with the special case of E.I when E is a type
5212 and something else, that I can be a reference to a static member.
5214 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
5215 handle a particular array type to create byte blobs, it is just
5216 something we dont generate byteblobs for.
5218 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
5221 * location.cs (Push): remove the key from the hashtable that we
5222 are about to add. This happens for empty files.
5224 * driver.cs: Dispose files after we have parsed them.
5226 (tokenize): new function that only runs the tokenizer on its
5227 input, for speed testing.
5229 2001-12-26 Ravi Pratap <ravi@ximian.com>
5231 * class.cs (Event.Define): Define the private field only if there
5232 are no accessors defined.
5234 * expression.cs (ResolveMemberAccess): If there is no associated
5235 field with the event, that means we have an event defined with its
5236 own accessors and we should flag error cs0070 since transforming
5237 ourselves into a field is not valid in that case.
5239 * ecore.cs (SimpleName.DoResolve): Same as above.
5241 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
5242 and charset to sane values.
5244 2001-12-25 Ravi Pratap <ravi@ximian.com>
5246 * assign.cs (DoResolve): Perform check on events only if they
5247 are being accessed outside the declaring type.
5249 * cs-parser.jay (event_declarations): Update rules to correctly
5250 set the type of the implicit parameter etc.
5252 (add_accessor, remove_accessor): Set current local parameters.
5254 * expression.cs (Binary): For delegate addition and subtraction,
5255 cast the return value from the method into the appropriate delegate
5258 2001-12-24 Ravi Pratap <ravi@ximian.com>
5260 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
5261 of these as the workaround is unnecessary.
5263 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
5264 delegate data - none of that is needed at all.
5266 Re-write bits to extract the instance expression and the delegate method
5269 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
5272 * attribute.cs (ApplyAttributes): New method to take care of common tasks
5273 of attaching attributes instead of duplicating code everywhere.
5275 * everywhere : Update code to do attribute emission using the above method.
5277 2001-12-23 Miguel de Icaza <miguel@ximian.com>
5279 * expression.cs (IsParamsMethodApplicable): if there are not
5280 parameters, return immediately.
5282 * ecore.cs: The 0 literal can be implicity converted to an enum
5285 (SimpleName.DoResolve): First lookup the type, then lookup the
5288 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
5289 want to get its address. If the InstanceExpression is not
5290 addressable, store the result in a temporary variable, then get
5293 * codegen.cs: Only display 219 errors on warning level or above.
5295 * expression.cs (ArrayAccess): Make it implement the
5296 IMemoryLocation interface.
5298 (Binary.DoResolve): handle the operator == (object a, object b)
5299 and operator != (object a, object b) without incurring into a
5300 BoxedCast (because 5 != o should never be performed).
5302 Handle binary enumerator operators.
5304 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
5305 value type, otherwise use Ldelem_ref.
5307 Use precomputed names;
5309 (AddressOf): Implement address of
5311 * cs-parser.jay (labeled_statement): Fix recursive block
5312 addition by reworking the production.
5314 * expression.cs (New.DoEmit): New has a special case:
5316 If we are dealing with a ValueType, we have a few
5317 situations to deal with:
5319 * The target of New is a ValueType variable, that is
5320 easy, we just pass this as the variable reference
5322 * The target of New is being passed as an argument,
5323 to a boxing operation or a function that takes a
5326 In this case, we need to create a temporary variable
5327 that is the argument of New.
5330 2001-12-23 Ravi Pratap <ravi@ximian.com>
5332 * rootcontext.cs (LookupType): Check that current_type is not null before
5333 going about looking at nested types.
5335 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
5336 not implement the IAssignMethod interface any more.
5338 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
5339 where we tranform them into FieldExprs if they are being resolved from within
5342 * ecore.cs (SimpleName.DoResolve): Do the same here.
5344 * assign.cs (DoResolve, Emit): Clean up code considerably.
5346 * ../errors/bug10.cs : Add.
5348 * ../errors/cs0070.cs : Add.
5350 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
5352 * assign.cs : Get rid of EventIsLocal everywhere.
5354 2001-12-23 Miguel de Icaza <miguel@ximian.com>
5356 * ecore.cs (ConvertIntLiteral): finished the implementation.
5358 * statement.cs (SwitchLabel): Convert the value we are using as a
5359 key before looking up the table.
5361 2001-12-22 Miguel de Icaza <miguel@ximian.com>
5363 * codegen.cs (EmitTopBlock): Require a Location argument now.
5365 * cs-parser.jay (constructor_declarator): We need to setup
5366 current_local_parameters before we parse the
5367 opt_constructor_initializer, to allow the variables to be bound
5368 to the constructor arguments.
5370 * rootcontext.cs (LookupType): First lookup nested classes in our
5371 class and our parents before we go looking outside our class.
5373 * expression.cs (ConstantFold): Extract/debox the values at the
5376 * rootcontext.cs (EmitCode): Resolve the constants first before we
5377 resolve the types. This is not really needed, but it helps debugging.
5379 * statement.cs: report location.
5381 * cs-parser.jay: pass location to throw statement.
5383 * driver.cs: Small bug fix.
5385 * report.cs: Updated format to be 4-zero filled digits.
5387 2001-12-22 Ravi Pratap <ravi@ximian.com>
5389 * expression.cs (CheckIndices): Fix minor bug where the wrong
5390 variable was being referred to ;-)
5392 (DoEmit): Do not call EmitStaticInitializers when the
5393 underlying type is System.Object.
5395 2001-12-21 Ravi Pratap <ravi@ximian.com>
5397 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
5398 and do the usual workaround for SRE.
5400 * class.cs (MyEventBuilder.EventType): New member to get at the type
5401 of the event, quickly.
5403 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
5405 * assign.cs (Assign.DoResolve): Handle the case when the target
5406 is an EventExpr and perform the necessary checks.
5408 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
5411 (SimpleName.MemberStaticCheck): Include check for EventExpr.
5413 (EventExpr): Set the type in the constructor itself since we
5414 are meant to be born fully resolved.
5416 (EventExpr.Define): Revert code I wrote earlier.
5418 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
5419 instance expression is null. The instance expression is a This in that case
5420 or a null, depending on whether it is a static method or not.
5422 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
5423 refers to more than one method.
5425 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
5426 and accordingly flag errors.
5428 2001-12-21 Miguel de Icaza <miguel@ximian.com>
5430 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
5432 2001-12-22 Miguel de Icaza <miguel@ximian.com>
5434 * location.cs (ToString): Provide useful rutine.
5436 2001-12-21 Miguel de Icaza <miguel@ximian.com>
5438 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
5439 objects, return the actual integral boxed.
5441 * statement.cs (SwitchLabel): define an ILLabel for each
5444 (Switch.CheckSwitch): If the value is a Literal, extract
5445 the underlying literal.
5447 Also in the unused hashtable we had, add the SwitchLabel so we can
5448 quickly look this value up.
5450 * constant.cs: Implement a bunch of new constants. Rewrite
5451 Literal based on this. Made changes everywhere to adapt to this.
5453 * expression.cs (Expression.MakeByteBlob): Optimize routine by
5454 dereferencing array only once, and also copes with enumrations.
5456 bytes are two bytes wide, not one.
5458 (Cast): Perform constant conversions.
5460 * ecore.cs (TryImplicitIntConversion): Return literals instead of
5461 wrappers to the literals here.
5463 * expression.cs (DoNumericPromotions): long literals can converted
5464 to ulong implicity (this is taken care of elsewhere, but I was
5467 * ecore.cs (Expression.Literalize): Make the return type Literal,
5468 to improve type checking.
5470 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
5472 2001-12-20 Miguel de Icaza <miguel@ximian.com>
5474 * literal.cs: Revert code from ravi that checked the bounds. The
5475 bounds are sane by the definition of the type itself.
5477 * typemanager.cs: Fix implementation of ImplementsInterface. We
5478 need to actually look up in our parent hierarchy for interfaces
5481 * const.cs: Use the underlying type for enumerations
5483 * delegate.cs: Compute the basename for the delegate creation,
5484 that should fix the delegate test case, and restore the correct
5485 Type Lookup semantics in rootcontext
5487 * rootcontext.cs: Revert Ravi's last patch. The correct way of
5488 referencing a nested type with the Reflection API is using the "+"
5491 * cs-parser.jay: Do not require EOF token at the end.
5493 2001-12-20 Ravi Pratap <ravi@ximian.com>
5495 * rootcontext.cs (LookupType): Concatenate type names with
5496 a '.' instead of a '+' The test suite passes again.
5498 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
5499 field of the enumeration.
5501 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
5502 the case when the member is an EventExpr.
5504 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
5505 static has an associated instance expression.
5507 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
5509 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
5511 * class.cs (Event.Define): Register event and perform appropriate checks
5514 We define the Add and Remove methods even if the use provides none because
5515 in that case, we provide default implementations ourselves.
5517 Define a private field of the type of the event. This is done by the CSC compiler
5518 and we should be doing it too ;-)
5520 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
5521 More methods we use in code we generate.
5523 (multicast_delegate_type, delegate_type): Two separate types since the distinction
5526 (InitCoreTypes): Update accordingly for the above.
5528 * class.cs (Event.Emit): Generate code for default accessors that we provide
5530 (EmitDefaultMethod): Do the job in the above.
5532 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
5535 2001-12-20 Miguel de Icaza <miguel@ximian.com>
5537 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
5538 builders even if we were missing one.
5540 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
5541 pass the Basename as our class name instead of the Name. The
5542 basename will be correctly composed for us.
5544 * parameter.cs (Paramters): Now takes a Location argument.
5546 * decl.cs (DeclSpace.LookupType): Removed convenience function and
5547 make all the code call directly LookupType in RootContext and take
5548 this chance to pass the Location information everywhere.
5550 * Everywhere: pass Location information.
5552 2001-12-19 Miguel de Icaza <miguel@ximian.com>
5554 * class.cs (Constructor.Define): Updated way of detecting the
5555 length of the parameters.
5557 (TypeContainer.DefineType): Use basename as the type name for
5560 (TypeContainer.Define): Do not recursively define types here, as
5561 definition is taken care in order by the RootContext.
5563 * tree.cs: Keep track of namespaces in a per-file basis.
5565 * parameter.cs (Parameter.ComputeSignature): Update to use
5568 (Parameters.GetSignature): ditto.
5570 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
5571 instead of a TypeContainer.
5573 (Interface.SemanticAnalysis): Use `this' instead of our parent to
5574 resolve names. Because we need to be resolve in our context, not
5577 * driver.cs: Implement response files.
5579 * class.cs (TypeContainer.DefineType): If we are defined, do not
5582 (Event.Emit): Emit the code for add/remove handlers.
5583 (Event.Define): Save the MethodBuilders for add/remove.
5585 * typemanager.cs: Use pair here too.
5587 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
5588 DictionaryEntry requires the first argument to be non-null.
5590 (enum_declaration): Compute full name for registering the
5593 (delegate_declaration): Instead of using
5594 formal_parameter_list, use opt_formal_parameter_list as the list
5597 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
5598 (EventParsing): New property that controls whether `add' and
5599 `remove' are returned as tokens or identifiers (for events);
5601 2001-12-19 Ravi Pratap <ravi@ximian.com>
5603 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
5604 use MyEventBuilder only and let it wrap the real builder for us.
5606 (MyEventBuilder): Revamp constructor etc.
5608 Implement all operations that we perform on EventBuilder in precisely the same
5611 (FindMembers): Update to use the EventBuilder member.
5613 (Event.Emit): Update accordingly.
5615 2001-12-18 Ravi Pratap <ravi@ximian.com>
5617 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
5618 by calling the appropriate methods.
5620 (GetCustomAttributes): Make stubs as they cannot possibly do anything
5623 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
5625 2001-12-17 Ravi Pratap <ravi@ximian.com>
5627 * delegate.cs (Delegate.Populate): Check that the return type
5628 and various parameters types are indeed accessible.
5630 * class.cs (Constructor.Define): Same here.
5632 (Field.Define): Ditto.
5634 (Event.Define): Ditto.
5636 (Operator.Define): Check that the underlying Method defined itself
5637 correctly - so it's MethodBuilder should not be null.
5639 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
5640 expression happens to be null.
5642 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
5643 members but as of now we don't seem to be able to do anything really useful with it.
5645 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
5646 not the EventBuilder.
5648 2001-12-18 Miguel de Icaza <miguel@ximian.com>
5650 * cs-tokenizer.cs: Add support for defines.
5651 Add support for #if, #elif, #else, #endif
5653 (eval_var): evaluates a variable.
5654 (eval): stubbed for evaluating functions.
5656 * cs-parser.jay: Pass the defines information
5658 * driver.cs: Add --define command line option.
5660 * decl.cs: Move MemberCore here.
5662 Make it the base class for DeclSpace. This allows us to catch and
5663 report 108 and 109 for everything now.
5665 * class.cs (TypeContainer.Define): Extract all the members
5666 before populating and emit the warning 108 (new keyword required
5667 to override) instead of having each member implement this.
5669 (MemberCore.Define): New abstract method, we will be using this in
5670 the warning reporting engine in Populate.
5672 (Operator.Define): Adjust to new MemberCore protocol.
5674 * const.cs (Const): This does not derive from Expression, it is a
5675 temporary object we use to create fields, it is a MemberCore.
5677 * class.cs (Method.Define): Allow the entry point to be in a
5680 * driver.cs: Rewrite the argument handler to clean it up a bit.
5682 * rootcontext.cs: Made it just an auxiliary namespace feature by
5683 making everything static.
5685 * driver.cs: Adapt code to use RootContext type name instead of
5688 * delegate.cs: Remove RootContext argument.
5690 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
5693 * class.cs (Event.Define): The lookup can fail.
5695 * cs-tokenizer.cs: Begin implementation of pre-procesor.
5697 * expression.cs: Resolve the this instance before invoking the code.
5699 2001-12-17 Miguel de Icaza <miguel@ximian.com>
5701 * cs-parser.jay: Add a production in element_access that allows
5702 the thing to become a "type" reference. This way we can parse
5703 things like "(string [])" as a type.
5705 Note that this still does not handle the more complex rules of
5709 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
5711 * ecore.cs: (CopyNewMethods): new utility function used to
5712 assemble the list of methods from running FindMembers.
5714 (MemberLookup): Rework FindMembers so that
5716 2001-12-16 Miguel de Icaza <miguel@ximian.com>
5718 * class.cs (TypeContainer): Remove Delegates who fail to be
5721 * delegate.cs (Populate): Verify that we dont get null return
5722 values. TODO: Check for AsAccessible.
5724 * cs-parser.jay: Use basename to emit error 574 (destructor should
5725 have the same name as container class), not the full name.
5727 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
5728 possible representation.
5730 Also implements integer type suffixes U and L.
5732 2001-12-15 Miguel de Icaza <miguel@ximian.com>
5734 * expression.cs (ArrayCreation.DoResolve): We need to do the
5735 argument resolution *always*.
5737 * decl.cs: Make this hold the namespace. Hold the root context as
5739 (LookupType): Move here.
5741 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
5743 * location.cs (Row, Name): Fixed the code, it was always returning
5744 references to the first file.
5746 * interface.cs: Register properties defined through interfaces.
5748 * driver.cs: Add support for globbing on the command line
5750 * class.cs (Field): Make it derive from MemberCore as well.
5753 2001-12-15 Ravi Pratap <ravi@ximian.com>
5755 * class.cs (Event::Define): Check that the type of the event is a delegate
5756 type else flag error #66.
5758 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
5761 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
5762 values of EntryPoint, CharSet etc etc.
5764 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
5766 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
5767 be null and we should ignore this. I am not sure if this is really clean. Apparently,
5768 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
5769 which needs this to do its work.
5771 * ../errors/cs0066.cs : Add.
5773 2001-12-14 Miguel de Icaza <miguel@ximian.com>
5775 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
5778 * class.cs: (MethodSignature.MethodSignature): Removed hack that
5779 clears out the parameters field.
5780 (MemberSignatureCompare): Cleanup
5782 (MemberCore): New base class used to share code between MethodCore
5785 (RegisterRequiredImplementations) BindingFlags.Public requires
5786 either BindingFlags.Instace or Static. Use instance here.
5788 (Property): Refactored code to cope better with the full spec.
5790 * parameter.cs (GetParameterInfo): Return an empty array instead
5793 * class.cs (Property): Abstract or extern properties have no bodies.
5795 * parameter.cs (GetParameterInfo): return a zero-sized array.
5797 * class.cs (TypeContainer.MethodModifiersValid): Move all the
5798 method modifier validation to the typecontainer so we can reuse
5801 (MethodCore.ParameterTypes): return an empty sized array of types.
5803 (Property.Define): Test property modifier validity.
5805 Add tests for sealed/override too.
5807 (Method.Emit): abstract or extern methods have no bodies.
5809 2001-12-14 Ravi Pratap <ravi@ximian.com>
5811 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
5814 (Method::Define, ::Emit): Modify accordingly.
5816 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
5818 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
5820 * makefile: Pass in /unsafe.
5822 2001-12-13 Miguel de Icaza <miguel@ximian.com>
5824 * class.cs (MakeKey): Kill routine.
5826 * class.cs (TypeContainer.Define): Correctly define explicit
5827 method implementations (they require the full interface name plus
5830 * typemanager.cs: Deply the PtrHashtable here and stop using the
5831 lame keys. Things work so much better.
5833 This of course broke everyone who depended on `RegisterMethod' to
5834 do the `test for existance' test. This has to be done elsewhere.
5836 * support.cs (PtrHashtable): A hashtable that avoid comparing with
5837 the object stupid Equals method (because, that like fails all over
5838 the place). We still do not use it.
5840 * class.cs (TypeContainer.SetRequiredInterface,
5841 TypeContainer.RequireMethods): Killed these two routines and moved
5842 all the functionality to RegisterRequiredImplementations.
5844 (TypeContainer.RegisterRequiredImplementations): This routine now
5845 registers all the implementations required in an array for the
5846 interfaces and abstract methods. We use an array of structures
5847 which can be computed ahead of time to reduce memory usage and we
5848 also assume that lookups are cheap as most classes will not
5849 implement too many interfaces.
5851 We also avoid creating too many MethodSignatures.
5853 (TypeContainer.IsInterfaceMethod): Update and optionally does not
5854 clear the "pending" bit if we find that there are problems with
5857 (TypeContainer.VerifyPendingMethods): Update to report errors of
5858 methods that look like implementations but are not.
5860 (TypeContainer.Define): Add support for explicit interface method
5863 2001-12-12 Miguel de Icaza <miguel@ximian.com>
5865 * typemanager.cs: Keep track of the parameters here instead of
5866 being a feature of the TypeContainer.
5868 * class.cs: Drop the registration of parameters here, as
5869 InterfaceMethods are also interface declarations.
5871 * delegate.cs: Register methods with the TypeManager not only with
5872 the TypeContainer. This code was buggy.
5874 * interface.cs: Full registation here.
5876 2001-12-11 Miguel de Icaza <miguel@ximian.com>
5878 * expression.cs: Remove reducer for binary expressions, it can not
5881 * const.cs: Put here the code that used to go into constant.cs
5883 * constant.cs: Put here the code for constants, this is a new base
5886 * literal.cs: Make Literal derive from Constant.
5888 2001-12-09 Miguel de Icaza <miguel@ximian.com>
5890 * statement.cs (Return.Emit): Report error 157 if the user
5891 attempts to return from a finally block.
5893 (Return.Emit): Instead of emitting a return, jump to the end of
5896 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
5897 LocalBuilder to store the result of the function. ReturnLabel is
5898 the target where we jump.
5901 2001-12-09 Radek Doulik <rodo@ximian.com>
5903 * cs-parser.jay: remember alias in current namespace
5905 * ecore.cs (SimpleName::DoResolve): use aliases for types or
5908 * class.cs (LookupAlias): lookup alias in my_namespace
5910 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
5912 (LookupAlias): lookup alias in this and if needed in parent
5915 2001-12-08 Miguel de Icaza <miguel@ximian.com>
5919 * rootcontext.cs: (ModuleBuilder) Made static, first step into
5920 making things static. I need this to avoid passing the
5921 TypeContainer when calling ParameterType.
5923 * support.cs (InternalParameters.ParameterType): Remove ugly hack
5924 that did string manipulation to compute the type and then call
5925 GetType. Use Parameter.ParameterType instead.
5927 * cs-tokenizer.cs: Consume the suffix for floating values.
5929 * expression.cs (ParameterReference): figure out whether this is a
5930 reference parameter or not. Kill an extra variable by computing
5931 the arg_idx during emission.
5933 * parameter.cs (Parameters.GetParameterInfo): New overloaded
5934 function that returns whether a parameter is an out/ref value or not.
5936 (Parameter.ParameterType): The type of the parameter (base,
5937 without ref/out applied).
5939 (Parameter.Resolve): Perform resolution here.
5940 (Parameter.ExternalType): The full type (with ref/out applied).
5942 * statement.cs (Using.Emit, Using.EmitExpression): Implement
5943 support for expressions on the using statement.
5945 2001-12-07 Miguel de Icaza <miguel@ximian.com>
5947 * statement.cs (Using.EmitLocalVariableDecls): Split the
5948 localvariable handling of the using statement.
5950 (Block.EmitMeta): Keep track of variable count across blocks. We
5951 were reusing slots on separate branches of blocks.
5953 (Try.Emit): Emit the general code block, we were not emitting it.
5955 Check the type of the declaration to be an IDisposable or
5956 something that can be implicity converted to it.
5958 Emit conversions if required.
5960 * ecore.cs (EmptyExpression): New utility class.
5961 (Expression.ImplicitConversionExists): New utility function.
5963 2001-12-06 Miguel de Icaza <miguel@ximian.com>
5965 * statement.cs (Using): Implement.
5967 * expression.cs (LocalVariableReference): Support read only variables.
5969 * statement.cs: Remove the explicit emit for the Leave opcode.
5970 (VariableInfo): Add a readonly field.
5972 2001-12-05 Miguel de Icaza <miguel@ximian.com>
5974 * ecore.cs (ConvCast): new class used to encapsulate the various
5975 explicit integer conversions that works in both checked and
5978 (Expression.ConvertNumericExplicit): Use new ConvCast class to
5979 properly generate the overflow opcodes.
5981 2001-12-04 Miguel de Icaza <miguel@ximian.com>
5983 * statement.cs: The correct type for the EmptyExpression is the
5984 element_type, not the variable type. Ravi pointed this out.
5986 2001-12-04 Ravi Pratap <ravi@ximian.com>
5988 * class.cs (Method::Define): Handle PInvoke methods specially
5989 by using DefinePInvokeMethod instead of the usual one.
5991 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
5992 above to do the task of extracting information and defining the method.
5994 2001-12-04 Ravi Pratap <ravi@ximian.com>
5996 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
5997 of the condition for string type.
5999 (Emit): Move that here.
6001 (ArrayCreation::CheckIndices): Keep string literals in their expression
6004 (EmitDynamicInitializers): Handle strings appropriately.
6006 2001-12-04 Miguel de Icaza <miguel@ximian.com>
6008 * codegen.cs (EmitContext): Replace multiple variables with a
6009 single pointer to the current Switch statement.
6011 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
6014 2001-12-03 Miguel de Icaza <miguel@ximian.com>
6018 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
6021 (Foreach.Emit): Foreach on arrays was not setting
6022 up the loop variables (for break/continue).
6024 (GotoCase): Semi-implented.
6026 2001-12-03 Ravi Pratap <ravi@ximian.com>
6028 * attribute.cs (CheckAttribute): Handle system attributes by using
6029 Attribute.GetAttributes to examine information we need.
6031 (GetValidPlaces): Same here.
6033 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
6035 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
6037 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
6039 (Method::Define): Set appropriate flags if we have a DllImport attribute.
6041 (Method::Emit): Handle the case when we are a PInvoke method.
6043 2001-12-03 Miguel de Icaza <miguel@ximian.com>
6045 * expression.cs: Use ResolveWithSimpleName on compound names.
6047 2001-12-02 Ravi Pratap <ravi@ximian.com>
6049 * constant.cs (EmitConstant): Make sure we resolve the associated expression
6050 before trying to reduce it.
6052 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
6054 * constant.cs (LookupConstantValue): Implement.
6056 (EmitConstant): Use the above in emitting the constant.
6058 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
6059 that are user-defined by doing a LookupConstantValue on them.
6061 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
6064 2001-11-29 Miguel de Icaza <miguel@ximian.com>
6066 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
6068 (BaseAccess.DoResolve): Implement.
6070 (MemberAccess.DoResolve): Split this routine into a
6071 ResolveMemberAccess routine that can be used independently
6073 2001-11-28 Miguel de Icaza <miguel@ximian.com>
6075 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
6076 As that share bits of the implementation. Is returns a boolean,
6077 while As returns the Type that is being probed.
6079 2001-12-01 Ravi Pratap <ravi@ximian.com>
6081 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
6082 instead of a Literal - much easier.
6084 (EnumInTransit): Remove - utterly useless :-)
6086 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
6088 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
6090 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
6091 chain when we have no associated expression.
6093 2001-11-30 Ravi Pratap <ravi@ximian.com>
6095 * constant.cs (Define): Use Location while reporting the errror.
6097 Also emit a warning when 'new' is used and there is no inherited
6100 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
6103 (LookupEnumValue): Implement to lookup an enum member's value and define it
6106 (Populate): Re-write accordingly to use the above routine.
6108 2001-11-27 Miguel de Icaza <miguel@ximian.com>
6110 * expression.cs (This): Fix prototype for DoResolveLValue to
6111 override the base class DoResolveLValue.
6113 * cs-parser.cs: Report errors cs574 and cs575 (destructor
6116 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
6117 (we need to load the address of the field here). This fixes
6120 (FieldExpr.DoResolveLValue): Call the DoResolve
6121 function to initialize the Instance expression.
6123 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
6124 correctly the GetEnumerator operation on a value type.
6126 * cs-parser.jay: Add more simple parsing error catches.
6128 * statement.cs (Switch): Add support for string switches.
6129 Handle null specially.
6131 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
6133 2001-11-28 Ravi Pratap <ravi@ximian.com>
6135 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
6137 (declare_local_constant): New helper function.
6139 * statement.cs (AddConstant): Keep a separate record of constants
6141 (IsConstant): Implement to determine if a variable is a constant.
6143 (GetConstantExpression): Implement.
6145 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
6147 * statement.cs (IsVariableDefined): Re-write.
6149 2001-11-27 Ravi Pratap <ravi@ximian.com>
6151 * class.cs (TypeContainer::FindMembers): Look for constants
6152 in the case when we are looking for MemberTypes.Field
6154 * expression.cs (MemberAccess::DoResolve): Check that in the
6155 case we are a FieldExpr and a Literal, we are not being accessed
6156 by an instance reference.
6158 * cs-parser.jay (local_constant_declaration): Implement.
6160 (declaration_statement): Implement for constant declarations.
6162 2001-11-26 Miguel de Icaza <miguel@ximian.com>
6164 * statement.cs (Switch): Catch double defaults.
6166 (Switch): More work on the switch() statement
6167 implementation. It works for integral values now, need to finish
6171 2001-11-24 Miguel de Icaza <miguel@ximian.com>
6173 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
6174 integer literals into other integer literals. To be used by
6177 2001-11-24 Ravi Pratap <ravi@ximian.com>
6179 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
6182 (EmitDynamicInitializers): Cope with the above since we extract data
6183 directly from ArrayData now.
6185 (ExpectInitializers): Keep track of whether initializers are mandatory
6188 (Bounds): Make it a hashtable to prevent the same dimension being
6189 recorded for every element in that dimension.
6191 (EmitDynamicInitializers): Fix bug which prevented the Set array method
6194 Also fix bug which was causing the indices to be emitted in the reverse
6197 2001-11-24 Miguel de Icaza <miguel@ximian.com>
6199 * expression.cs (ArrayCreation): Implement the bits that Ravi left
6200 unfinished. They do not work, because the underlying code is
6203 2001-11-22 Miguel de Icaza <miguel@ximian.com>
6205 * cs-parser.jay: Remove bogus fixme.
6207 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
6208 on Switch statement.
6210 2001-11-23 Ravi Pratap <ravi@ximian.com>
6212 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
6215 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
6216 parameter. Apparently, any expression is allowed.
6218 (ValidateInitializers): Update accordingly.
6220 (CheckIndices): Fix some tricky bugs thanks to recursion.
6222 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
6223 I was being completely brain-dead.
6225 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
6226 and re-write acordingly.
6228 (DelegateInvocation): Re-write accordingly.
6230 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
6232 (MakeByteBlob): Handle types more correctly.
6234 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
6235 initialization from expressions but it is incomplete because I am a complete
6238 2001-11-22 Miguel de Icaza <miguel@ximian.com>
6240 * statement.cs (If.Emit): Fix a bug that generated incorrect code
6241 on If. Basically, we have to return `true' (ie, we do return to
6242 our caller) only if both branches of the if return.
6244 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
6245 short-circuit operators, handle them as short circuit operators.
6247 (Cast.DoResolve): Resolve type.
6248 (Cast.Cast): Take an expression as the target type.
6250 * cs-parser.jay (cast_expression): Remove old hack that only
6251 allowed a limited set of types to be handled. Now we take a
6252 unary_expression and we resolve to a type during semantic
6255 Use the grammar productions from Rhys to handle casts (this is
6256 not complete like Rhys syntax yet, we fail to handle that corner
6257 case that C# has regarding (-x), but we will get there.
6259 2001-11-22 Ravi Pratap <ravi@ximian.com>
6261 * class.cs (EmitFieldInitializer): Take care of the case when we have a
6262 field which is an array type.
6264 * cs-parser.jay (declare_local_variables): Support array initialization too.
6266 * typemanager.cs (MakeKey): Implement.
6268 (everywhere): Use the above appropriately.
6270 * cs-parser.jay (for_statement): Update for array initialization while
6271 declaring variables.
6273 * ecore.cs : The error message was correct, it's the variable's names that
6274 were misleading ;-) Make the code more readable.
6276 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
6277 the correct type etc.
6279 (ConvertExplicit): Handle Enum types by examining the underlying type.
6281 2001-11-21 Ravi Pratap <ravi@ximian.com>
6283 * parameter.cs (GetCallingConvention): Always return
6284 CallingConventions.Standard for now.
6286 2001-11-22 Miguel de Icaza <miguel@ximian.com>
6288 * expression.cs (Binary.ResolveOperator): Update the values of `l'
6289 and `r' after calling DoNumericPromotions.
6291 * ecore.cs: Fix error message (the types were in the wrong order).
6293 * statement.cs (Foreach.ProbeCollectionType): Need to pass
6294 BindingFlags.Instance as well
6296 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
6297 implicit int literal conversion in an empty cast so that we
6298 propagate the right type upstream.
6300 (UnboxCast): new class used to unbox value types.
6301 (Expression.ConvertExplicit): Add explicit type conversions done
6304 (Expression.ImplicitNumericConversion): Oops, forgot to test for
6305 the target type before applying the implicit LongLiterals to ULong
6308 2001-11-21 Miguel de Icaza <miguel@ximian.com>
6310 * cs-parser.jay (for_statement): Reworked the way For works: now
6311 we declare manually any variables that are introduced in
6312 for_initializer to solve the problem of having out-of-band code
6313 emition (that is what got for broken).
6315 (declaration_statement): Perform the actual variable declaration
6316 that used to be done in local_variable_declaration here.
6318 (local_variable_declaration): Do not declare anything, just pass
6319 the information on a DictionaryEntry
6321 2001-11-20 Ravi Pratap <ravi@ximian.com>
6323 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
6324 re-write of the logic to now make it recursive.
6326 (UpdateIndices): Re-write accordingly.
6328 Store element data in a separate ArrayData list in the above methods.
6330 (MakeByteBlob): Implement to dump the array data into a byte array.
6332 2001-11-19 Ravi Pratap <ravi@ximian.com>
6334 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
6337 * constant.cs (Define): Implement.
6339 (EmitConstant): Re-write fully.
6341 Pass in location info.
6343 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
6346 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
6347 DictionaryEntry since we need location info too.
6349 (constant_declaration): Update accordingly.
6351 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
6352 code into another method : UpdateIndices.
6354 2001-11-18 Ravi Pratap <ravi@ximian.com>
6356 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
6357 some type checking etc.
6359 2001-11-17 Ravi Pratap <ravi@ximian.com>
6361 * expression.cs (ArrayCreation::ValidateInitializers): Implement
6362 bits to provide dimension info if the user skips doing that.
6364 Update second constructor to store the rank correctly.
6366 2001-11-16 Ravi Pratap <ravi@ximian.com>
6368 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
6369 and try to implement.
6371 * ../errors/cs0150.cs : Add.
6373 * ../errors/cs0178.cs : Add.
6375 2001-11-16 Miguel de Icaza <miguel@ximian.com>
6377 * statement.cs: Implement foreach on multi-dimensional arrays.
6379 * parameter.cs (Parameters.GetParameterByName): Also lookup the
6380 name of the params argument.
6382 * expression.cs: Use EmitStoreOpcode to get the right opcode while
6383 initializing the array.
6385 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
6386 we can use this elsewhere.
6388 * statement.cs: Finish implementation of foreach for single
6391 * cs-parser.jay: Use an out-of-band stack to pass information
6392 around, I wonder why I need this.
6394 foreach_block: Make the new foreach_block the current_block.
6396 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
6397 function used to return a static Parameters structure. Used for
6398 empty parameters, as those are created very frequently.
6400 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
6402 2001-11-15 Ravi Pratap <ravi@ximian.com>
6404 * interface.cs : Default modifier is private, not public. The
6405 make verify test passes again.
6407 2001-11-15 Ravi Pratap <ravi@ximian.com>
6409 * support.cs (ReflectionParameters): Fix logic to determine
6410 whether the last parameter is a params one. Test 9 passes again.
6412 * delegate.cs (Populate): Register the builders we define with
6413 RegisterParameterForBuilder. Test 19 passes again.
6415 * cs-parser.jay (property_declaration): Reference $6 instead
6416 of $$ to get at the location.
6418 (indexer_declaration): Similar stuff.
6422 * class.cs (Property): Register parameters for the Get and Set methods
6423 if they exist. Test 23 passes again.
6425 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
6426 call to EmitArguments as we are sure there aren't any params arguments.
6427 Test 32 passes again.
6429 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
6430 IndexOutOfRangeException.
6432 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
6433 Test 33 now passes again.
6435 2001-11-15 Miguel de Icaza <miguel@ximian.com>
6437 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
6438 broke a bunch of things. Will have to come up with a better way
6439 of tracking locations.
6441 * statement.cs: Implemented foreach for single dimension arrays.
6443 2001-11-09 Miguel de Icaza <miguel@ximian.com>
6445 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
6446 an error. This removes the lookup from the critical path.
6448 * cs-parser.jay: Removed use of temporary_loc, which is completely
6451 2001-11-14 Miguel de Icaza <miguel@ximian.com>
6453 * support.cs (ReflectionParameters.ParameterModifier): Report
6454 whether the argument is a PARAMS argument or not.
6456 * class.cs: Set the attribute `ParamArrayAttribute' on the
6459 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
6460 and cons_param_array_attribute (ConstructorInfo for
6461 ParamArrayAttribute).,
6463 * codegen.cs: Emit the return using the `Return' statement, that
6464 way we can report the error correctly for missing return values.
6466 * class.cs (Method.Emit): Clean up.
6468 * expression.cs (Argument.Resolve): Take another argument: the
6469 location where this argument is used. Notice that this is not
6470 part of the "Argument" class as to reduce the size of the
6471 structure (we know the approximate location anyways).
6473 Test if the argument is a variable-reference, if not, then
6474 complain with a 206.
6476 (Argument.Emit): Emit addresses of variables.
6478 (Argument.FullDesc): Simplify.
6480 (Invocation.DoResolve): Update for Argument.Resolve.
6482 (ElementAccess.DoResolve): ditto.
6484 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
6485 method should be virtual, as this method is always virtual.
6487 (NewDelegate.DoResolve): Update for Argument.Resolve.
6489 * class.cs (ConstructorInitializer.DoResolve): ditto.
6491 * attribute.cs (Attribute.Resolve): ditto.
6493 2001-11-13 Miguel de Icaza <miguel@ximian.com>
6495 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
6497 * expression.cs (ParameterReference): Drop IStackStorage and implement
6498 IAssignMethod instead.
6500 (LocalVariableReference): ditto.
6502 * ecore.cs (FieldExpr): Drop IStackStorage and implement
6503 IAssignMethod instead.
6505 2001-11-13 Miguel de Icaza <miguel@ximian.com>
6507 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
6508 enumerations that are used in heavily used structures derive from
6509 byte in a laughable and pathetic attempt to reduce memory usage.
6510 This is the kind of pre-optimzations that you should not do at
6511 home without adult supervision.
6513 * expression.cs (UnaryMutator): New class, used to handle ++ and
6514 -- separatedly from the other unary operators. Cleans up the
6515 code, and kills the ExpressionStatement dependency in Unary.
6517 (Unary): Removed `method' and `Arguments' from this class, making
6518 it smaller, and moving it all to SimpleCall, so I can reuse this
6519 code in other locations and avoid creating a lot of transient data
6520 strucutres when not required.
6522 * cs-parser.jay: Adjust for new changes.
6524 2001-11-11 Miguel de Icaza <miguel@ximian.com>
6526 * enum.cs (Enum.Populate): If there is a failure during
6529 * cs-parser.jay (opt_enum_base): we used to catch type errors
6530 here, but this is really incorrect. The type error should be
6531 catched during semantic analysis.
6533 2001-12-11 Ravi Pratap <ravi@ximian.com>
6535 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
6536 current_local_parameters as expected since I, in my stupidity, had forgotten
6539 * attribute.cs (GetValidPlaces): Fix stupid bug.
6541 * class.cs (Method::Emit): Perform check on applicability of attributes.
6543 (Constructor::Emit): Ditto.
6545 (Field::Emit): Ditto.
6547 (Field.Location): Store location information.
6549 (Property, Event, Indexer, Operator): Ditto.
6551 * cs-parser.jay (field_declaration): Pass in location for each field.
6553 * ../errors/cs0592.cs : Add.
6555 2001-11-12 Ravi Pratap <ravi@ximian.com>
6557 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
6559 (InitCoreTypes): Update accordingly.
6561 (RegisterAttrType, LookupAttr): Implement.
6563 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
6564 info about the same.
6566 (Resolve): Update to populate the above as necessary.
6570 (GetValidPlaces): Helper to the above.
6572 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
6574 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
6576 2001-11-12 Ravi Pratap <ravi@ximian.com>
6578 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
6580 * ../errors/cs0617.cs : Add.
6582 2001-11-11 Ravi Pratap <ravi@ximian.com>
6584 * enum.cs (Emit): Rename to Populate to be more consistent with what
6585 we expect it to do and when exactly it is called.
6587 * class.cs, rootcontext.cs : Update accordingly.
6589 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
6590 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
6592 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
6594 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
6595 of a fieldinfo using the above, when dealing with a FieldBuilder.
6597 2001-11-10 Ravi Pratap <ravi@ximian.com>
6599 * ../errors/cs0031.cs : Add.
6601 * ../errors/cs1008.cs : Add.
6603 * ../errrors/cs0543.cs : Add.
6605 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
6608 (FindMembers): Implement.
6610 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
6611 enums and delegates too.
6613 (enum_types): Rename to builder_to_enum.
6615 (delegate_types): Rename to builder_to_delegate.
6617 * delegate.cs (FindMembers): Implement.
6619 2001-11-09 Ravi Pratap <ravi@ximian.com>
6621 * typemanager.cs (IsEnumType): Implement.
6623 * enum.cs (Emit): Re-write parts to account for the underlying type
6624 better and perform checking etc.
6626 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
6627 of the underlying type.
6629 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
6632 * enum.cs (error31): Helper to report error #31.
6634 * cs-parser.jay (enum_declaration): Store location of each member too.
6636 * enum.cs (member_to_location): New hashtable.
6638 (AddEnumMember): Update location hashtable.
6640 (Emit): Use the location of each member while reporting errors.
6642 2001-11-09 Miguel de Icaza <miguel@ximian.com>
6644 * cs-parser.jay: A for_initializer if is a
6645 local_variable_declaration really ammount to have an implicit
6646 block with the variable declaration and no initializer for for.
6648 * statement.cs (For.Emit): Cope with null initializers.
6650 This fixes the infinite loop on for initializers.
6652 2001-11-08 Miguel de Icaza <miguel@ximian.com>
6654 * enum.cs: More cleanup.
6656 * ecore.cs: Remove dead code.
6658 * class.cs (Property.Emit): More simplification.
6659 (Event.Emit): ditto.
6661 Reworked to have less levels of indentation.
6663 2001-11-08 Ravi Pratap <ravi@ximian.com>
6665 * class.cs (Property): Emit attributes.
6675 * enum.cs (Emit): Ditto.
6677 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
6680 * class.cs (Field, Event, etc.): Move attribute generation into the
6681 Emit method everywhere.
6683 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
6684 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
6685 as we had no way of defining nested enums !
6687 * rootcontext.cs : Adjust code accordingly.
6689 * typemanager.cs (AddEnumType): To keep track of enum types separately.
6691 2001-11-07 Ravi Pratap <ravi@ximian.com>
6693 * expression.cs (EvalConstantExpression): Move into ecore.cs
6695 * enum.cs (Enum): Rename some members and make them public and readonly
6696 according to our convention.
6698 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
6701 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
6703 (Enum::Emit): Write a simple version for now which doesn't try to compute
6704 expressions. I shall modify this to be more robust in just a while.
6706 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
6708 (TypeContainer::CloseType): Create the Enum types too.
6710 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
6712 * expression.cs (EvalConstantExpression): Get rid of completely.
6714 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
6715 user-defined values and other cases.
6717 (IsValidEnumLiteral): Helper function.
6719 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
6720 out there in the case we had a literal FieldExpr.
6722 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
6724 (Literalize): Revamp a bit to take two arguments.
6726 (EnumLiteral): New class which derives from Literal to wrap enum literals.
6728 2001-11-06 Ravi Pratap <ravi@ximian.com>
6730 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
6732 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
6734 (Resolve): Use the above to ensure we have proper initializers.
6736 2001-11-05 Ravi Pratap <ravi@ximian.com>
6738 * expression.cs (Expression::EvalConstantExpression): New method to
6739 evaluate constant expressions.
6741 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
6743 2001-11-07 Miguel de Icaza <miguel@ximian.com>
6745 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
6748 (Binary.ResolveOperator): Handle operator != (object a, object b)
6749 and operator == (object a, object b);
6751 (Binary.DoNumericPromotions): Indicate whether the numeric
6752 promotion was possible.
6754 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
6757 Made the ArrayAccess implement interface IAssignMethod instead of
6758 IStackStore as the order in which arguments are passed reflects
6761 * assign.cs: Instead of using expr.ExprClass to select the way of
6762 assinging, probe for the IStackStore/IAssignMethod interfaces.
6764 * typemanager.cs: Load InitializeArray definition.
6766 * rootcontext.cs (RootContext.MakeStaticData): Used to define
6767 static data that can be used to initialize arrays.
6769 2001-11-05 Miguel de Icaza <miguel@ximian.com>
6771 * expression.cs: Handle operator== and operator!= for booleans.
6773 (Conditioal.Reduce): Implement reducer for the ?: operator.
6775 (Conditional.Resolve): Implement dead code elimination.
6777 (Binary.Resolve): Catch string literals and return a new
6778 concatenated string.
6780 (Unary.Reduce): Implement reduction of unary expressions.
6782 * ecore.cs: Split out the expression core handling here.
6784 (Expression.Reduce): New method used to perform constant folding
6785 and CSE. This is needed to support constant-expressions.
6787 * statement.cs (Statement.EmitBoolExpression): Pass true and false
6788 targets, and optimize for !x.
6790 2001-11-04 Ravi Pratap <ravi@ximian.com>
6792 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
6793 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
6794 set custom atttributes.
6796 * literal.cs (Literal::GetValue): New abstract method to return the actual
6797 value of the literal, cast as an object.
6799 (*Literal): Implement GetValue method.
6801 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
6802 expressions to the arraylist but objects of type Argument.
6804 * class.cs (TypeContainer::Emit): Emit our attributes too.
6806 (Method::Emit, Constructor::Emit): Ditto.
6808 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
6809 to be ignoring earlier.
6811 2001-11-03 Ravi Pratap <ravi@ximian.com>
6813 * attribute.cs (AttributeSection::Define): Implement to do the business
6814 of constructing a CustomAttributeBuilder.
6816 (Attribute): New trivial class. Increases readability of code.
6818 * cs-parser.jay : Update accordingly.
6820 (positional_argument_list, named_argument_list, named_argument): New rules
6822 (attribute_arguments): Use the above so that we are more correct.
6824 2001-11-02 Ravi Pratap <ravi@ximian.com>
6826 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
6827 to perform all checks for a method with a params parameter.
6829 (Invocation::OverloadResolve): Update to use the above method and therefore
6830 cope correctly with params method invocations.
6832 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
6835 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
6836 constructors in our parent too because we can't afford to miss out on
6839 * attribute.cs (AttributeSection): New name for the class Attribute
6841 Other trivial changes to improve readability.
6843 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
6844 use the new class names.
6846 2001-11-01 Ravi Pratap <ravi@ximian.com>
6848 * class.cs (Method::Define): Complete definition for params types too
6850 (Indexer::Define): Ditto.
6852 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
6853 Cope everywhere with a request for info about the array parameter.
6855 2001-11-01 Ravi Pratap <ravi@ximian.com>
6857 * tree.cs (RecordNamespace): Fix up to check for the correct key.
6859 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
6860 local_variable_type to extract the string corresponding to the type.
6862 (local_variable_type): Fixup the action to use the new helper method.
6864 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
6867 * expression.cs : Clean out code which uses the above.
6869 2001-10-31 Ravi Pratap <ravi@ximian.com>
6871 * typemanager.cs (RegisterMethod): Check if we already have an existing key
6872 and bale out if necessary by returning a false.
6874 (RegisterProperty): Ditto.
6876 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
6877 and print out appropriate error messages.
6879 * interface.cs (everywhere): Ditto.
6881 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
6882 location to constructor.
6884 * class.cs (Property, Event, Indexer): Update accordingly.
6886 * ../errors/cs111.cs : Added.
6888 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
6889 of a method, as laid down by the spec.
6891 (Invocation::OverloadResolve): Use the above method.
6893 2001-10-31 Ravi Pratap <ravi@ximian.com>
6895 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
6896 now take a TypeContainer and a Parameters object.
6898 (ParameterData): Modify return type of ParameterModifier method to be
6899 Parameter.Modifier and not a string.
6901 (ReflectionParameters, InternalParameters): Update accordingly.
6903 * expression.cs (Argument::GetParameterModifier): Same here.
6905 * support.cs (InternalParameters::ParameterType): Find a better way of determining
6906 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
6907 symbol in it at all so maybe this is only for now.
6909 2001-10-30 Ravi Pratap <ravi@ximian.com>
6911 * support.cs (InternalParameters): Constructor now takes an extra argument
6912 which is the actual Parameters class.
6914 (ParameterDesc): Update to provide info on ref/out modifiers.
6916 * class.cs (everywhere): Update call to InternalParameters to pass in
6917 the second argument too.
6919 * support.cs (ParameterData): Add ParameterModifier, which is a method
6920 to return the modifier info [ref/out etc]
6922 (InternalParameters, ReflectionParameters): Implement the above.
6924 * expression.cs (Argument::ParameterModifier): Similar function to return
6925 info about the argument's modifiers.
6927 (Invocation::OverloadResolve): Update to take into account matching modifiers
6930 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
6931 a new SetFormalParameters object which we pass to InternalParameters.
6933 2001-10-30 Ravi Pratap <ravi@ximian.com>
6935 * expression.cs (NewArray): Merge into the ArrayCreation class.
6937 2001-10-29 Ravi Pratap <ravi@ximian.com>
6939 * expression.cs (NewArray): Merge classes NewBuiltinArray and
6940 NewUserdefinedArray into one as there wasn't much of a use in having
6943 * expression.cs (Argument): Change field's name to ArgType from Type.
6945 (Type): New readonly property which returns the proper type, taking into
6946 account ref/out modifiers.
6948 (everywhere): Adjust code accordingly for the above.
6950 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
6951 whether we are emitting for a ref or out parameter.
6953 * expression.cs (Argument::Emit): Use the above field to set the state.
6955 (LocalVariableReference::Emit): Update to honour the flag and emit the
6958 * parameter.cs (Attributes): Set the correct flags for ref parameters.
6960 * expression.cs (Argument::FullDesc): New function to provide a full desc.
6962 * support.cs (ParameterData): Add method ParameterDesc to the interface.
6964 (ReflectionParameters, InternalParameters): Implement the above method.
6966 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
6969 (Invocation::FullMethodDesc): Ditto.
6971 2001-10-29 Miguel de Icaza <miguel@ximian.com>
6973 * cs-parser.jay: Add extra production for the second form of array
6976 * expression.cs (ArrayCreation): Update to reflect the above
6979 * Small changes to prepare for Array initialization.
6981 2001-10-28 Miguel de Icaza <miguel@ximian.com>
6983 * typemanager.cs (ImplementsInterface): interface might be null;
6984 Deal with this problem;
6986 Also, we do store negative hits on the cache (null values), so use
6987 this instead of calling t.GetInterfaces on the type everytime.
6989 2001-10-28 Ravi Pratap <ravi@ximian.com>
6991 * typemanager.cs (IsBuiltinType): New method to help determine the same.
6993 * expression.cs (New::DoResolve): Get rid of array creation code and instead
6994 split functionality out into different classes.
6996 (New::FormArrayType): Move into NewBuiltinArray.
6998 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
7001 (NewBuiltinArray): New class to handle creation of built-in arrays.
7003 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
7004 account creation of one-dimensional arrays.
7006 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
7008 (NewUserdefinedArray::DoResolve): Implement.
7010 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
7012 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
7013 we maintain inside the TypeManager. This is necessary to perform lookups on the
7016 (LookupType): Update to perform GetType on the module builders too.
7018 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
7020 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
7022 2001-10-23 Ravi Pratap <ravi@ximian.com>
7024 * expression.cs (New::DoResolve): Implement guts of array creation.
7026 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
7028 2001-10-27 Miguel de Icaza <miguel@ximian.com>
7030 * expression.cs: Fix bug I introduced lsat night that broke
7033 (Expression.Resolve): Report a 246 error (can not resolve name)
7034 if we find a SimpleName in the stream.
7036 (Expression.ResolveLValue): Ditto.
7038 (Expression.ResolveWithSimpleName): This function is a variant of
7039 ResolveName, this one allows SimpleNames to be returned without a
7040 warning. The only consumer of SimpleNames is MemberAccess
7042 2001-10-26 Miguel de Icaza <miguel@ximian.com>
7044 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
7045 might arrive here. I have my doubts that this is correct.
7047 * statement.cs (Lock): Implement lock statement.
7049 * cs-parser.jay: Small fixes to support `lock' and `using'
7051 * cs-tokenizer.cs: Remove extra space
7053 * driver.cs: New flag --checked, allows to turn on integer math
7056 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
7057 Threading.Monitor.Exit
7059 2001-10-23 Miguel de Icaza <miguel@ximian.com>
7061 * expression.cs (IndexerAccess::DoResolveLValue): Set the
7062 Expression Class to be IndexerAccess.
7064 Notice that Indexer::DoResolve sets the eclass to Value.
7066 2001-10-22 Miguel de Icaza <miguel@ximian.com>
7068 * class.cs (TypeContainer::Emit): Emit code for indexers.
7070 * assign.cs (IAssignMethod): New interface implemented by Indexers
7071 and Properties for handling assignment.
7073 (Assign::Emit): Simplify and reuse code.
7075 * expression.cs (IndexerAccess, PropertyExpr): Implement
7076 IAssignMethod, clean up old code.
7078 2001-10-22 Ravi Pratap <ravi@ximian.com>
7080 * typemanager.cs (ImplementsInterface): New method to determine if a type
7081 implements a given interface. Provides a nice cache too.
7083 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
7086 (ConvertReferenceExplicit): Ditto.
7088 * delegate.cs (Delegate::Populate): Update to define the parameters on the
7089 various methods, with correct names etc.
7091 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
7092 Operator.UnaryNegation.
7094 * cs-parser.jay (operator_declarator): Be a little clever in the case where
7095 we have a unary plus or minus operator.
7097 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
7100 * everywhere : update accordingly.
7102 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
7105 * class.cs (Method::Define): For the case where we are implementing a method
7106 inherited from an interface, we need to set the MethodAttributes.Final flag too.
7107 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
7109 2001-10-21 Ravi Pratap <ravi@ximian.com>
7111 * interface.cs (FindMembers): Implement to work around S.R.E
7114 * typemanager.cs (IsInterfaceType): Implement.
7116 (FindMembers): Update to handle interface types too.
7118 * expression.cs (ImplicitReferenceConversion): Re-write bits which
7119 use IsAssignableFrom as that is not correct - it doesn't work.
7121 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
7122 and accordingly override EmitStatement.
7124 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
7125 using the correct logic :-)
7127 2001-10-19 Ravi Pratap <ravi@ximian.com>
7129 * ../errors/cs-11.cs : Add to demonstrate error -11
7131 2001-10-17 Miguel de Icaza <miguel@ximian.com>
7133 * assign.cs (Assign::Resolve): Resolve right hand side first, and
7134 then pass this as a hint to ResolveLValue.
7136 * expression.cs (FieldExpr): Add Location information
7138 (FieldExpr::LValueResolve): Report assignment to readonly
7141 (Expression::ExprClassFromMemberInfo): Pass location information.
7143 (Expression::ResolveLValue): Add new method that resolves an
7146 (Expression::DoResolveLValue): Default invocation calls
7149 (Indexers): New class used to keep track of indexers in a given
7152 (IStackStore): Renamed from LValue, as it did not really describe
7153 what this did. Also ResolveLValue is gone from this interface and
7154 now is part of Expression.
7156 (ElementAccess): Depending on the element access type
7158 * typemanager.cs: Add `indexer_name_type' as a Core type
7159 (System.Runtime.CompilerServices.IndexerNameAttribute)
7161 * statement.cs (Goto): Take a location.
7163 2001-10-18 Ravi Pratap <ravi@ximian.com>
7165 * delegate.cs (Delegate::VerifyDelegate): New method to verify
7166 if two delegates are compatible.
7168 (NewDelegate::DoResolve): Update to take care of the case when
7169 we instantiate a delegate from another delegate.
7171 * typemanager.cs (FindMembers): Don't even try to look up members
7172 of Delegate types for now.
7174 2001-10-18 Ravi Pratap <ravi@ximian.com>
7176 * delegate.cs (NewDelegate): New class to take care of delegate
7179 * expression.cs (New): Split the delegate related code out into
7180 the NewDelegate class.
7182 * delegate.cs (DelegateInvocation): New class to handle delegate
7185 * expression.cs (Invocation): Split out delegate related code into
7186 the DelegateInvocation class.
7188 2001-10-17 Ravi Pratap <ravi@ximian.com>
7190 * expression.cs (New::DoResolve): Implement delegate creation fully
7191 and according to the spec.
7193 (New::DoEmit): Update to handle delegates differently.
7195 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
7196 because of which we were printing out arguments in reverse order !
7198 * delegate.cs (VerifyMethod): Implement to check if the given method
7199 matches the delegate.
7201 (FullDelegateDesc): Implement.
7203 (VerifyApplicability): Implement.
7205 * expression.cs (Invocation::DoResolve): Update to accordingly handle
7206 delegate invocations too.
7208 (Invocation::Emit): Ditto.
7210 * ../errors/cs1593.cs : Added.
7212 * ../errors/cs1594.cs : Added.
7214 * delegate.cs (InstanceExpression, TargetMethod): New properties.
7216 2001-10-16 Ravi Pratap <ravi@ximian.com>
7218 * typemanager.cs (intptr_type): Core type for System.IntPtr
7220 (InitCoreTypes): Update for the same.
7222 (iasyncresult_type, asynccallback_type): Ditto.
7224 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
7227 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
7230 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
7231 the builders for the 4 members of a delegate type :-)
7233 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
7236 * expression.cs (New::DoResolve): Implement guts for delegate creation.
7238 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
7240 2001-10-15 Miguel de Icaza <miguel@ximian.com>
7242 * statement.cs (Break::Emit): Implement.
7243 (Continue::Emit): Implement.
7245 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
7246 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
7247 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
7248 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
7251 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
7252 properties that track the label for the current loop (begin of the
7253 loop and end of the loop).
7255 2001-10-15 Ravi Pratap <ravi@ximian.com>
7257 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
7258 use of emitting anything at all.
7260 * class.cs, rootcontext.cs : Get rid of calls to the same.
7262 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
7264 (Populate): Define the constructor correctly and set the implementation
7267 * typemanager.cs (delegate_types): New hashtable to hold delegates that
7270 (AddDelegateType): Implement.
7272 (IsDelegateType): Implement helper method.
7274 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
7276 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
7277 and accordingly handle it.
7279 * delegate.cs (Populate): Take TypeContainer argument.
7280 Implement bits to define the Invoke method. However, I still haven't figured out
7281 how to take care of the native int bit :-(
7283 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
7284 Qualify the name of the delegate, not its return type !
7286 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
7289 (StandardConversionExists): Checking for array types turns out to be recursive.
7291 (ConvertReferenceExplicit): Implement array conversion.
7293 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
7295 2001-10-12 Ravi Pratap <ravi@ximian.com>
7297 * cs-parser.jay (delegate_declaration): Store the fully qualified
7298 name as it is a type declaration.
7300 * delegate.cs (ReturnType, Name): Rename members to these. Make them
7303 (DefineDelegate): Renamed from Define. Does the same thing essentially,
7304 as TypeContainer::DefineType.
7306 (Populate): Method in which all the definition of the various methods (Invoke)
7309 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
7312 (CloseDelegate): Finally creates the delegate.
7314 * class.cs (TypeContainer::DefineType): Update to define delegates.
7315 (Populate, Emit and CloseType): Do the same thing here too.
7317 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
7318 delegates in all these operations.
7320 2001-10-14 Miguel de Icaza <miguel@ximian.com>
7322 * expression.cs: LocalTemporary: a new expression used to
7323 reference a temporary that has been created.
7325 * assign.cs: Handle PropertyAccess back here, so that we can
7326 provide the proper semantic access to properties.
7328 * expression.cs (Expression::ConvertReferenceExplicit): Implement
7329 a few more explicit conversions.
7331 * modifiers.cs: `NEW' modifier maps to HideBySig.
7333 * expression.cs (PropertyExpr): Make this into an
7334 ExpressionStatement, and support the EmitStatement code path.
7336 Perform get/set error checking, clean up the interface.
7338 * assign.cs: recognize PropertyExprs as targets, and if so, turn
7339 them into toplevel access objects.
7341 2001-10-12 Miguel de Icaza <miguel@ximian.com>
7343 * expression.cs: PropertyExpr::PropertyExpr: use work around the
7346 * typemanager.cs: Keep track here of our PropertyBuilders again to
7347 work around lameness in SRE.
7349 2001-10-11 Miguel de Icaza <miguel@ximian.com>
7351 * expression.cs (LValue::LValueResolve): New method in the
7352 interface, used to perform a second resolution pass for LValues.
7354 (This::DoResolve): Catch the use of this in static methods.
7356 (This::LValueResolve): Implement.
7358 (This::Store): Remove warning, assigning to `this' in structures
7361 (Invocation::Emit): Deal with invocation of
7362 methods on value types. We need to pass the address to structure
7363 methods rather than the object itself. (The equivalent code to
7364 emit "this" for structures leaves the entire structure on the
7365 stack instead of a pointer to it).
7367 (ParameterReference::DoResolve): Compute the real index for the
7368 argument based on whether the method takes or not a `this' pointer
7369 (ie, the method is static).
7371 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
7372 value types returned from functions when we need to invoke a
7373 method on the sturcture.
7376 2001-10-11 Ravi Pratap <ravi@ximian.com>
7378 * class.cs (TypeContainer::DefineType): Method to actually do the business of
7379 defining the type in the Modulebuilder or Typebuilder. This is to take
7380 care of nested types which need to be defined on the TypeBuilder using
7383 (TypeContainer::GetClassBases): Implement. Essentially the code from the
7384 methods in RootContext, only ported to be part of TypeContainer.
7386 (TypeContainer::GetInterfaceOrClass): Ditto.
7388 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
7390 * interface.cs (Interface::DefineInterface): New method. Does exactly
7391 what RootContext.CreateInterface did earlier, only it takes care of nested types
7394 (Interface::GetInterfaces): Move from RootContext here and port.
7396 (Interface::GetInterfaceByName): Same here.
7398 * rootcontext.cs (ResolveTree): Re-write.
7400 (PopulateTypes): Re-write.
7402 * class.cs (TypeContainer::Populate): Populate nested types too.
7403 (TypeContainer::Emit): Emit nested members too.
7405 * typemanager.cs (AddUserType): Do not make use of the FullName property,
7406 instead just use the name argument passed in as it is already fully
7409 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
7410 to TypeContainer mapping to see if a type is user-defined.
7412 * class.cs (TypeContainer::CloseType): Implement.
7414 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
7415 the default constructor.
7417 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
7420 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
7422 * interface.cs (CloseType): Create the type here.
7424 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
7427 Remove all the methods which are now in TypeContainer.
7429 2001-10-10 Ravi Pratap <ravi@ximian.com>
7431 * delegate.cs (Define): Re-write bits to define the delegate
7434 2001-10-10 Miguel de Icaza <miguel@ximian.com>
7436 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
7438 * expression.cs (ImplicitReferenceConversion): handle null as well
7439 as a source to convert to any reference type.
7441 * statement.cs (Return): Perform any implicit conversions to
7442 expected return type.
7444 Validate use of return statement.
7446 * codegen.cs (EmitContext): Pass the expected return type here.
7448 * class.cs (Method, Constructor, Property): Pass expected return
7449 type to EmitContext.
7451 2001-10-09 Miguel de Icaza <miguel@ximian.com>
7453 * expression.cs: Make DoResolve take an EmitContext instead of a
7456 Replaced `l' and `location' for `loc', for consistency.
7458 (Error, Warning): Remove unneeded Tc argument.
7460 * assign.cs, literal.cs, constant.cs: Update to new calling
7463 * codegen.cs: EmitContext now contains a flag indicating whether
7464 code is being generated in a static method or not.
7466 * cs-parser.jay: DecomposeQI, new function that replaces the old
7467 QualifiedIdentifier. Now we always decompose the assembled
7468 strings from qualified_identifier productions into a group of
7471 2001-10-08 Miguel de Icaza <miguel@ximian.com>
7473 * rootcontext.cs: Deal with field-less struct types correctly now
7474 by passing the size option to Define Type.
7476 * class.cs: Removed hack that created one static field.
7478 2001-10-07 Miguel de Icaza <miguel@ximian.com>
7480 * statement.cs: Moved most of the code generation here.
7482 2001-10-09 Ravi Pratap <ravi@ximian.com>
7484 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
7487 (ElementAccess): Remove useless bits for now - keep checks as the spec
7490 2001-10-08 Ravi Pratap <ravi@ximian.com>
7492 * expression.cs (ElementAccess::DoResolve): Remove my crap code
7493 and start performing checks according to the spec.
7495 2001-10-07 Ravi Pratap <ravi@ximian.com>
7497 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
7498 rank_specifiers instead.
7500 (rank_specifiers): Change the order in which the rank specifiers are stored
7502 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
7504 * expression.cs (ElementAccess): Implement the LValue interface too.
7506 2001-10-06 Ravi Pratap <ravi@ximian.com>
7508 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
7509 except that user defined conversions are not included.
7511 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
7512 perform the conversion of the return type, if necessary.
7514 (New::DoResolve): Check whether we are creating an array or an object
7515 and accordingly do the needful.
7517 (New::Emit): Same here.
7519 (New::DoResolve): Implement guts of array creation.
7521 (New::FormLookupType): Helper function.
7523 2001-10-07 Miguel de Icaza <miguel@ximian.com>
7525 * codegen.cs: Removed most of the code generation here, and move the
7526 corresponding code generation bits to the statement classes.
7528 Added support for try/catch/finalize and throw.
7530 * cs-parser.jay: Added support for try/catch/finalize.
7532 * class.cs: Catch static methods having the flags override,
7533 virtual or abstract.
7535 * expression.cs (UserCast): This user cast was not really doing
7536 what it was supposed to do. Which is to be born in fully resolved
7537 state. Parts of the resolution were being performed at Emit time!
7541 2001-10-05 Miguel de Icaza <miguel@ximian.com>
7543 * expression.cs: Implicity convert the result from UserCast.
7545 2001-10-05 Ravi Pratap <ravi@ximian.com>
7547 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
7548 prevented it from working correctly.
7550 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
7551 merely ConvertImplicit.
7553 2001-10-05 Miguel de Icaza <miguel@ximian.com>
7555 * typemanager.cs: Make the LookupTypeContainer function static,
7556 and not per-instance.
7558 * class.cs: Make static FindMembers (the one that takes a Type
7561 * codegen.cs: Add EmitForeach here.
7563 * cs-parser.jay: Make foreach a toplevel object instead of the
7564 inline expansion, as we need to perform semantic analysis on it.
7566 2001-10-05 Ravi Pratap <ravi@ximian.com>
7568 * expression.cs (Expression::ImplicitUserConversion): Rename to
7569 UserDefinedConversion.
7571 (Expression::UserDefinedConversion): Take an extra argument specifying
7572 whether we look for explicit user conversions too.
7574 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
7576 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
7578 (ExplicitUserConversion): Make it a call to UserDefinedConversion
7579 with the appropriate arguments.
7581 * cs-parser.jay (cast_expression): Record location too.
7583 * expression.cs (Cast): Record location info.
7585 (Expression::ConvertExplicit): Take location argument.
7587 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
7588 to determine if we are doing explicit conversions.
7590 (UserCast::Emit): Update accordingly.
7592 (Expression::ConvertExplicit): Report an error if everything fails.
7594 * ../errors/cs0030.cs : Add.
7596 2001-10-04 Miguel de Icaza <miguel@ximian.com>
7598 * modifiers.cs: If the ABSTRACT keyword is present, also set the
7599 virtual and newslot bits.
7601 * class.cs (TypeContainer::RegisterRequiredImplementations):
7602 Record methods we need.
7604 (TypeContainer::MakeKey): Helper function to make keys for
7605 MethodBases, since the Methodbase key is useless.
7607 (TypeContainer::Populate): Call RegisterRequiredImplementations
7608 before defining the methods.
7610 Create a mapping for method_builders_to_methods ahead of time
7611 instead of inside a tight loop.
7613 (::RequireMethods): Accept an object as the data to set into the
7614 hashtable so we can report interface vs abstract method mismatch.
7616 2001-10-03 Miguel de Icaza <miguel@ximian.com>
7618 * report.cs: Make all of it static.
7620 * rootcontext.cs: Drop object_type and value_type computations, as
7621 we have those in the TypeManager anyways.
7623 Drop report instance variable too, now it is a global.
7625 * driver.cs: Use try/catch on command line handling.
7627 Add --probe option to debug the error reporting system with a test
7630 * report.cs: Add support for exiting program when a probe
7631 condition is reached.
7633 2001-10-03 Ravi Pratap <ravi@ximian.com>
7635 * expression.cs (Binary::DoNumericPromotions): Fix the case when
7636 we do a forcible conversion regardless of type, to check if
7637 ForceConversion returns a null.
7639 (Binary::error19): Use location to report error.
7641 (Unary::error23): Use location here too.
7643 * ../errors/cs0019.cs : Check in.
7645 * ../errors/cs0023.cs : Check in.
7647 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
7648 case of a non-null MethodInfo object with a length of 0 !
7650 (Binary::ResolveOperator): Flag error if overload resolution fails to find
7651 an applicable member - according to the spec :-)
7652 Also fix logic to find members in base types.
7654 (Unary::ResolveOperator): Same here.
7656 (Unary::report23): Change name to error23 and make first argument a TypeContainer
7657 as I was getting thoroughly confused between this and error19 :-)
7659 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
7660 (::FindMostEncompassedType): Implement.
7661 (::FindMostEncompassingType): Implement.
7662 (::StandardConversionExists): Implement.
7664 (UserImplicitCast): Re-vamp. We now need info about most specific
7665 source and target types so that we can do the necessary conversions.
7667 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
7668 mathematical union with no duplicates.
7670 2001-10-03 Miguel de Icaza <miguel@ximian.com>
7672 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
7673 in order from base classes to child classes, so that we can in
7674 child classes look up in our parent for method names and
7675 attributes (required for handling abstract, virtual, new, override
7676 constructs: we need to instrospect our base class, and if we dont
7677 populate the classes in order, the introspection might be
7678 incorrect. For example, a method could query its parent before
7679 the parent has any methods and would determine that the parent has
7680 no abstract methods (while it could have had them)).
7682 (RootContext::CreateType): Record the order in which we define the
7685 2001-10-02 Miguel de Icaza <miguel@ximian.com>
7687 * class.cs (TypeContainer::Populate): Also method definitions can
7688 fail now, keep track of this.
7690 (TypeContainer::FindMembers): Implement support for
7691 DeclaredOnly/noDeclaredOnly flag.
7693 (Constructor::Emit) Return the ConstructorBuilder.
7695 (Method::Emit) Return the MethodBuilder.
7696 Check for abstract or virtual methods to be public.
7698 * rootcontext.cs (RootContext::CreateType): Register all the
7699 abstract methods required for the class to be complete and the
7700 interface methods that must be implemented.
7702 * cs-parser.jay: Report error 501 (method requires body if it is
7703 not marked abstract or extern).
7705 * expression.cs (TypeOf::Emit): Implement.
7707 * typemanager.cs: runtime_handle_type, new global type.
7709 * class.cs (Property::Emit): Generate code for properties.
7711 2001-10-02 Ravi Pratap <ravi@ximian.com>
7713 * expression.cs (Unary::ResolveOperator): Find operators on base type
7714 too - we now conform exactly to the spec.
7716 (Binary::ResolveOperator): Same here.
7718 * class.cs (Operator::Define): Fix minor quirk in the tests.
7720 * ../errors/cs0215.cs : Added.
7722 * ../errors/cs0556.cs : Added.
7724 * ../errors/cs0555.cs : Added.
7726 2001-10-01 Miguel de Icaza <miguel@ximian.com>
7728 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
7729 single integer which is really efficient
7731 2001-10-01 Ravi Pratap <ravi@ximian.com>
7733 * expression.cs (Expression::ImplicitUserConversion): Use location
7734 even in the case when we are examining True operators.
7736 * class.cs (Operator::Define): Perform extensive checks to conform
7737 with the rules for operator overloading in the spec.
7739 * expression.cs (Expression::ImplicitReferenceConversion): Implement
7740 some of the other conversions mentioned in the spec.
7742 * typemanager.cs (array_type): New static member for the System.Array built-in
7745 (cloneable_interface): For System.ICloneable interface.
7747 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
7748 we start resolving the tree and populating types.
7750 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
7752 2001-10-01 Miguel de Icaza <miguel@ximian.com>
7754 * expression.cs (Expression::ExprClassFromMemberInfo,
7755 Expression::Literalize): Create literal expressions from
7756 FieldInfos which are literals.
7758 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
7759 type casts, because they were wrong. The test suite in tests
7762 (ImplicitNumericConversion): ushort to ulong requires a widening
7765 Int32 constant to long requires widening cast as well.
7767 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
7768 for integers because the type on the stack is not i4.
7770 2001-09-30 Miguel de Icaza <miguel@ximian.com>
7772 * expression.cs (report118): require location argument.
7774 * parameter.cs: Do not dereference potential null value.
7776 * class.cs: Catch methods that lack the `new' keyword when
7777 overriding a name. Report warnings when `new' is used without
7778 anything being there to override.
7780 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
7782 * class.cs: Only add constructor to hashtable if it is non-null
7783 (as now constructors can fail on define).
7785 (TypeManager, Class, Struct): Take location arguments.
7787 Catch field instance initialization in structs as errors.
7789 accepting_filter: a new filter for FindMembers that is static so
7790 that we dont create an instance per invocation.
7792 (Constructor::Define): Catch errors where a struct constructor is
7795 * cs-parser.jay: Pass location information for various new
7798 * delegate.cs (Delegate): take a location argument.
7800 * driver.cs: Do not call EmitCode if there were problesm in the
7801 Definition of the types, as many Builders wont be there.
7803 * decl.cs (Decl::Decl): Require a location argument.
7805 * cs-tokenizer.cs: Handle properly hex constants that can not fit
7806 into integers, and find the most appropiate integer for it.
7808 * literal.cs: Implement ULongLiteral.
7810 * rootcontext.cs: Provide better information about the location of
7811 failure when CreateType fails.
7813 2001-09-29 Miguel de Icaza <miguel@ximian.com>
7815 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
7818 * expression.cs (Binary::CheckShiftArguments): Add missing type
7820 (Binary::ResolveOperator): Add type to the logical and and logical
7821 or, Bitwise And/Or and Exclusive Or code paths, it was missing
7824 (Binary::DoNumericPromotions): In the case where either argument
7825 is ulong (and most signed types combined with ulong cause an
7826 error) perform implicit integer constant conversions as well.
7828 2001-09-28 Miguel de Icaza <miguel@ximian.com>
7830 * expression.cs (UserImplicitCast): Method should always be
7832 (Invocation::BetterConversion): Simplified test for IntLiteral.
7834 (Expression::ImplicitNumericConversion): Split this routine out.
7835 Put the code that performs implicit constant integer conversions
7838 (Expression::Resolve): Become a wrapper around DoResolve so we can
7839 check eclass and type being set after resolve.
7841 (Invocation::Badness): Remove this dead function
7843 (Binary::ResolveOperator): Do not compute the expensive argumnets
7844 unless we have a union for it.
7846 (Probe::Emit): Is needs to do an isinst and then
7847 compare against null.
7849 (::CanConvert): Added Location argument. If the Location argument
7850 is null (Location.Null), then we do not report errors. This is
7851 used by the `probe' mechanism of the Explicit conversion. We do
7852 not want to generate an error for something that the user
7853 explicitly requested to be casted. But the pipeline for an
7854 explicit cast first tests for potential implicit casts.
7856 So for now, if the Location is null, it means `Probe only' to
7857 avoid adding another argument. Might have to revise this
7860 (ClassCast): New class used to type cast objects into arbitrary
7861 classes (used in Explicit Reference Conversions).
7863 Implement `as' as well.
7865 Reverted all the patches from Ravi below: they were broken:
7867 * The use of `level' as a mechanism to stop recursive
7868 invocations is wrong. That was there just to catch the
7869 bug with a strack trace but not as a way of addressing
7872 To fix the problem we have to *understand* what is going
7873 on and the interactions and come up with a plan, not
7874 just get things going.
7876 * The use of the type conversion cache that I proposed
7877 last night had an open topic: How does this work across
7878 protection domains. A user defined conversion might not
7879 be public in the location where we are applying the
7880 conversion, a different conversion might be selected
7881 (ie, private A->B (better) but public B->A (worse),
7882 inside A, A->B applies, but outside it, B->A will
7885 * On top of that (ie, even if the above is solved),
7886 conversions in a cache need to be abstract. Ie, `To
7887 convert from an Int to a Short use an OpcodeCast', not
7888 `To convert from an Int to a Short use the OpcodeCast on
7889 the variable 5' (which is what this patch was doing).
7891 2001-09-28 Ravi Pratap <ravi@ximian.com>
7893 * expression.cs (Invocation::ConversionExists): Re-write to use
7894 the conversion cache
7896 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
7897 cache all conversions done, not just user-defined ones.
7899 (Invocation::BetterConversion): The real culprit. Use ConversionExists
7900 to determine if a conversion exists instead of acutually trying to
7901 perform the conversion. It's faster too.
7903 (Expression::ConvertExplicit): Modify to use ConversionExists to check
7904 and only then attempt the implicit conversion.
7906 2001-09-28 Ravi Pratap <ravi@ximian.com>
7908 * expression.cs (ConvertImplicit): Use a cache for conversions
7909 already found. Check level of recursion and bail out if necessary.
7911 2001-09-28 Miguel de Icaza <miguel@ximian.com>
7913 * typemanager.cs (string_concat_string_string, string_concat_object_object):
7914 Export standard methods that we expect for string operations.
7916 * statement.cs (Block::UsageWarning): Track usage of variables and
7917 report the errors for not used variables.
7919 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
7922 2001-09-27 Miguel de Icaza <miguel@ximian.com>
7924 * codegen.cs: remove unnneded code
7926 * expression.cs: Removed BuiltinTypeAccess class
7928 Fix the order in which implicit conversions are
7931 The previous fixed dropped support for boxed conversions (adding a
7932 test to the test suite now)
7934 (UserImplicitCast::CanConvert): Remove test for source being null,
7935 that code is broken. We should not feed a null to begin with, if
7936 we do, then we should track the bug where the problem originates
7937 and not try to cover it up here.
7939 Return a resolved expression of type UserImplicitCast on success
7940 rather than true/false. Ravi: this is what I was talking about,
7941 the pattern is to use a static method as a "constructor" for
7944 Also, do not create arguments until the very last minute,
7945 otherwise we always create the arguments even for lookups that
7946 will never be performed.
7948 (UserImplicitCast::Resolve): Eliminate, objects of type
7949 UserImplicitCast are born in a fully resolved state.
7951 * typemanager.cs (InitCoreTypes): Init also value_type
7954 * expression.cs (Cast::Resolve): First resolve the child expression.
7956 (LValue): Add new method AddressOf to be used by
7959 Change the argument of Store to take an EmitContext instead of an
7960 ILGenerator, because things like FieldExpr need to be able to call
7961 their children expression to generate the instance code.
7963 (Expression::Error, Expression::Warning): Sugar functions for
7966 (Expression::MemberLookup): Accept a TypeContainer instead of a
7967 Report as the first argument.
7969 (Expression::ResolvePrimary): Killed. I still want to improve
7970 this as currently the code is just not right.
7972 (Expression::ResolveMemberAccess): Simplify, but it is still
7975 (Unary::Resolve): Catch errors in AddressOf operators.
7977 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
7978 index to a byte for the short-version, or the compiler will choose
7979 the wrong Emit call, which generates the wrong data.
7981 (ParameterReference::Emit, ::Store): same.
7983 (FieldExpr::AddressOf): Implement.
7985 * typemanager.cs: TypeManager: made public variable instead of
7988 * driver.cs: document --fatal.
7990 * report.cs (ErrorMessage, WarningMessage): new names for the old
7991 Error and Warning classes.
7993 * cs-parser.jay (member_access): Turn built-in access to types
7994 into a normal simplename
7996 2001-09-27 Ravi Pratap <ravi@ximian.com>
7998 * expression.cs (Invocation::BetterConversion): Fix to cope
7999 with q being null, since this was introducing a bug.
8001 * expression.cs (ConvertImplicit): Do built-in conversions first.
8003 2001-09-27 Ravi Pratap <ravi@ximian.com>
8005 * expression.cs (UserImplicitCast::Resolve): Fix bug.
8007 2001-09-27 Ravi Pratap <ravi@ximian.com>
8009 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
8010 I had introduced long ago (what's new ?).
8012 * expression.cs (UserImplicitCast::CanConvert): Static method to do
8013 the work of all the checking.
8014 (ConvertImplicit): Call CanConvert and only then create object if necessary.
8015 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
8017 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
8018 that is the right way.
8020 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
8021 overloading resolution. Use everywhere instead of cutting and pasting code.
8023 (Binary::ResolveOperator): Use MakeUnionSet.
8025 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
8026 we have to convert to bool types. Not complete yet.
8028 2001-09-27 Miguel de Icaza <miguel@ximian.com>
8030 * typemanager.cs (TypeManager::CSharpName): support ushort.
8032 * expression.cs (Expression::TryImplicitIntConversion): Attempts
8033 to provide an expression that performsn an implicit constant int
8034 conversion (section 6.1.6).
8035 (Expression::ConvertImplicitRequired): Reworked to include
8036 implicit constant expression conversions.
8038 (Expression::ConvertNumericExplicit): Finished.
8040 (Invocation::Emit): If InstanceExpression is null, then it means
8041 that we perform a call on this.
8043 2001-09-26 Miguel de Icaza <miguel@ximian.com>
8045 * expression.cs (Unary::Emit): Remove some dead code.
8046 (Probe): Implement Resolve and Emit for `is'.
8047 (Expression::ConvertImplicitRequired): Attempt to do constant
8048 expression conversions here. Maybe should be moved to
8049 ConvertImplicit, but I am not sure.
8050 (Expression::ImplicitLongConstantConversionPossible,
8051 Expression::ImplicitIntConstantConversionPossible): New functions
8052 that tell whether is it possible to apply an implicit constant
8053 expression conversion.
8055 (ConvertNumericExplicit): Started work on explicit numeric
8058 * cs-parser.jay: Update operator constants.
8060 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
8061 (Parameters::GetSignature): Hook up VerifyArgs here.
8062 (Parameters::VerifyArgs): Verifies that no two arguments have the
8065 * class.cs (Operator): Update the operator names to reflect the
8066 ones that the spec expects (as we are just stringizing the
8069 * expression.cs (Unary::ResolveOperator): Fix bug: Use
8070 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
8071 previous usage did only work for our methods.
8072 (Expression::ConvertImplicit): Handle decimal implicit numeric
8073 conversions as well.
8074 (Expression::InternalTypeConstructor): Used to invoke constructors
8075 on internal types for default promotions.
8077 (Unary::Emit): Implement special handling for the pre/post
8078 increment/decrement for overloaded operators, as they need to have
8079 the same semantics as the other operators.
8081 (Binary::ResolveOperator): ditto.
8082 (Invocation::ConversionExists): ditto.
8083 (UserImplicitCast::Resolve): ditto.
8085 2001-09-26 Ravi Pratap <ravi@ximian.com>
8087 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
8088 operator, return after emitting body. Regression tests pass again !
8090 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
8091 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
8092 (Invocation::OverloadResolve): Ditto.
8093 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
8095 * everywhere : update calls to the above methods accordingly.
8097 2001-09-26 Miguel de Icaza <miguel@ximian.com>
8099 * assign.cs (Assign): Make it inherit from ExpressionStatement.
8101 * expression.cs (ExpressionStatement): New base class used for
8102 expressions that can appear in statements, so that we can provide
8103 an alternate path to generate expression that do not leave a value
8106 (Expression::Emit, and all the derivatives): We no longer return
8107 whether a value is left on the stack or not. Every expression
8108 after being emitted leaves a single value on the stack.
8110 * codegen.cs (EmitContext::EmitStatementExpression): Use the
8111 facilties of ExpressionStatement if possible.
8113 * cs-parser.jay: Update statement_expression.
8115 2001-09-25 Miguel de Icaza <miguel@ximian.com>
8117 * driver.cs: Change the wording of message
8119 2001-09-25 Ravi Pratap <ravi@ximian.com>
8121 * expression.cs (Binary::ResolveOperator): Had forgottten to set
8122 the type of the expression to the return type of the method if
8123 we have an overloaded operator match ! The regression tests pass again !
8124 (Unary::ResolveOperator): Ditto.
8126 * expression.cs (Invocation::ConversionExists): Correct the member lookup
8127 to find "op_Implicit", not "implicit" ;-)
8128 (UserImplicitCast): New class to take care of user-defined implicit conversions.
8129 (ConvertImplicit, ForceConversion): Take TypeContainer argument
8131 * everywhere : Correct calls to the above accordingly.
8133 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
8134 (ConvertImplicit): Do user-defined conversion if it exists.
8136 2001-09-24 Miguel de Icaza <miguel@ximian.com>
8138 * assign.cs: track location.
8139 (Resolve): Use implicit conversions on assignment.
8141 * literal.cs: Oops. Not good, Emit of short access values should
8142 pass (Bytes) or the wrong argument will be selected.
8144 * expression.cs (Unary::Emit): Emit code for -expr.
8146 (Unary::ResolveOperator): Handle `Substract' for non-constants
8147 (substract from zero from the non-constants).
8148 Deal with Doubles as well.
8150 (Expression::ConvertImplicitRequired): New routine that reports an
8151 error if no implicit conversion exists.
8153 (Invocation::OverloadResolve): Store the converted implicit
8154 expressions if we make them
8156 2001-09-24 Ravi Pratap <ravi@ximian.com>
8158 * class.cs (ConstructorInitializer): Take a Location argument.
8159 (ConstructorBaseInitializer): Same here.
8160 (ConstructorThisInitializer): Same here.
8162 * cs-parser.jay : Update all calls accordingly.
8164 * expression.cs (Unary, Binary, New): Take location argument.
8165 Update accordingly everywhere.
8167 * cs-parser.jay : Update all calls to the above to take a location
8172 2001-09-24 Ravi Pratap <ravi@ximian.com>
8174 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
8175 (Invocation::BetterConversion): Same here
8176 (Invocation::ConversionExists): Ditto.
8178 (Invocation::ConversionExists): Implement.
8180 2001-09-22 Ravi Pratap <ravi@ximian.com>
8182 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
8183 Also take an additional TypeContainer argument.
8185 * All over : Pass in TypeContainer as argument to OverloadResolve.
8187 * typemanager.cs (CSharpName): Update to check for the string type and return
8190 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
8193 2001-09-21 Ravi Pratap <ravi@ximian.com>
8195 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
8196 (Invocation::BetterFunction): Implement.
8197 (Invocation::BetterConversion): Implement.
8198 (Invocation::ConversionExists): Skeleton, no implementation yet.
8200 Okay, things work fine !
8202 2001-09-21 Miguel de Icaza <miguel@ximian.com>
8204 * typemanager.cs: declare and load enum_type, delegate_type and
8207 * expression.cs (Expression::Emit): Now emit returns a value that
8208 tells whether a value is left on the stack or not. This strategy
8209 might be reveted tomorrow with a mechanism that would address
8210 multiple assignments.
8211 (Expression::report118): Utility routine to report mismatches on
8214 (Unary::Report23): Report impossible type/operator combination
8217 (Unary::IsIncrementableNumber): Whether the type can be
8218 incremented or decremented with add.
8219 (Unary::ResolveOperator): Also allow enumerations to be bitwise
8221 (Unary::ResolveOperator): Implement ++, !, ~,
8223 (Invocation::Emit): Deal with new Emit convetion.
8225 * All Expression derivatives: Updated their Emit method to return
8226 whether they leave values on the stack or not.
8228 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
8229 stack for expressions that are statements.
8231 2001-09-20 Miguel de Icaza <miguel@ximian.com>
8233 * expression.cs (LValue): New interface. Must be implemented by
8235 (LocalVariableReference, ParameterReference, FieldExpr): Implement
8238 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
8239 interface for generating code, simplifies the code.
8241 2001-09-20 Ravi Pratap <ravi@ximian.com>
8243 * expression.cs (everywhere): Comment out return statements in ::Resolve
8244 methods to avoid the warnings.
8246 2001-09-20 Miguel de Icaza <miguel@ximian.com>
8248 * driver.cs (parse): Report error 2001 if we can not open the
8251 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
8254 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
8257 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
8258 otherwise nested blocks end up with the same index.
8260 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
8262 * expression.cs: Instead of having FIXMEs in the Resolve
8263 functions, throw exceptions so it is obvious that we are facing a
8266 * cs-parser.jay (invocation_expression): Pass Location information.
8268 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
8269 Use a basename for those routines because .NET does not like paths
8272 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
8275 2001-09-19 Miguel de Icaza <miguel@ximian.com>
8277 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
8278 are loading the correct data types (throws an exception if not).
8279 (TypeManager::InitCoreTypes): Use CoreLookupType
8281 * expression.cs (Unary::ResolveOperator): return the child
8282 expression for expressions which are just +expr.
8283 (Unary::ResolveOperator): Return negative literals for -LITERAL
8284 expressions (otherwise they are Unary {Literal}).
8285 (Invocation::Badness): Take into account `Implicit constant
8286 expression conversions'.
8288 * literal.cs (LongLiteral): Implement long literal class.
8289 (IntLiteral): export the `Value' of the intliteral.
8291 2001-09-19 Ravi Pratap <ravi@ximian.com>
8293 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
8295 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
8296 instead of 'Operator'
8298 * expression.cs (Binary::ResolveOperator): Update accordingly.
8299 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
8302 * cs-parser.jay (unary_expression): Update to use the new names.
8304 * gen-treedump.cs (GetUnary): Same here.
8306 * expression.cs (Unary::Resolve): Implement.
8307 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
8308 operators are found instead of making noise ;-)
8309 (Unary::ResolveOperator): New method to do precisely the same thing which
8310 Binary::ResolveOperator does for Binary expressions.
8311 (Unary.method, .Arguments): Add.
8312 (Unary::OperName): Implement.
8313 (Unary::ForceConversion): Copy and Paste !
8315 * class.cs (Operator::Define): Fix a small bug for the case when we have
8318 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
8319 for the inbuilt operators. Only overloading works for now ;-)
8321 2001-09-18 Miguel de Icaza <miguel@ximian.com>
8323 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
8324 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
8326 * expression.cs (This::Emit): Implement.
8327 (This::Resolve): Implement.
8328 (TypeOf:Resolve): Implement.
8329 (Expression::ResolveSimpleName): Add an implicit this to instance
8331 (MemberAccess::Resolve): Deal with Parameters and Fields.
8332 Bind instance variable to Field expressions.
8333 (FieldExpr::Instance): New field used to track the expression that
8334 represents the object instance.
8335 (FieldExpr::Resolve): Track potential errors from MemberLookup not
8337 (FieldExpr::Emit): Implement.
8339 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
8340 the last instruction contains a return opcode to avoid generating
8341 the last `ret' instruction (this generates correct code, and it is
8342 nice to pass the peverify output).
8344 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
8345 initializer for static and instance variables.
8346 (Constructor::Emit): Allow initializer to be null in the case of
8347 static constructors. Only emit initializer for instance
8350 (TypeContainer::FindMembers): Return a null array if there are no
8353 Also fix the code for the MemberTypes.Method branch, as it was not
8354 scanning that for operators (or tried to access null variables before).
8356 * assign.cs (Assign::Emit): Handle instance and static fields.
8360 * driver.cs: Stop compilation if there are parse errors.
8362 * cs-parser.jay (constructor_declaration): Provide default base
8363 initializer for non-static constructors.
8364 (constructor_declarator): Do not provide a default base
8365 initializers if none was specified.
8366 Catch the fact that constructors should not have parameters.
8368 * class.cs: Do not emit parent class initializers for static
8369 constructors, that should be flagged as an error.
8371 2001-09-18 Ravi Pratap <ravi@ximian.com>
8373 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
8374 Move back code into TypeContainer::Populate.
8376 2001-09-18 Ravi Pratap <ravi@ximian.com>
8378 * class.cs (TypeContainer::AddConstructor): Fix the check to
8379 compare against Name, not Basename.
8380 (Operator::OpType): Change Plus and Minus to Add and Subtract.
8382 * cs-parser.jay : Update accordingly.
8384 * class.cs (TypeContainer::FindMembers): For the case where we are searching
8385 for methods, don't forget to look into the operators too.
8386 (RegisterMethodBuilder): Helper method to take care of this for
8387 methods, constructors and operators.
8388 (Operator::Define): Completely revamp.
8389 (Operator.OperatorMethod, MethodName): New fields.
8390 (TypeContainer::Populate): Move the registering of builders into
8391 RegisterMethodBuilder.
8392 (Operator::Emit): Re-write.
8394 * expression.cs (Binary::Emit): Comment out code path to emit method
8395 invocation stuff for the case when we have a user defined operator. I am
8396 just not able to get it right !
8398 2001-09-17 Miguel de Icaza <miguel@ximian.com>
8400 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
8403 (Expression::MemberLookup): Provide a version that allows to
8404 specify the MemberTypes and BindingFlags.
8406 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
8407 so it was not fetching variable information from outer blocks.
8409 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
8410 Beforefieldinit as it was buggy.
8412 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
8415 * class.cs (Constructor::Emit): Only emit if block is not null.
8416 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
8417 deal with this by semantically definining it as if the user had
8420 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
8421 constructors as we now "emit" them at a higher level.
8423 (TypeContainer::DefineDefaultConstructor): Used to define the
8424 default constructors if none was provided.
8426 (ConstructorInitializer): Add methods Resolve and Emit.
8428 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
8430 2001-09-17 Ravi Pratap <ravi@ximian.com>
8432 * class.cs (TypeContainer::EmitDefaultConstructor): Register
8433 the default constructor builder with our hashtable for methodbuilders
8436 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
8437 and argument_count is 0 in which case we have a match.
8438 (Binary::ResolveOperator): More null checking and miscellaneous coding
8441 2001-09-17 Ravi Pratap <ravi@ximian.com>
8443 * rootcontext.cs (IsNameSpace): Compare against null.
8445 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
8447 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
8448 and Unary::Operator.
8450 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
8453 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
8454 we have overloaded operators.
8455 (Binary::ResolveOperator): Implement the part which does the operator overload
8458 * class.cs (Operator::Emit): Implement.
8459 (TypeContainer::Emit): Emit the operators we have too.
8461 * expression.cs (Binary::Emit): Update to emit the appropriate code for
8462 the case when we have a user-defined operator.
8464 2001-09-17 Miguel de Icaza <miguel@ximian.com>
8466 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
8468 2001-09-16 Ravi Pratap <ravi@ximian.com>
8470 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
8471 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
8472 (Constructor::Emit): Implement.
8473 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
8474 if we have no work to do.
8475 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
8478 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
8479 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
8481 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
8484 2001-09-15 Ravi Pratap <ravi@ximian.com>
8486 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
8488 (Tree::RecordNamespace): Method to do what the name says ;-)
8489 (Tree::Namespaces): Property to get at the namespaces hashtable.
8491 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
8494 * rootcontext.cs (IsNamespace): Fixed it :-)
8496 2001-09-14 Miguel de Icaza <miguel@ximian.com>
8498 * class.cs (TypeContainer::FindMembers): Add support for
8500 (MethodCore): New class that encapsulates both the shared aspects
8501 of a Constructor and a Method.
8502 (Method, Constructor): Factored pieces into MethodCore.
8504 * driver.cs: Added --fatal which makes errors throw exceptions.
8505 Load System assembly as well as part of the standard library.
8507 * report.cs: Allow throwing exceptions on errors for debugging.
8509 * modifiers.cs: Do not use `parent', instead use the real type
8510 container to evaluate permission settings.
8512 * class.cs: Put Ravi's patch back in. He is right, and we will
8513 have to cope with the
8515 2001-09-14 Ravi Pratap <ravi@ximian.com>
8517 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
8518 FamORAssem, not FamANDAssem.
8520 2001-09-14 Miguel de Icaza <miguel@ximian.com>
8522 * driver.cs: Added --parse option that only parses its input files
8525 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
8526 incorrect. IsTopLevel is not used to tell whether an object is
8527 root_types or not (that can be achieved by testing this ==
8528 root_types). But to see if this is a top-level *class* (not
8529 necessarly our "toplevel" container).
8531 2001-09-14 Ravi Pratap <ravi@ximian.com>
8533 * enum.cs (Enum::Define): Modify to call the Lookup method on the
8534 parent instead of a direct call to GetType.
8536 2001-09-14 Ravi Pratap <ravi@ximian.com>
8538 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
8539 Modifiers.TypeAttr. This should just be a call to that method.
8541 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
8542 object so that we can determine if we are top-level or not.
8544 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
8547 * enum.cs (Enum::Define): Ditto.
8549 * modifiers.cs (FieldAttr): Re-write.
8551 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
8552 (TypeContainer::HaveStaticConstructor): New property to provide access
8553 to precisely that info.
8555 * modifiers.cs (MethodAttr): Re-write.
8556 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
8558 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
8559 of top-level types as claimed.
8561 2001-09-13 Miguel de Icaza <miguel@ximian.com>
8563 * expression.cs (MemberLookup): Fruitless attempt to lookup
8564 constructors. Maybe I need to emit default constructors? That
8565 might be it (currently .NET emits this for me automatically).
8566 (Invocation::OverloadResolve): Cope with Arguments == null.
8567 (Invocation::EmitArguments): new function, shared by the new
8569 (Invocation::Emit): Handle static and instance methods. Emit
8570 proper call instruction for virtual or non-virtual invocations.
8571 (New::Emit): Implement.
8572 (New::Resolve): Implement.
8573 (MemberAccess:Resolve): Implement.
8574 (MethodGroupExpr::InstanceExpression): used conforming to the spec
8576 (FieldExpr::Resolve): Set type.
8578 * support.cs: Handle empty arguments.
8580 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
8581 SimpleLookup): Auxiliary routines to help parse a qualifier
8584 Update qualifier_identifier rule.
8586 * codegen.cs: Removed debugging messages.
8588 * class.cs: Make this a global thing, this acts just as a "key" to
8589 objects that we might have around.
8591 (Populate): Only initialize method_builders_to_methods once.
8593 * expression.cs (PropertyExpr): Initialize type from the
8596 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
8597 Resolve pattern. Attempt to implicitly convert value to boolean.
8600 * expression.cs: Set the type for the int32/int32 argument case.
8601 (Binary::ResolveOperator): Set the return type to boolean for
8602 comparission operators
8604 * typemanager.cs: Remove debugging print code.
8606 (Invocation::Resolve): resolve type.
8608 * class.cs: Allocate a MemberInfo of the correct size, as the code
8609 elsewhere depends on the test to reflect the correct contents.
8611 (Method::) Keep track of parameters, due to System.Reflection holes
8613 (TypeContainer::Populate): Keep track of MethodBuilders to Method
8616 (TypeContainer::FindMembers): Use ArrayList and then copy an array
8617 of the exact size and return that.
8619 (Class::LookupMethodByBuilder): New function that maps
8620 MethodBuilders to its methods. Required to locate the information
8621 on methods because System.Reflection bit us again.
8623 * support.cs: New file, contains an interface ParameterData and
8624 two implementations: ReflectionParameters and InternalParameters
8625 used to access Parameter information. We will need to grow this
8628 * expression.cs (Invocation::GetParameterData): implement a cache
8629 and a wrapper around the ParameterData creation for methods.
8630 (Invocation::OverloadResolve): Use new code.
8632 2001-09-13 Ravi Pratap <ravi@ximian.com>
8634 * class.cs (TypeContainer::EmitField): Remove and move into
8635 (Field::Define): here and modify accordingly.
8636 (Field.FieldBuilder): New member.
8637 (TypeContainer::Populate): Update accordingly.
8638 (TypeContainer::FindMembers): Implement.
8640 2001-09-13 Miguel de Icaza <miguel@ximian.com>
8642 * statement.cs: (VariableInfo::VariableType): New field to be
8643 initialized with the full type once it is resolved.
8645 2001-09-12 Miguel de Icaza <miguel@ximian.com>
8647 * parameter.cs (GetParameterInfo): Use a type cache to compute
8648 things only once, and to reuse this information
8650 * expression.cs (LocalVariableReference::Emit): Implement.
8651 (OpcodeCast::Emit): fix.
8653 (ParameterReference::Resolve): Implement.
8654 (ParameterReference::Emit): Implement.
8656 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
8657 that are expressions need to stay as Expressions.
8659 * typemanager.cs (CSharpName): Returns the C# name of a type if
8662 * expression.cs (Expression::ConvertImplicit): New function that
8663 implements implicit type conversions.
8665 (Expression::ImplicitReferenceConversion): Implements implicit
8666 reference conversions.
8668 (EmptyCast): New type for transparent casts.
8670 (OpcodeCast): New type for casts of types that are performed with
8671 a sequence of bytecodes.
8673 (BoxedCast): New type used for casting value types into reference
8674 types. Emits a box opcode.
8676 (Binary::DoNumericPromotions): Implements numeric promotions of
8677 and computation of the Binary::Type.
8679 (Binary::EmitBranchable): Optimization.
8681 (Binary::Emit): Implement code emission for expressions.
8683 * typemanager.cs (TypeManager): Added two new core types: sbyte
8686 2001-09-12 Ravi Pratap <ravi@ximian.com>
8688 * class.cs (TypeContainer::FindMembers): Method which does exactly
8689 what Type.FindMembers does, only we don't have to use reflection. No
8692 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
8693 typecontainer objects as we need to get at them.
8694 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
8696 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
8697 typecontainer object.
8699 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
8700 of just a Report object.
8702 2001-09-11 Ravi Pratap <ravi@ximian.com>
8704 * class.cs (Event::Define): Go back to using the prefixes "add_" and
8706 (TypeContainer::Populate): Now define the delegates of the type too.
8707 (TypeContainer.Delegates): Property to access the list of delegates defined
8710 * delegates.cs (Delegate::Define): Implement partially.
8712 * modifiers.cs (TypeAttr): Handle more flags.
8714 2001-09-11 Ravi Pratap <ravi@ximian.com>
8716 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
8718 (Operator::Define): Re-write logic to get types by using the LookupType method
8719 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
8720 (Indexer::Define): Ditto.
8721 (Event::Define): Ditto.
8722 (Property::Define): Ditto.
8724 2001-09-10 Ravi Pratap <ravi@ximian.com>
8726 * class.cs (TypeContainer::Populate): Now define operators too.
8727 (TypeContainer.Operators): New property to access the list of operators
8729 (Operator.OperatorMethodBuilder): New member to hold the method builder
8730 for the operator we are defining.
8731 (Operator::Define): Implement.
8733 2001-09-10 Ravi Pratap <ravi@ximian.com>
8735 * class.cs (Event::Define): Make the prefixes of the accessor methods
8736 addOn_ and removeOn_
8738 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
8739 of the location being passed in too. Ideally, this should go later since all
8740 error reporting should be done through the Report object.
8742 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
8743 (Populate): Iterate thru the indexers we have and define them too.
8744 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
8745 for the get and set accessors.
8746 (Indexer::Define): Implement.
8748 2001-09-09 Miguel de Icaza <miguel@ximian.com>
8750 * expression.cs (Binary::Resolve): Beginning of it. I scratched
8751 my previous implementation, did not work.
8753 * typemanager.cs: Add a couple of missing types (the longs).
8755 * literal.cs: Use TypeManager.bool_type instead of getting it.
8757 * expression.cs (EventExpr): New kind of expressions.
8758 (Expressio::ExprClassFromMemberInfo): finish
8760 2001-09-08 Miguel de Icaza <miguel@ximian.com>
8762 * assign.cs: Emit stores to static fields differently.
8764 2001-09-08 Ravi Pratap <ravi@ximian.com>
8766 * Merge in changes and adjust code to tackle conflicts. Backed out my
8767 code in Assign::Resolve ;-)
8769 2001-09-08 Ravi Pratap <ravi@ximian.com>
8771 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
8772 instead Report.Error and also pass in the location.
8773 (CSharpParser::Lexer): New readonly property to return the reference
8774 to the Tokenizer object.
8775 (declare_local_variables): Use Report.Error with location instead of plain
8779 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
8780 (Operator.CheckBinaryOperator): Ditto.
8782 * cs-parser.jay (operator_declarator): Update accordingly.
8784 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
8785 (CheckBinaryOperator): Same here.
8787 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
8788 on the name without any prefixes of namespace names etc. This is because we
8789 already might have something already fully qualified like
8790 'System.Console.WriteLine'
8792 * assign.cs (Resolve): Begin implementation. Stuck ;-)
8794 2001-09-07 Ravi Pratap <ravi@ximian.com>
8796 * cs-tokenizer.cs (location): Return a string which also contains
8799 * expression.cs (ElementAccess): New class for expressions of the
8800 type 'element access.'
8801 (BaseAccess): New class for expressions of the type 'base access.'
8802 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
8805 * cs-parser.jay (element_access): Implement action.
8806 (base_access): Implement actions.
8807 (checked_expression, unchecked_expression): Implement.
8809 * cs-parser.jay (local_variable_type): Correct and implement.
8810 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
8812 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
8814 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
8815 name and the specifiers.
8817 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
8819 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
8820 making them all public ;-)
8822 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
8825 2001-09-07 Miguel de Icaza <miguel@ximian.com>
8827 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
8829 (FieldExpr, PropertyExprs): New resolved expressions.
8830 (SimpleName::MemberStaticCheck): Perform static checks for access
8831 to non-static fields on static methods. Maybe this should be
8832 generalized for MemberAccesses.
8833 (SimpleName::ResolveSimpleName): More work on simple name
8836 * cs-parser.jay (primary_expression/qualified_identifier): track
8837 the parameter index.
8839 * codegen.cs (CodeGen::Save): Catch save exception, report error.
8840 (EmitContext::EmitBoolExpression): Chain to expression generation
8841 instead of temporary hack.
8842 (::EmitStatementExpression): Put generic expression code generation.
8844 * assign.cs (Assign::Emit): Implement variable assignments to
8845 local variables, parameters and fields.
8847 2001-09-06 Miguel de Icaza <miguel@ximian.com>
8849 * statement.cs (Block::GetVariableInfo): New method, returns the
8850 VariableInfo for a variable name in a block.
8851 (Block::GetVariableType): Implement in terms of GetVariableInfo
8853 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
8854 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
8856 2001-09-06 Ravi Pratap <ravi@ximian.com>
8858 * cs-parser.jay (operator_declaration): Continue on my quest : update
8859 to take attributes argument.
8860 (event_declaration): Ditto.
8861 (enum_declaration): Ditto.
8862 (indexer_declaration): Ditto.
8864 * class.cs (Operator::Operator): Update constructor accordingly.
8865 (Event::Event): Ditto.
8867 * delegate.cs (Delegate::Delegate): Same here.
8869 * enum.cs (Enum::Enum): Same here.
8871 2001-09-05 Ravi Pratap <ravi@ximian.com>
8873 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
8875 * ../tests/cs0658.cs : New file to demonstrate error 0658.
8877 * attribute.cs (Attributes): New class to encapsulate all attributes which were
8878 being passed around as an arraylist.
8879 (Attributes::AddAttribute): Method to add attribute sections.
8881 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
8882 (struct_declaration): Update accordingly.
8883 (constant_declaration): Update.
8884 (field_declaration): Update.
8885 (method_header): Update.
8886 (fixed_parameter): Update.
8887 (parameter_array): Ditto.
8888 (property_declaration): Ditto.
8889 (destructor_declaration): Ditto.
8891 * class.cs (Struct::Struct): Update constructors accordingly.
8892 (Class::Class): Ditto.
8893 (Field::Field): Ditto.
8894 (Method::Method): Ditto.
8895 (Property::Property): Ditto.
8896 (TypeContainer::OptAttribute): update property's return type.
8898 * interface.cs (Interface.opt_attributes): New member.
8899 (Interface::Interface): Update to take the extra Attributes argument.
8901 * parameter.cs (Parameter::Parameter): Ditto.
8903 * constant.cs (Constant::Constant): Ditto.
8905 * interface.cs (InterfaceMemberBase): New OptAttributes field.
8906 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
8907 the attributes as a parameter.
8908 (InterfaceProperty): Update constructor call.
8909 (InterfaceEvent): Ditto.
8910 (InterfaceMethod): Ditto.
8911 (InterfaceIndexer): Ditto.
8913 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
8914 pass the attributes too.
8915 (interface_event_declaration): Ditto.
8916 (interface_property_declaration): Ditto.
8917 (interface_method_declaration): Ditto.
8918 (interface_declaration): Ditto.
8920 2001-09-05 Miguel de Icaza <miguel@ximian.com>
8922 * class.cs (Method::Define): Track the "static Main" definition to
8923 create an entry point.
8925 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
8926 EntryPoint if we find it.
8928 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
8929 (EmitContext::ig): Make this variable public.
8931 * driver.cs: Make the default output file be the first file name
8932 with the .exe extension.
8934 Detect empty compilations
8936 Handle various kinds of output targets. Handle --target and
8937 rename -t to --dumper.
8939 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
8940 methods inherited from Expression return now an Expression. This
8941 will is used during the tree rewriting as we resolve them during
8944 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
8945 the spec. Missing entirely is the information about
8946 accessability of elements of it.
8948 (Expression::ExprClassFromMemberInfo): New constructor for
8949 Expressions that creates a fully initialized Expression based on
8950 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
8953 (Invocation::Resolve): Begin implementing resolution of invocations.
8955 * literal.cs (StringLiteral): Implement Emit.
8957 2001-09-05 Ravi Pratap <ravi@ximian.com>
8959 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
8962 2001-09-04 Ravi Pratap <ravi@ximian.com>
8964 * cs-parser.jay (attribute_arguments): Implement actions.
8965 (attribute): Fix bug in production. Implement action.
8966 (attribute_list): Implement.
8967 (attribute_target): Implement.
8968 (attribute_target_specifier, opt_target_specifier): Implement
8969 (CheckAttributeTarget): New method to check if the attribute target
8971 (attribute_section): Implement.
8972 (opt_attributes): Implement.
8974 * attribute.cs : New file to handle attributes.
8975 (Attribute): Class to hold attribute info.
8977 * cs-parser.jay (opt_attribute_target_specifier): Remove production
8978 (attribute_section): Modify production to use 2 different rules to
8979 achieve the same thing. 1 s/r conflict down !
8980 Clean out commented, useless, non-reducing dimension_separator rules.
8982 * class.cs (TypeContainer.attributes): New member to hold list
8983 of attributes for a type.
8984 (Struct::Struct): Modify to take one more argument, the attribute list.
8985 (Class::Class): Ditto.
8986 (Field::Field): Ditto.
8987 (Method::Method): Ditto.
8988 (Property::Property): Ditto.
8990 * cs-parser.jay (struct_declaration): Update constructor call to
8991 pass in the attributes too.
8992 (class_declaration): Ditto.
8993 (constant_declaration): Ditto.
8994 (field_declaration): Ditto.
8995 (method_header): Ditto.
8996 (fixed_parameter): Ditto.
8997 (parameter_array): Ditto.
8998 (property_declaration): Ditto.
9000 * constant.cs (Constant::Constant): Update constructor similarly.
9001 Use System.Collections.
9003 * parameter.cs (Parameter::Parameter): Update as above.
9005 2001-09-02 Ravi Pratap <ravi@ximian.com>
9007 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
9008 (TypeContainer.delegates): New member to hold list of delegates.
9010 * cs-parser.jay (delegate_declaration): Implement the action correctly
9011 this time as I seem to be on crack ;-)
9013 2001-09-02 Miguel de Icaza <miguel@ximian.com>
9015 * rootcontext.cs (RootContext::IsNamespace): new function, used to
9016 tell whether an identifier represents a namespace.
9018 * expression.cs (NamespaceExpr): A namespace expression, used only
9019 temporarly during expression resolution.
9020 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
9021 utility functions to resolve names on expressions.
9023 2001-09-01 Miguel de Icaza <miguel@ximian.com>
9025 * codegen.cs: Add hook for StatementExpressions.
9027 * class.cs: Fix inverted test for static flag in methods.
9029 2001-09-02 Ravi Pratap <ravi@ximian.com>
9031 * class.cs (Operator::CheckUnaryOperator): Correct error number used
9032 to make it coincide with MS' number.
9033 (Operator::CheckBinaryOperator): Ditto.
9035 * ../errors/errors.txt : Remove error numbers added earlier.
9037 * ../errors/cs1019.cs : Test case for error # 1019
9039 * ../errros/cs1020.cs : Test case for error # 1020
9041 * cs-parser.jay : Clean out commented cruft.
9042 (dimension_separators, dimension_separator): Comment out. Ostensibly not
9043 used anywhere - non-reducing rule.
9044 (namespace_declarations): Non-reducing rule - comment out.
9046 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
9047 with TypeContainer::AddEnum.
9049 * delegate.cs : New file for delegate handling classes.
9050 (Delegate): Class for declaring delegates.
9052 * makefile : Update.
9054 * cs-parser.jay (delegate_declaration): Implement.
9056 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
9058 * class.cs (Event::Define): Implement.
9059 (Event.EventBuilder): New member.
9061 * class.cs (TypeContainer::Populate): Update to define all enums and events
9063 (Events): New property for the events arraylist we hold. Shouldn't we move to using
9064 readonly fields for all these cases ?
9066 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
9068 * class.cs (Property): Revamp to use the convention of making fields readonly.
9069 Accordingly modify code elsewhere.
9071 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
9072 the Define method of the Property class.
9074 * class.cs : Clean up applied patch and update references to variables etc. Fix
9076 (TypeContainer::Populate): Update to define all the properties we have. Also
9077 define all enumerations.
9079 * enum.cs (Define): Implement.
9081 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
9083 * cs-parser.jay (overloadable_operator): The semantic value is an
9084 enum of the Operator class.
9085 (operator_declarator): Implement actions.
9086 (operator_declaration): Implement.
9088 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
9089 validity of definitions.
9090 (Operator::CheckBinaryOperator): Static method to check for binary operators
9091 (TypeContainer::AddOperator): New method to add an operator to a type.
9093 * cs-parser.jay (indexer_declaration): Added line to actually call the
9094 AddIndexer method so it gets added ;-)
9096 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
9097 already taken care of by the MS compiler ?
9099 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
9101 * class.cs (Operator): New class for operator declarations.
9102 (Operator::OpType): Enum for the various operators.
9104 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
9106 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
9107 ostensibly handle this in semantic analysis.
9109 * cs-parser.jay (general_catch_clause): Comment out
9110 (specific_catch_clauses, specific_catch_clause): Ditto.
9111 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
9112 (catch_args, opt_catch_args): New productions.
9113 (catch_clause): Rewrite to use the new productions above
9114 (catch_clauses): Modify accordingly.
9115 (opt_catch_clauses): New production to use in try_statement
9116 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
9117 and re-write the code in the actions to extract the specific and
9118 general catch clauses by being a little smart ;-)
9120 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
9121 Hooray, try and catch statements parse fine !
9123 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
9125 * statement.cs (Block::GetVariableType): Fix logic to extract the type
9126 string from the hashtable of variables.
9128 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
9129 I end up making that mistake ;-)
9130 (catch_clauses): Fixed gross error which made Key and Value of the
9131 DictionaryEntry the same : $1 !!
9133 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
9135 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
9137 * cs-parser.jay (event_declaration): Correct to remove the semicolon
9138 when the add and remove accessors are specified.
9140 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
9142 * cs-parser.jay (IndexerDeclaration): New helper class to hold
9143 information about indexer_declarator.
9144 (indexer_declarator): Implement actions.
9145 (parsing_indexer): New local boolean used to keep track of whether
9146 we are parsing indexers or properties. This is necessary because
9147 implicit_parameters come into picture even for the get accessor in the
9149 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
9151 * class.cs (Indexer): New class for indexer declarations.
9152 (TypeContainer::AddIndexer): New method to add an indexer to a type.
9153 (TypeContainer::indexers): New member to hold list of indexers for the
9156 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
9158 * cs-parser.jay (add_accessor_declaration): Implement action.
9159 (remove_accessor_declaration): Implement action.
9160 (event_accessors_declaration): Implement
9161 (variable_declarators): swap statements for first rule - trivial.
9163 * class.cs (Event): New class to hold information about event
9165 (TypeContainer::AddEvent): New method to add an event to a type
9166 (TypeContainer::events): New member to hold list of events.
9168 * cs-parser.jay (event_declaration): Implement actions.
9170 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
9172 * cs-parser.jay (dim_separators): Implement. Make it a string
9173 concatenating all the commas together, just as they appear.
9174 (opt_dim_separators): Modify accordingly
9175 (rank_specifiers): Update accordingly. Basically do the same
9176 thing - instead, collect the brackets here.
9177 (opt_rank_sepcifiers): Modify accordingly.
9178 (array_type): Modify to actually return the complete type string
9179 instead of ignoring the rank_specifiers.
9180 (expression_list): Implement to collect the expressions
9181 (variable_initializer): Implement. We make it a list of expressions
9182 essentially so that we can handle the array_initializer case neatly too.
9183 (variable_initializer_list): Implement.
9184 (array_initializer): Make it a list of variable_initializers
9185 (opt_array_initializer): Modify accordingly.
9187 * expression.cs (New::NType): Add enumeration to help us
9188 keep track of whether we have an object/delegate creation
9189 or an array creation.
9190 (New:NewType, New::Rank, New::Indices, New::Initializers): New
9191 members to hold data about array creation.
9192 (New:New): Modify to update NewType
9193 (New:New): New Overloaded contructor for the array creation
9196 * cs-parser.jay (array_creation_expression): Implement to call
9197 the overloaded New constructor.
9199 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
9201 * class.cs (TypeContainer::Constructors): Return member
9202 constructors instead of returning null.
9204 2001-08-26 Miguel de Icaza <miguel@ximian.com>
9206 * typemanager.cs (InitCoreTypes): Initialize the various core
9207 types after we have populated the type manager with the user
9208 defined types (this distinction will be important later while
9209 compiling corlib.dll)
9211 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
9212 on Expression Classification. Now all expressions have a method
9213 `Resolve' and a method `Emit'.
9215 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
9216 generation from working. Also add some temporary debugging
9219 2001-08-24 Miguel de Icaza <miguel@ximian.com>
9221 * codegen.cs: Lots of code generation pieces. This is only the
9222 beginning, will continue tomorrow with more touches of polish. We
9223 handle the fundamentals of if, while, do, for, return. Others are
9224 trickier and I need to start working on invocations soon.
9226 * gen-treedump.cs: Bug fix, use s.Increment here instead of
9229 * codegen.cs (EmitContext): New struct, used during code
9230 emission to keep a context. Most of the code generation will be
9233 * cs-parser.jay: Add embedded blocks to the list of statements of
9234 this block. So code generation proceeds in a top down fashion.
9236 2001-08-23 Miguel de Icaza <miguel@ximian.com>
9238 * statement.cs: Add support for multiple child blocks.
9240 2001-08-22 Miguel de Icaza <miguel@ximian.com>
9242 * codegen.cs (EmitCode): New function, will emit the code for a
9243 Block of code given a TypeContainer and its ILGenerator.
9245 * statement.cs (Block): Standard public readonly optimization.
9246 (Block::Block constructors): Link children.
9247 (Block::Child): Child Linker.
9248 (Block::EmitVariables): Emits IL variable declarations.
9250 * class.cs: Drop support for MethodGroups here, delay until
9252 (Method::): Applied the same simplification that I did before, and
9253 move from Properties to public readonly fields.
9254 (Method::ParameterTypes): Returns the parameter types for the
9255 function, and implements a cache that will be useful later when I
9256 do error checking and the semantic analysis on the methods is
9258 (Constructor::GetCallingConvention): Renamed from CallingConvetion
9259 and made a method, optional argument tells whether this is a class
9260 or a structure to apply the `has-this' bit.
9261 (Method::GetCallingConvention): Implement, returns the calling
9263 (Method::Define): Defines the type, a second pass is performed
9264 later to populate the methods.
9266 (Constructor::ParameterTypes): implement a cache similar to the
9267 one on Method::ParameterTypes, useful later when we do semantic
9270 (TypeContainer::EmitMethod): New method. Emits methods.
9272 * expression.cs: Removed MethodGroup class from here.
9274 * parameter.cs (Parameters::GetCallingConvention): new method.
9276 2001-08-21 Miguel de Icaza <miguel@ximian.com>
9278 * class.cs (TypeContainer::Populate): Drop RootContext from the
9281 (Constructor::CallingConvention): Returns the calling convention.
9282 (Constructor::ParameterTypes): Returns the constructor parameter
9285 (TypeContainer::AddConstructor): Keep track of default constructor
9286 and the default static constructor.
9288 (Constructor::) Another class that starts using `public readonly'
9289 instead of properties.
9291 (Constructor::IsDefault): Whether this is a default constructor.
9293 (Field::) use readonly public fields instead of properties also.
9295 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
9296 track of static constructors; If none is used, turn on
9297 BeforeFieldInit in the TypeAttributes.
9299 * cs-parser.jay (opt_argument_list): now the return can be null
9300 for the cases where there are no arguments.
9302 (constructor_declarator): If there is no implicit `base' or
9303 `this', then invoke the default parent constructor.
9305 * modifiers.cs (MethodAttr): New static function maps a set of
9306 modifiers flags into a MethodAttributes enum
9307 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
9308 MethodAttr, TypeAttr to represent the various mappings where the
9310 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
9312 2001-08-19 Miguel de Icaza <miguel@ximian.com>
9314 * parameter.cs (GetParameterInfo): Fix bug where there would be no
9317 * interface.cs (PopulateIndexer): Implemented the code generator
9318 for interface indexers.
9320 2001-08-17 Miguel de Icaza <miguel@ximian.com>
9322 * interface.cs (InterfaceMemberBase): Now we track the new status
9325 (PopulateProperty): Implement property population. Woohoo! Got
9326 Methods and Properties going today.
9328 Removed all the properties for interfaces, and replaced them with
9329 `public readonly' fields.
9331 2001-08-16 Miguel de Icaza <miguel@ximian.com>
9333 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
9334 initialize their hashtables/arraylists only when they are needed
9335 instead of doing this always.
9337 * parameter.cs: Handle refs and out parameters.
9339 * cs-parser.jay: Use an ArrayList to construct the arguments
9340 instead of the ParameterCollection, and then cast that to a
9343 * parameter.cs: Drop the use of ParameterCollection and use
9344 instead arrays of Parameters.
9346 (GetParameterInfo): Use the Type, not the Name when resolving
9349 2001-08-13 Miguel de Icaza <miguel@ximian.com>
9351 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
9352 and instead use public readonly fields.
9354 * class.cs: Put back walking code for type containers.
9356 2001-08-11 Miguel de Icaza <miguel@ximian.com>
9358 * class.cs (MakeConstant): Code to define constants.
9360 * rootcontext.cs (LookupType): New function. Used to locate types
9363 2001-08-08 Miguel de Icaza <miguel@ximian.com>
9365 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
9366 this System.Reflection code is. Kudos to Microsoft
9368 * typemanager.cs: Implement a type cache and avoid loading all
9369 types at boot time. Wrap in LookupType the internals. This made
9370 the compiler so much faster. Wow. I rule!
9372 * driver.cs: Make sure we always load mscorlib first (for
9373 debugging purposes, nothing really important).
9375 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
9376 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
9378 * rootcontext.cs: Lookup types on their namespace; Lookup types
9379 on namespaces that have been imported using the `using' keyword.
9381 * class.cs (TypeContainer::TypeAttr): Virtualize.
9382 (Class::TypeAttr): Return attributes suitable for this bad boy.
9383 (Struct::TypeAttr): ditto.
9384 Handle nested classes.
9385 (TypeContainer::) Remove all the type visiting code, it is now
9386 replaced with the rootcontext.cs code
9388 * rootcontext.cs (GetClassBases): Added support for structs.
9390 2001-08-06 Miguel de Icaza <miguel@ximian.com>
9392 * interface.cs, statement.cs, class.cs, parameter.cs,
9393 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
9394 Drop use of TypeRefs, and use strings instead.
9396 2001-08-04 Miguel de Icaza <miguel@ximian.com>
9400 * class.cs (Struct::Struct): set the SEALED flags after
9401 checking the modifiers.
9402 (TypeContainer::TypeAttr): new property, returns the
9403 TypeAttributes for a class.
9405 * cs-parser.jay (type_list): Oops, list production was creating a
9406 new list of base types.
9408 * rootcontext.cs (StdLib): New property.
9409 (GetInterfaceTypeByName): returns an interface by type name, and
9410 encapsulates error handling here.
9411 (GetInterfaces): simplified.
9412 (ResolveTree): Encapsulated all the tree resolution here.
9413 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
9416 * driver.cs: Add support for --nostdlib, to avoid loading the
9418 (Main): Do not put tree resolution here.
9420 * rootcontext.cs: Beginning of the class resolution.
9422 2001-08-03 Miguel de Icaza <miguel@ximian.com>
9424 * rootcontext.cs: Provide better error reporting.
9426 * cs-parser.jay (interface_base): set our $$ to be interfaces.
9428 * rootcontext.cs (CreateInterface): Handle the case where there
9429 are no parent interfaces.
9431 (CloseTypes): Routine to flush types at the end.
9432 (CreateInterface): Track types.
9433 (GetInterfaces): Returns an array of Types from the list of
9436 * typemanager.c (AddUserType): Mechanism to track user types (puts
9437 the type on the global type hash, and allows us to close it at the
9440 2001-08-02 Miguel de Icaza <miguel@ximian.com>
9442 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
9443 RecordInterface instead.
9445 * cs-parser.jay: Updated to reflect changes above.
9447 * decl.cs (Definition): Keep track of the TypeBuilder type that
9448 represents this type here. Not sure we will use it in the long
9449 run, but wont hurt for now.
9451 * driver.cs: Smaller changes to accomodate the new code.
9453 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
9456 * rootcontext.cs (CreateInterface): New method, used to create
9457 the System.TypeBuilder type for interfaces.
9458 (ResolveInterfaces): new entry point to resolve the interface
9460 (CodeGen): Property, used to keep track of the code generator.
9462 2001-07-26 Miguel de Icaza <miguel@ximian.com>
9464 * cs-parser.jay: Add a second production for delegate_declaration
9467 (enum_body): Put an opt_comma here instead of putting it on
9468 enum_body or enum_member_declarations so we can handle trailing
9469 commas on enumeration members. Gets rid of a shift/reduce.
9471 (type_list): Need a COMMA in the middle.
9473 (indexer_declaration): Tell tokenizer to recognize get/set
9475 * Remove old targets.
9477 * Re-add the parser target.
9479 2001-07-13 Simon Cozens <simon@simon-cozens.org>
9481 * cs-parser.jay: Add precendence rules for a number of operators
9482 ot reduce the number of shift/reduce conflicts in the grammar.
9484 2001-07-17 Miguel de Icaza <miguel@ximian.com>
9486 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
9489 Get rid of old crufty code.
9491 * rootcontext.cs: Use this to keep track of the parsed
9492 representation and the defined types available to the program.
9494 * gen-treedump.cs: adjust for new convention.
9496 * type.cs: Split out the type manager, and the assembly builder
9499 * typemanager.cs: the type manager will live here now.
9501 * cil-codegen.cs: And the code generator here.
9503 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
9505 * makefile: Fixed up for easy making.
9507 2001-07-13 Simon Cozens <simon@simon-cozens.org>
9509 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
9512 (unary_expression): Expand pre_increment_expression and
9513 post_decrement_expression to reduce a shift/reduce.
9515 2001-07-11 Simon Cozens
9517 * cs-tokenizer.cs: Hex numbers should begin with a 0.
9519 Improve allow_keyword_as_indent name.
9521 2001-06-19 Miguel de Icaza <miguel@ximian.com>
9523 * Adjustments for Beta2.
9525 2001-06-13 Miguel de Icaza <miguel@ximian.com>
9527 * decl.cs: Added `Define' abstract method.
9528 (InTransit): new property, used to catch recursive definitions.
9530 * interface.cs: Implement `Define'.
9532 * modifiers.cs: Map Modifiers.constants to
9533 System.Reflection.TypeAttribute flags.
9535 * class.cs: Keep track of types and user-defined types.
9536 (BuilderInit): New method for creating an assembly
9537 (ResolveType): New function to launch the resolution process, only
9538 used by interfaces for now.
9540 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
9541 that are inserted into the name space.
9543 2001-06-08 Miguel de Icaza <miguel@ximian.com>
9545 * ARGH. I have screwed up my tree so many times due to the use of
9546 rsync rather than using CVS. Going to fix this at once.
9548 * driver.cs: Objetify driver. Load assemblies, use assemblies to
9551 2001-06-07 Miguel de Icaza <miguel@ximian.com>
9553 * Experiment successful: Use System.Type rather that our own
9556 2001-05-25 Miguel de Icaza <miguel@ximian.com>
9558 * cs-parser.jay: Removed nsAliases from here.
9560 Use new namespaces, handle `using XXX;'
9562 * namespace.cs: Reimplemented namespace handling, use a recursive
9563 definition of the class. Now we can keep track of using clauses
9564 and catch invalid using clauses.
9566 2001-05-24 Miguel de Icaza <miguel@ximian.com>
9568 * gen-treedump.cs: Adapted for all the renaming.
9570 * expression.cs (Expression): this class now has a Type property
9571 which returns an expression Type.
9573 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
9574 `Type', as this has a different meaning now in the base
9576 2001-05-22 Miguel de Icaza <miguel@ximian.com>
9578 * interface.cs, class.cs: Removed from all the sources the
9579 references to signature computation, as we can not do method
9580 signature computation during the parsing time, as we are not
9581 trying to solve at that point distinguishing:
9585 void a (NS.Blah x) {}
9588 Which depending on the context might be valid or not, as we do not
9589 know if Blah is the same thing as NS.Blah at that point.
9591 * Redid everything so the code uses TypeRefs now instead of
9592 Types. TypeRefs are just temporary type placeholders, that need
9593 to be resolved. They initially have a pointer to a string and the
9594 current scope in which they are used. This is used later by the
9595 compiler to resolve the reference to an actual Type.
9597 * DeclSpace is no longer a CIR.Type, and neither are
9598 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
9599 are all DeclSpaces, but no Types.
9601 * type.cs (TypeRefManager): This implements the TypeRef manager,
9602 which keeps track of all the types that need to be resolved after
9603 the parsing has finished.
9605 2001-05-13 Miguel de Icaza <miguel@ximian.com>
9607 * ARGH. We are going to have to store `foreach' as a class rather
9608 than resolving it, as we need to verify error 1579 after name
9609 resolution. *OR* we could keep a flag that says `This request to
9610 IEnumerator comes from a foreach statement' which we can then use
9611 to generate the error.
9613 2001-05-10 Miguel de Icaza <miguel@ximian.com>
9615 * class.cs (TypeContainer.AddMethod): we now add methods to the
9616 MethodGroup instead of the method hashtable.
9618 * expression.cs: Add MethodGroup abstraction, which gets us one
9619 step closer to the specification in the way we handle method
9622 * cs-parser.jay (primary_expression): qualified_identifier now
9623 tried to match up an identifier to a local variable reference or
9624 to a parameter reference.
9626 current_local_parameters is now a parser global variable that
9627 points to the current parameters for the block, used during name
9630 (property_declaration): Now creates an implicit `value' argument to
9633 2001-05-09 Miguel de Icaza <miguel@ximian.com>
9635 * parameter.cs: Do not use `param' arguments as part of the
9636 signature, per the spec.
9638 2001-05-08 Miguel de Icaza <miguel@ximian.com>
9640 * decl.cs: Base class for classes, structs and interfaces. This
9641 is the "Declaration Space"
9643 * cs-parser.jay: Use CheckDef for checking declaration errors
9644 instead of having one on each function.
9646 * class.cs: Factor out some code for handling error handling in
9647 accordance to the "Declarations" section in the "Basic Concepts"
9648 chapter in the ECMA C# spec.
9650 * interface.cs: Make all interface member classes derive from
9651 InterfaceMemberBase.
9653 2001-05-07 Miguel de Icaza <miguel@ximian.com>
9655 * Many things: all interfaces are parsed and generated in
9656 gen-treedump. Support for member variables, constructors,
9657 destructors, properties, constants is there.
9659 Beginning of the IL backend, but very little done, just there for
9662 2001-04-29 Miguel de Icaza <miguel@ximian.com>
9664 * cs-parser.jay: Fix labeled statement.
9666 * cs-tokenizer.cs (escape): Escape " and ' always.
9667 ref_line, ref_name: keep track of the line/filename as instructed
9668 by #line by the compiler.
9671 2001-04-27 Miguel de Icaza <miguel@ximian.com>
9673 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
9674 to match the values in System.CodeDOM.
9676 Divid renamed to Divide.
9678 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
9680 (Statements.set): remove.
9682 * System.CodeDOM/CodeCatchClause.cs: always have a valid
9685 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
9686 falseStatements always have valid values.
9688 * cs-parser.jay: Use System.CodeDOM now.