1 2003-04-26 Miguel de Icaza <miguel@ximian.com>
3 * statement.cs (Block): replace Implicit bool, for a generic
5 New flag: `Unchecked'. This is used during the EmitMeta phase
6 (which is out-of-line with the regular Resolve/Emit process for a
7 statement, as this is done ahead of time, but still gets a chance
8 to call constant resolve).
10 (Block.Flags): new enum for adding a new flag.
12 (Block.EmitMeta): track the state of unchecked.
14 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
15 to enable constant resolution to work there as well.
17 2003-04-22 Miguel de Icaza <miguel@ximian.com>
19 * typemanager.cs (ienumerable_type): Also look up
20 System.Collections.IEnumerable.
22 2003-04-21 Miguel de Icaza <miguel@ximian.com>
24 TODO: Test more than one conditional per method.
26 * class.cs (Indexer.Define): Report the location where the user is
27 referencing the unsupported feature.
29 (MethodData): Overload the use of `conditionals' to
30 minimize the creation of needless ArrayLists. This saves roughly
33 (Method): Implement the new IIteratorContainer interface.
34 (Method.SetYields): Implement the method by setting the ModFlags
35 to contain METHOD_YIELDS.
37 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
38 which just got set to null.
40 * iterators.cs: New file.
42 (Yield, YieldBreak): New statements.
44 * statement.cs (Return.Resolve): Flag an error if we are used in
47 * codegen.cs (InIterator): New flag set if the code is being
48 compiled in an iterator method.
50 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
51 internal modifier, and we just use it to avoid adding extra
52 fields, as this is seldom used.
54 * cs-parser.jay: Add yield_statement (yield and yield break).
56 * driver.cs: New flag -v2 to turn on version 2 features.
58 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
59 hashtable when v2 is enabled.
61 2003-04-20 Miguel de Icaza <miguel@ximian.com>
63 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
64 there is already a namespace defined with this name.
66 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
67 people upgraded their corlibs.
69 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
70 always use fully qualified types, no need to use the compiler
73 (TypeManager.IsNamespace): Use binarysearch.
75 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
76 AddDelegate): I did not quite use the new IsValid API properly: I
77 have to pass the short-name and the fullname. I was passing only
78 the basename instead of the fullname sometimes.
80 (TypeContainer.DefineType): call NamespaceClash.
82 * interface.cs (Interface.DefineType): use NamespaceClash before
85 * delegate.cs (Delegate.DefineType): use NamespaceClash before
88 * enum.cs: (Enum.DefineType): use NamespaceClash before
91 * typemanager.cs (: 3-line patch that gives us some tasty 11%
92 speed increase. First, use the negative_hits cache when we get a
93 negative. Second, add the type with its full original name
94 instead of the new . and + encoded name (reflection uses + to
95 separate type from a nested type). Use LookupTypeReflection
96 directly which bypasses the type->name hashtable (that we already
97 know does not contain the type.
99 * decl.cs (DeclSpace.ResolveTypeExpr): track the
100 location/container type.
102 * driver.cs: When passing utf8, use directly the UTF8Encoding.
104 2003-04-19 Miguel de Icaza <miguel@ximian.com>
106 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
108 * delegate.cs (NewDelegate.Resolve): Test whether an instance
109 method is being referenced in the method group from a static
110 context, and report error 120 if so.
112 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
115 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
116 is created, we create the A namespace).
118 * cs-parser.jay: A namespace also introduces a DeclarationFound.
121 2003-04-18 Miguel de Icaza <miguel@ximian.com>
123 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
124 invocation to ModuleBuilder.GetType with the same values will
125 return a new type instance, so we need to cache its return
128 * expression.cs (Binary.ResolveOperator): Only allow the compare
129 operators on enums if they are of the same type.
131 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
132 types of ValueType on their own case. Before we were giving them
133 the same treatment as objects.
135 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
136 fullname. Short name is used to compare against container name.
137 Fullname is used to check against defined namespace names.
139 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
140 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
142 (Method.CheckBase): Call parent.
143 (MemberBase.CheckBase): Check for protected members on sealed
145 (PropertyBase.CheckBase): Call parent.
146 (Field.Define): Call parent.
148 * report.cs: Negative error codes are now mapped to 8000 - code,
149 so that the display is render more nicely.
151 * typemanager.cs: Do not use try/catch, instead report a regular
154 (GetPointerType, GetReferenceType): These methods provide
155 mechanisms to obtain the T* and T& from a T. We had the code
156 previously scattered around the code base, and it also used
157 TypeManager.LookupType that would go through plenty of caches.
158 This one goes directly to the type source.
160 In some places we did the Type.GetType followed by
161 ModuleBuilder.GetType, but not in others, so this unifies the
164 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
165 statements now that we have namespace information.
167 * typemanager.cs (IsNamespace): New method, returns whether the
168 string presented is a namespace or not.
170 (ComputeNamespaces): New public entry point, computes the list of
171 available namespaces, using the GetNamespaces API call in Mono, or
172 the slower version in MS.NET.
174 Now before we start the semantic analysis phase, we have a
175 complete list of namespaces including everything that the user has
178 Deleted old code to cache namespaces in .nsc files.
180 2003-04-17 Miguel de Icaza <miguel@ximian.com>
182 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
183 class/struct location definition Location for the implicit
184 constructor location.
186 (Operator.Define): Use the location of the operator for the
187 implicit Method definition.
189 (Constructor.Emit): use the constructor location for the implicit
190 base initializer constructor.
192 * ecore.cs: Remove ITypeExpression. This interface is now gone,
193 and the Expression class now contains two new methods:
195 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
196 isolate type lookup from the rest of the resolution process.
198 Since we use Expressions to hold type definitions due to the way
199 we parse the input we have historically overloaded Resolve to
200 perform the Type lookups if a special flag is passed. Now this is
201 eliminated and two methods take their place.
203 The differences in the two methods between xStep and xTerminal is
204 that xStep is involved in our current lookup system that uses
205 SimpleNames to compose a name, while xTerminal is used just to
206 catch the case where the simplename lookup failed.
208 2003-04-16 Miguel de Icaza <miguel@ximian.com>
210 * expression.cs (ResolveMemberAccess): Remove redundant code.
211 TypeExpr expressions are always born fully resolved.
213 * interface.cs (PopulateMethod): Do not lookup the types twice.
214 We were doing it once during SemanticAnalysis and once during
217 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
218 in local variable type definitions, were being returned as a
219 SimpleName (we decomposed everything into a string), that is
220 because primary_expression was being used instead of a type in the
221 grammar (reduce/reduce conflicts).
223 The part that was wrong is that we converted the expression into a
224 string (an oversimplification in one hand, compounded with primary
225 expressions doing string concatenation).
231 Would return "A.B.C[]" as a SimpleName. This stopped things like
232 using clauses from working on this particular context. And a type
233 was being matched directly against "A.B.C[]".
235 We now use the correct approach, and allow for ComposedCast to be
236 part of the unary expression. So the "A.B.C []" become a composed
237 cast of "A.B.C" (as a nested group of MemberAccess with a
238 SimpleName at the end) plus the rank composition "[]".
242 2003-04-10 Miguel de Icaza <miguel@ximian.com>
244 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
245 for the access level checking.
247 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
248 `TypeContainer container', because I kept getting confused when I
249 was debugging this code.
251 * expression.cs (Indexers): Instead of tracking getters/setters,
252 we now track them in parallel. We create one arraylist less, but
253 most importantly it is possible now for the LValue code to find a
254 matching get for a set.
256 (IndexerAccess.DoResolveLValue): Update the code.
257 GetIndexersForType has been modified already to extract all the
258 indexers from a type. The code assumed it did not.
260 Also make the code set the correct return type for the indexer.
261 This was fixed a long time ago for properties, but was missing for
262 indexers. It used to be void_type.
264 (Binary.Emit): Test first for doubles instead of
265 floats, as they are more common.
267 (Binary.EmitBranchable): Use the .un version of the branch opcodes
268 when dealing with floats and the <=, >= operators. This fixes bug
271 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
272 to load the array value by emitting a load on the foreach variable
273 type. This was incorrect.
275 We now emit the code to load an element using the the array
276 variable type, and then we emit the conversion operator.
280 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
282 * attribute.cs: Avoid allocation of ArrayLists in the common case.
284 2003-04-09 Miguel de Icaza <miguel@ximian.com>
286 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
287 test for protection before we test for signatures.
289 (MethodSignature.ToString): implement.
291 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
292 to the case where we reduced into a LongConstant.
294 * decl.cs (CheckAccessLevel): If the type is an array, we can not
295 depend on whether the information is acurrate, because the
296 Microsoft runtime will always claim that the array type is public,
297 regardless of the real state.
299 If the type is a pointer, another problem happens: the type is
300 reported as non-public in Microsoft.
302 In both cases we have to call CheckAccessLevel recursively with
303 the underlying type as the argument to be tested.
305 2003-04-08 Miguel de Icaza <miguel@ximian.com>
307 * assign.cs (Assign.Emit): If we are dealing with a compound
308 assignment expression, we should use the code path that stores the
309 intermediate result in a temporary value. This fixes #40903.
311 *expression.cs (Indirection.ToString): Provide ToString method for
314 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
316 * class.cs: Null out fields holding references to Block objects so
317 they can be garbage collected.
319 * expression.cs (OverloadResolve): Remove unused local.
321 2003-04-07 Martin Baulig <martin@ximian.com>
323 * codegen.cs (EmitContext.CurrentFile): New public field.
324 (EmitContext.Mark): Use the CurrentFile to check whether the
325 location is in the correct file.
326 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
328 2003-04-07 Martin Baulig <martin@ximian.com>
330 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
332 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
333 location. [FIXME: The location argument which gets passed to this
334 method is sometimes wrong!]
336 2003-04-07 Nick Drochak <ndrochak@gol.com>
338 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
340 2003-04-07 Miguel de Icaza <miguel@ximian.com>
342 * expression.cs (Indirection.EmitAssign): We were using the
343 temporary, but returning immediately instead of continuing the
346 2003-04-06 Martin Baulig <martin@ximian.com>
348 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
349 if it's a nested child, but also deriving from the outer class.
352 * typemanager.cs (IsNestedChildOf): Make this work if it's a
353 nested child, but also deriving from the outer class. See
355 (FilterWithClosure): We may access private members of the outer
356 class if we're a nested child and deriving from the outer class.
357 (RealMemberLookup): Only set `closure_private_ok' if the
358 `original_bf' contained BindingFlags.NonPublic.
360 2003-04-05 Martin Baulig <martin@ximian.com>
362 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
364 2003-04-02 Miguel de Icaza <miguel@ximian.com>
366 * class.cs (Event.Define): Do not allow abstract events to have
369 2003-04-01 Miguel de Icaza <miguel@ximian.com>
371 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
372 block in event declarations.
374 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
375 value type, get its address.
377 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
378 leaving a class on the stack instead of a boolean value (int
379 0/1). Change the code so we compare against null, and then the
382 * class.cs (TypeContainer.GetClassBases): We were checking for the
383 parent class being sealed too late.
385 * expression.cs (Binary.Emit): For <= and >= when dealing with
386 floating point values, use cgt.un and clt.un instead of cgt and
389 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
391 * statement.cs: Apply the same optimization as MS: skip the
392 GetEnumerator returning an IEnumerator, and use the one returning a
393 CharEnumerator instead. This allows us to avoid the try-finally block
396 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
398 * cs-parser.jay: Attributes cannot be applied to
399 namespaces. Fixes #40473
401 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
404 (Add*): check if the name is valid using the full name for constants,
405 fields, properties and events.
407 2003-03-28 Miguel de Icaza <miguel@ximian.com>
409 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
410 char constants to be part of the enumeration.
412 * expression.cs (Conditional.DoResolve): Add support for operator
413 true. Implements the missing functionality from 14.12
415 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
416 operator true/false as required by the spec.
418 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
419 implicit conversion to boolean.
421 * statement.cs (Statement.ResolveBoolean): A boolean expression is
422 also one where the type implements `operator true'.
424 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
425 get an expression that will invoke operator true based on an
428 (GetConversionOperators): Removed the hack that called op_True
431 (Expression.ResolveBoolean): Move this from Statement.
433 2003-03-17 Miguel de Icaza <miguel@ximian.com>
435 * ecore.cs (FieldExpr): do not allow initialization of initonly
436 fields on derived classes
438 2003-03-13 Martin Baulig <martin@ximian.com>
440 * statement.cs (Block.Emit): Call ig.BeginScope() and
441 ig.EndScope() when compiling with debugging info; call
442 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
444 2003-03-08 Miguel de Icaza <miguel@ximian.com>
446 * expression.cs (Indexers): Do not construct immediately, allow
447 for new members to be appended as we go. Fixes 38143
449 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
451 * expression.cs: save/restore context when resolving an unchecked
454 2003-03-05 Miguel de Icaza <miguel@ximian.com>
456 * cfold.cs: Catch division by zero in modulus operator during
459 2003-03-03 Miguel de Icaza <miguel@ximian.com>
461 * interface.cs (Interface.DefineMembers): Avoid defining members
464 2003-02-27 Miguel de Icaza <miguel@ximian.com>
466 * driver.cs: handle the +/- options for -noconfig
468 * statement.cs (Unckeched.Resolve): Also track the state of
469 unchecked in the Resolve phase.
471 2003-02-27 Martin Baulig <martin@ximian.com>
473 * ecore.cs (Expression.MemberLookup): Don't create a
474 MethodGroupExpr for something which is not a method. Fixes #38291.
476 2003-02-25 Miguel de Icaza <miguel@ximian.com>
478 * class.cs (MemberBase.CheckParameters): Also check that the type
479 is unmanaged if it is a pointer.
481 * expression.cs (SizeOf.Resolve): Add location information.
483 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
484 a managed type is declared.
486 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
487 parameter modifiers as well. Fixes bug 38606
489 * class.cs: Very sad. Am backing out the speed up changes
490 introduced by the ArrayList -> Array in the TypeContainer, as they
491 were not actually that much faster, and introduced a bug (no error
492 reports on duplicated methods).
494 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
495 source first, this will guarantee that we have a valid expression
496 before calling in lower levels functions that will require a
497 resolved object. Then use this original_source in the
498 target.ResolveLValue instead of the original source that was
501 Another change. Use target.Resolve instead of LValueResolve.
502 Although we are resolving for LValues, we will let the Assign code
503 take care of that (it will be called again from Resolve). This
504 basically allows code like this:
506 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
507 class Y { void A (X x) { x [0] += o; }
509 The problem was that the indexer was trying to resolve for
510 set_Item (idx, object o) and never finding one. The real set_Item
511 was set_Item (idx, X). By delaying the process we get the right
516 2003-02-23 Martin Baulig <martin@ximian.com>
518 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
519 while calling DoEmit ().
521 * codegen.cs (EmitContext.Mark): Don't mark locations in other
522 source files; if you use the #line directive inside a method, the
523 compiler stops emitting line numbers for the debugger until it
524 reaches the end of the method or another #line directive which
525 restores the original file.
527 2003-02-23 Martin Baulig <martin@ximian.com>
529 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
531 2003-02-23 Martin Baulig <martin@ximian.com>
533 * statement.cs (Block.AddChildVariableNames): We need to call this
534 recursively, not just for our immediate children.
536 2003-02-23 Martin Baulig <martin@ximian.com>
538 * class.cs (Event.Define): Always make the field private, like csc does.
540 * typemanager.cs (TypeManager.RealMemberLookup): Make events
541 actually work, fixes bug #37521.
543 2003-02-23 Miguel de Icaza <miguel@ximian.com>
545 * delegate.cs: When creating the various temporary "Parameters"
546 classes, make sure that we call the ComputeAndDefineParameterTypes
547 on those new parameters (just like we do with the formal ones), to
548 allow them to be resolved in the context of the DeclSpace.
550 This fixes the bug that Dick observed in Bugzilla #38530.
552 2003-02-22 Miguel de Icaza <miguel@ximian.com>
554 * expression.cs (ResolveMemberAccess): When resolving a constant,
555 do not attempt to pull a constant if the value was not able to
556 generate a valid constant.
558 * const.cs (LookupConstantValue): Do not report more errors than required.
560 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
562 * expression.cs: fixes bug #38328.
564 2003-02-18 Miguel de Icaza <miguel@ximian.com>
566 * class.cs: Changed all the various members that can be part of a
567 class from being an ArrayList to be an Array of the right type.
568 During the DefineType type_list, interface_list, delegate_list and
569 enum_list are turned into types, interfaces, delegates and enums
572 And during the member population, indexer_list, event_list,
573 constant_list, field_list, instance_constructor_list, method_list,
574 operator_list and property_list are turned into their real arrays.
576 Although we could probably perform this operation earlier, for
577 good error reporting we need to keep the lists and remove the
578 lists for longer than required.
580 This optimization was triggered by Paolo profiling the compiler
581 speed on the output of `gen-sample-program.pl' perl script.
583 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
584 not crash in methods like MemberLookupFailed that use this field.
586 This problem arises when the compiler fails to resolve a type
587 during interface type definition for example.
589 2003-02-18 Miguel de Icaza <miguel@ximian.com>
591 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
592 inherit from System.Object, so we have to stop at null, not only
593 when reaching System.Object.
595 2003-02-17 Miguel de Icaza <miguel@ximian.com>
597 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
598 DeclaredOnly because the parent indexer might have had a different
599 name, but did not loop until the top of the hierarchy was reached.
601 The problem this one fixes is 35492: when a class implemented an
602 indexer from an interface, we were getting the interface method
603 (which was abstract) and we were flagging an error (can not invoke
606 This also keeps bug 33089 functioning, and test-148 functioning.
608 * typemanager.cs (IsSpecialMethod): The correct way of figuring
609 out if a method is special is to see if it is declared in a
610 property or event, or whether it is one of the predefined operator
611 names. This should fix correctly #36804.
613 2003-02-15 Miguel de Icaza <miguel@ximian.com>
615 The goal here is to remove the dependency on EmptyCast.Peel ().
616 Killing it completely.
618 The problem is that currently in a number of places where
619 constants are expected, we have to "probe" for an EmptyCast, and
620 Peel, which is not the correct thing to do, as this will be
621 repetitive and will likely lead to errors.
623 The idea is to remove any EmptyCasts that are used in casts that
624 can be reduced to constants, so we only have to cope with
627 This bug hunt was triggered by Bug 37363 and the desire to remove
628 the duplicate pattern where we were "peeling" emptycasts to check
629 whether they were constants. Now constants will always be
632 * ecore.cs: Use an enumconstant here instead of wrapping with
635 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
636 throwing me off. By handling this we can get rid of a few hacks.
638 * statement.cs (Switch): Removed Peel() code.
640 2003-02-14 Miguel de Icaza <miguel@ximian.com>
642 * class.cs: Location information for error 508
644 * expression.cs (New.DoResolve): Add a guard against double
645 resolution of an expression.
647 The New DoResolve might be called twice when initializing field
648 expressions (see EmitFieldInitializers, the call to
649 GetInitializerExpression will perform a resolve on the expression,
650 and later the assign will trigger another resolution
652 This leads to bugs (#37014)
654 * delegate.cs: The signature for EndInvoke should contain any ref
655 or out parameters as well. We were not doing this in the past.
657 * class.cs (Field.Define): Do not overwrite the type definition
658 inside the `volatile' group. Turns out that volatile enumerations
659 were changing the type here to perform a validity test, which
662 2003-02-12 Miguel de Icaza <miguel@ximian.com>
664 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
665 and structs, we do not want to load the instance variable
667 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
668 enum_type has to be handled like an object reference (implicit
669 conversions exists from this to object), but the regular IsClass
670 and IsValueType tests will never return true for this one.
672 Also we use TypeManager.IsValueType instead of type.IsValueType,
673 just for consistency with the rest of the code (this is only
674 needed if we ever use the construct exposed by test-180.cs inside
675 corlib, which we dont today).
677 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
679 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
682 2003-02-09 Martin Baulig <martin@ximian.com>
684 * namespace.cs (Namespace..ctor): Added SourceFile argument.
685 (Namespace.DefineNamespaces): New static public method; this is
686 called when we're compiling with debugging to add all namespaces
689 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
690 pass it to the Namespace's .ctor.
692 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
693 and MethodBase arguments; pass the namespace ID to the symwriter;
694 pass the MethodBase instead of the token to the symwriter.
695 (SymbolWriter.DefineNamespace): New method to add a namespace to
698 2003-02-09 Martin Baulig <martin@ximian.com>
700 * symbolwriter.cs: New file. This is a wrapper around
701 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
702 methods here in near future.
704 2003-02-09 Martin Baulig <martin@ximian.com>
706 * codegen.cs (EmitContext.Mark): Just pass the arguments to
707 ILGenerator.MarkSequencePoint() which are actually used by the
710 2003-02-09 Martin Baulig <martin@ximian.com>
712 * location.cs (SourceFile): New public sealed class. This
713 contains the name and an index which is used in the location's token.
714 (Location): Reserve an appropriate number of bits in the token for
715 the source file instead of walking over that list, this gives us a
716 really huge performance improvement when compiling with debugging.
718 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
719 `SourceFile' argument instead of a string.
720 (Driver.ProcessFile): Add all the files via Location.AddFile(),
721 but don't parse/tokenize here, we need to generate the list of all
722 source files before we do that.
723 (Driver.ProcessFiles): New static function. Parses/tokenizes all
726 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
729 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
732 2003-02-09 Martin Baulig <martin@ximian.com>
734 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
735 filename on `#line default'.
737 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
739 * statement.cs: don't clear the pinned var when the fixed statement
740 returns from the method (fixes bug#37752).
742 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
744 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
747 2003-02-07 Martin Baulig <martin@ximian.com>
749 * driver.cs: Removed the `--debug-args' command line argument.
751 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
752 automatically by the AsssemblyBuilder.
753 (CodeGen.InitializeSymbolWriter): We don't need to call any
754 initialization function on the symbol writer anymore. This method
755 doesn't take any arguments.
757 2003-02-03 Miguel de Icaza <miguel@ximian.com>
759 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
760 from referenced assemblies as well.
762 2003-02-02 Martin Baulig <martin@ximian.com>
764 * class.cs (MethodData.Emit): Generate debugging info for external methods.
766 2003-02-02 Martin Baulig <martin@ximian.com>
768 * class.cs (Constructor.Emit): Open the symbol writer before
769 emitting the constructor initializer.
770 (ConstructorInitializer.Emit): Call ec.Mark() to allow
771 single-stepping through constructor initializers.
773 2003-01-30 Miguel de Icaza <miguel@ximian.com>
775 * class.cs: Handle error 549: do not allow virtual methods in
778 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
780 * decl.cs: Check access levels when resolving types
782 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
784 * statement.cs: Add parameters and locals set in catch blocks that might
787 2003-01-29 Miguel de Icaza <miguel@ximian.com>
789 * class.cs (Operator): Set the SpecialName flags for operators.
791 * expression.cs (Invocation.DoResolve): Only block calls to
792 accessors and operators on SpecialName methods.
794 (Cast.TryReduce): Handle conversions from char constants.
797 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
799 * statement.cs: small memory and time optimization in FlowBranching.
801 2003-01-28 Pedro Mart <yoros@wanadoo.es>
803 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
804 problem that the last fix but in the other sid (Set).
806 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
807 access when there is no indexer in the hierarchy.
809 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
811 * class.cs: Combine some if statements.
813 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
815 * driver.cs: fixed bug #37187.
817 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
819 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
820 any indexer, it's needed to build a list with all the indexers in the
821 hierarchy (AllGetters), else we have problems. Fixes #35653.
823 2003-01-23 Miguel de Icaza <miguel@ximian.com>
825 * class.cs (MethodData.Define): It is wrong for an interface
826 implementation to be static in both cases: explicit and implicit.
827 We were only handling this in one case.
829 Improve the if situation there to not have negations.
831 * class.cs (Field.Define): Turns out that we do not need to check
832 the unsafe bit on field definition, only on usage. Remove the test.
834 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
836 * driver.cs: use assembly.Location instead of Codebase (the latest
837 patch made mcs fail when using MS assemblies).
839 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
841 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
842 get the path to *corlib.dll.
844 2003-01-21 Nick Drochak <ndrochak@gol.com>
848 * typemanager.cs: Remove compiler warnings
850 2003-01-20 Duncan Mak <duncan@ximian.com>
852 * AssemblyInfo.cs: Bump the version number to 0.19.
854 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
856 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
858 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
860 * class.cs (Constructor::Emit): Emit debugging info for constructors.
862 2003-01-17 Miguel de Icaza <miguel@ximian.com>
864 * cs-parser.jay: Small fix: we were not comparing the constructor
865 name correctly. Thanks to Zoltan for the initial pointer.
867 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
869 * cs-tokenizer.cs: Set file name when specified with #line
871 2003-01-15 Miguel de Icaza <miguel@ximian.com>
873 * cs-parser.jay: Only perform the constructor checks here if we
874 are named like the class; This will help provider a better
875 error. The constructor path is taken when a type definition is
876 not found, but most likely the user forgot to add the type, so
877 report that rather than the constructor error.
879 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
881 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
884 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
886 * cs-parser.jay: Add cleanup call.
888 2003-01-13 Duncan Mak <duncan@ximian.com>
890 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
891 consistent with other methods.
893 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
895 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
897 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
899 * attribute.cs: only set GuidAttr to true when we have a
902 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
906 * typemanager.cs: fixes to allow mcs compile corlib with the new
907 Type.IsSubclassOf fix.
909 2003-01-08 Miguel de Icaza <miguel@ximian.com>
911 * expression.cs (LocalVariableReference.DoResolve): Classify a
912 constant as a value, not as a variable. Also, set the type for
915 * cs-parser.jay (fixed_statement): take a type instead of a
916 pointer_type, so we can produce a better error message later.
918 * statement.cs (Fixed.Resolve): Flag types that are not pointers
921 (For.DoEmit): Make inifinite loops have a
922 non-conditional branch back.
924 (Fixed.DoEmit): First populate the pinned variables, then emit the
925 statement, then clear the variables. Before I was emitting the
926 code once for each fixed piece.
929 2003-01-08 Martin Baulig <martin@ximian.com>
931 * statement.cs (FlowBranching.MergeChild): A break in a
932 SWITCH_SECTION does not leave a loop. Fixes #36155.
934 2003-01-08 Martin Baulig <martin@ximian.com>
936 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
937 lives in the same number space than `param_map'. Fixes #36154.
939 2003-01-07 Miguel de Icaza <miguel@ximian.com>
941 * cs-parser.jay (constructor_declaration): Set the
942 Constructor.ModFlags before probing for it. This makes the
943 compiler report 514, 515 and 132 (the code was there, but got
946 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
947 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
948 (GotoCase.Resolve): Set `Returns' to ALWAYS.
950 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
952 * enum.cs: create the enum static fields using the enum type.
954 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
956 * class.cs: don't try to create the ParamBuilder for the return
957 type if it's not needed (and handle it breaking for the ms runtime
960 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
962 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
964 2002-12-29 Miguel de Icaza <miguel@ximian.com>
966 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
967 the command. This showed up while compiling the JANET source
968 code, which used \r as its only newline separator.
970 2002-12-28 Miguel de Icaza <miguel@ximian.com>
972 * class.cs (Method.Define): If we are an operator (because it
973 reuses our code), then set the SpecialName and HideBySig. #36128
975 2002-12-22 Miguel de Icaza <miguel@ximian.com>
977 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
978 exception, report error 120 `object reference required'.
980 * driver.cs: Add --pause option, used during to measure the size
981 of the process as it goes with --timestamp.
983 * expression.cs (Invocation.DoResolve): Do not allow methods with
984 SpecialName to be invoked.
986 2002-12-21 Miguel de Icaza <miguel@ximian.com>
988 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
989 number before adding it.
991 2002-12-21 Ravi Pratap <ravi@ximian.com>
993 * ecore.cs (StandardImplicitConversion): When in an unsafe
994 context, we allow conversion between void * to any other pointer
995 type. This fixes bug #35973.
997 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
999 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
1000 is not thrown when extensionless outputs are used
1002 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1004 * rootcontext.cs: fixed compilation of corlib.
1006 2002-12-19 Miguel de Icaza <miguel@ximian.com>
1008 * attribute.cs (Attributes.Contains): Add new method.
1010 * class.cs (MethodCore.LabelParameters): if the parameter is an
1011 `out' parameter, check that no attribute `[In]' has been passed.
1013 * enum.cs: Handle the `value__' name in an enumeration.
1015 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
1017 * decl.cs: Added special case to allow overrides on "protected
1020 2002-12-18 Ravi Pratap <ravi@ximian.com>
1022 * attribute.cs (Attributes.AddAttributeSection): Rename to this
1023 since it makes much more sense.
1025 (Attributes.ctor): Don't require a Location parameter.
1027 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
1029 * attribute.cs (ApplyAttributes): Remove extra Location parameters
1030 since we already have that information per attribute.
1032 * everywhere : make appropriate changes.
1034 * class.cs (LabelParameters): Write the code which actually
1035 applies attributes to the return type. We can't do this on the MS
1036 .NET runtime so we flag a warning in the case an exception is
1039 2002-12-18 Miguel de Icaza <miguel@ximian.com>
1041 * const.cs: Handle implicit null conversions here too.
1043 2002-12-17 Ravi Pratap <ravi@ximian.com>
1045 * class.cs (MethodCore.LabelParameters): Remove the extra
1046 Type [] parameter since it is completely unnecessary. Instead
1047 pass in the method's attributes so that we can extract
1048 the "return" attribute.
1050 2002-12-17 Miguel de Icaza <miguel@ximian.com>
1052 * cs-parser.jay (parse): Use Report.Error to flag errors instead
1053 of ignoring it and letting the compile continue.
1055 * typemanager.cs (ChangeType): use an extra argument to return an
1056 error condition instead of throwing an exception.
1058 2002-12-15 Miguel de Icaza <miguel@ximian.com>
1060 * expression.cs (Unary.TryReduce): mimic the code for the regular
1061 code path. Perform an implicit cast in the cases where we can
1062 implicitly convert to one of the integral types, and then reduce
1063 based on that constant. This fixes bug #35483.
1065 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1067 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
1069 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1071 * namespace.cs: fixed bug #35489.
1073 2002-12-12 Miguel de Icaza <miguel@ximian.com>
1075 * class.cs: Remove some dead code.
1077 * cs-parser.jay: Estimate the number of methods needed
1078 (RootContext.MethodCount);
1080 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
1081 numbers instead of StringBuilders.
1083 * support.cs (PtrHashtable): Add constructor with initial size;
1084 We can now reduce reallocations of the method table.
1086 2002-12-10 Ravi Pratap <ravi@ximian.com>
1088 * attribute.cs (ApplyAttributes): Keep track of the emitted
1089 attributes on a per-target basis. This fixes bug #35413.
1091 2002-12-10 Miguel de Icaza <miguel@ximian.com>
1093 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
1094 default to the Windows 1252 encoding.
1096 (UnixParseOption): Support version, thanks to Alp for the missing
1099 * AssemblyInfo.cs: Add nice assembly information.
1101 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
1104 * cs-parser.jay: Allow a trailing comma before the close bracked
1105 in the attribute_section production.
1107 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
1108 address of the instance was being taken, I will take this out,
1109 because we take the address of the object immediately here.
1111 2002-12-09 Ravi Pratap <ravi@ximian.com>
1113 * typemanager.cs (AreMultipleAllowed): Take care of the most
1114 obvious case where attribute type is not in the current assembly -
1117 2002-12-08 Miguel de Icaza <miguel@ximian.com>
1119 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
1120 definitions, instead of doing that afterwards.
1122 Also we use a nice little hack, depending on the constructor, we
1123 know if we are a "composed" name or a simple name. Hence, we
1124 avoid the IndexOf test, and we avoid
1126 * codegen.cs: Add code to assist in a bug reporter to track down
1127 the source of a compiler crash.
1129 2002-12-07 Ravi Pratap <ravi@ximian.com>
1131 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
1132 types have been emitted for a given element and flag an error
1133 if something which does not have AllowMultiple set is used more
1136 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
1137 attribute types and their corresponding AllowMultiple properties
1139 (AreMultipleAllowed): Check the property for a given type.
1141 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
1142 property in the case we have a TypeContainer.
1144 (Attributes.AddAttribute): Detect duplicates and just skip on
1145 adding them. This trivial fix catches a pretty gross error in our
1146 attribute emission - global attributes were being emitted twice!
1148 Bugzilla bug #33187 is now fixed.
1150 2002-12-06 Miguel de Icaza <miguel@ximian.com>
1152 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
1155 * expression.cs (Binary.ResolveOperator): I can only use the
1156 Concat (string, string, string) and Concat (string, string,
1157 string, string) if the child is actually a concatenation of
1160 2002-12-04 Miguel de Icaza <miguel@ximian.com>
1162 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
1163 context where we need a 2-character lookahead.
1165 * pending.cs (PendingImplementation): Rework so we can keep track
1166 of interface types all the time, and flag those which were
1167 implemented by parents as optional.
1169 2002-12-03 Miguel de Icaza <miguel@ximian.com>
1171 * expression.cs (Binary.ResolveOperator): Use
1172 String.Concat(string,string,string) or
1173 String.Concat(string,string,string,string) when possible.
1175 * typemanager: More helper methods.
1178 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1180 * pending.cs: remove the bogus return from GetMissingInterfaces()
1181 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1183 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1185 * namespace.cs: avoid duplicated 'using xxx' being added to
1186 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1187 when we get more than one 'using' statement for the same namespace.
1188 Report a CS0105 warning for it.
1190 2002-11-30 Miguel de Icaza <miguel@ximian.com>
1192 * cs-tokenizer.cs (consume_identifier): use read directly, instead
1193 of calling getChar/putback, uses internal knowledge of it.
1195 (xtoken): Reorder tokenizer so most common patterns are checked
1196 first. This reduces the compilation time in another 5% (from 8.11s
1197 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1199 The parsing time is 22% of the compilation in mcs, and from that
1200 64% is spent on the tokenization process.
1202 I tried using a binary search for keywords, but this is slower
1203 than the hashtable. Another option would be to do a couple of
1206 * Not use a StringBuilder, instead use an array of chars,
1207 with a set value. Notice that this way we could catch
1208 the 645 error without having to do it *afterwards*.
1210 * We could write a hand-parser to avoid the hashtable
1211 compares altogether.
1213 The identifier consumption process takes 37% of the tokenization
1214 time. Another 15% is spent on is_number. 56% of the time spent
1215 on is_number is spent on Int64.Parse:
1217 * We could probably choose based on the string length to
1218 use Int32.Parse or Int64.Parse and avoid all the 64-bit
1221 Another 3% is spend on wrapping `xtoken' in the `token' function.
1223 Handle 0xa0 as whitespace (#34752)
1225 2002-11-26 Miguel de Icaza <miguel@ximian.com>
1227 * typemanager.cs (IsCLRType): New routine to tell whether a type
1228 is one of the builtin types.
1230 Maybe it needs to use TypeCodes to be faster. Maybe we could use
1231 typecode in more places instead of doing pointer comparissions.
1232 We could leverage some knowledge about the way the typecodes are
1235 New code to cache namespaces in assemblies, it is currently not
1236 invoked, to be used soon.
1238 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
1240 * expression.cs (Binary.ResolveOperator): specially handle
1241 strings, and do not perform user-defined operator overloading for
1244 2002-11-24 Miguel de Icaza <miguel@ximian.com>
1246 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
1247 internalcall as it is a pretty simple operation; Avoid whenever
1248 possible to call Char.IsLetter.
1250 (consume_identifier): Cut by half the number of
1251 hashtable calls by merging the is_keyword and GetKeyword behavior.
1253 Do not short-circuit, because if we do, we
1254 report errors (ie, #if false && true would produce an invalid
1258 2002-11-24 Martin Baulig <martin@ximian.com>
1260 * expression.cs (Cast.TryReduce): If we're in checked syntax,
1261 check constant ranges and report a CS0221. Fixes #33186.
1263 2002-11-24 Martin Baulig <martin@ximian.com>
1265 * cs-parser.jay: Make this work for uninitialized variable
1266 declarations in the `for' initializer. Fixes #32416.
1268 2002-11-24 Martin Baulig <martin@ximian.com>
1270 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
1271 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
1273 2002-11-24 Martin Baulig <martin@ximian.com>
1275 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
1276 argument; if true, we also check for user-defined conversions.
1277 This is only needed if both arguments are of a user-defined type.
1278 Fixes #30443, added test-175.cs.
1279 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
1281 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
1283 2002-11-24 Martin Baulig <martin@ximian.com>
1285 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
1286 function to get the store opcode.
1287 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
1288 only emit the Ldelema if the store opcode is Stobj. You must run
1289 both test-34 and test-167 to test this. Fixes #34529.
1291 2002-11-23 Martin Baulig <martin@ximian.com>
1293 * ecore.cs (Expression.MemberLookup): Added additional
1294 `qualifier_type' argument which is used when we're being called
1295 from MemberAccess.DoResolve() and null if we're called from a
1297 (Expression.MemberLookupFailed): New method to report errors; this
1298 does the CS1540 check and reports the correct error message.
1300 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
1301 argument for the CS1540 check and redone the way how we're dealing
1302 with private members. See the comment in the source code for details.
1303 (FilterWithClosure): Reverted this back to revision 1.197; renamed
1304 `closure_start_type' to `closure_qualifier_type' and check whether
1305 it's not null. It was not this filter being broken, it was just
1306 being called with the wrong arguments.
1308 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
1309 and pass it the correct `qualifier_type'; this also does the error
1312 2002-11-22 Miguel de Icaza <miguel@ximian.com>
1314 * expression.cs (Invocation.EmitParams): If the we are dealing
1315 with a non-built-in value type, load its address as well.
1317 (ArrayCreation): Use a a pretty constant instead
1318 of the hardcoded value 2. Use 6 instead of 2 for the number of
1319 static initializers.
1321 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
1322 because they are not really value types, just glorified integers.
1324 * driver.cs: Do not append .exe, the CSC compiler does not do it.
1326 * ecore.cs: Remove redundant code for enumerations, make them use
1327 the same code path as everything else, fixes the casting issue
1328 with enumerations in Windows.Forms.
1330 * attribute.cs: Do only cast to string if it is a string, the
1331 validation happens later.
1333 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
1334 people upgrade their corlibs.
1336 * ecore.cs: Oops, enumerations were not following the entire code path
1338 2002-11-21 Miguel de Icaza <miguel@ximian.com>
1340 * typemanager.cs (FilterWithClosure): Commented out the test for
1341 1540 in typemanager.cs, as it has problems when accessing
1342 protected methods from a parent class (see test-174.cs).
1344 * attribute.cs (Attribute.ValidateGuid): new method.
1345 (Attribute.Resolve): Use above.
1347 2002-11-19 Miguel de Icaza <miguel@ximian.com>
1349 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
1351 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
1352 handling for enumerations, as we only needed the TypeContainer
1353 functionality to begin with (this is required for the fix below to
1354 work for enums that reference constants in a container class for
1357 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
1359 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
1360 a valid TypeBuilder to perform lookups on.o
1362 * class.cs (InheritableMemberSignatureCompare): Use true in the
1363 call to GetGetMethod and GetSetMethod, because we are comparing
1364 the signature, and we need to get the methods *even* if they are
1367 (PropertyBase.CheckBase): ditto.
1369 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
1370 GotoCase.Resolve): Use Peel on EmpytCasts.
1372 * ecore.cs (EmptyCast): drop child, add Peel method.
1374 2002-11-17 Martin Baulig <martin@ximian.com>
1376 * ecore.cs (EmptyCast.Child): New public property.
1378 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
1379 label resolved to an EmptyCast. Fixes #34162.
1380 (GotoCase.Resolve): Likewise.
1381 (Block.EmitMeta): Likewise.
1383 2002-11-17 Martin Baulig <martin@ximian.com>
1385 * expression.cs (Invocation.BetterConversion): Prefer int over
1386 uint; short over ushort; long over ulong for integer literals.
1387 Use ImplicitConversionExists instead of StandardConversionExists
1388 since we also need to check for user-defined implicit conversions.
1389 Fixes #34165. Added test-173.cs.
1391 2002-11-16 Martin Baulig <martin@ximian.com>
1393 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
1394 with the `true' and `false' literals. Fixes #33151.
1396 2002-11-16 Martin Baulig <martin@ximian.com>
1398 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
1399 October 22nd; don't do the cs1540 check for static members.
1401 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
1402 now using our own filter here and doing the cs1540 check again.
1404 2002-11-16 Martin Baulig <martin@ximian.com>
1406 * support.cs (InternalParameters): Don't crash if we don't have
1407 any fixed parameters. Fixes #33532.
1409 2002-11-16 Martin Baulig <martin@ximian.com>
1411 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
1412 when looking up static methods to make this work on Windows.
1415 2002-11-16 Martin Baulig <martin@ximian.com>
1417 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1418 a setter rather than using PropertyInfo.CanWrite.
1420 2002-11-15 Nick Drochak <ndrochak@gol.com>
1422 * class.cs: Allow acces to block member by subclasses. Fixes build
1425 2002-11-14 Martin Baulig <martin@ximian.com>
1427 * class.cs (Constructor.Emit): Added the extern/block check.
1430 2002-11-14 Martin Baulig <martin@ximian.com>
1432 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1433 iteration while looking for indexers, this is needed because the
1434 indexer may have a different name in our base classes. Fixed the
1435 error reporting (no indexers at all, not get accessor, no
1436 overloaded match). Fixes bug #33089.
1437 (IndexerAccess.DoResolveLValue): Likewise.
1439 2002-11-14 Martin Baulig <martin@ximian.com>
1441 * class.cs (PropertyBase.CheckBase): Make this work for multiple
1442 indexers. Fixes the first part of bug #33089.
1443 (MethodSignature.InheritableMemberSignatureCompare): Added support
1446 2002-11-13 Ravi Pratap <ravi@ximian.com>
1448 * attribute.cs (Attribute.Resolve): Catch the
1449 NullReferenceException and report it since it isn't supposed to
1452 2002-11-12 Miguel de Icaza <miguel@ximian.com>
1454 * expression.cs (Binary.EmitBranchable): Also handle the cases for
1455 LogicalOr and LogicalAnd that can benefit from recursively
1456 handling EmitBranchable. The code now should be nice for Paolo.
1458 2002-11-08 Miguel de Icaza <miguel@ximian.com>
1460 * typemanager.cs (LookupType): Added a negative-hit hashtable for
1461 the Type lookups, as we perform quite a number of lookups on
1462 non-Types. This can be removed once we can deterministically tell
1463 whether we have a type or a namespace in advance.
1465 But this might require special hacks from our corlib.
1469 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1470 and double which avoids a conversion from an integer to a double.
1472 * expression.cs: tiny optimization, avoid calling IsConstant,
1473 because it effectively performs the lookup twice.
1475 2002-11-06 Miguel de Icaza <miguel@ximian.com>
1477 But a bogus return here to keep the semantics of the old code
1478 until the Mono runtime is fixed.
1480 * pending.cs (GetMissingInterfaces): New method used to remove all
1481 the interfaces that are already implemented by our parent
1482 classes from the list of pending methods.
1484 * interface.cs: Add checks for calls after ResolveTypeExpr.
1486 2002-11-05 Miguel de Icaza <miguel@ximian.com>
1488 * class.cs (Class.Emit): Report warning 67: event not used if the
1489 warning level is beyond 3.
1491 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1492 being a NullLiteral.
1494 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1497 * class.cs (TypeContainer.GetClassBases): Cover a missing code
1498 path that might fail if a type can not be resolved.
1500 * expression.cs (Binary.Emit): Emit unsigned versions of the
1503 * driver.cs: use error 5.
1505 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1507 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1509 2002-11-01 Miguel de Icaza <miguel@ximian.com>
1511 * cs-parser.jay (switch_section): A beautiful patch from Martin
1512 Baulig that fixed 33094.
1514 2002-10-31 Miguel de Icaza <miguel@ximian.com>
1516 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1517 Check whether the base is abstract and report an error if so.
1519 * expression.cs (IndexerAccess.DoResolveLValue,
1520 IndexerAccess.DoResolve): ditto.
1522 (Invocation.DoResolve): ditto.
1524 (Invocation.FullMethodDesc): Improve the report string.
1526 * statement.cs (Block): Eliminate IsVariableDefined as it is
1527 basically just a wrapper for GetVariableInfo.
1529 * ecore.cs (SimpleName): Use new
1531 * support.cs (ReflectionParamter.ParameterType): We unwrap the
1532 type, as we return the actual parameter ref/unref state on a
1535 2002-10-30 Miguel de Icaza <miguel@ximian.com>
1537 * support.cs: Return proper flags REF/OUT fixing the previous
1540 * expression.cs: Reverted last patch, that was wrong. Is_ref is
1541 not used to mean `ref' but `ref or out' in ParameterReference
1543 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1544 full type signature instead of calling TypeManger.CSharpName
1547 * support.cs (InternalParameters.ParameterDesc): Do not compare
1548 directly to the modflags, because REF/OUT will actually be bitsets
1551 * delegate.cs (VerifyMethod): Check also the modifiers.
1553 * cs-tokenizer.cs: Fix bug where floating point values with an
1554 exponent where a sign was missing was ignored.
1556 * driver.cs: Allow multiple assemblies to be specified in a single
1559 2002-10-28 Miguel de Icaza <miguel@ximian.com>
1561 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
1562 because identifiers after a parenthesis would end up in this kind
1563 of production, and we needed to desamiguate it for having casts
1566 (UserDefinedType *) xxx
1568 2002-10-24 Miguel de Icaza <miguel@ximian.com>
1570 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1571 we should set on the Bindingflags.NonPublic, but not turn on
1572 private_ok. private_ok controls whether a Private member is
1573 returned (this is chekced on the filter routine), while the
1574 BindingFlags.NonPublic just controls whether private/protected
1575 will be allowed. This fixes the problem part of the problem of
1576 private properties being allowed to be used in derived classes.
1578 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1579 so we can call the children DoResolveLValue method (this will
1580 properly signal errors on lvalue assignments to base properties)
1582 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1583 getter are null, and we have a property info, we know that this
1584 happened because the lookup failed, so we report an error 122 for
1585 protection level violation.
1587 We also silently return if setter and getter are null in the
1588 resolve functions, this condition only happens if we have flagged
1589 the error before. This is the other half of the problem.
1591 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1592 not have accessibility information, that is why we were returning
1593 true in the filter function in typemanager.cs.
1595 To properly report 122 (property is inaccessible because of its
1596 protection level) correctly, we report this error in ResolveAccess
1597 by failing if both the setter and the getter are lacking (ie, the
1600 DoResolve and DoLResolve have been modified to check for both
1601 setter/getter being null and returning silently, the reason being
1602 that I did not want to put the knowledge about this error in upper
1605 int old = Report.Errors;
1606 x = new PropertyExpr (...);
1607 if (old != Report.Errors)
1612 So the property expr is returned, but it is invalid, so the error
1613 will be flagged during the resolve process.
1615 * class.cs: Remove InheritablePropertySignatureCompare from the
1616 class, as we no longer depend on the property signature to compute
1617 whether it is possible to implement a method or not.
1619 The reason is that calling PropertyInfo.GetGetMethod will return
1620 null (in .NET, in Mono it works, and we should change this), in
1621 cases where the Get Method does not exist in that particular
1626 class X { public virtual int A { get { return 1; } } }
1628 class Z : Y { public override int A { get { return 2; } } }
1630 Would fail in Z because the parent (Y) would not have the property
1631 defined. So we avoid this completely now (because the alternative
1632 fix was ugly and slow), and we now depend exclusively on the
1635 (PropertyBase.CheckBase): Use a method-base mechanism to find our
1636 reference method, instead of using the property.
1638 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
1639 routines are gone now.
1641 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
1642 names, they were incorrectly named.
1644 * cs-tokenizer.cs: Return are more gentle token on failure.
1646 * pending.cs (PendingImplementation.InterfaceMethod): This routine
1647 had an out-of-sync index variable, which caused it to remove from
1648 the list of pending methods the wrong method sometimes.
1650 2002-10-22 Miguel de Icaza <miguel@ximian.com>
1652 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
1653 CanWrite, because those refer to this particular instance of the
1654 property, and do not take into account the fact that we can
1655 override single members of a property.
1657 Constructor requires an EmitContext. The resolution process does
1658 not happen here, but we need to compute the accessors before,
1659 because the resolution does not always happen for properties.
1661 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
1662 subclass, before we did not update this flag, but we did update
1665 (GetAccessors): Drop this routine, as it did not work in the
1666 presence of partially overwritten set/get methods.
1668 Notice that this broke the cs1540 detection, but that will require
1671 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1675 * driver.cs: issue a warning instead of an error if we don't support
1676 debugging for the platform. Also ignore a couple of errors that may
1677 arise when trying to write the symbols. Undo my previous patch.
1679 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1681 * driver.cs: ignore /debug switch except for Unix platforms.
1683 2002-10-23 Nick Drochak <ndrochak@gol.com>
1685 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
1687 2002-10-21 Miguel de Icaza <miguel@ximian.com>
1689 * driver.cs: Do not make mcs-debug conditional, so we do not break
1692 * statement.cs (UsageVector.MergeChildren): I would like Martin to
1693 review this patch. But basically after all the children variables
1694 have been merged, the value of "Breaks" was not being set to
1695 new_breaks for Switch blocks. I think that it should be set after
1696 it has executed. Currently I set this to the value of new_breaks,
1697 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
1698 conservative, but I do not understand this code very well.
1700 I did not break anything in the build, so that is good ;-)
1702 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
1704 2002-10-20 Mark Crichton <crichton@gimp.org>
1706 * cfold.cs: Fixed compile blocker. Really fixed it this time.
1708 2002-10-20 Nick Drochak <ndrochak@gol.com>
1710 * cfold.cs: Fixed compile blocker.
1712 2002-10-20 Miguel de Icaza <miguel@ximian.com>
1714 * driver.cs: I was chekcing the key, not the file.
1716 2002-10-19 Ravi Pratap <ravi@ximian.com>
1718 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
1719 message that we were generating - we just need to silently return
1722 2002-10-19 Miguel de Icaza <miguel@ximian.com>
1724 * class.cs (Event.Define): Change my previous commit, as this
1725 breaks the debugger. This is a temporary hack, as it seems like
1726 the compiler is generating events incorrectly to begin with.
1728 * expression.cs (Binary.ResolveOperator): Added support for
1729 "U operator - (E x, E y)"
1731 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
1734 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
1735 init-only variables, but this path did not take into account that
1736 there might be also instance readonly variables. Correct this
1739 This fixes bug 32253
1741 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
1744 * driver.cs: Change the extension for modules to `netmodule'
1746 * cs-parser.jay: Improved slightly the location tracking for
1747 the debugger symbols.
1749 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
1750 modifiers that were specified instead of the hardcoded value
1751 (FamAndAssem). This was basically ignoring the static modifier,
1752 and others. Fixes 32429.
1754 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
1755 fixed a bug in the process (32476)
1757 * expression.cs (ArrayAccess.EmitAssign): Patch from
1758 hwang_rob@yahoo.ca that fixes bug 31834.3
1760 2002-10-18 Miguel de Icaza <miguel@ximian.com>
1762 * driver.cs: Make the module extension .netmodule.
1764 2002-10-16 Miguel de Icaza <miguel@ximian.com>
1766 * driver.cs: Report an error if the resource file is not found
1767 instead of crashing.
1769 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
1770 false, like Emit does.
1772 2002-10-16 Nick Drochak <ndrochak@gol.com>
1774 * typemanager.cs: Remove unused private member. Also reported mcs
1775 bug to report this as a warning like csc.
1777 2002-10-15 Martin Baulig <martin@gnome.org>
1779 * statement.cs (Statement.Emit): Made this a virtual method; emits
1780 the line number info and calls DoEmit().
1781 (Statement.DoEmit): New protected abstract method, formerly knows
1782 as Statement.Emit().
1784 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
1786 2002-10-11 Miguel de Icaza <miguel@ximian.com>
1788 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
1789 have fixed a remaining problem: not every AddXXXX was adding a
1790 fully qualified name.
1792 Now everyone registers a fully qualified name in the DeclSpace as
1793 being defined instead of the partial name.
1795 Downsides: we are slower than we need to be due to the excess
1796 copies and the names being registered this way.
1798 The reason for this is that we currently depend (on the corlib
1799 bootstrap for instance) that types are fully qualified, because
1800 we dump all the types in the namespace, and we should really have
1801 types inserted into the proper namespace, so we can only store the
1802 basenames in the defined_names array.
1804 2002-10-10 Martin Baulig <martin@gnome.org>
1806 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
1807 from bug #31834, see the bug report for a testcase which is
1810 2002-10-10 Martin Baulig <martin@gnome.org>
1812 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
1813 flow analysis code for this.
1815 * statement.cs (Do, While, For): Tell the flow analysis code about
1817 (FlowBranching.UsageVector): Added support for infinite loops.
1818 (Block.Resolve): Moved the dead code elimination here and use flow
1821 2002-10-09 Miguel de Icaza <miguel@ximian.com>
1823 * class.cs (Field.Define): Catch cycles on struct type
1826 * typemanager.cs (IsUnmanagedtype): Do not recursively check
1827 fields if the fields are static. We only need to check instance
1830 * expression.cs (As.DoResolve): Test for reference type.
1832 * statement.cs (Using.ResolveExpression): Use
1833 ConvertImplicitRequired, not ConvertImplicit which reports an
1835 (Using.ResolveLocalVariableDecls): ditto.
1837 * expression.cs (Binary.ResolveOperator): Report errors in a few
1838 places where we had to.
1840 * typemanager.cs (IsUnmanagedtype): Finish implementation.
1842 2002-10-08 Miguel de Icaza <miguel@ximian.com>
1844 * expression.cs: Use StoreFromPtr instead of extracting the type
1845 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
1847 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
1848 an enumeration value to a System.Enum, but System.Enum is not a
1849 value type, but an class type, so we need to box.
1851 (Expression.ConvertExplicit): One codepath could return
1852 errors but not flag them. Fix this. Fixes #31853
1854 * parameter.cs (Resolve): Do not allow void as a parameter type.
1856 2002-10-06 Martin Baulig <martin@gnome.org>
1858 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
1859 if it's a class type and not a struct. Fixes #31815.
1861 2002-10-06 Martin Baulig <martin@gnome.org>
1863 * statement.cs: Reworked the flow analysis code a bit to make it
1864 usable for dead code elimination.
1866 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1868 * cs-parser.jay: allow empty source files. Fixes bug #31781.
1870 2002-10-04 Miguel de Icaza <miguel@ximian.com>
1872 * expression.cs (ComposedCast.DoResolveType): A quick workaround
1873 to fix the test 165, will investigate deeper.
1875 2002-10-04 Martin Baulig <martin@gnome.org>
1877 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
1878 finally blocks actually work.
1879 (Try.Resolve): We don't need to create a sibling for `finally' if
1880 there is no finally block.
1882 2002-10-04 Martin Baulig <martin@gnome.org>
1884 * class.cs (Constructor.Define): The default accessibility for a
1885 non-default constructor is private, not public.
1887 2002-10-04 Miguel de Icaza <miguel@ximian.com>
1889 * class.cs (Constructor): Make AllowedModifiers public, add
1892 * cs-parser.jay: Perform the modifiers test here, as the
1893 constructor for the Constructor class usually receives a zero
1894 because of the way we create it (first we create, later we
1895 customize, and we were never checking the modifiers).
1897 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
1898 is a version of LookupTypeReflection that includes the type-name
1899 cache. This can be used as a fast path for functions that know
1900 the fully qualified name and are only calling into *.GetType() to
1901 obtain a composed type.
1903 This is also used by TypeManager.LookupType during its type
1906 (LookupType): We now also track the real type name, as sometimes
1907 we can get a quey for the real type name from things like
1908 ComposedCast. This fixes bug 31422.
1910 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
1911 complete type fullname, it does not have to go through the type
1912 resolution system to obtain the composed version of the type (for
1913 obtaining arrays or pointers).
1915 (Conditional.Emit): Use the EmitBoolExpression to
1916 generate nicer code, as requested by Paolo.
1918 (ArrayCreation.CheckIndices): Use the patch from
1919 hwang_rob@yahoo.ca to validate the array initializers.
1921 2002-10-03 Miguel de Icaza <miguel@ximian.com>
1923 * class.cs (ConstructorInitializer.Emit): simplify code by using
1924 Invocation.EmitCall, and at the same time, fix the bugs in calling
1925 parent constructors that took variable arguments.
1927 * ecore.cs (Expression.ConvertNumericExplicit,
1928 Expression.ImplicitNumericConversion): Remove the code that
1929 manually wrapped decimal (InternalTypeConstructor call is now gone
1932 * expression.cs (Cast.TryReduce): Also handle decimal types when
1933 trying to perform a constant fold on the type.
1935 * typemanager.cs (IsUnmanagedtype): Partially implemented.
1937 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
1938 that only turned off an error report, and did nothing else.
1940 2002-10-02 Miguel de Icaza <miguel@ximian.com>
1942 * driver.cs: Handle and ignore /fullpaths
1944 2002-10-01 Miguel de Icaza <miguel@ximian.com>
1946 * expression.cs (Binary.ResolveOperator): Catch the case where
1947 DoNumericPromotions returns true,
1949 (Binary.DoNumericPromotions): Simplify the code, and the tests.
1951 2002-09-27 Miguel de Icaza <miguel@ximian.com>
1953 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
1956 2002-09-26 Miguel de Icaza <miguel@ximian.com>
1958 * ecore.cs (ConvertNumericExplicit): It is not enough that the
1959 conversion exists, but it is also required that the conversion be
1960 performed. This manifested in "(Type64Enum) 2".
1962 * class.cs (TypeManager.AddMethod): The fix is not to change
1963 AddEnum, because that one was using a fully qualified name (every
1964 DeclSpace derivative does), but to change the AddMethod routine
1965 that was using an un-namespaced name. This now correctly reports
1966 the duplicated name.
1968 Revert patch until I can properly fix it. The issue
1969 is that we have a shared Type space across all namespaces
1970 currently, which is wrong.
1972 Options include making the Namespace a DeclSpace, and merge
1973 current_namespace/current_container in the parser.
1975 2002-09-25 Miguel de Icaza <miguel@ximian.com>
1977 * cs-parser.jay: Improve error reporting when we get a different
1978 kind of expression in local_variable_type and
1979 local_variable_pointer_type.
1981 Propagate this to avoid missleading errors being reported.
1983 * ecore.cs (ImplicitReferenceConversion): treat
1984 TypeManager.value_type as a target just like object_type. As
1989 Is valid, and needs to result in the int 1 being boxed before it
1990 is assigned to the value type v.
1992 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
1993 to validate the enumeration name.
1995 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
1996 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
1997 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
1999 * ecore.cs (TryImplicitIntConversion): When doing an
2000 implicit-enumeration-conversion, check if the type is 64-bits and
2001 perform a conversion before passing to EnumConstant.
2003 2002-09-23 Miguel de Icaza <miguel@ximian.com>
2005 * decl.cs (Error_AmbiguousTypeReference); New routine used to
2006 report ambiguous type references. Unlike the MS version, we
2007 report what the ambiguity is. Innovation at work ;-)
2009 (DeclSpace.FindType): Require a location argument to
2010 display when we display an ambiguous error.
2012 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
2014 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
2016 * expression.cs (EmitDynamicInitializers): Apply patch from
2017 hwang_rob@yahoo.ca that fixes the order in which we emit our
2020 2002-09-21 Martin Baulig <martin@gnome.org>
2022 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
2023 delegate takes no arguments.
2025 2002-09-20 Miguel de Icaza <miguel@ximian.com>
2027 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
2030 * expression.cs: Extract the underlying type.
2032 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
2034 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
2036 2002-09-19 Miguel de Icaza <miguel@ximian.com>
2038 * class.cs (TypeContainer.DefineType): We can not use the nice
2039 PackingSize with the size set to 1 DefineType method, because it
2040 will not allow us to define the interfaces that the struct
2043 This completes the fixing of bug 27287
2045 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
2046 means also structs. This fixes part of the problem.
2047 (Expresion.ImplicitReferenceConversionExists): ditto.
2049 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
2050 error if there were no errors reported during the type lookup
2051 process, to avoid duplicates or redundant errors. Without this
2052 you would get an ambiguous errors plus a type not found. We have
2053 beaten the user enough with the first error.
2055 (DeclSparce.FindType): Emit a warning if we have an ambiguous
2058 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
2059 during the resolution process, stop the lookup, this avoids
2060 repeated error reports (same error twice).
2062 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
2064 * typemanager.cs (LookupType): Redo the type lookup code to match
2065 the needs of System.Reflection.
2067 The issue is that System.Reflection requires references to nested
2068 types to begin with a "+" sign instead of a dot. So toplevel
2069 types look like: "NameSpace.TopLevelClass", and nested ones look
2070 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
2073 2002-09-19 Martin Baulig <martin@gnome.org>
2075 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
2076 says that a method always returns or always throws an exception,
2077 don't report the CS0161.
2079 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
2080 set `Returns = new_returns'.
2082 2002-09-19 Martin Baulig <martin@gnome.org>
2084 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
2085 to an enum constant, check for a CS0176.
2087 2002-09-18 Miguel de Icaza <miguel@ximian.com>
2089 * class.cs (TypeContainer.CheckPairedOperators): Now we check
2090 for operators that must be in pairs and report errors.
2092 * ecore.cs (SimpleName.DoResolveType): During the initial type
2093 resolution process, when we define types recursively, we must
2094 check first for types in our current scope before we perform
2095 lookups in the enclosing scopes.
2097 * expression.cs (MakeByteBlob): Handle Decimal blobs.
2099 (Invocation.VerifyArgumentsCompat): Call
2100 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
2101 I thought we were supposed to always call this, but there are a
2102 few places in the code where we dont do it.
2104 2002-09-17 Miguel de Icaza <miguel@ximian.com>
2106 * driver.cs: Add support in -linkres and -resource to specify the
2107 name of the identifier.
2109 2002-09-16 Miguel de Icaza <miguel@ximian.com>
2111 * ecore.cs (StandardConversionExists): Sync with the conversion
2112 code: allow anything-* to void* conversions.
2114 (FindMostSpecificSource): Use an Expression argument
2115 instead of a Type, because we might be handed over a Literal which
2116 gets a few more implicit conversions that plain types do not. So
2117 this information was being lost.
2119 Also, we drop the temporary type-holder expression when not
2122 2002-09-17 Martin Baulig <martin@gnome.org>
2124 * class.cs (PropertyBase.CheckBase): Don't check the base class if
2125 this is an explicit interface implementation.
2127 2002-09-17 Martin Baulig <martin@gnome.org>
2129 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
2130 different `IndexerName' attributes.
2132 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
2133 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
2134 virtual CommonResolve().
2136 2002-09-16 Miguel de Icaza <miguel@ximian.com>
2138 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
2139 and convert that to the UnderlyingType.
2141 * statement.cs (Foreach.Resolve): Indexers are just like variables
2142 or PropertyAccesses.
2144 * cs-tokenizer.cs (consume_string): Track line numbers and columns
2145 inside quoted strings, we were not doing this before.
2147 2002-09-16 Martin Baulig <martin@gnome.org>
2149 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
2150 resolve it. This is needed for the definite assignment check of the
2151 instance expression, fixes bug #29846.
2152 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
2154 2002-09-16 Nick Drochak <ndrochak@gol.com>
2156 * parameter.cs: Fix compile error. Cannot reference static member
2157 from an instance object. Is this an mcs bug?
2159 2002-09-14 Martin Baulig <martin@gnome.org>
2161 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
2162 multiple times. Fixes bug #30295, added test-166.cs.
2164 2002-09-14 Martin Baulig <martin@gnome.org>
2166 * statement.cs (Block.Emit): Don't emit unreachable code.
2167 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
2169 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
2171 2002-09-14 Martin Baulig <martin@gnome.org>
2173 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
2176 2002-09-14 Martin Baulig <martin@gnome.org>
2178 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2179 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2180 be false on the ms runtime.
2182 2002-09-13 Martin Baulig <martin@gnome.org>
2184 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2185 the CS0038 error message.
2187 2002-09-12 Miguel de Icaza <miguel@ximian.com>
2189 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2190 constant inside, return it.
2192 2002-09-12 Martin Baulig <martin@gnome.org>
2194 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2195 implicit conversion can be done between enum types.
2197 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2198 check whether an implicit conversion to the current enum's UnderlyingType
2199 exists and report an error if not.
2201 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
2202 without debugging support.
2204 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
2205 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
2207 2002-09-12 Martin Baulig <martin@gnome.org>
2209 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
2211 * ecore.cs (IMemberExpr.DeclaringType): New property.
2212 (SimpleName.SimpleNameResolve): Check whether we're accessing a
2213 nonstatic member of an outer type (CS0038).
2215 2002-09-11 Miguel de Icaza <miguel@ximian.com>
2217 * driver.cs: Activate the using-error detector at warning level
2218 4 (at least for MS-compatible APIs).
2220 * namespace.cs (VerifyUsing): Small buglett fix.
2222 * pending.cs (PendingImplementation): pass the container pointer.
2224 * interface.cs (GetMethods): Allow for recursive definition. Long
2225 term, I would like to move every type to support recursive
2226 definitions, not the current ordering mechanism that we have right
2229 The situation is this: Attributes are handled before interfaces,
2230 so we can apply attributes to interfaces. But some attributes
2231 implement interfaces, we will now handle the simple cases
2232 (recursive definitions will just get an error).
2234 * parameter.cs: Only invalidate types at the end if we fail to
2237 2002-09-09 Martin Baulig <martin@gnome.org>
2239 * ecore.cs (PropertyExpr.Emit): Also check for
2240 TypeManager.system_int_array_get_length so this'll also work when
2241 compiling corlib. Fixes #30003.
2243 2002-09-09 Martin Baulig <martin@gnome.org>
2245 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
2246 and throw an exception if we can't get the type's size. Fixed #30040,
2249 2002-09-09 Martin Baulig <martin@gnome.org>
2251 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
2253 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
2254 context. Fixes bug #30027.
2256 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
2257 virtual functions. Fixes bug #30043, added test-164.cs.
2259 2002-09-08 Ravi Pratap <ravi@ximian.com>
2261 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
2263 2002-09-08 Nick Drochak <ndrochak@gol.com>
2265 * driver.cs: Use an object to get the windows codepage since it's not a
2268 2002-09-08 Miguel de Icaza <miguel@ximian.com>
2270 * statement.cs (For.Emit): for infinite loops (test == null)
2271 return whether there is a break inside, not always "true".
2273 * namespace.cs (UsingEntry): New struct to hold the name of the
2274 using definition, the location where it is defined, and whether it
2275 has been used in a successful type lookup.
2277 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
2282 2002-09-06 Ravi Pratap <ravi@ximian.com>
2284 * attribute.cs : Fix incorrect code which relied on catching
2285 a NullReferenceException to detect a null being passed in
2286 where an object was expected.
2288 2002-09-06 Miguel de Icaza <miguel@ximian.com>
2290 * statement.cs (Try): flag the catch variable as assigned
2292 * expression.cs (Cast): Simplified by using ResolveType instead of
2295 * statement.cs (Catch): Fix bug by using ResolveType.
2297 2002-09-06 Ravi Pratap <ravi@ximian.com>
2299 * expression.cs (BetterConversion): Special case for when we have
2300 a NullLiteral as the argument and we have to choose between string
2301 and object types - we choose string the way csc does.
2303 * attribute.cs (Attribute.Resolve): Catch the
2304 NullReferenceException and report error #182 since the Mono
2305 runtime no more has the bug and having this exception raised means
2306 we tried to select a constructor which takes an object and is
2309 2002-09-05 Ravi Pratap <ravi@ximian.com>
2311 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
2312 message (1502, 1503) when we can't locate a method after overload
2313 resolution. This is much more informative and closes the bug
2316 * interface.cs (PopulateMethod): Return if there are no argument
2317 types. Fixes a NullReferenceException bug.
2319 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
2320 expressions too. Previously we were checking only in one place for
2321 positional arguments leaving out named arguments.
2323 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
2324 type to the enum type is not allowed. Remove code corresponding to
2327 (ConvertNumericExplicit): Allow explicit conversions from
2328 the underlying type to enum type. This precisely follows the spec
2329 and closes a bug filed by Gonzalo.
2331 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2334 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
2336 2002-09-03 Miguel de Icaza <miguel@ximian.com>
2338 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
2339 it was important that we stored the right value after the
2340 reduction in `converted'.
2342 2002-09-04 Martin Baulig <martin@gnome.org>
2344 * location.cs (Location.SymbolDocument): Use full pathnames for the
2347 2002-08-30 Miguel de Icaza <miguel@ximian.com>
2349 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
2350 of the expression resolve mechanism, because that will catch the
2351 SimpleName error failures.
2353 (Conditional): If we can not resolve the
2354 expression, return, do not crash.
2356 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2359 (location): display token name instead of its number.
2361 2002-08-28 Martin Baulig <martin@gnome.org>
2363 * expression.cs (Binary.ResolveOperator): Don't silently return
2364 but return an error if an operator cannot be applied between two
2367 2002-08-28 Martin Baulig <martin@gnome.org>
2369 * class.cs (Constructor.Define): Set the permission attributes
2370 correctly instead of making all constructors public.
2372 2002-08-28 Martin Baulig <martin@gnome.org>
2374 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
2375 for private members before reporting a CS0103; if we find anything,
2378 2002-08-28 Martin Baulig <martin@gnome.org>
2380 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
2381 to check whether `closure_start_type == closure_invocation_type',
2382 we also need to check whether `m.DeclaringType == closure_invocation_type'
2383 before bypassing the permission checks. We might be accessing
2384 protected/private members from the base class.
2385 (TypeManager.RealMemberLookup): Only set private_ok if private
2386 members were requested via BindingFlags.NonPublic.
2388 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
2390 * expression.cs (MemberAccess.ResolveMemberAccess): Set
2391 MethodGroupExpr.IsExplicitImpl if appropriate.
2392 (Invocation.DoResolve): Don't report the CS0120 for explicit
2393 interface implementations.
2395 2002-08-27 Martin Baulig <martin@gnome.org>
2397 * expression.cs (Invocation.DoResolve): If this is a static
2398 method and we don't have an InstanceExpression, we must report
2401 2002-08-25 Martin Baulig <martin@gnome.org>
2403 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
2404 `==' between a valuetype and an object.
2406 2002-08-25 Miguel de Icaza <miguel@ximian.com>
2408 * ecore.cs (TypeExpr): Provide a ToString method.
2410 2002-08-24 Martin Baulig <martin@gnome.org>
2412 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
2413 now called proggie.dbg and it's a binary file.
2415 2002-08-23 Martin Baulig <martin@gnome.org>
2417 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2419 2002-08-23 Martin Baulig <martin@gnome.org>
2421 * struct.cs (MyStructInfo.ctor): Make this work with empty
2422 structs; it's not allowed to use foreach() on null.
2424 2002-08-23 Martin Baulig <martin@gnome.org>
2426 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2427 writer the full pathname of the generated assembly.
2429 2002-08-23 Martin Baulig <martin@gnome.org>
2431 * statements.cs (FlowBranching.UsageVector.MergeChildren):
2432 A `finally' block never returns or breaks; improved handling of
2435 2002-08-23 Martin Baulig <martin@gnome.org>
2437 * statement.cs (Throw.Resolve): Allow `throw null'.
2439 2002-08-23 Martin Baulig <martin@gnome.org>
2441 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2442 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2443 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
2444 MemberLookup would return a wrong event if this is an explicit
2445 interface implementation and the class has an event with the same
2448 2002-08-23 Martin Baulig <martin@gnome.org>
2450 * statement.cs (Block.AddChildVariableNames): New public method.
2451 (Block.AddChildVariableName): Likewise.
2452 (Block.IsVariableNameUsedInChildBlock): Likewise.
2453 (Block.AddVariable): Check whether a variable name has already
2454 been used in a child block.
2456 * cs-parser.jay (declare_local_variables): Mark all variable names
2457 from the current block as being used in a child block in the
2460 2002-08-23 Martin Baulig <martin@gnome.org>
2462 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2463 find the symbol writer.
2465 * driver.cs: csc also allows the arguments to /define being
2466 separated by commas, not only by semicolons.
2468 2002-08-23 Martin Baulig <martin@gnome.org>
2470 * interface.cs (Interface.GetMembers): Added static check for events.
2472 2002-08-15 Martin Baulig <martin@gnome.org>
2474 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2475 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2477 * ecore.cs (Expression.MemberLookup): Added documentation and explained
2478 why the MethodData.EmitDestructor() change was necessary.
2480 2002-08-20 Martin Baulig <martin@gnome.org>
2482 * class.cs (TypeContainer.FindMembers): Added static check for events.
2484 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2486 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2487 use Type.GetEvents(), not Type.FindMembers().
2489 2002-08-20 Martin Baulig <martin@gnome.org>
2491 * decl.cs (MemberCache): Added a special method cache which will
2492 be used for method-only searched. This ensures that a method
2493 search will return a MethodInfo with the correct ReflectedType for
2496 2002-08-20 Martin Baulig <martin@gnome.org>
2498 * decl.cs (DeclSpace.FindMembers): Made this public.
2500 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2502 * delegate.cs: fixed build on windows.
2503 [FIXME: Filed as bug #29150: MCS must report these errors.]
2505 2002-08-19 Ravi Pratap <ravi@ximian.com>
2507 * ecore.cs (StandardConversionExists): Return a false
2508 if we are trying to convert the void type to anything else
2509 since that is not allowed.
2511 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2512 we flag error 70 in the event an event is trying to be accessed
2513 directly from outside the declaring type.
2515 2002-08-20 Martin Baulig <martin@gnome.org>
2517 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2518 MemberCache from typemanager.cs to decl.cs.
2520 2002-08-19 Martin Baulig <martin@gnome.org>
2522 * class.cs (TypeContainer): Implement IMemberContainer.
2523 (TypeContainer.DefineMembers): Create the MemberCache.
2524 (TypeContainer.FindMembers): Do better BindingFlags checking; only
2525 return public members if BindingFlags.Public was given, check
2526 whether members are static.
2528 2002-08-16 Martin Baulig <martin@gnome.org>
2530 * decl.cs (DeclSpace.Define): Splitted this in Define and
2531 DefineMembers. DefineMembers is called first and initializes the
2534 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
2535 DefineMembers() on all our DeclSpaces.
2537 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2538 but call DefineMembers() on all nested interfaces. We call their
2539 Define() in our new Define() function.
2541 * interface.cs (Interface): Implement IMemberContainer.
2542 (Interface.Define): Moved all code except the attribute stuf to
2544 (Interface.DefineMembers): Initialize the member cache.
2546 * typemanager.cs (IMemberFinder): Removed this interface, we don't
2547 need this anymore since we can use MemberCache.FindMembers directly.
2549 2002-08-19 Martin Baulig <martin@gnome.org>
2551 * typemanager.cs (MemberCache): When creating the cache for an
2552 interface type, add all inherited members.
2553 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2554 to `out bool used_cache' and documented it.
2555 (TypeManager.MemberLookup): If we already used the cache in the first
2556 iteration, we don't need to do the interfaces check.
2558 2002-08-19 Martin Baulig <martin@gnome.org>
2560 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
2561 here from IMemberFinder and don't implement this interface anymore.
2562 (DeclSpace.MemberCache): Moved here from IMemberFinder.
2564 * typemanager.cs (IMemberFinder): This interface is now only used by
2565 classes which actually support the member cache.
2566 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2567 since we only put DeclSpaces into this Hashtable.
2568 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2569 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2571 2002-08-16 Martin Baulig <martin@gnome.org>
2573 * typemanager.cs (ICachingMemberFinder): Removed.
2574 (IMemberFinder.MemberCache): New property.
2575 (TypeManager.FindMembers): Merged this with RealFindMembers().
2576 This function will never be called from TypeManager.MemberLookup()
2577 so we can't use the cache here, just the IMemberFinder.
2578 (TypeManager.MemberLookup_FindMembers): Check whether the
2579 IMemberFinder has a MemberCache and call the cache's FindMembers
2581 (MemberCache): Rewrote larger parts of this yet another time and
2582 cleaned it up a bit.
2584 2002-08-15 Miguel de Icaza <miguel@ximian.com>
2586 * driver.cs (LoadArgs): Support quoting.
2588 (Usage): Show the CSC-like command line arguments.
2590 Improved a few error messages.
2592 2002-08-15 Martin Baulig <martin@gnome.org>
2594 * typemanager.cs (IMemberContainer.Type): New property.
2595 (IMemberContainer.IsInterface): New property.
2597 The following changes are conditional to BROKEN_RUNTIME, which is
2598 defined at the top of the file.
2600 * typemanager.cs (MemberCache.MemberCache): Don't add the base
2601 class'es members, but add all members from TypeHandle.ObjectType
2602 if we're an interface.
2603 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2604 is the current type.
2605 (MemberCache.CacheEntry.Container): Removed this field.
2606 (TypeHandle.GetMembers): Include inherited members.
2608 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2610 * typemanager.cs: fixed compilation and added a comment on a field that
2613 2002-08-15 Martin Baulig <martin@gnome.org>
2615 * class.cs (ConstructorInitializer.Resolve): In the
2616 Expression.MemberLookup call, use the queried_type as
2619 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2620 declared' attribute, it's always true.
2621 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
2622 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
2623 temporary wrapper for FindMembers which tells MemberLookup whether
2624 members from the base classes are included in the return value.
2625 This will go away soon.
2626 (TypeManager.MemberLookup): Use this temporary hack here; once the
2627 new MemberCache is completed, we don't need to do the DeclaredOnly
2628 looping here anymore since the MemberCache will take care of this.
2629 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
2630 (MemberCache): When creating the MemberCache for a class, get
2631 members from the current class and all its base classes.
2632 (MemberCache.CacheEntry.Container): New field. This is a
2633 temporary hack until the Mono runtime is fixed to distinguish
2634 between ReflectedType and DeclaringType. It allows us to use MCS
2635 with both the MS runtime and the unfixed Mono runtime without
2636 problems and without accecting performance.
2637 (MemberCache.SearchMembers): The DeclaredOnly looping from
2638 TypeManager.MemberLookup is now done here.
2640 2002-08-14 Martin Baulig <martin@gnome.org>
2642 * statement.cs (MyStructInfo.MyStructInfo): Don't call
2643 Type.GetFields on dynamic types but get the fields from the
2644 corresponding TypeContainer.
2645 (MyStructInfo.GetStructInfo): Added check for enum types.
2647 * typemanager.cs (MemberList.IsSynchronized): Implemented.
2648 (MemberList.SyncRoot): Implemented.
2649 (TypeManager.FilterWithClosure): No need to check permissions if
2650 closure_start_type == closure_invocation_type, don't crash if
2651 closure_invocation_type is null.
2653 2002-08-13 Martin Baulig <martin@gnome.org>
2655 Rewrote TypeContainer.FindMembers to use a member cache. This
2656 gives us a speed increase of about 35% for the self-hosting MCS
2657 build and of about 15-20% for the class libs (both on GNU/Linux).
2659 * report.cs (Timer): New class to get enhanced profiling. This
2660 whole class is "TIMER" conditional since it remarkably slows down
2663 * class.cs (MemberList): New class. This is an IList wrapper
2664 which we're now using instead of passing MemberInfo[]'s around to
2665 avoid copying this array unnecessarily.
2666 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
2667 (ICachingMemberFinder, IMemberContainer): New interface.
2668 (TypeManager.FilterWithClosure): If `criteria' is null, the name
2669 has already been checked, otherwise use it for the name comparision.
2670 (TypeManager.FindMembers): Renamed to RealMemberFinder and
2671 provided wrapper which tries to use ICachingMemberFinder.FindMembers
2672 if possible. Returns a MemberList, not a MemberInfo [].
2673 (TypeHandle): New class, implements IMemberContainer. We create
2674 one instance of this class per type, it contains a MemberCache
2675 which is used to do the member lookups.
2676 (MemberCache): New class. Each instance of this class contains
2677 all members of a type and a name-based hash table.
2678 (MemberCache.FindMembers): This is our new member lookup
2679 function. First, it looks up all members of the requested name in
2680 the hash table. Then, it walks this list and sorts out all
2681 applicable members and returns them.
2683 2002-08-13 Martin Baulig <martin@gnome.org>
2685 In addition to a nice code cleanup, this gives us a performance
2686 increase of about 1.4% on GNU/Linux - not much, but it's already
2687 half a second for the self-hosting MCS compilation.
2689 * typemanager.cs (IMemberFinder): New interface. It is used by
2690 TypeManager.FindMembers to call FindMembers on a TypeContainer,
2691 Enum, Delegate or Interface.
2692 (TypeManager.finder_to_member_finder): New PtrHashtable.
2693 (TypeManager.finder_to_container): Removed.
2694 (TypeManager.finder_to_delegate): Removed.
2695 (TypeManager.finder_to_interface): Removed.
2696 (TypeManager.finder_to_enum): Removed.
2698 * interface.cs (Interface): Implement IMemberFinder.
2700 * delegate.cs (Delegate): Implement IMemberFinder.
2702 * enum.cs (Enum): Implement IMemberFinder.
2704 * class.cs (TypeContainer): Implement IMemberFinder.
2706 2002-08-12 Martin Baulig <martin@gnome.org>
2708 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2710 2002-08-12 Martin Baulig <martin@gnome.org>
2712 * ecore.cs (ITypeExpression): New interface for expressions which
2714 (TypeExpression): Renamed to TypeLookupExpression.
2715 (Expression.DoResolve): If we're doing a types-only lookup, the
2716 expression must implement the ITypeExpression interface and we
2717 call DoResolveType() on it.
2718 (SimpleName): Implement the new ITypeExpression interface.
2719 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
2720 hack, the situation that we're only looking up types can't happen
2721 anymore when this method is called. Moved the type lookup code to
2722 DoResolveType() and call it.
2723 (SimpleName.DoResolveType): This ITypeExpression interface method
2724 is now doing the types-only lookup.
2725 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
2726 (ResolveFlags): Added MaskExprClass.
2728 * expression.cs (MemberAccess): Implement the ITypeExpression
2730 (MemberAccess.DoResolve): Added support for a types-only lookup
2731 when we're called via ITypeExpression.DoResolveType().
2732 (ComposedCast): Implement the ITypeExpression interface.
2734 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
2735 Expression.Resolve() with ResolveFlags.Type instead.
2737 2002-08-12 Martin Baulig <martin@gnome.org>
2739 * interface.cs (Interface.Define): Apply attributes.
2741 * attribute.cs (Attribute.ApplyAttributes): Added support for
2742 interface attributes.
2744 2002-08-11 Martin Baulig <martin@gnome.org>
2746 * statement.cs (Block.Emit): Only check the "this" variable if we
2747 do not always throw an exception.
2749 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
2750 whether the property has a set accessor.
2752 2002-08-11 Martin Baulig <martin@gnome.org>
2754 Added control flow analysis support for structs.
2756 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
2757 with control flow analysis turned off.
2758 (IVariable): New interface.
2759 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
2760 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
2761 (FieldExpr.DoResolve): Resolve the instance expression with flow
2762 analysis turned off and do the definite assignment check after the
2763 resolving when we know what the expression will resolve to.
2765 * expression.cs (LocalVariableReference, ParameterReference):
2766 Implement the new IVariable interface, only call the flow analysis
2767 code if ec.DoFlowAnalysis is true.
2768 (This): Added constructor which takes a Block argument. Implement
2769 the new IVariable interface.
2770 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
2771 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
2772 This does the definite assignment checks for struct members.
2774 * class.cs (Constructor.Emit): If this is a non-static `struct'
2775 constructor which doesn't have any initializer, call
2776 Block.AddThisVariable() to tell the flow analysis code that all
2777 struct elements must be initialized before control returns from
2780 * statement.cs (MyStructInfo): New public class.
2781 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
2782 argument to this indexer. If non-zero, check an individual struct
2783 member, not the whole struct.
2784 (FlowBranching.CheckOutParameters): Check struct members.
2785 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
2786 overloaded versions of these methods which take an additional
2787 `int field_idx' argument to check struct members.
2788 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
2789 overloaded versions of these methods which take an additional
2790 `string field_name' argument to check struct member.s
2791 (VariableInfo): Implement the IVariable interface.
2792 (VariableInfo.StructInfo): New public property. Returns the
2793 MyStructInfo instance of the variable if it's a struct or null.
2794 (Block.AddThisVariable): New public method. This is called from
2795 Constructor.Emit() for non-static `struct' constructor which do
2796 not have any initializer. It creates a special variable for the
2797 "this" instance variable which will be checked by the flow
2798 analysis code to ensure that all of the struct's fields are
2799 initialized before control returns from the constructor.
2800 (UsageVector): Added support for struct members. If a
2801 variable/parameter is a struct with N members, we reserve a slot
2802 in the usage vector for each member. A struct is considered fully
2803 initialized if either the struct itself (slot 0) or all its
2804 members are initialized.
2806 2002-08-08 Martin Baulig <martin@gnome.org>
2808 * driver.cs (Driver.MainDriver): Only report an error CS5001
2809 if there were no compilation errors.
2811 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
2812 `UnsafeContext' property to determine whether the parent is in
2813 unsafe context rather than checking the parent's ModFlags:
2814 classes nested in an unsafe class are unsafe as well.
2816 2002-08-08 Martin Baulig <martin@gnome.org>
2818 * statement.cs (UsageVector.MergeChildren): Distinguish between
2819 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
2820 we return. Added test17() and test18() to test-154.cs.
2822 2002-08-08 Martin Baulig <martin@gnome.org>
2824 * typemanager.cs (TypeManager.FilterWithClosure): If we have
2825 Family access, make sure the invoking type isn't a subclass of the
2826 queried type (that'd be a CS1540).
2828 * ecore.cs (Expression.MemberLookup): Added overloaded version of
2829 this method which takes an additional `Type invocation_type'.
2831 * expression.cs (BaseAccess.DoResolve): Use the base type as
2832 invocation and query type.
2833 (MemberAccess.DoResolve): If the lookup failed and we're about to
2834 report a CS0122, try a lookup with the ec.ContainerType - if this
2835 succeeds, we must report a CS1540.
2837 2002-08-08 Martin Baulig <martin@gnome.org>
2839 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
2840 (MethodGroupExpr): Implement the IMemberExpr interface.
2842 * expression (MemberAccess.ResolveMemberAccess): No need to have
2843 any special code for MethodGroupExprs anymore, they're now
2846 2002-08-08 Martin Baulig <martin@gnome.org>
2848 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
2849 Family, FamANDAssem and FamORAssem permissions.
2850 (TypeManager.IsSubclassOrNestedChildOf): New public method.
2852 2002-08-08 Martin Baulig <martin@gnome.org>
2854 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
2855 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
2858 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
2860 * driver.cs: implemented /resource option to embed managed resources.
2862 2002-08-07 Martin Baulig <martin@gnome.org>
2864 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
2865 (FieldBase.HasFieldInitializer): New public property.
2866 (FieldBase.GetInitializerExpression): New public method. Resolves and
2867 returns the field initializer and makes sure it is only resolved once.
2868 (TypeContainer.EmitFieldInitializers): Call
2869 FieldBase.GetInitializerExpression to get the initializer, this ensures
2870 that it isn't resolved multiple times.
2872 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
2873 the resolving process (SimpleName/MemberLookup) that we're currently
2874 emitting a field initializer (which must not access any instance members,
2875 this is an error CS0236).
2877 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
2878 argument, if the `IsFieldInitializer' flag is set, we must report and
2879 error CS0236 and not an error CS0120.
2881 2002-08-07 Martin Baulig <martin@gnome.org>
2883 * ecore.cs (IMemberExpr): New public interface.
2884 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
2885 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
2886 if the expression is an IMemberExpr.
2888 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
2889 to be null, implicitly default to `this' if we're non-static in
2890 this case. Simplified the code a lot by using the new IMemberExpr
2891 interface. Also fixed bug #28176 here.
2893 2002-08-06 Martin Baulig <martin@gnome.org>
2895 * cs-parser.jay (SimpleLookup): Removed. We need to create
2896 ParameterReferences during semantic analysis so that we can do a
2897 type-only search when resolving Cast, TypeOf and SizeOf.
2898 (block): Pass the `current_local_parameters' to the Block's
2901 * class.cs (ConstructorInitializer): Added `Parameters parameters'
2902 argument to the constructor.
2903 (ConstructorInitializer.Resolve): Create a temporary implicit
2904 block with the parameters.
2906 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
2907 references here if we aren't doing a type-only search.
2909 * statement.cs (Block): Added constructor which takes a
2910 `Parameters parameters' argument.
2911 (Block.Parameters): New public property.
2913 * support.cs (InternalParameters.Parameters): Renamed `parameters'
2914 to `Parameters' and made it public readonly.
2916 2002-08-06 Martin Baulig <martin@gnome.org>
2918 * ecore.cs (Expression.Warning): Made this public as well.
2920 * report.cs (Report.Debug): Print the contents of collections.
2922 2002-08-06 Martin Baulig <martin@gnome.org>
2924 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
2925 used to tell Resolve() which kinds of expressions it may return.
2926 (Expression.Resolve): Added overloaded version of this method which
2927 takes a `ResolveFlags flags' argument. This can be used to tell
2928 Resolve() which kinds of expressions it may return. Reports a
2930 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
2931 ResolveFlags.SimpleName.
2932 (Expression.Error118): Added overloaded version of this method which
2933 takes a `ResolveFlags flags' argument. It uses the flags to determine
2934 which kinds of expressions are allowed.
2936 * expression.cs (Argument.ResolveMethodGroup): New public method.
2937 Resolves an argument, but allows a MethodGroup to be returned.
2938 This is used when invoking a delegate.
2940 * TODO: Updated a bit.
2942 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2944 Fixed compilation with csc.
2946 * ecore.cs: Expression.Error made public. Is this correct? Should
2947 Warning be made public too?
2949 * expression.cs: use ea.Location instead of ea.loc.
2950 [FIXME: Filed as bug #28607: MCS must report these errors.]
2952 2002-08-06 Martin Baulig <martin@gnome.org>
2954 * ecore.cs (Expression.loc): Moved the location here instead of
2955 duplicating it in all derived classes.
2956 (Expression.Location): New public property.
2957 (Expression.Error, Expression.Warning): Made them non-static and
2958 removed the location argument.
2959 (Expression.Warning): Added overloaded version which takes an
2960 `int level' argument.
2961 (Expression.Error118): Make this non-static and removed the
2962 expression and location arguments.
2963 (TypeExpr): Added location argument to the constructor.
2965 * expression.cs (StaticCallExpr): Added location argument to
2967 (Indirection, PointerArithmetic): Likewise.
2968 (CheckedExpr, UnCheckedExpr): Likewise.
2969 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
2970 (StringPtr): Likewise.
2973 2002-08-05 Martin Baulig <martin@gnome.org>
2975 * expression.cs (BaseAccess.DoResolve): Actually report errors.
2977 * assign.cs (Assign.DoResolve): Check whether the source
2978 expression is a value or variable.
2980 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
2981 while resolving the corresponding blocks.
2983 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
2984 an error, don't silently return null.
2986 * statement.cs (Block.AddVariable): Do the error reporting here
2987 and distinguish between CS0128 and CS0136.
2988 (Block.DoResolve): Report all unused labels (warning CS0164).
2989 (LabeledStatement): Pass the location to the constructor.
2990 (LabeledStatement.HasBeenReferenced): New property.
2991 (LabeledStatement.Resolve): Set it to true here.
2993 * statement.cs (Return.Emit): Return success even after reporting
2994 a type mismatch error (CS0126 or CS0127), this is what csc does and
2995 it avoids confusing the users with any consecutive errors.
2997 2002-08-05 Martin Baulig <martin@gnome.org>
2999 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
3001 * const.cs (Const.LookupConstantValue): Catch circular definitions.
3003 * expression.cs (MemberAccess.DoResolve): Silently return if an
3004 error has already been reported.
3006 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
3007 error has already been reported.
3009 2002-08-05 Martin Baulig <martin@gnome.org>
3011 * statement.cs (UsageVector): Only initialize the `parameters'
3012 vector if we actually have any "out" parameters.
3014 2002-08-05 Martin Baulig <martin@gnome.org>
3016 * expression.cs (Binary.ResolveOperator): When combining delegates,
3017 they must have the same type.
3019 2002-08-05 Martin Baulig <martin@gnome.org>
3021 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
3022 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
3023 work with the ms runtime and we also don't need it: if we're a
3024 PropertyBuilder and not in the `indexer_arguments' hash, then we
3025 are a property and not an indexer.
3027 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
3028 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
3029 since the latter one doesn't work with the ms runtime.
3031 2002-08-03 Martin Baulig <martin@gnome.org>
3033 Fixed bugs #27998 and #22735.
3035 * class.cs (Method.IsOperator): New public field.
3036 (Method.CheckBase): Report CS0111 if there's already a method
3037 with the same parameters in the current class. Report CS0508 when
3038 attempting to change the return type of an inherited method.
3039 (MethodData.Emit): Report CS0179 if a method doesn't have a body
3040 and it's not marked abstract or extern.
3041 (PropertyBase): New abstract base class for Property and Indexer.
3042 (PropertyBase.CheckBase): Moved here from Property and made it work
3044 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
3045 the same so we can reuse it there.
3046 (Property, Indexer): Derive from PropertyBase.
3047 (MethodSignature.inheritable_property_signature_filter): New delegate
3048 to find properties and indexers.
3050 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
3051 argument and improved error reporting.
3053 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
3054 EmptyReadOnlyParameters and made it a property.
3056 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
3057 version of this method which takes a `PropertyInfo indexer'.
3058 (TypeManager.RegisterIndexer): New method.
3060 * class.cs: Added myself as author of this file :-)
3062 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3064 * class.cs: fixed compilation on windoze.
3066 2002-08-03 Martin Baulig <martin@gnome.org>
3068 * interface.cs (Interface.GetInterfaceBases): Check whether all
3069 base interfaces are at least as accessible than the current one.
3071 * class.cs (TypeContainer.GetClassBases): Check whether base types
3072 are at least as accessible than the current type.
3073 (TypeContainer.AsAccessible): Implemented and made non-static.
3074 (MemberBase.CheckParameters): Report errors if the accessibility
3077 * delegate.cs (Delegate.Delegate): The default visibility is
3078 internal for top-level types and private for nested types.
3079 (Delegate.Define): Report errors if the accessibility checks fail.
3081 * enum.cs (Enum.Enum): The default visibility is internal for
3082 top-level types and private for nested types.
3083 (Enum.DefineType): Compute the correct visibility.
3085 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
3086 function which takes a `bool is_toplevel' instead of a TypeContainer.
3088 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
3091 2002-08-02 Martin Baulig <martin@gnome.org>
3093 * expression.cs (LocalVariableReferenc): Added constructor which
3094 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
3095 (LocalVariableReference.IsReadOnly): New property.
3096 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
3097 variable is readonly, use our own readonly flag to do this; you can
3098 use the new constructor to get a writable reference to a read-only
3101 * cs-parser.jay (foreach_statement, using_statement): Get a writable
3102 reference to the local variable.
3104 2002-08-01 Miguel de Icaza <miguel@ximian.com>
3106 * rootcontext.cs (ResolveCore): Also include System.Exception
3108 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
3109 we reach an EmptyStatement.
3111 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
3114 * expression.cs (Binary.ResolveOperator): Check error result in
3117 use brtrue/brfalse directly and avoid compares to null.
3119 2002-08-02 Martin Baulig <martin@gnome.org>
3121 * class.cs (TypeContainer.Define): Define all nested interfaces here.
3122 Fixes bug #28407, added test-155.cs.
3124 2002-08-01 Martin Baulig <martin@gnome.org>
3126 * class.cs (Event.EmitDefaultMethod): Make this work with static
3127 events. Fixes #28311, added verify-3.cs.
3129 2002-08-01 Martin Baulig <martin@gnome.org>
3131 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
3132 `is_disposable' fields.
3133 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
3134 `hm.is_disposable' if we're using the collection pattern.
3135 (Foreach.EmitCollectionForeach): Use the correct type for the
3136 enumerator's local variable, only emit the try/finally block if
3137 necessary (fixes #27713).
3139 2002-08-01 Martin Baulig <martin@gnome.org>
3141 * ecore.cs (Expression.report118): Renamed to Error118 and made
3144 * statement.cs (Throw.Resolve): Check whether the expression is of
3145 the correct type (CS0118) and whether the type derives from
3146 System.Exception (CS0155).
3147 (Catch.Resolve): New method. Do the type lookup here and check
3148 whether it derives from System.Exception (CS0155).
3149 (Catch.CatchType, Catch.IsGeneral): New public properties.
3151 * typemanager.cs (TypeManager.exception_type): Added.
3153 2002-07-31 Miguel de Icaza <miguel@ximian.com>
3155 * driver.cs: Updated About function.
3157 2002-07-31 Martin Baulig <martin@gnome.org>
3159 Implemented Control Flow Analysis.
3161 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
3162 (EmitContext.CurrentBranching): Added.
3163 (EmitContext.StartFlowBranching): Added.
3164 (EmitContext.EndFlowBranching): Added.
3165 (EmitContext.KillFlowBranching): Added.
3166 (EmitContext.IsVariableAssigned): Added.
3167 (EmitContext.SetVariableAssigned): Added.
3168 (EmitContext.IsParameterAssigned): Added.
3169 (EmitContext.SetParameterAssigned): Added.
3170 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
3171 Added control flow analysis stuff here.
3173 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
3174 resolve the expression as lvalue.
3175 (LocalVariableReference.DoResolve): Check whether the variable has
3176 already been assigned.
3177 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
3178 the parameter as assigned here.
3179 (ParameterReference.DoResolve): Check whether the parameter has already
3181 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3182 expression as lvalue.
3184 * statement.cs (FlowBranching): New class for the flow analysis code.
3185 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3186 (LabeledStatement.IsDefined): New public property.
3187 (LabeledStatement.AddUsageVector): New public method to tell flow
3188 analyis that the label may be reached via a forward jump.
3189 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3191 (VariableInfo.Number): New public field. This is used by flow analysis
3192 to number all locals of a block.
3193 (Block.CountVariables): New public property. This is the number of
3194 local variables in this block (including the locals from all parent
3196 (Block.EmitMeta): Number all the variables.
3198 * statement.cs: Added flow analysis support to all classes.
3200 2002-07-31 Martin Baulig <martin@gnome.org>
3202 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
3203 To get debugging messages, compile mcs with /define:MCS_DEBUG and
3204 then use this argument.
3206 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
3208 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
3209 use this to specify /define options.
3211 2002-07-29 Martin Baulig <martin@gnome.org>
3213 * statement.cs (Fixed): Moved all code that does variable lookups
3214 and resolvings from Emit to Resolve.
3216 * statement.cs (For): Moved all code that does variable lookups
3217 and resolvings from Emit to Resolve.
3219 * statement.cs (Using): Moved all code that does variable lookups
3220 and resolvings from Emit to Resolve.
3222 2002-07-29 Martin Baulig <martin@gnome.org>
3224 * attribute.cs (Attribute.Resolve): Explicitly catch a
3225 System.NullReferenceException when creating the
3226 CustromAttributeBuilder and report a different warning message.
3228 2002-07-29 Martin Baulig <martin@gnome.org>
3230 * support.cs (ParameterData.ParameterName): Added method to
3231 get the name of a parameter.
3233 * typemanager.cs (TypeManager.IsValueType): New public method.
3235 2002-07-29 Martin Baulig <martin@gnome.org>
3237 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
3238 is a flag which specifies that it's either ref or out.
3239 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
3240 the out parameter to `out Parameter.Modifier mod', also set the
3241 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
3243 * support.cs (InternalParameters.ParameterModifier): Distinguish
3244 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3245 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3247 * expression.cs (Argument.GetParameterModifier): Distinguish
3248 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3249 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3251 2002-07-29 Martin Baulig <martin@gnome.org>
3253 * expression.cs (ParameterReference.ParameterReference): Added
3254 `Location loc' argument to the constructor.
3256 * cs-parser.jay: Pass location to ParameterReference.
3258 2002-07-28 Miguel de Icaza <miguel@ximian.com>
3260 * statement.cs (Try): Initialize the location.
3262 * cs-parser.jay: pass location to Try.
3264 * expression.cs (Unary.Reduce): Change the prototype to return
3265 whether a constant fold could be performed or not. The result is
3266 returned in an out parameters. In the case of Indirection and
3267 AddressOf, we want to perform the full tests.
3269 2002-07-26 Miguel de Icaza <miguel@ximian.com>
3271 * statement.cs (Statement.Emit): Flag dead code.
3273 2002-07-27 Andrew Birkett <andy@nobugs.org>
3275 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
3277 2002-07-27 Martin Baulig <martin@gnome.org>
3279 * class.cs (MethodData.Define): Put back call to
3280 TypeManager.AddMethod(), accidentally commented this out.
3282 * report.cs (Debug): New public method to print debugging information,
3283 this is `[Conditional ("DEBUG")]'.
3285 2002-07-26 Martin Baulig <martin@gnome.org>
3287 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
3288 (switch_statement): Push the current_block to the switch_stack and
3289 pop it again when we're done with the switch.
3290 (switch_section): The new block is a child of the current_block.
3291 Fixes bug #24007, added test-152.cs.
3293 2002-07-27 Martin Baulig <martin@gnome.org>
3295 * expression.cs (Invocation.EmitArguments): When calling a varargs
3296 function with only its fixed arguments, we need to pass an empty
3299 2002-07-27 Martin Baulig <martin@gnome.org>
3301 Mono 0.13 has been released.
3303 2002-07-25 Miguel de Icaza <miguel@ximian.com>
3305 * driver.cs: Rename --resource to --linkres, because that is what
3306 we do currently, we dont support --resource yet.
3308 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
3310 2002-07-25 Martin Baulig <martin@gnome.org>
3312 * class.cs (MethodData): New public class. This is a `method builder'
3313 class for a method or one accessor of a Property/Indexer/Event.
3314 (MethodData.GetMethodFlags): Moved here from MemberBase.
3315 (MethodData.ApplyAttributes): Likewise.
3316 (MethodData.ApplyObsoleteAttribute): Likewise.
3317 (MethodData.ApplyConditionalAttribute): Likewise.
3318 (MethodData.ApplyDllImportAttribute): Likewise.
3319 (MethodData.CheckAbstractAndExternal): Likewise.
3320 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
3321 (MethodData.Emit): Formerly known as Method.Emit().
3322 (MemberBase): Moved everything which was specific to a single
3323 accessor/method to MethodData.
3324 (Method): Create a new MethodData and call Define() and Emit() on it.
3325 (Property, Indexer, Event): Create a new MethodData objects for each
3326 accessor and call Define() and Emit() on them.
3328 2002-07-25 Martin Baulig <martin@gnome.org>
3330 Made MethodCore derive from MemberBase to reuse the code from there.
3331 MemberBase now also checks for attributes.
3333 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
3334 (MemberBase.GetMethodFlags): Moved here from class Method and marked
3336 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
3337 `CallingConventions cc' and `Attributes opt_attrs' arguments.
3338 (MemberBase.ApplyAttributes): New virtual method; applies the
3339 attributes to a method or accessor.
3340 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
3341 (MemberBase.ApplyConditionalAttribute): Likewise.
3342 (MemberBase.ApplyDllImportAttribute): Likewise.
3343 (MemberBase.CheckAbstractAndExternal): Likewise.
3344 (MethodCore.ParameterTypes): This is now a property instead of a
3345 method, it's initialized from DoDefineParameters().
3346 (MethodCore.ParameterInfo): Removed the set accessor.
3347 (MethodCore.DoDefineParameters): New protected virtual method to
3348 initialize ParameterTypes and ParameterInfo.
3349 (Method.GetReturnType): We can now simply return the MemberType.
3350 (Method.GetMethodFlags): Override the MemberBase version and add
3351 the conditional flags.
3352 (Method.CheckBase): Moved some code from Define() here, call
3353 DoDefineParameters() here.
3354 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
3355 here to avoid some larger code duplication.
3356 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
3357 ensure that abstract and external accessors don't declare a body.
3359 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
3360 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
3361 lookup in the attribute's parent classes, so we need to abort as soon
3362 as we found the first match.
3363 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
3364 the attribute has no arguments.
3366 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
3369 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3371 * cs-parser.jay: reverted previous patch.
3373 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3375 * cs-parser.jay: fixed bug #22119.
3377 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3379 * attribute.cs: fixed compilation. The error was:
3380 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
3381 be assigned to before control leaves the current method."
3382 [FIXME: Filed as bug #28186: MCS must report this error.]
3384 2002-07-25 Martin Baulig <martin@gnome.org>
3386 * attribute.cs (Attribute.Conditional_GetConditionName): New static
3387 method to pull the condition name ouf of a Conditional attribute.
3388 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
3389 the obsolete message and error flag out of an Obsolete attribute.
3391 * class.cs (Method.GetMethodFlags): New public method to get the
3392 TypeManager.MethodFlags for this method.
3393 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
3395 (Method.Define): Get and apply the Obsolete and Conditional attributes;
3396 if we're overriding a virtual function, set the new private variable
3397 `parent_method'; call the new TypeManager.AddMethod().
3399 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
3400 the MethodBuilder and the Method in a PtrHashtable.
3401 (TypeManager.builder_to_method): Added for this purpose.
3402 (TypeManager.MethodFlags): Added IsObsoleteError.
3403 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
3404 Obsolete and Conditional arguments in MethodBuilders. If we discover
3405 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
3406 the message from the attribute.
3408 2002-07-24 Martin Baulig <martin@gnome.org>
3410 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
3411 preprocessor directives, ensure that the argument to #define/#undef is
3412 exactly one identifier and that it's actually an identifier.
3414 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3417 2002-07-24 Martin Baulig <martin@gnome.org>
3419 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3420 initialize it to TypeManager.object_type in the constructor.
3421 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3422 of the `hm.get_current' method if we're using the collection pattern.
3423 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3424 for the explicit conversion to make it work when we're using the collection
3425 pattern and the `Current' property has a different return type than `object'.
3428 2002-07-24 Martin Baulig <martin@gnome.org>
3430 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3431 does not match, but don't report any errors. This method is called in
3432 order for all methods in a MethodGroupExpr until a matching method is
3433 found, so we don't want to bail out if the first method doesn't match.
3434 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3435 matches, report the 123. Fixes #28070.
3437 2002-07-24 Martin Baulig <martin@gnome.org>
3439 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3440 TypeManager.TypeToCoreType() to the top of the method so the
3441 following equality checks will work. Fixes #28107.
3443 2002-07-24 Martin Baulig <martin@gnome.org>
3445 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3446 operand is of type uint, and the other operand is of type sbyte,
3447 short or int, the operands are converted to type long." -
3448 Actually do what this comment already told us. Fixes bug #28106,
3451 2002-07-24 Martin Baulig <martin@gnome.org>
3453 * class.cs (MethodBase): New abstract class. This is now a base
3454 class for Property, Indexer and Event to avoid some code duplication
3455 in their Define() and DefineMethods() methods.
3456 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3457 generic methods for Define() and DefineMethods().
3458 (FieldBase): Derive from MemberBase, not MemberCore.
3459 (Property): Derive from MemberBase, not MemberCore.
3460 (Property.DefineMethod): Moved all the code from this method to the
3461 new MethodBase.DefineAccessor(), just call it with appropriate
3463 (Property.Define): Call the new Property.DoDefine(), this does some
3464 sanity checks and we don't need to duplicate the code everywhere.
3465 (Event): Derive from MemberBase, not MemberCore.
3466 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3467 accessors, this will also make them work with interface events.
3468 (Indexer): Derive from MemberBase, not MemberCore.
3469 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3470 (Indexer.Define): Use the new MethodBase functions.
3472 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3473 argument to the constructor.
3474 (Interface.FindMembers): Added support for interface events.
3475 (Interface.PopluateEvent): Implemented.
3477 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
3479 2002-07-22 Miguel de Icaza <miguel@ximian.com>
3481 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3482 but this is required to check for a method name being the same as
3483 the containing class.
3487 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3489 * interface.cs: initialize variable.
3491 2002-07-23 Martin Baulig <martin@gnome.org>
3493 Implemented the IndexerName attribute in interfaces.
3495 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3496 name if this is an explicit interface implementation.
3497 (Indexer.InterfaceIndexerName): New public variable. If we're
3498 implementing an interface indexer, this is the IndexerName in that
3499 interface. Otherwise, it's the IndexerName.
3500 (Indexer.DefineMethod): If we're implementing interface indexer,
3501 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
3502 and Pending.ImplementIndexer methods.
3503 (Indexer.Define): Also define the PropertyBuilder if we're
3504 implementing an interface indexer and this is neither an explicit
3505 interface implementation nor do the IndexerName match the one in
3508 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3509 If a method is defined here, then we always need to create a proxy
3510 for it. This is used when implementing interface indexers.
3511 (Pending.IsInterfaceIndexer): New public method.
3512 (Pending.ImplementIndexer): New public method.
3513 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3514 This is used when implementing interface indexers to define a proxy
3516 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3517 define a proxy if necessary.
3519 * interface.cs (Interface.IndexerName): New public variable.
3520 (Interface.PopulateIndexer): Set the IndexerName.
3521 (Interface.DefineIndexers): New private method. Populate all the
3522 indexers and make sure their IndexerNames match.
3524 * typemanager.cs (IndexerPropertyName): Added support for interface
3527 2002-07-22 Martin Baulig <martin@gnome.org>
3529 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3530 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3531 ret if HasReturnLabel.
3532 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3535 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3536 and set the ec.LoopBeginTryCatchLevel.
3537 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3538 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3539 the current ec.TryCatchLevel, the branch goes out of an exception
3540 block. In this case, we need to use Leave and not Br.
3542 2002-07-22 Martin Baulig <martin@gnome.org>
3544 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3545 block unless the block does not always return or it is contained in
3546 another try { ... } catch { ... } block. Fixes bug #26506.
3547 Added verify-1.cs to the test suite.
3549 2002-07-22 Martin Baulig <martin@gnome.org>
3551 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3552 then we do not always return. Fixes bug #24985.
3554 2002-07-22 Martin Baulig <martin@gnome.org>
3556 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3557 lookup on a per-class level; ie. walk up the class hierarchy until we
3558 found at least one applicable method, then choose the best among them.
3559 Fixes bug #24463 and test-29.cs.
3561 2002-07-22 Martin Baulig <martin@gnome.org>
3563 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3564 return types of the methods. The return type is not part of the
3565 signature and we must not check it to make the `new' modifier work.
3566 Fixes bug #27999, also added test-147.cs.
3567 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3569 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3570 on the method's return type.
3572 2002-07-21 Martin Baulig <martin@gnome.org>
3574 * assign.cs: Make this work if the rightmost source is a constant and
3575 we need to do an implicit type conversion. Also adding a few more tests
3576 to test-38.cs which should have caught this.
3578 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3579 target in the makefile for this. The makefile.gnu is primarily intended
3580 for end-users who don't want to debug the compiler.
3582 2002-07-21 Martin Baulig <martin@gnome.org>
3584 * assign.cs: Improved the Assign class so it can now handle embedded
3585 assignments (X = Y = Z = something). As a side-effect this'll now also
3586 consume less local variables. test-38.cs now passes with MCS, added
3587 a few new test cases to that test.
3589 2002-07-20 Martin Baulig <martin@gnome.org>
3591 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3592 instructions. Fixes bug #27977, also added test-146.cs.
3594 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3596 * cs-tokenizer.cs: fixed getHex ().
3598 2002-07-19 Martin Baulig <martin@gnome.org>
3600 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3601 not Type.GetType() to lookup the array type. This is needed when
3602 we're constructing an array of a user-defined type.
3603 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3604 single-dimensional arrays, but also for single-dimensial arrays of
3607 2002-07-19 Martin Baulig <martin@gnome.org>
3609 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3610 this function is called, it's not allowed to share LocalBuilders
3613 2002-07-19 Martin Baulig <martin@gnome.org>
3615 * expression.cs (Argument.Resolve): Report an error 118 when trying
3616 to pass a type as argument.
3618 2002-07-18 Martin Baulig <martin@gnome.org>
3620 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3621 Conv_R_Un for the signed `long' type.
3623 2002-07-15 Miguel de Icaza <miguel@ximian.com>
3625 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
3626 `expr' for the temporary result, as that will fail if we do
3627 multiple resolves on the same expression.
3629 2002-07-05 Miguel de Icaza <miguel@ximian.com>
3631 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
3632 ec.TypeContainer for looking up aliases.
3634 * class.cs (TypeContainer): Remove LookupAlias from here.
3636 * decl.cs (DeclSpace); Move here.
3638 2002-07-01 Miguel de Icaza <miguel@ximian.com>
3640 * class.cs (FindMembers): Only call filter if the constructor
3641 bulider is not null.
3643 Also handle delegates in `NestedTypes' now. Now we will perform
3644 type lookups using the standard resolution process. This also
3647 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
3648 This uses Expressions (the limited kind that can be parsed by the
3649 tree) instead of strings.
3651 * expression.cs (ComposedCast.ToString): Implement, used to flag
3652 errors since now we have to render expressions.
3654 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
3657 * ecore.cs (SimpleName.ToString): ditto.
3659 * cs-parser.jay: Instead of using strings to assemble types, use
3660 Expressions to assemble the type (using SimpleName, ComposedCast,
3661 MemberAccess). This should fix the type lookups in declarations,
3662 because we were using a different code path for this.
3664 * statement.cs (Block.Resolve): Continue processing statements
3665 even when there is an error.
3667 2002-07-17 Miguel de Icaza <miguel@ximian.com>
3669 * class.cs (Event.Define): Also remove the `remove' method from
3670 the list of pending items.
3672 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
3673 generate more compact code.
3675 2002-07-17 Martin Baulig <martin@gnome.org>
3677 * const.cs (Const.LookupConstantValue): Add support for constant
3678 `unchecked' and `checked' expressions.
3679 Also adding test case test-140.cs for this.
3681 2002-07-17 Martin Baulig <martin@gnome.org>
3683 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
3684 check whether mi.ReturnType implements the IEnumerator interface; the
3685 `==' and the IsAssignableFrom() will fail in this situation.
3687 2002-07-16 Ravi Pratap <ravi@ximian.com>
3689 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
3692 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3694 * expression.cs: fixed bug #27811.
3696 2002-07-14 Miguel de Icaza <miguel@ximian.com>
3698 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
3699 Molaro: when we are a ref, the value already contains a pointer
3700 value, do not take the address of it.
3702 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
3703 * removed mb-parser.jay and mb-tokenizer.cs
3705 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3707 * expression.cs: check against the building corlib void type.
3709 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
3711 * ecore.cs: fix for valuetype static readonly fields: when
3712 initializing them, we need their address, not the address of a copy.
3714 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
3716 * typemanager.cs: register also enum_type in corlib.
3718 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3720 * class.cs: allow calling this (but not base) initializers in structs.
3722 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
3724 * ecore.cs: make sure we compare against the building base types
3727 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
3729 * typemanager.cs: fix TypeToCoreType() to handle void and object
3730 (corlib gets no more typerefs after this change).
3732 2002-07-12 Miguel de Icaza <miguel@ximian.com>
3734 * expression.cs (ArrayCreation.EmitArrayArguments): use
3735 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
3737 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
3738 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
3739 array indexes, the runtime actually forbids them.
3741 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
3742 for array arguments here.
3744 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
3745 instead of the default for ValueTypes.
3747 (New.DoEmit): Use IsValueType instead of
3748 IsSubclassOf (value_type)
3749 (New.DoResolve): ditto.
3750 (Invocation.EmitCall): ditto.
3752 * assign.cs (Assign): ditto.
3754 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
3755 Statements *are* currently doing part of their resolution during
3758 Expressions do always resolve during resolve, but statements are
3759 only required to propagate resolution to their children.
3761 2002-07-11 Miguel de Icaza <miguel@ximian.com>
3763 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
3765 (LoadAssembly): Do not add the dll if it is already specified
3767 (MainDriver): Add the System directory to the link path at the end,
3768 after all the other -L arguments.
3770 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
3771 wrong opcode for loading bytes and bools (ldelem.i1 instead of
3772 ldelem.u1) and using the opposite for sbytes.
3774 This fixes Digger, and we can finally run it.
3776 * driver.cs (UnixParseOption): Move the option parsing here.
3777 (CSCParseOption): Implement CSC-like parsing of options.
3779 We now support both modes of operation, the old Unix way, and the
3780 new CSC-like way. This should help those who wanted to make cross
3783 The only thing broken is that /r:, /reference: and /lib: are not
3784 implemented, because I want to make those have the same semantics
3785 as the CSC compiler has, and kill once and for all the confussion
3786 around this. Will be doing this tomorrow.
3788 * statement.cs (Unsafe.Resolve): The state is checked during
3789 resolve, not emit, so we have to set the flags for IsUnsfe here.
3791 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3793 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
3794 not catch the Error_ObjectRefRequired in SimpleName (as it is
3795 possible to have a class/instance variable name that later gets
3796 deambiguated), we have to check this here.
3798 2002-07-10 Ravi Pratap <ravi@ximian.com>
3800 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
3801 make static and put into Expression.
3803 (Event.Define): Register the private field of the event with the
3804 TypeManager so that GetFieldFromEvent can get at it.
3806 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
3807 keep track of the private field associated with an event which
3810 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
3813 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
3815 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3817 * expression.cs (Binary.EmitBranchable): this routine emits the
3818 Binary expression in a branchable context. This basically means:
3819 we need to branch somewhere, not just get the value on the stack.
3821 This works together with Statement.EmitBoolExpression.
3823 * statement.cs (Statement.EmitBoolExpression): Use
3826 2002-07-09 Miguel de Icaza <miguel@ximian.com>
3828 * statement.cs (For): Reduce the number of jumps in loops.
3830 (For): Implement loop inversion for the For statement.
3832 (Break): We can be breaking out of a Try/Catch controlled section
3833 (foreach might have an implicit try/catch clause), so we need to
3834 use Leave instead of Br.
3836 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
3837 now). If the instace expression supports IMemoryLocation, we use
3838 the AddressOf method from the IMemoryLocation to extract the
3839 address instead of emitting the instance.
3841 This showed up with `This', as we were emitting the instance
3842 always (Emit) instead of the Address of This. Particularly
3843 interesting when This is a value type, as we dont want the Emit
3844 effect (which was to load the object).
3846 2002-07-08 Miguel de Icaza <miguel@ximian.com>
3848 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
3850 * statement.cs (Checked): Set the CheckedState during the resolve
3851 process too, as the ConvCast operations track the checked state on
3852 the resolve process, and not emit.
3854 * cs-parser.jay (namespace_member_declaration): Flag that we have
3855 found a declaration when we do. This is used to flag error 1529
3857 * driver.cs: Report ok when we display the help only.
3859 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
3861 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
3863 2002-07-04 Miguel de Icaza <miguel@ximian.com>
3865 * cs-tokenizer.cs (define): We also have to track locally the
3866 defines. AllDefines is just used for the Conditional Attribute,
3867 but we also need the local defines for the current source code.
3869 2002-07-03 Miguel de Icaza <miguel@ximian.com>
3871 * statement.cs (While, For, Do): These loops can exit through a
3872 Break statement, use this information to tell whether the
3873 statement is the last piece of code.
3875 (Break): Flag that we break.
3877 * codegen.cs (EmitContexts): New `Breaks' state variable.
3879 2002-07-03 Martin Baulig <martin@gnome.org>
3881 * class.cs (TypeContainer.MethodModifiersValid): Allow override
3882 modifiers in method declarations in structs. Otherwise, you won't
3883 be able to override things like Object.Equals().
3885 2002-07-02 Miguel de Icaza <miguel@ximian.com>
3887 * class.cs (Method, Property, Indexer): Do not allow the public
3888 modifier to be used in explicit interface implementations.
3890 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
3891 override modifiers in method declarations in structs
3893 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
3895 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
3896 integer or real overflow, report an error
3898 2002-07-02 Martin Baulig <martin@gnome.org>
3900 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
3901 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
3902 to tell the runtime about our newly created System.Object and
3903 System.ValueType types.
3905 2002-07-02 Miguel de Icaza <miguel@ximian.com>
3907 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
3908 struct instead of Ldarg/Starg.
3910 2002-07-02 Martin Baulig <martin@gnome.org>
3912 * expression.cs (Indirection.Indirection): Call
3913 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
3915 2002-07-02 Martin Baulig <martin@gnome.org>
3917 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
3918 ValueType, call TypeManager.TypeToCoreType() on it.
3919 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
3920 the OpCodes.Newarr argument.
3922 2002-07-02 Martin Baulig <martin@gnome.org>
3924 * expression.cs (Invocation.EmitCall): When compiling corlib,
3925 replace all calls to the system's System.Array type to calls to
3926 the newly created one.
3928 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
3929 System.Array methods.
3930 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
3931 from the system's System.Array type which must be replaced.
3933 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
3935 * typemanager.cs: load unverifiable_code_ctor so we can build
3936 corlib using the correct type. Avoid using GetTypeCode() with
3938 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
3939 TypeManager.object_type to allow building corlib.
3941 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
3943 * ecore.cs: handle System.Enum separately in LoadFromPtr().
3945 2002-07-01 Martin Baulig <martin@gnome.org>
3947 * class.cs: Make the last change actually work, we need to check
3948 whether `ifaces != null' to avoid a crash.
3950 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3952 * class.cs: when we build structs without fields that implement
3953 interfaces, we need to add the interfaces separately, since there is
3954 no API to both set the size and add the interfaces at type creation
3957 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3959 * expression.cs: the dimension arguments to the array constructors
3960 need to be converted if they are a long.
3962 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
3964 * class.cs: don't emit ldarg.0 if there is no parent constructor
3965 (fixes showstopper for corlib).
3967 2002-06-29 Martin Baulig <martin@gnome.org>
3969 MCS now compiles corlib on GNU/Linux :-)
3971 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
3972 ie. check for MethodImplOptions.InternalCall.
3974 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
3975 and TypeManager.attribute_type are null, so we must explicitly check
3976 whether parent is not null to find out whether it's an attribute type.
3977 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
3978 and SetBuilder, not only if the property is neither abstract nor external.
3979 This is necessary to set the MethodImplOptions on the accessor methods.
3980 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
3981 SetBuilder, see Property.Emit().
3983 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
3984 populate "System.Object", "System.ValueType" and "System.Attribute" since
3985 they've already been populated from BootCorlib_PopulateCoreTypes().
3987 2002-06-29 Martin Baulig <martin@gnome.org>
3989 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
3990 is the NullLiteral, we also need to make sure that target_type is not
3993 2002-06-29 Martin Baulig <martin@gnome.org>
3995 * rootcontext.cs (RootContext.ResolveCore): We must initialize
3996 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
3997 before calling BootstrapCorlib_ResolveDelegate ().
3999 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4001 * statement.cs: fixed build-breaker. All tests passed ok.
4003 2002-06-27 Martin Baulig <martin@gnome.org>
4005 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
4006 for System.Decimal when compiling corlib.
4008 2002-06-27 Martin Baulig <martin@gnome.org>
4010 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
4011 switch blocks which contain nothing but a default clause.
4013 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
4015 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
4017 2002-06-27 Martin Baulig <martin@gnome.org>
4019 * ecore.cs (PropertyExpr.PropertyExpr): Call
4020 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
4022 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
4023 is already a TypeBuilder.
4025 2002-06-27 Martin Baulig <martin@gnome.org>
4027 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
4028 `target_type == TypeManager.array_type', not IsAssignableFrom() in
4029 the "from an array-type to System.Array" case. This makes it work
4030 when compiling corlib.
4032 2002-06-27 Martin Baulig <martin@gnome.org>
4034 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
4035 non-static PropertyExpr, set its InstanceExpression. This makes
4036 the `ICollection.Count' property work in System/Array.cs.
4038 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
4040 * driver.cs: Made error handling more consistent. Errors now
4041 tracked by Report class, so many methods which used to return int
4042 now return void. Main() now prints success/failure and
4043 errors/warnings message.
4045 Renamed '--probe' compiler argument to '--expect-error'. Removed
4046 the magic number return values (123 and 124). Now, if the
4047 expected error occurs, the compiler exits with success (exit value
4048 0). If the compilation completes without seeing that particular
4049 error, the compiler exits with failure (exit value 1). The
4050 makefile in mcs/errors has been changed to handle the new behaviour.
4052 * report.cs: Made 'expected error' number a property and renamed
4053 it from 'Probe' to 'ExpectedError'.
4055 * genericparser.cs: Removed error handling support, since it is
4056 now all done by Report class.
4058 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
4059 class, so parse() no longer returns an int.
4061 * namespace.cs: Use Report.Error instead of GenericParser.error
4063 2002-06-22 Miguel de Icaza <miguel@ximian.com>
4065 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
4066 TypeContainer.AddOperator): At the front of the list put the
4067 explicit implementations, so they get resolved/defined first.
4069 2002-06-21 Miguel de Icaza <miguel@ximian.com>
4071 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
4072 interface type is implemented by this TypeContainer. Used during
4073 explicit interface implementation.
4075 (Property.Define, Indexer.Define, Method.Define): Validate that
4076 the given interface in the explicit implementation is one of the
4077 base classes for the containing type.
4079 Also if we are explicitly implementing an interface, but there is
4080 no match in the pending implementation table, report an error.
4082 (Property.Define): Only define the property if we are
4083 not explicitly implementing a property from an interface. Use the
4084 correct name also for those properties (the same CSC uses,
4085 although that is really not needed).
4087 (Property.Emit): Do not emit attributes for explicitly implemented
4088 properties, as there is no TypeBuilder.
4090 (Indexer.Emit): ditto.
4092 Hiding then means that we do not really *implement* a pending
4093 implementation, which makes code fail.
4095 2002-06-22 Martin Baulig <martin@gnome.org>
4097 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
4098 the return value of Object.GetType(). [FIXME: we need to do this whenever
4099 we get a type back from the reflection library].
4101 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
4103 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
4105 2002-06-20 Miguel de Icaza <miguel@ximian.com>
4107 * attribute.cs: Return null if we can not look up the type.
4109 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
4110 the interface types found.
4112 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
4113 interface types found.
4115 * typemanager.cs (GetInterfaces): Make this routine returns alll
4116 the interfaces and work around the lame differences between
4117 System.Type and System.Reflection.Emit.TypeBuilder in the results
4118 result for GetInterfaces.
4120 (ExpandInterfaces): Given an array of interface types, expand and
4121 eliminate repeated ocurrences of an interface. This expands in
4122 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
4125 2002-06-21 Martin Baulig <martin@gnome.org>
4127 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
4130 2002-06-21 Martin Baulig <martin@gnome.org>
4132 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
4133 and called with one of the core types, return the corresponding typebuilder for
4136 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
4139 2002-06-21 Martin Baulig <martin@gnome.org>
4141 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
4142 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
4143 (Expression.ConvertReferenceExplicit): Likewise.
4145 * expression.cs (ElementAccess.DoResolve): Likewise.
4146 (ElementAccess.DoResolveLValue): Likewise.
4148 2002-06-10 Martin Baulig <martin@gnome.org>
4150 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
4151 add the "value" parameter to the parameter list.
4153 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
4156 2002-06-19 Miguel de Icaza <miguel@ximian.com>
4158 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
4159 the argument to an int, uint, long or ulong, per the spec. Also
4160 catch negative constants in array creation.
4162 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
4164 * class.cs: do not allow the same interface to appear twice in
4165 the definition list.
4167 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
4169 * ecore.cs: don't use ldlen with System.Array.
4171 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
4173 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
4175 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
4177 * modifiers.cs: produce correct field attributes for protected
4178 internal. Easy fix so miguel can work on ther harder stuff:-)
4180 2002-06-18 Miguel de Icaza <miguel@ximian.com>
4182 * pending.cs: New file. Move the code from class.cs here.
4183 Support clearning the pending flag for all methods (when not doing
4184 explicit interface implementation).
4186 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4188 * rootcontext.cs: added a couple more types needed to bootstrap.
4190 2002-06-17 Miguel de Icaza <miguel@ximian.com>
4192 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4193 constructor in the type, instead of any constructor in the type
4194 hierarchy. Thanks to Paolo for finding this bug (it showed up as
4195 a bug in the Mono runtime when applying the params attribute).
4197 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4198 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
4200 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
4202 * expression.cs (Unary.ResolveOperator): Use TypeManager
4203 to resolve the type.
4205 2002-06-13 Ravi Pratap <ravi@ximian.com>
4207 * cs-parser.jay (enum_member_declaration): Pass in the attributes
4210 * enum.cs (AddEnumMember): Add support to store the attributes associated
4211 with each member too.
4213 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
4214 field builders too - this takes care of the enum member case.
4216 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
4218 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
4219 address-of operator on both value types and pointers.
4221 2002-06-10 Martin Baulig <martin@gnome.org>
4223 * interface.cs (Interface.PopulateIndexer): Add the indexer's
4224 PropertyBuilder to the `property_builders' list.
4226 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
4227 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
4228 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
4229 find any indexers which are inherited from an interface.
4231 2002-06-09 Martin Baulig <martin@gnome.org>
4233 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
4234 the same type as the constant if necessary. There's also a test-130.cs
4237 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
4239 * typemanager.cs (TypeManager.ChangeType): Previously known as
4240 Enum.ChangeEnumType().
4242 2002-06-09 Martin Baulig <martin@gnome.org>
4244 * expression.cs (Cast.TryReduce): Added support for consts.
4246 2002-06-08 Ravi Pratap <ravi@ximian.com>
4248 * class.cs (Accessor): Hold attributes information so we can pass
4251 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
4252 Modify to pass in attributes attached to the methods.
4254 (add_accessor_declaration, remove_accessor_declaration): Ditto.
4256 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
4257 to handle the Accessor kind :-)
4259 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
4261 2002-06-08 Martin Baulig <martin@gnome.org>
4263 * expression.cs (Unary.TryReduceNegative): Added support for
4266 2002-06-08 Martin Baulig <martin@gnome.org>
4268 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
4269 name can't be found in the `defined_names' - the caller will do a
4270 MemberLookup in this case and thus find methods in System.Enum
4271 such as Enum.IsDefined().
4273 2002-06-08 Martin Baulig <martin@gnome.org>
4275 * enum.cs (Enum.ChangeEnumType): This is a custom version of
4276 Convert.ChangeType() which works with TypeBuilder created types.
4277 (Enum.LookupEnumValue, Enum.Define): Use it here.
4279 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
4280 `TypeBuilder.BaseType != null' check.
4281 (TypeContainer.FindMembers): Only lookup parent members if we
4282 actually have a parent.
4283 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
4284 (ConstructorInitializer.Resolve): Likewise.
4286 * interface.cs (Interface.FindMembers): Added
4287 `TypeBuilder.BaseType != null' check.
4289 * rootcontext.cs (RootContext.ResolveCore): Added
4290 "System.Runtime.CompilerServices.IndexerNameAttribute" to
4291 classes_second_stage.
4293 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
4294 debug_type and trace_type when compiling with --nostdlib.
4296 2002-06-07 Martin Baulig <martin@gnome.org>
4298 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
4299 (AddField): Set it to true when adding a non-static field.
4300 (DefineType): Use `have_nonstatic_fields' to find out whether we
4301 have non-static fields, not `Fields != null'.
4303 2002-06-02 Miguel de Icaza <miguel@ximian.com>
4305 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
4306 dereferencing a null on the static-field code path)
4308 2002-05-30 Martin Baulig <martin@gnome.org>
4310 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
4311 to take command line arguments. Use reflection to call the new
4312 custom `Initialize' function on the symbol writer and pass it the
4313 command line arguments.
4315 * driver.cs (--debug-args): New command line argument to pass command
4316 line arguments to the symbol writer.
4318 2002-05-28 Miguel de Icaza <miguel@ximian.com>
4320 * assign.cs (DoResolve): Forgot to do the implicit conversion to
4321 the target type for indexers and properties. Thanks to Joe for
4324 2002-05-27 Miguel de Icaza <miguel@ximian.com>
4326 * typemanager.cs (MethodFlags): returns the method flags
4327 (Obsolete/ShouldIgnore) that control warning emission and whether
4328 the invocation should be made, or ignored.
4330 * expression.cs (Invocation.Emit): Remove previous hack, we should
4331 not do this on matching a base type, we should do this based on an attribute
4333 Only emit calls to System.Diagnostics.Debug and
4334 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
4335 on the command line.
4337 * rootcontext.cs: Global settings for tracing and debugging.
4339 * cs-tokenizer.cs (define): New utility function to track
4340 defines. Set the global settings for TRACE and DEBUG if found.
4342 2002-05-25 Ravi Pratap <ravi@ximian.com>
4344 * interface.cs (Populate*): Pass in the TypeContainer as well as
4345 the DeclSpace as parameters so that we can create EmitContexts and
4346 then use that to apply attributes etc.
4348 (PopulateMethod, PopulateEvent, PopulateProperty)
4349 (PopulateIndexer): Apply attributes everywhere.
4351 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
4354 (ApplyAttributes): Update accordingly.
4356 We now apply interface attributes for all members too.
4358 2002-05-26 Miguel de Icaza <miguel@ximian.com>
4360 * class.cs (Indexer.Define); Correctly check if we are explicit
4361 implementation (instead of checking the Name for a ".", we
4362 directly look up if the InterfaceType was specified).
4364 Delay the creation of the PropertyBuilder.
4366 Only create the PropertyBuilder if we are not an explicit
4367 interface implementation. This means that explicit interface
4368 implementation members do not participate in regular function
4369 lookups, and hence fixes another major ambiguity problem in
4370 overload resolution (that was the visible effect).
4372 (DefineMethod): Return whether we are doing an interface
4375 * typemanager.cs: Temporary hack until we get attributes in
4376 interfaces (Ravi is working on that) and we get IndexerName
4377 support in interfaces.
4379 * interface.cs: Register the indexers as properties.
4381 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
4382 warning, I have verified that this is a bug in the .NET runtime
4383 (JavaScript suffers of the same problem).
4385 * typemanager.cs (MemberLookup): When looking up members for
4386 interfaces, the parent of an interface is the implicit
4387 System.Object (so we succeed in searches of Object methods in an
4388 interface method invocation. Example: IEnumerable x; x.ToString
4391 2002-05-25 Miguel de Icaza <miguel@ximian.com>
4393 * class.cs (Event): Events should also register if they do
4394 implement the methods that an interface requires.
4396 * typemanager.cs (MemberLookup); use the new GetInterfaces
4399 (GetInterfaces): The code used to lookup interfaces for a type is
4400 used in more than one place, factor it here.
4402 * driver.cs: Track the errors at the bottom of the file, we kept
4405 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
4406 instance if the method we are calling is static!
4408 2002-05-24 Miguel de Icaza <miguel@ximian.com>
4410 * attribute.cs (ApplyAttributes): Make this function filter out
4411 the IndexerName attribute (as that attribute in reality is never
4412 applied) and return the string constant for the IndexerName
4415 * class.cs (TypeContainer.Emit): Validate that all the indexers
4416 have the same IndexerName attribute, and if so, set the
4417 DefaultName attribute on the class.
4419 * typemanager.cs: The return value might contain other stuff (not
4420 only methods). For instance, consider a method with an "Item"
4421 property and an Item method.
4423 * class.cs: If there is a problem with the parameter types,
4426 2002-05-24 Ravi Pratap <ravi@ximian.com>
4428 * ecore.cs (ImplicitConversionExists): Wrapper function which also
4429 looks at user defined conversion after making a call to
4430 StandardConversionExists - we need this for overload resolution.
4432 * expression.cs : Update accordingly the various method calls.
4434 This fixes 2 bugs filed against implicit user defined conversions
4436 2002-05-22 Miguel de Icaza <miguel@ximian.com>
4438 * statement.cs: Track the result of the assignment.
4440 2002-05-21 Miguel de Icaza <miguel@ximian.com>
4442 * expression.cs (MemberAccess): Improved error reporting for
4443 inaccessible members.
4445 2002-05-22 Martin Baulig <martin@gnome.org>
4447 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
4448 itself with debugging support.
4450 2002-05-22 Martin Baulig <martin@gnome.org>
4452 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4453 Removed, this isn't needed anymore.
4455 2002-05-20 Martin Baulig <martin@gnome.org>
4457 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4458 be underlying type for an enum.
4460 2002-05-20 Miguel de Icaza <miguel@ximian.com>
4462 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4463 that splits out the loading of just the core types.
4465 * rootcontext.cs (ResolveCore): Split the struct resolution in
4466 two, so we can load the enumeration underlying types before any
4469 * expression.cs (Is): Bandaid until we fix properly Switch (see
4470 bug #24985 for details).
4472 * typemanager.cs (ImplementsInterface): The hashtable will contain
4473 a null if there are no interfaces implemented.
4475 2002-05-18 Miguel de Icaza <miguel@ximian.com>
4477 * cs-parser.jay (indexer_declarator): It is fine to have array
4480 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4482 * typemanager.cs: (RegisterBuilder): New function used to register
4483 TypeBuilders that implement interfaces. Since
4484 TypeBuilder.GetInterfaces (as usual) does not work with lame
4486 (AddUserType): register interfaces.
4488 (ImplementsInterface): Use the builder_to_ifaces hash if we are
4489 dealing with TypeBuilder. Also, arrays are showing up as
4490 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4491 methods can not be invoked on them!
4493 * ecore.cs (ExplicitReferenceConversionExists): Made public.
4494 (ImplicitReferenceConversionExists): Split out from
4495 StandardConversionExists.
4497 * expression.cs (As): We were only implementing one of the three
4498 cases for the as operator. We now implement them all.
4499 (Is): Implement the various other cases for Is as well.
4501 * typemanager.cs (CACHE): New define used to control if we want or
4502 not the FindMembers cache. Seems to have a negative impact on
4503 performance currently
4505 (MemberLookup): Nested types have full acess to
4506 enclosing type members
4508 Remove code that coped with instance/static returns for events, we
4509 now catch this in RealFindMembers.
4511 (RealFindMembers): only perform static lookup if the instance
4512 lookup did not return a type or an event.
4514 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4516 * assign.cs (CompoundAssign): We pass more semantic information
4517 now to Compound Assignments than we did before: now we have all
4518 the information at hand, and now we resolve the target *before* we
4519 do the expression expansion, which allows the "CacheValue" method
4520 to have the effect we intended (before, a [x] += 1 would generate
4521 two differen ArrayAccess expressions from the ElementAccess,
4522 during the resolution process).
4524 (CompoundAssign.DoResolve): Resolve target and original_source here.
4526 2002-05-16 Miguel de Icaza <miguel@ximian.com>
4528 * expression.cs (ArrayAccess): dropped debugging information.
4530 * typemanager.cs: Small bug fix: I was always returning i_members,
4531 instead of one of i_members or s_members (depending on which had
4534 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
4535 method is invoked before any code generation takes place, and it
4536 is a mechanism to inform that the expression will be invoked more
4537 than once, and that the method should use temporary values to
4538 avoid having side effects
4540 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4542 * ecore.cs (Expression.CacheTemporaries): Provide empty default
4545 * expression.cs (Indirection, ArrayAccess): Add support for
4546 CacheTemporaries in these two bad boys.
4548 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4550 (StoreFromPtr): Handle stobj as well.
4552 * expression.cs (UnaryMutator): Share more code.
4554 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4555 down: I was not tracking the Filter function as well, which
4556 was affecting the results of the cache.
4558 2002-05-15 Miguel de Icaza <miguel@ximian.com>
4560 * attribute.cs: Remove the hack to handle the CharSet property on
4563 2002-05-14 Miguel de Icaza <miguel@ximian.com>
4565 * attribute.cs (DoResolve): More uglyness, we now only try to
4566 resolve the attribute partially, to extract the CharSet
4567 information (only if we are a StructLayout attribute). Otherwise
4569 (GetExtraTypeInfo): Add some code to conditionally kill in the
4570 future this. I am more and more convinced that the .NET
4571 framework has special code to handle the attribute setting on
4574 * expression.cs (IsParamsMethodApplicable): Revert my previous
4575 foreach change here, it was wrong.
4577 2002-05-13 Miguel de Icaza <miguel@ximian.com>
4579 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4580 (pp_expr): do not abort on unknown input, just return.
4581 (eval): abort if there are pending chars.
4583 * attribute.cs (Attribute.Resolve): Positional parameters are
4584 optional. Deal with that case.
4586 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4587 the Ansi/Unicode/Auto information for the type.
4589 (TypeContainer.DefineType): instantiate the EmitContext here, as
4590 we will be using it during the type definition (to resolve
4591 attributes) and during the emit phase.
4593 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4594 to pull type information out of the attributes
4596 (Attribute.Resolve): track the constructor builder, and allow for
4597 multiple invocations (structs and classes will use this).
4599 * ecore.cs (MemberLookupFinal): new version with all the
4600 parameters customizable.
4602 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4603 constructors. Return if the result value is null (as the error
4604 would have been flagged already by MemberLookupFinal)
4606 Do not allow instances of abstract classes or interfaces to be
4609 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4610 We have to compare the assembly property here when dealing with
4611 FamANDAssem and Assembly access modifiers, because we might be
4612 creating an assembly from *modules* (that means that we are not
4613 getting TypeBuilders for types defined in other modules that are
4614 part of this assembly).
4616 (Method.Emit): If the method is marked abstract and has a body,
4619 (TypeContainer.DefineMembers): If both the defined member and the
4620 parent name match are methods, then do not emit any warnings: let
4621 the Method.Define routine take care of flagging warnings. But if
4622 there is a mismatch (method overrides something else, or method is
4623 overriwritten by something, then emit warning).
4625 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
4626 set to null, this means `do not check for the return type on the
4629 (Method.Define): set the return type for the method signature to
4630 null, so that we get methods with the same name and parameters and
4631 different return types. This is used to flag warning 114 (you are
4632 hiding a method, and you probably want to use the new/override
4635 * typemanager.cs (MemberLookup): Implemented proper access
4636 control, closing a long standing set of bug reports. The problem
4637 was that the Framework only has two bits: Public and NonPublic,
4638 and NonPublic includes private and protected methods, but we need
4639 to enforce the FamANDAssem, FamOrAssem and Family.
4641 2002-05-11 Miguel de Icaza <miguel@ximian.com>
4643 * statement.cs (GotoCase): Return true: Ammounts to giving up
4644 knowledge on whether we return or not, and letting the other case
4645 be responsible for it.
4647 2002-05-10 Miguel de Icaza <miguel@ximian.com>
4649 * driver.cs: Do not load directories for each file processed, only
4650 do it if there is a pattern.
4652 * ecore.cs: Report readonly assigns here as well, as we might have
4653 been resolved only by MemberAccess.
4655 (SimpleName.SimpleNameResolve): Also be useful for LValue
4656 resolution. We need this to propagate assign to local readonly variables
4658 * typemanager.cs: Use a ptrhashtable for the criteria, because we
4659 do not want to reuse potential criteria memory.
4661 * class.cs (MyEventBuilder): Set reflected_type;
4663 * ecore.cs (Constantify): Added support for constifying bools.
4665 (RootContext.LookupType): Added a cache for values looked up in
4666 the declaration space.
4668 * typemanager.cs (FindMembers): Now is a front-end to
4669 RealFindMembers, and provides a two-level hashtable-based cache to
4672 15% performance improvement: from 22.5 to 19.2 seconds.
4674 * expression.cs (IsParamsMethodApplicable): use foreach.
4675 (Invocation.DoResolve): ditto.
4676 (New.DoResolve): ditto.
4677 (ArrayCreation.DoResolve): ditto.
4679 * ecore.cs (FindMostEncompassingType): use foreach.
4681 * delegate.cs (NewDelegate.DoResolve): Use foreach
4683 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
4684 (RemoveMethods): use foreach.
4686 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
4687 nested foreach statements instead of for, and also break out of
4688 the inner loop once a match is found.
4690 (Invocation.OverloadResolve): Use foreach, simplify the code.
4692 2002-05-08 Miguel de Icaza <miguel@ximian.com>
4694 * cfold.cs (BinaryFold): During an enumeration evaluation context,
4695 we actually unwrap the expression to allow for extra information
4698 * expression.cs: Use Shr_Un on unsigned operations.
4700 2002-05-08 Ravi Pratap <ravi@ximian.com>
4702 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
4703 applicable operators was not being considered correctly. This closes
4704 the bug Miguel reported.
4706 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
4708 * attribute.cs: check that the type derives from System.Attribute
4709 and report the correct error in that case (moved the duplicate code to
4710 its own method, too).
4712 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
4714 * attribute.cs: lookup attribute type name as the spec says: first the
4715 bare attribute name and then name + "Attribute" (nant compiles with
4716 mcs after this fix).
4718 2002-05-07 Miguel de Icaza <miguel@ximian.com>
4720 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
4721 Because of the way we parse things, we should try to see if a
4722 UIntConstant can fit in an integer.
4724 2002-05-07 Ravi Pratap <ravi@ximian.com>
4726 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
4727 when we are in an explicit context.
4729 (ConvertReferenceExplicit): When converting from Iface type S to Class
4730 T make sure the rules are implemented as an OR.
4732 * parameter.cs (ParameterType): Make it a property for now although the
4733 purpose really isn't anything immediate.
4735 * expression.cs (Is*Applicable): Do better checking on the parameter type
4736 of a ref/out parameter. The ones from the system assemblies are already
4737 marked with the correct type so we don't need to do any correction.
4739 * ecore.cs (StandardConversionExists): Conversion from Interface types to
4740 the object type is standard too so include that.
4742 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4744 * ecore.cs (StandardConversionExists): Augment with missing code:
4745 deal with IntConstant, LongConstants and Enumerations.
4747 * assign.cs: Report the error, instead of failing silently
4749 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
4750 typecontainer that they are declared, because the
4751 typecontainer/namespace will have the list of using clauses that
4754 Assembly Attributes were escaping the normal registration
4757 (EmitCode): Apply attributes within an EmitContext that represents
4758 the container they were declared on.
4760 * cs-parser.jay: Track bases for structs. How did I get this wrong?
4762 2002-05-06 Ravi Pratap <ravi@ximian.com>
4764 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
4765 Revamp completely - make much cleaner as we now operate only
4768 (FindMostSpecificSource, FindMostSpecificTarget): New methods
4769 to implement the logic detailed in the spec more correctly.
4771 (UserDefinedConversion): Update accordingly.
4773 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4775 * statement.cs: Return flow analysis information up.
4777 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
4780 (token): Do not consume an extra character before calling
4783 2002-05-06 Piers Haken <piersh@friskit.com>
4785 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
4787 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4789 * class.cs (Constructor.Emit): Set the IsStatic flag in the
4790 EmitContext during the instance constructor initializer
4791 resolution, to stop access to instance variables.
4793 This is mandated by the spec, last paragraph of the `constructor
4794 initializers' section.
4796 2002-05-05 Miguel de Icaza <miguel@ximian.com>
4798 * cs-parser.jay, class.cs (Accessor): new class used to represent
4799 an accessor (get or set). In the past we used `null' to represent
4800 a missing accessor. But this is ambiguous because there was no
4801 way to tell in abstract indexers/properties if one of them was
4804 Now there is a way of addressing that.
4806 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
4807 instead of FindMembers.
4809 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
4810 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
4812 * attribute.cs: Treat indexers and properties as the same in terms
4813 of applying attributes
4815 * ecore.cs (FindMostEncompassedType): Use statically initialized
4816 EmptyExpressions()s like we do elsewhere to avoid creating useless
4817 objects (and we take this out of the tight loop).
4819 (GetConversionOperators): Move the code to extract the actual
4820 operators to a separate routine to clean things up.
4822 2002-05-04 Miguel de Icaza <miguel@ximian.com>
4824 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
4825 events are always registered FieldBuilders.
4827 * class.cs (FieldBase): New class shared by Fields
4829 * delegate.cs: If we are a toplevel delegate, use our full name.
4830 If we are a nested delegate, then only use our tail name.
4832 2002-05-02 Ravi Pratap <ravi@ximian.com>
4834 * expression.cs (IsApplicable): Ensure that we add the "&" to
4835 ref/out types before comparing it with the type of the argument.
4837 (IsParamsMethodApplicable): Ditto.
4839 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
4842 * delegate.cs : Handle the case when we have more than one applicable
4843 method. Flag an error only when we finish checking all.
4845 2002-05-02 Miguel de Icaza <miguel@ximian.com>
4847 * expression.cs: Add support for boolean static initializers.
4849 2002-05-01 Miguel de Icaza <miguel@ximian.com>
4851 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
4853 * parameter.cs (ComputeParameterTypes,
4854 ComputeAndDefineParameterTypes): Better error handling: now we
4855 clear the `types' cache if we fail during any of the type lookups.
4856 We also return the status code correctly to our caller
4858 * delegate.cs: If we fail to define a delegate, abort the extra
4861 * expression.cs (Binary.ResolveOperator): for
4862 operator==(object,object) and operator !=(object, object) we also
4863 have to verify that there is an implicit conversion from one to
4866 (ArrayAccess.DoResolve): Array Access can operate on
4869 2002-04-30 Miguel de Icaza <miguel@ximian.com>
4871 * assign.cs (CompoundAssign): A new class used as a "flag" that
4872 the assignment actually is happening as part of a compound
4873 assignment operator.
4875 During compound assignment, a few new rules exist to enable things
4882 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
4883 to the type of x) if y is implicitly convertible to the type of x,
4884 and the operator is a builtin operator and the return type of the
4885 operator is explicitly convertible to the type of x.
4887 * rootcontext.cs: Reset warning level to 2. 4 catches various
4888 "interesting" features in mcs, we must clean this up at some
4889 point, but currently am trying to kill other bugs ;-)
4891 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
4892 in container classes as well.
4894 * expression.cs (Binary.ResolveOperator): Handle string case
4895 before anything else (as operator overloading does emit an error
4896 before doing anything else).
4898 This code could go away when we move to a table driven model, but
4899 i could not come up with a good plan last night.
4901 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
4903 * typemanager.cs (CSharpName): reimplementation using regex.
4904 * class.cs: added null check for fields in Emit
4905 * rootcontext.cs: set warninglevel to 4
4907 2002-04-29 Miguel de Icaza <miguel@ximian.com>
4909 * typemanager.cs (CSharpName): reimplemented with Lupus
4912 2002-04-28 Miguel de Icaza <miguel@ximian.com>
4914 * statement.cs (If): correclty implement Resolve, because we were
4915 not catching sem errors in there. The same process is needed
4917 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
4920 (Statement.Warning_DeadCodeFound): Factorize code.
4921 (While): Report dead code here too.
4923 (Statement): Added Resolve virtual method to allow
4924 for resolution split from the emit code.
4926 2002-04-26 Miguel de Icaza <miguel@ximian.com>
4928 * statement.cs (EmitBoolExpression): No longer try to resolve the
4930 (MakeBoolean): New utility function that resolve, implicitly
4931 converts to boolean and tags the expression.
4934 (If, Do): Implement dead code elimination.
4935 (While): Implement loop inversion
4937 (Do, While, For, If): Resolve the expression prior to calling our
4940 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
4943 - added method Report28 (warning: program has more than one entry point)
4944 - added method IsEntryPoint, implements paragraph 10.1 of the spec
4945 - modified method Method.Define, the part at the end of the method
4947 * rootcontext.cs: added static public Location EntryPointLocation;
4949 * ../errors/cs0028.cs : Add test case for the above warning.
4952 - modified method CSharpName to allow arrays of primitive type to
4953 be printed nicely (e.g. instead of System.Int32[][] it now prints
4955 - added method CSharpSignature: returns the signature of a method
4956 in string format to be used in reporting errors, warnings, etc.
4958 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
4961 2002-04-26 Ravi Pratap <ravi@ximian.com>
4963 * delegate.cs (Define): Fix extremely silly bug where I was
4964 setting the type of the 'object' parameter of the BeginInvoke
4965 method to System.IAsyncResult instead of System.Object ;-)
4967 2002-04-26 Miguel de Icaza <miguel@ximian.com>
4969 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
4972 (Constructor.Emit): return if we fail to initialize the
4973 constructor. Another door closed!
4975 * expression.cs (New.DoResolve): Improve error message (from -6 to
4976 1501). Use DeclaredOnly lookup to find the exact constructor.
4978 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
4979 loop. This is useful.
4981 * cs-parser.jay: Adjust the default parameters so that destructors
4982 have the proper signature.
4984 2002-04-26 Martin Baulig <martin@gnome.org>
4986 * driver.cs (LoadAssembly): If `assembly' contains any characters
4987 which are only valid in path names and not in assembly names
4988 (currently slash, backslash and point), use Assembly.LoadFrom ()
4989 instead of Assembly.Load () on the `assembly' (before iteration
4990 over the link_paths).
4992 2002-04-26 Martin Baulig <martin@gnome.org>
4994 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
4996 2002-04-25 Miguel de Icaza <miguel@ximian.com>
4998 * class.cs (Property): use the new typemanager.MemberLookup
5000 (TypeContainer.MemberLookup): Implement using the
5001 TypeManager.MemberLookup now.
5003 * typemanager.cs: Make MemberLookup a function of the TypeManager,
5004 and return MemberInfos, so that these can be used without an
5005 EmitContext (what we had before).
5007 2002-04-24 Miguel de Icaza <miguel@ximian.com>
5009 * expression.cs: Fix the case where the argument to params if the
5010 type of the params. I omitted handling this before. Fixed
5012 2002-04-22 Miguel de Icaza <miguel@ximian.com>
5014 * driver.cs: Call BootCorlib_PopulateCoreType
5016 * class.cs (Property.CheckBase): Check for properties only, not
5019 * interface.cs: Temporary hack: try/catch around the
5020 CustomAttributeBuilder, because I am getting an exception that I
5023 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
5024 types whose definitions are required to be there (attributes are
5025 defined before standard types).
5027 Compute definitions as we boot the various types, as they are used
5028 immediately (value_type class will need object_type, but if we do
5029 not initialize object_type, we will pass a null, which will let
5030 the runtime pick the System.Object from the existing corlib, which
5031 is not what we want).
5033 2002-04-22 Patrik Torstensson <totte@labs2.com>
5035 * cs-tokenizer.cs: fixed a number of trim() issues.
5037 2002-04-22 Ravi Pratap <ravi@ximian.com>
5039 * expression.cs (Argument.Type): Ensure that we return the correct
5040 type when we have out or ref parameters [in which case we
5043 2002-04-22 Miguel de Icaza <miguel@ximian.com>
5045 * class.cs (Property, Indexer): Allow extern modifier in there.
5047 * typemanager.cs (InitBaseTypes): Initializes object_type and
5048 value_type, since those will be used early on during the bootstrap
5049 process to compile corlib.
5051 (InitCoreTypes): Move code from here to InitBaseTypes.
5053 2002-04-21 Miguel de Icaza <miguel@ximian.com>
5055 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
5056 single-dimension arrays as using the ldlen opcode.
5058 Daniel Lewis discovered this optimization.
5060 * typemanager.cs: Add signature for System.Array::get_Length
5062 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5064 * statement.cs: report the error when the foreach does not apply to an
5065 array nor a collection.
5067 2002-04-19 Miguel de Icaza <miguel@ximian.com>
5069 * expression.cs: Add implicit conversions to the operator ~.
5071 * constant.cs (DecimalConstant.Emit): Emit decimal value.
5073 * typemanager.cs: Locate the decimal constructor.
5075 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5077 * attribute.cs: use the new property of TypeOf.
5078 * expression.cs: added 'get' property around typearg.
5080 These changes fix a build breaker reported by NickD. Is this the
5081 correct way to fix? If not, please, revert my changes and make it
5084 2002-04-17 Miguel de Icaza <miguel@ximian.com>
5086 * attribute.cs: Add support for typeof in attribute invocations.
5087 I am not sure that this is right though.
5089 2002-04-14 Duncan Mak <duncan@ximian.com>
5091 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
5092 Binary.Operator.Division case.
5094 2002-04-13 Ravi Pratap <ravi@ximian.com>
5096 * class.cs (DefineType): Ensure that we do a proper check on
5097 attribute types and also register it with the TypeManager.
5099 (TypeContainer.Targets): The default for attribute types is
5100 AttributeTargets.All.
5102 * attribute.cs (ApplyAttributes): Registering the attribute type
5103 is done elsewhere, not when we discover we have a Usage attribute.
5105 2002-04-12 Ravi Pratap <ravi@ximian.com>
5107 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
5108 and get rid of is_delegate parameter.
5110 * everywhere : update.
5112 2002-04-12 Ravi Pratap <ravi@ximian.com>
5114 * cs-parser.jay (compilation_unit): Revamp completely to use
5115 some new ideas that I got from Rhys' grammar to solve the problems
5116 with assembly level attributes.
5118 (outer_declaration): New grammar production.
5120 (attribute_sections): Add.
5122 (opt_attributes): Base on attribute_sections
5124 (namespace_declaration): Allow opt_attributes to tackle the case
5125 when we have assembly level attributes - we are clever in this
5128 * attribute.cs (ApplyAttributes): Do not worry about assembly
5129 attributes in the non-global context.
5131 * rootcontext.cs (AddGlobalAttributes): Go back to using this
5132 instead of SetGlobalAttributes.
5134 * class.cs, rootcontext.cs : Ensure we define and generate
5135 attribute types before anything else.
5137 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
5138 and flag the new error -20 for the case when the attribute type
5139 does not have valid targets specified. csc does not catch this.
5141 * ../errors/errors.txt : update for error # -20
5143 2002-04-11 Ravi Pratap <ravi@ximian.com>
5145 * support.cs (InternalParameters.ParameterModifier): Do some null
5146 checking and return sane values.
5148 * class.cs (Method.Define): If we are a PInvoke method, ensure
5149 that we are static and extern. Report error # 601
5151 * ../errors/cs0601.cs : Add test case for the above error.
5153 2002-04-07 Ravi Pratap <ravi@ximian.com>
5155 * rootcontext.cs (attribute_types): We need to keep type of
5156 all attribute types separately and emit code for them first.
5158 (RegisterAttribute) : Implement.
5160 * class.cs (DefineType): Check if the current Type is a custom
5161 attribute type and register it accordingly.
5163 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
5164 adding the first attribute twice and rename to
5166 (SetGlobalAttributes): this.
5168 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
5171 * attribute.cs (ApplyAttributes): Take an additional argument telling us
5172 if we are processing global arguments. Hmm, I am unsure of this.
5174 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5176 * expression.cs: added static array of strings to avoid calling
5177 Enum.ToString () for Operator in Binary. Significant recover of
5180 2002-04-10 Miguel de Icaza <miguel@ximian.com>
5182 * class.cs (FindMembers): Allow the Builders of the various
5183 members to be null. If they are skip them. This only happens
5184 during the PInvoke declaration.
5186 2002-04-09 Miguel de Icaza <miguel@ximian.com>
5188 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5189 failure, so we do not keep going afterwards.
5191 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5192 wanted to pass `false' as the `is_delegate' argument. If this is
5193 the case, why not use delegate_type == null to mean `is_delegate =
5194 false' and anything else as is_delegate = true.
5196 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
5198 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
5199 code for the section, not the beginning of the tests.
5201 2002-04-08 Miguel de Icaza <miguel@ximian.com>
5203 * cfold.cs: Handle operator + (Enum x, Underlying x)
5205 * expression.cs (Binary): same. Warn about errors where we have
5206 Enum/Enum in operator + as well.
5208 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
5211 - added support for switch(bool)
5212 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
5213 - add TableSwitchEmit() to handle table-based switch statements
5215 2002-04-05 Ravi Pratap <ravi@ximian.com>
5217 * expression.cs (Invocation.OverloadResolve): Factor out code which
5218 does parameter compatibility checking with arguments so that we can
5219 re-use the code even from Delegate.VerifyApplicability
5221 (VerifyArgumentsCompat): Move above code here.
5223 * delegate.cs (VerifyApplicability): Get rid of duplicate code
5224 and instead make a call to the above method.
5226 2002-03-31 Ravi Pratap <ravi@ximian.com>
5228 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
5229 We use it to keep track of classes which are attribute types.
5231 2002-04-02 Miguel de Icaza <miguel@ximian.com>
5233 * delegate.cs (Delegate.Define): Correctly define the types in the
5234 presence of fixed and array parameters.
5236 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
5239 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
5240 include NonPublic after the first iteration.
5242 * class.cs (Indexer.CheckBase): Only check if both parents are
5245 * cs-parser.jay (accessor_body): If empty, set to null.
5247 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
5248 same code path here to resolve constants names that we did have in
5249 MemberAccess.DoResolve. There is too much code duplicated here.
5251 2002-04-01 Miguel de Icaza <miguel@ximian.com>
5253 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
5255 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
5258 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
5259 tokens, numbers and strings.
5261 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
5264 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
5265 asyncronous parameters and the regular parameters.
5267 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
5268 specify the target directory.
5270 * expression.cs: (This.DoResolve): Simplify
5271 (As.Emit): Optimize, do not generate IsInst if the expression is
5272 always of the given type.
5274 (Is.DoResolve): Bug fix, we were reporting both always/never for
5277 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
5278 creating too many unnecessary arrays.
5280 2002-03-31 Miguel de Icaza <miguel@ximian.com>
5282 * class.cs (EmitFieldInitializer): Use Assign expression to assign
5283 fields instead of rolling our own initializer. Takes care of all
5284 implicit conversions, and drops unnecessary static checks/argument.
5286 2002-03-31 Dick Porter <dick@ximian.com>
5288 * driver.cs: use the GetDirectories() return values properly, and
5289 use "/" as path separator.
5291 2002-03-30 Miguel de Icaza <miguel@ximian.com>
5293 * expression.cs (Unary): Optimize - - expr into expr.
5294 (Binary): Optimize a + (-b) into a -b.
5296 * codegen.cs (CodeGen): Made all methods static.
5298 2002-03-29 Miguel de Icaza <miguel@ximian.com>
5302 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
5303 TypeBuilder property.
5305 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
5308 * tree.cs: Removed the various RecordXXXX, and replaced with a
5309 single RecordDecl. Removed all the accessor methods, and just
5310 left a single access point Type
5312 * enum.cs: Rename DefineEnum to DefineType.
5314 * decl.cs: New abstract method `DefineType' used to unify the
5315 Defines for Enumerations, Interfaces, TypeContainers and
5318 (FindType): Moved LookupInterfaceOrClass here. Moved the
5319 LookupBaseClasses method that used to live in class.cs and
5320 interface.cs here, and renamed to FindType.
5322 * delegate.cs: Implement DefineType. Take advantage of the
5323 refactored pattern for locating the parent builder without taking
5324 the parent_builder argument (which we know does not work if we are
5325 nested, and triggering a toplevel definition).
5327 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5329 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
5330 accessibility of a member has changed during override and report
5333 * class.cs (Method.Define, Property.Define): Only complain on
5334 overrides if the method is private, any other accessibility is
5335 fine (and since we just checked the permission is the same, we are
5338 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
5339 and elif are processed always. The other pre-processing
5340 directives are only processed if we are "taking" the path
5342 2002-03-29 Martin Baulig <martin@gnome.org>
5344 * class.cs (Method.Emit): Only emit symbolic debugging info if the
5345 current location is not Null.
5347 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
5348 a separate method so we can profile it.
5350 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
5351 `span.Seconds' are just seconds, but no minutes or hours.
5352 (MainDriver): Profile the CodeGen.SaveSymbols calls.
5354 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5356 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
5357 Remove the gratuitous set of Final:
5359 // If an interface implementation, then we can set Final.
5360 if (((flags & MethodAttributes.Abstract) == 0) &&
5361 implementing.DeclaringType.IsInterface)
5362 flags |= MethodAttributes.Final;
5364 I do not know what I was smoking when I used that.
5367 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
5368 step into fixing the name resolution issues for delegates and
5369 unifying the toplevel name resolution.
5371 2002-03-28 Martin Baulig <martin@gnome.org>
5373 * class.cs (Method.Emit): If we have a symbol writer, call its
5374 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
5375 tell it about the current method.
5377 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
5378 writer that we're going to emit the first byte of IL code for a new
5379 statement (a new source line).
5380 (EmitContext.EmitTopBlock): If we have a symbol writer, call
5381 EmitContext.Mark() before emitting any code.
5383 * location.cs (SymbolDocument): Return null when we're Null.
5385 * statement.cs (Statement): Moved the `Location loc' variable here.
5386 (Statement.EmitBoolExpression): If we have a symbol writer, call
5387 ec.Mark() before emitting any code to tell it that we're at the
5388 beginning of a new statement.
5389 (StatementExpression): Added `Location' argument to the constructor.
5390 (Block): Added public readonly variable `StartLocation' and public
5391 variable `EndLocation'. The latter is to be set using SetEndLocation().
5392 (Block): Added constructor which takes a start and end location.
5393 (Block.SetEndLocation): New method. This sets the end location.
5394 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
5395 local variables we create.
5396 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
5397 each statement and do also mark the begin and end of the block.
5399 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
5400 tell it the current lexer.Location, use Location.Null for the end of the
5402 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
5403 current block, set its end location using SetEndLocation().
5404 (statement_expression): StatementExpression constructor now takes the
5405 lexer.Location as additional argument.
5406 (for_statement, declare_local_variables): Likewise.
5407 (declare_local_variables): When creating a new implicit block, use the
5408 new Block constructor and pass it the lexer.Location.
5410 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5412 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
5413 members also on the parent interfaces recursively.
5415 2002-03-27 Miguel de Icaza <miguel@ximian.com>
5417 * report.cs: Use new formats, since Gonzalo finished the missing
5420 * expression.cs (Binary.ResolveOperator): added missing operator|
5421 operator& and operator^ for bool/bool.
5423 * cs-parser.jay: CheckDef now takes a Location argument that is
5424 used to report errors more precisly (instead of reporting the end
5425 of a definition, we try to track something which is a lot closer
5426 to the source of the problem).
5428 * cs-tokenizer.cs: Track global token use, so we can properly flag
5429 the use of #define/#undef after the first token has been seen.
5431 Also, rename the reportXXXX to Error_DescriptiveName
5433 * decl.cs (DeclSpace.IsTopLevel): Move property here from
5434 TypeContainer, so that Enum and Interface can use this too.
5436 * class.cs (TypeContainer.LookupInterfaceOrClass,
5437 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5438 `builder' argument. Typically this was used to pass the parent
5439 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5442 The problem is that a nested class could trigger the definition of
5443 a toplevel class, and the builder would be obviously wrong in that
5446 So we drop this argument, and we compute dynamically the
5447 TypeBuilder/ModuleBuilder (the correct information was available
5448 to us anyways from DeclSpace.Parent)
5450 * interface.cs (Interface.DefineInterface): Drop builder
5451 parameter cleanup like class.cs
5453 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
5456 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5459 (Try.Emit): Propagate the returns value from the statement.
5461 (Return.Emit): Even if we are leavning
5463 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5465 * modifiers.cs: Fix the computation of MethodAttributes flags.
5467 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5469 * driver.cs: allow compilation of files that start with '/'.
5470 Add a default case when checking the argument of --target.
5472 2002-03-25 Miguel de Icaza <miguel@ximian.com>
5474 * interface.cs: Implement the same search algorithm for types in
5477 * delegate.cs: Do not allow multiple definition.
5479 * Recovered ChangeLog that got accidentally amputated
5481 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5483 * rootcontext.cs: Load manually enum to allow core classes to
5484 contain enumerations.
5486 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5487 Update to new static methods in TypeManager.
5489 * typemanager.cs (GetMethod, GetConstructor): Use our
5490 implementation of FindMembers to find the members, since during
5491 corlib compilation, the types are TypeBuilders and GetMethod and
5492 GetConstructor do not work.
5494 Make all methods in TypeManager static.
5496 (InitCodeHelpers): Split the functionality from
5497 the InitCodeTypes function.
5499 * driver.cs: Call InitCodeHelpers after we have populated the
5502 * cs-parser.jay (delegate_declaration): we did not used to compute
5503 the delegate name correctly for void delegates.
5505 2002-03-24 Miguel de Icaza <miguel@ximian.com>
5507 * rootcontext.cs (RootContext): Init the interface_resolve_order
5508 and type_container_resolve_order always.
5510 (ResolveCore, BootstrapCorlib_ResolveClass,
5511 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5512 compiler when compiling with --nostdlib
5514 * class.cs (TypeContainer.DefineType): Check that our parent is
5515 not null. This test is most important when we are bootstraping
5518 * codegen.cs: Split out the symbol writing code.
5520 2002-03-25 Martin Baulig <martin@gnome.org>
5522 * driver.cs (-g): Made -g an alias for --debug.
5524 2002-03-24 Martin Baulig <martin@gnome.org>
5526 * codegen.cs (SymbolWriter): New public variable. Returns the
5527 current symbol writer.
5528 (CodeGen): Added `bool want_debugging_support' argument to the
5529 constructor. If true, tell the ModuleBuild that we want debugging
5530 support and ask it for the ISymbolWriter.
5531 (Save): If we have a symbol writer, call it's Close() method after
5532 saving the assembly.
5534 * driver.c (--debug): New command line argument to create a
5535 debugger information file.
5537 * location.cs (SymbolDocument): New public property. Returns an
5538 ISymbolDocumentWriter object for the current source file or null
5539 if we don't have a symbol writer.
5541 2002-03-21 Miguel de Icaza <miguel@ximian.com>
5543 * driver.cs (LoadAssembly): Correctly return when all the paths
5544 have been tried and not before.
5546 * statement.cs (Switch.Emit): return the actual coverage for this
5547 statement (returns/not-returns)
5549 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5550 switch of the statement if we are the last switch section. That
5551 kills two problems: try/catch problems (we used to emit an empty
5552 nop at the end) and switch statements where all branches would
5555 2002-03-19 Miguel de Icaza <miguel@ximian.com>
5557 * driver.cs: Add default assemblies (the equivalent to the
5558 Microsoft CSC.RSP file)
5560 * cs-tokenizer.cs: When updating `cols and setting it to zero,
5561 also update tokens_seen and set it to false.
5563 * driver.cs: Implement --recurse for Mike.
5565 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5566 correctly splitting out the paths.
5568 2002-03-18 Miguel de Icaza <miguel@ximian.com>
5570 * interface.cs (Interface.PopulateProperty): Instead of using
5571 `parent' as the declaration space for the set parameters, use
5574 * support.cs (InternalParameters): InternalParameters constructor
5575 takes a DeclSpace instead of a TypeContainer.
5577 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5578 types are being initialized, load the address of it before calling
5581 (New): Provide a mechanism to disable the generation of local
5582 value type temporaries when the caller will be providing us with
5583 an address to store it.
5585 (ArrayCreation.EmitDynamicInitializers): Use it.
5587 2002-03-17 Miguel de Icaza <miguel@ximian.com>
5589 * expression.cs (Invocation.EmitArguments): Only probe for array
5590 property if there is more than one argument. Sorry about that.
5592 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5595 * class.cs (Method.LabelParameters): Fix incorrect code path that
5596 prevented the `ParamArrayAttribute' from being applied to the
5599 2002-03-16 Miguel de Icaza <miguel@ximian.com>
5601 * support.cs (ReflectionParameters): Correctly compute whether the
5602 last argument is a params array. Fixes the problem with
5605 * typemanager.cs: Make the assemblies array always be non-null
5606 (empty, but non-null)
5608 * tree.cs (RecordDecl): New function that abstracts the recording
5609 of names. This reports error 101, and provides a pointer to the
5610 previous declaration. Fixes a crash in the compiler.
5612 * cs-parser.jay (constructor_declaration): Update to new grammar,
5613 and provide a constructor_body that can be empty.
5615 2002-03-15 Miguel de Icaza <miguel@ximian.com>
5617 * driver.cs: Add support for --resources.
5619 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5620 Make all types for the various array helper methods be integer.
5622 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
5623 CheckState to ConvCast.
5625 (ConvCast): Now it takes a `checked' state argument, to avoid
5626 depending on the emit context for the conversion, and just using
5627 the resolve time setting.
5629 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
5630 instead of Invocation.EmitArguments. We do not emit the original
5631 arguments, instead we emit those which have been converted to
5632 unsigned int expressions.
5634 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
5636 * codegen.cs: ditto.
5638 * expression.cs (LocalVariableReference): Drop the use of the
5639 Store function that depended on the variable index.
5641 * statement.cs (VariableInfo): Drop the `Idx' property from this
5642 class, as this is not taking into account the indexes for
5643 temporaries tat we generate during the execution, getting the
5646 * class.cs: First emit class initializers, then call the parent
5649 * expression.cs (Binary): Fix opcode emision.
5650 (UnaryMutator.EmitCode): Support checked code generation
5652 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
5653 matches for events for both the Static and Instance scans,
5654 pointing to the same element. Fix that.
5656 2002-03-14 Miguel de Icaza <miguel@ximian.com>
5658 * rootcontext.cs (ResolveTree): Always set the
5659 interface_resolve_order, because nested interfaces will be calling
5662 * class.cs (GetInterfaceOrClass): Track the same resolution
5663 process used by TypeManager.LookupType. This fixes the nested
5664 type lookups in class declarations (separate path from
5667 (TypeContainer.DefineType): Also define nested interfaces.
5668 (TypeContainer.RegisterOrder): New public function used to
5669 register the order in which child interfaces need to be closed.
5671 Nested interfaces need to be closed after their parents have been
5674 * interface.cs (InterfaceAttr): Put all the logic for computing
5675 the interface attribute here.
5677 (DefineInterface): Register our interface order with the
5678 RootContext or with the TypeContainer depending on the case.
5680 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5682 * cs-parser.jay: rework foreach statement to work with the new
5683 changes to the policy on SimpleNames.
5685 * report.cs: support Stacktrace on warnings as well.
5687 * makefile: drop --unsafe and /unsafe from the compile.
5689 2002-03-13 Ravi Pratap <ravi@ximian.com>
5691 * ecore.cs (StandardConversionExists): Modify to take an Expression
5692 as the first parameter. Ensure we do null -> reference type conversion
5695 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
5696 temporary Expression objects.
5698 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
5700 * interface.cs: workaround bug in method overloading resolution
5701 (there is already a bugzilla bug for it).
5703 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5705 We could also solve this problem by having a separate path for
5706 performing type lookups, instead of DoResolve, we could have a
5707 ResolveType entry point, and only participating pieces of the
5708 production (simplename, deref, array) would implement this.
5710 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
5711 signal SimpleName to only resolve type names and not attempt to
5712 resolve anything else.
5714 * expression.cs (Cast): Set the flag.
5716 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
5718 * class.cs: Only report 108 if there is no `new' modifier.
5720 * cs-parser.jay: rework foreach statement to work with the new
5721 changes to the policy on SimpleNames.
5723 * report.cs: support Stacktrace on warnings as well.
5725 * makefile: drop --unsafe and /unsafe from the compile.
5727 2002-03-11 Miguel de Icaza <miguel@ximian.com>
5729 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5730 lookups here, instead of doing that at parse time. This means
5731 that our grammar will not introduce `LocalVariableReferences' as
5732 expressions at this point. That solves the problem of code like
5740 This is only half the fix. The full fix requires parameters to
5741 also be handled in this way.
5743 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
5744 makes the use more obvious of the DeclSpace. The
5745 ec.TypeContainer.TypeBuilder is now only used to pull the
5748 My theory is that I can get rid of the TypeBuilder completely from
5749 the EmitContext, and have typecasts where it is used (from
5750 DeclSpace to where it matters).
5752 The only pending problem is that the code that implements Aliases
5753 is on TypeContainer, and probably should go in DeclSpace.
5755 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5756 lookups here, instead of doing that at parse time. This means
5757 that our grammar will not introduce `LocalVariableReferences' as
5758 expressions at this point. That solves the problem of code like
5766 This is only half the fix. The full fix requires parameters to
5767 also be handled in this way.
5769 * class.cs (Property.DefineMethod): When implementing an interface
5770 method, set newslot, when implementing an abstract method, do not
5771 set the flag (before we tried never setting it, or always setting
5772 it, which is the difference).
5773 (Indexer.DefineMethod): same.
5774 (Method.DefineMethod): same.
5776 * ecore.cs: Only set the status used flag if we get back a Field.
5778 * attribute.cs: Temporary hack, so Paolo can keep working.
5780 2002-03-08 Ravi Pratap <ravi@ximian.com>
5782 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
5783 the unmanaged type in the case we have a MarshalAs attribute.
5785 (Resolve): Handle the case when we are parsing the special MarshalAs
5786 attribute [we need to store the unmanaged type to use later]
5788 * typemanager.cs (marshal_as_attr_type): Built in type for the
5789 MarshalAs Attribute.
5791 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
5792 on parameters and accordingly set the marshalling info.
5794 2002-03-09 Miguel de Icaza <miguel@ximian.com>
5796 * class.cs: Optimizing slightly by removing redundant code after
5797 we switched to the `NoTypes' return value.
5798 (Property.DefineMethod): use NoTypes here too.
5800 This fixes the bug I introduced in my last batch of changes.
5802 2002-03-05 Ravi Pratap <ravi@ximian.com>
5804 * tree.cs (RecordEnum): Add. We now keep track of enums too.
5806 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
5807 Enums since those are types too.
5809 * cs-parser.jay (enum_declaration): Record enums as we parse them.
5811 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
5812 thanks to a call during the lookup process.
5814 2002-03-07 Miguel de Icaza <miguel@ximian.com>
5816 * statement.cs (Foreach): Lots of work to accomodate a particular
5817 kind of foreach statement that I had not kept in mind. It is
5818 possible to have foreachs on classes that provide a GetEnumerator
5819 method that return objects that implement the "pattern" for using
5820 a foreach, there is no need to support GetEnumerator
5823 This is needed to compile nant.
5825 * decl.cs: Only report 114 if the member is not `Finalize' and if
5826 the warning level is at least 2.
5828 * class.cs: Moved the compare function from Method to
5831 (MethodSignature.InheritableMemberSignatureCompare): Add new
5832 filter function that is used to extract inheritable methods from a
5835 (Method.Define): Use the new `inheritable_method_signature_filter'
5838 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
5841 2002-03-06 Miguel de Icaza <miguel@ximian.com>
5843 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
5845 * cs-parser.jay: Add opt_semicolon to the interface declaration.
5847 * expression.cs: Pass location information to
5848 ConvertImplicitStandard.
5850 * class.cs: Added debugging code to track return values from
5853 2002-03-05 Miguel de Icaza <miguel@ximian.com>
5855 * expression.cs (Is.DoResolve): If either side of the `is' is an
5856 interface, do not flag the warning.
5858 * ecore.cs (ImplicitReferenceConversion): We need a separate test
5861 * report.cs: Allow for --fatal to be used with --probe.
5863 * typemanager.cs (NoTypes): Move the definition for the empty Type
5866 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
5868 (TypeContainer.DefineProxy): New function used to proxy to parent
5869 implementations when implementing interfaces.
5870 (TypeContainer.ParentImplements): used to lookup if our parent
5871 implements a public function that is required by an interface.
5872 (TypeContainer.VerifyPendingMethods): Hook this up.
5874 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
5875 `modules' and `assemblies' arraylists into arrays. We only grow
5876 these are the very early start up of the program, so this improves
5877 the speedof LookupType (nicely measured).
5879 * expression.cs (MakeByteBlob): Replaced unsafe code with
5880 BitConverter, as suggested by Paolo.
5882 * cfold.cs (ConstantFold.Binary): Special case: perform constant
5883 folding of string concatenation, but if either side is a string,
5884 and the other is not, then return null, and let the runtime use
5885 the concatenation on the string plus the object (using
5888 2002-03-04 Miguel de Icaza <miguel@ximian.com>
5890 Constant Folding has been implemented now.
5892 * expression.cs (Unary.Reduce): Do not throw an exception, catch
5893 the error instead on types that are not supported in one's
5896 * constant.cs (Constant and all children): New set of functions to
5897 perform implict and explicit conversions.
5899 * ecore.cs (EnumConstant): Implement the new functions to perform
5900 conversion by proxying to the child expression.
5902 * codegen.cs: (ConstantCheckState): Constant evaluation has its
5903 own separate setting that can not be turned off from the command
5904 line using --unchecked or --checked and is only controlled using
5905 the checked/unchecked statements and expressions. This setting is
5906 used by the constant folder to flag errors.
5908 * expression.cs (CheckedExpr, UncheckedExpr): Set the
5909 ConstantCheckState as well.
5911 During Resolve, they also have to flag the state, because the
5912 constant folder runs completely in the Resolve phase.
5914 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
5917 2002-03-01 Miguel de Icaza <miguel@ximian.com>
5919 * cfold.cs: New file, this file contains the constant folder.
5921 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
5922 argument to track whether we are using the resulting address to
5923 load or store a value and provide better error messages.
5925 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
5926 new AddressOf arguments.
5928 * statement.cs (Foreach.EmitCollectionForeach): Update
5930 * expression.cs (Argument.Emit): Call AddressOf with proper
5931 arguments to track usage.
5933 (New.DoEmit): Call AddressOf with new arguments.
5935 (Unary.Emit): Adjust AddressOf call.
5937 2002-03-01 Ravi Pratap <ravi@ximian.com>
5939 * cs-parser.jay (member_access): Change the case for pre-defined types
5940 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
5943 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
5946 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
5947 essentially like methods and apply attributes like MethodImplOptions to them too.
5949 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
5952 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
5953 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
5956 * Update code everywhere accordingly.
5958 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
5960 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
5962 2002-02-28 Ravi Pratap <ravi@ximian.com>
5964 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
5965 try performing lookups against those instead of jumping straight into using
5966 the 'using' clauses.
5968 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
5970 (LookupType): Perform lookups in implicit parents too.
5972 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
5973 sequence as RootContext.LookupType.
5975 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
5976 the various cases of namespace lookups into this method.
5978 2002-03-01 Miguel de Icaza <miguel@ximian.com>
5980 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
5981 in positional arguments)
5983 * class.cs (Operator): Update the AllowedModifiers to contain
5986 * cs-parser.jay: Update operator declaration to allow for the
5987 operator body to be empty.
5989 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
5992 2002-02-27 Miguel de Icaza <miguel@ximian.com>
5994 * class.cs (Method.Emit): Label parameters.
5996 * driver.cs: Return 1 or 0 as the program exit code.
5998 2002-02-26 Miguel de Icaza <miguel@ximian.com>
6000 * expression.cs: Special case the `null' object when trying to
6001 auto-compute the type, as anything can be explicitly converted to
6004 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
6005 spotting this Paolo.
6007 (Expression.ImplicitNumericConversion): Perform comparissions of
6008 the type using the underlying type in the case of an enumeration
6009 rather than using the enumeration type for the compare.
6011 Cope with the underlying == type case, which is not possible to
6014 (Expression.ConvertNumericExplicit): Perform comparissions of
6015 the type using the underlying type in the case of an enumeration
6016 rather than using the enumeration type for the compare.
6018 * driver.cs: If the user does not supply an extension, assume .exe
6020 * cs-parser.jay (if_statement): Rewrote so that we can track the
6021 location for the if statement.
6023 * expression.cs (Binary.ConstantFold): Only concat strings when
6024 the operation is "+", not everything ;-)
6026 * statement.cs (Statement.EmitBoolExpression): Take a location
6028 (If, While, Do): Track location.
6030 * expression.cs (Binary.ResolveOperator): In the object + string
6031 case, I was missing a call to ConvertImplicit
6033 2002-02-25 Ravi Pratap <ravi@ximian.com>
6035 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
6036 Location arguments. Ensure we use RootContext.LookupType to do our work
6037 and not try to do a direct Type.GetType and ModuleBuilder.GetType
6039 * interface.cs (PopulateMethod): Handle the type of the parameter being
6042 * expression.cs (Invocation.BetterFunction): Handle the case when we
6043 have a params method with no fixed arguments and a call is made with no
6046 2002-02-25 Miguel de Icaza <miguel@ximian.com>
6048 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
6049 the verbatim-string-literal
6051 * support.cs (InternalParameters.ParameterModifier): handle null
6053 (InternalParameters.ParameterType): ditto.
6055 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
6056 duplicating the name of the variable parameter.
6057 (GetParameterByName): Fix bug where we were not looking up array
6058 paramters if they were the only present (thanks Paolo!).
6059 (GetParameterInfo): We only have an empty set of types if both
6060 fixed and array are set to null.
6061 (GetParameterInfo-idx): Handle FixedParameter == null
6063 * cs-parser.jay: Handle the case where there is no catch
6064 statements (missing null test).
6066 2002-02-22 Miguel de Icaza <miguel@ximian.com>
6068 * driver.cs (MainDriver): Be conservative on our command line
6071 Catch DirectoryNotFoundException when calling GetFiles.
6073 (SplitPathAndPattern): Used to split the input specification into
6074 a path and a pattern that we can feed to Directory.GetFiles.
6076 2002-02-21 Miguel de Icaza <miguel@ximian.com>
6078 * statement.cs (Fixed): Implement the last case of the Fixed
6079 statement (string handling).
6081 * expression.cs (StringPtr): New class used to return a char * to
6082 a string; Used by the Fixed statement.
6084 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
6086 * expression.cs (Binary.ResolveOperator): Remove redundant
6087 MemberLookup pn parent type.
6088 Optimize union call, we do not need a union if the types are the same.
6089 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
6092 Specialize the use of MemberLookup everywhere, instead of using
6093 the default settings.
6095 (StackAlloc): Implement stackalloc keyword.
6097 * cs-parser.jay: Add rule to parse stackalloc.
6099 * driver.cs: Handle /h, /help, /?
6101 * expression.cs (MakeByteBlob): Removed the hacks we had in place
6102 before we supported unsafe code.
6104 * makefile: add --unsafe to the self compilation of mcs.
6106 2002-02-20 Miguel de Icaza <miguel@ximian.com>
6108 * expression.cs (PointerArithmetic): New class that is used to
6109 perform pointer arithmetic.
6110 (Binary.Resolve): Handle pointer arithmetic
6111 Handle pointer comparission.
6112 (ArrayPtr): Utility expression class that is used to take the
6113 address of an array.
6115 (ElementAccess): Implement array access for pointers
6117 * statement.cs (Fixed): Implement fixed statement for arrays, we
6118 are missing one more case before we are done.
6120 * expression.cs (Indirection): Implement EmitAssign and set the
6121 ExprClass to Variable. This allows pointer dereferences to be
6122 treated as variables, and to have values assigned to them.
6124 * ecore.cs (Expression.StoreFromPtr): New utility function to
6125 store values dereferencing.
6127 2002-02-20 Ravi Pratap <ravi@ximian.com>
6129 * expression.cs (Binary.ResolveOperator): Ensure that we are
6130 not trying to operate on a void type - this fixes the reported
6133 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
6134 the parent implementation is sealed.
6136 * ../errors/cs0239.cs : Add.
6138 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
6140 * typemanager.cs (unverifiable_code_type): Corresponds to
6141 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
6142 which have unsafe code in them.
6144 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
6147 2002-02-19 Miguel de Icaza <miguel@ximian.com>
6149 * cs-tokenizer.cs: Add support for @"litreal strings"
6151 Make tokenizer accept pre-processor directives
6152 on any column (remove the old C-like limitation).
6154 * rootcontext.cs (EmitCode): Emit any global attributes.
6155 (AddGlobalAttributes): Used to keep track of assembly attributes.
6157 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
6159 * cs-parser.jay: Add support for global attributes.
6161 2002-02-17 Miguel de Icaza <miguel@ximian.com>
6163 * expression.cs (Indirection): New helper class. Unary will
6164 create Indirection classes to be able to implement the
6165 IMemoryLocation interface on it.
6167 2002-02-16 Miguel de Icaza <miguel@ximian.com>
6169 * cs-parser.jay (fixed_statement): reference the right statement.
6171 * statement.cs (Fixed.Emit): Finish implementing the fixed
6172 statement for the &x case.
6174 2002-02-14 Miguel de Icaza <miguel@ximian.com>
6176 * class.cs (Property.Define, Method.Define): Remove newslot when
6179 * modifiers.cs: My use of NewSlot when `Abstract' was set was
6180 wrong. NewSlot should only be used if the `new' keyword is present.
6182 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6183 locating our system dir. Sorry about this.
6185 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6187 * driver.cs (GetSystemDir): Compute correctly the location of our
6188 system assemblies. I was using the compiler directory instead of
6189 the library directory.
6191 2002-02-13 Ravi Pratap <ravi@ximian.com>
6193 * expression.cs (BetterFunction): Put back in what Miguel commented out
6194 since it is the correct fix. The problem is elsewhere ;-)
6196 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6197 parameters of the parms method are themselves compatible or not !
6199 (StandardConversionExists): Fix very dangerous bug where we were forgetting
6200 to check that a class implements an interface before saying that an implicit
6201 conversion was allowed. Use ImplementsInterface to do the checking.
6203 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6205 * class.cs (Method.Define): Track whether we are an explicit
6206 implementation or not. And only call DefineMethodOverride if we
6207 are an explicit implementation.
6209 (Property.DefineMethod): Ditto.
6211 2002-02-11 Ravi Pratap <ravi@ximian.com>
6213 * expression.cs (BetterFunction): Catch hideous bug which was
6214 preventing us from detecting ambiguous calls due to implicit casts i.e
6217 2002-01-29 Miguel de Icaza <miguel@ximian.com>
6219 * support.cs (Pair): Remove un-needed method. I figured why I was
6220 getting the error in cs-parser.jay, the variable in a foreach loop
6221 is readonly, and the compiler does not really treat this as a variable.
6223 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
6224 instead of EQUALS in grammar.
6226 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
6228 * expression.cs (Unary.DoResolve): Check whether the argument is
6231 2002-01-28 Miguel de Icaza <miguel@ximian.com>
6233 * support.cs: Api for Pair to set a value. Despite the fact that
6234 the variables are public the MS C# compiler refuses to compile
6235 code that accesses the field if the variable is part of a foreach
6238 * statement.cs (Fixed): Begin implementation of the fixed
6241 (Block.AddVariable): Return the VariableInfo on success and null
6242 on failure instead of true/false.
6244 * cs-parser.jay (foreach): Catch errors on variables already
6245 defined (we were ignoring this value before) and properly unwind
6248 (fixed_statement): grammar for the fixed statement.
6250 2002-01-25 Miguel de Icaza <miguel@ximian.com>
6252 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
6253 pointer types to be incretemented.
6255 (SizeOf): Implement.
6257 * cs-parser.jay (pointer_member_access): Implement
6258 expr->IDENTIFIER production.
6260 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
6261 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
6264 (Unary): Implement indirection.
6266 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
6267 use in non-unsafe context).
6269 (SimpleName.DoResolve): Check for pointers in field access on safe
6272 (Expression.LoadFromPtr): Factor the load-indirect code in this
6273 function. This was duplicated in UnboxCast and ParameterReference
6275 2002-01-24 Miguel de Icaza <miguel@ximian.com>
6277 * expression.cs (ComposedCast): report an error if a pointer cast
6278 is used in a safe region.
6280 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
6281 pointer type casts in unsafe context.
6283 * codegen.cs (EmitContext): Set up IsUnsafe.
6285 * cs-parser.jay (non_expression_type): Add productions for pointer
6288 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
6289 code. We should not use force into static mode if the method is
6290 not virtual. Fixes bug in MIS
6292 * statement.cs (Do.Emit, While.Emit, For.Emit,
6293 Statement.EmitBoolExpression): Add support to Do and While to
6294 propagate infinite loop as `I do return' semantics.
6296 Improve the For case to also test for boolean constants.
6298 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
6299 to the list of attributes we can add.
6301 Remove `EmitContext' argument.
6303 * class.cs (Method.Define): Apply parameter attributes.
6304 (Constructor.Define): Apply parameter attributes.
6305 (MethodCore.LabelParameters): Move here the core of labeling
6308 * support.cs (ReflectionParameters.ParameterModifier,
6309 InternalParameters.ParameterModifier): Use IsByRef on the type and
6310 only return the OUT bit for these parameters instead of in/out/ref
6313 This is because I miss-understood things. The ParameterInfo.IsIn
6314 and IsOut represent whether the parameter has the [In] and [Out]
6317 2002-01-22 Miguel de Icaza <miguel@ximian.com>
6319 * ecore.cs (FieldExpr.Emit): Release temporaries.
6321 * assign.cs (LocalTemporary.Release): new function.
6323 * codegen.cs (EmitContext.GetTemporaryStorage,
6324 EmitContext.FreeTemporaryStorage): Rework the way we deal with
6325 temporary storage. Now we can "put back" localbuilders when we
6328 2002-01-21 Miguel de Icaza <miguel@ximian.com>
6330 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
6331 need to make a copy of the variable to generate verifiable code.
6333 2002-01-19 Miguel de Icaza <miguel@ximian.com>
6335 * driver.cs: Compute dynamically the system directory.
6337 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
6338 Slower, but more generally useful. Used by the abstract
6339 registering implementation.
6341 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
6342 the rules for the special rule on Type/instances. First check if
6343 we have the same name, and if so, try that special static path
6344 rather than the instance path.
6346 2002-01-18 Miguel de Icaza <miguel@ximian.com>
6348 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
6351 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
6352 Enum, ValueType, Delegate or Array for non-corlib compiles.
6354 * cs-tokenizer.cs: Catch long identifiers (645)
6356 * typemanager.cs (IndexerPropetyName): Ravi never tested this
6359 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
6360 fix, we were returning too early, so we were not registering
6361 pending methods from abstract classes.
6363 Do not register pending methods if the class is abstract.
6365 * expression.cs (Conditional.DoResolve): Report circular implicit
6366 conversions when we neecd to compute it for conditional
6369 (Is.DoResolve): If the expression is always of the provided type,
6370 flag warning 183. If the expression can not ever be of the
6371 provided type flag warning 184.
6373 * class.cs: Catch 169 as well.
6375 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
6378 2002-01-18 Nick Drochak <ndrochak@gol.com>
6380 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
6382 2002-01-17 Miguel de Icaza <miguel@ximian.com>
6384 * interface.cs: (PopulateMethod): Check for pointers being defined
6385 only if the unsafe context is active.
6386 (PopulateProperty): ditto.
6387 (PopulateIndexer): ditto.
6389 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
6390 specified. If pointers are present, make sure that they are
6391 present in an unsafe context.
6392 (Constructor, Constructor.Define): ditto.
6393 (Field, Field.Define): ditto.
6394 (Property, Property.Define): ditto.
6395 (Event, Event.Define): ditto.
6397 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
6398 hashtable if there are classes or structs defined.
6400 * expression.cs (LocalVariableReference.DoResolve): Simplify this
6401 code, as the constant resolution moved.
6403 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
6404 the metadata, so we can flag error 133.
6406 * decl.cs (MemberCore.UnsafeOK): New function to test that a
6407 pointer is being declared in an unsafe context.
6409 2002-01-16 Miguel de Icaza <miguel@ximian.com>
6411 * modifiers.cs (Modifiers.Check): Require a Location argument.
6412 Report error 227 for Unsafe use.
6414 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6416 * statement.cs (For.Emit): If the test is null, then report that
6417 we do `return', as we wont reach anything afterwards.
6419 (Switch.SwitchGoverningType): Track the expression that matched
6422 * driver.cs: Allow negative numbers as an error code to flag.
6424 * cs-parser.jay: Handle 1551.
6426 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6428 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6430 * cs-parser.jay: Report 1518 (type declaration can only contain
6431 class, struct, interface, enum or delegate)
6433 (switch_label): Report 1523 (keywords `case' or `default' must
6436 (opt_switch_sections): Report 1522 (empty switch)
6438 * driver.cs: Report 1515 (response file specified multiple times)
6439 Report 1516 (Source file specified multiple times).
6441 * expression.cs (Argument.Resolve): Signal 1510
6443 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6444 access not allowed in static code)
6446 2002-01-11 Ravi Pratap <ravi@ximian.com>
6448 * typemanager.cs (IsPointerType): Utility method which we are going
6451 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6452 the object type, so we take care of that.
6454 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6456 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6457 added to non-params parameters :-)
6459 * typemanager.cs (CSharpName): Include 'void' type too.
6461 (void_ptr_type): Include in the set of core types.
6463 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
6466 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
6469 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
6470 completely forgotten about it.
6472 2002-01-10 Ravi Pratap <ravi@ximian.com>
6474 * cs-parser.jay (pointer_type): Add. This begins our implementation
6475 of parsing rules for unsafe code.
6477 (unsafe_statement): Implement.
6479 (embedded_statement): Modify to include the above.
6481 * statement.cs (Unsafe): Implement new class for unsafe blocks.
6483 * codegen.cs (EmitContext.InUnsafe): Add. This determines
6484 if the current context is an unsafe one.
6486 * cs-parser.jay (local_variable_pointer_type): Since local variable types
6487 are handled differently, we need separate rules for them.
6489 (local_variable_declaration): Update to use local_variable_pointer_type
6490 to allow variable declarations of unmanaged pointer types.
6492 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6495 * ../errors/cs0214.cs : Add.
6497 2002-01-16 Nick Drochak <ndrochak@gol.com>
6499 * makefile: remove 'response' file when cleaning.
6501 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6503 * cs-parser.jay: Report 1524.
6505 2002-01-14 Miguel de Icaza <miguel@ximian.com>
6507 * typemanager.cs (RegisterMethod): drop checking if we have
6508 registered this from here
6510 2002-01-12 Miguel de Icaza <miguel@ximian.com>
6512 * class.cs (Method.EmitDestructor): Implement calling our base
6515 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6518 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6519 this routine and will wrap the call in a try/catch block. Deal
6522 2002-01-11 Miguel de Icaza <miguel@ximian.com>
6524 * ecore.cs (Expression.MemberLookup): instead of taking a
6525 parameter `same_type' that was used to tell whether we could
6526 access private members we compute our containing type from the
6529 (FieldExpr): Added partial support for volatile fields. This does
6530 not work for volatile fields exposed from assemblies, as I can not
6531 figure out how to extract the modreq from it.
6533 Updated all the source files to use this.
6535 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6536 because it is referenced by MemberLookup very often.
6538 2002-01-09 Ravi Pratap <ravi@ximian.com>
6540 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6541 TypeBuilder.GetCustomAttributes to retrieve what we need.
6543 Get rid of redundant default_member_attr_type as this is the same as
6544 default_member_type which already exists.
6546 * interface.cs, attribute.cs : Update accordingly.
6548 2002-01-08 Miguel de Icaza <miguel@ximian.com>
6550 * typemanager.cs: Enable IndexerPropertyName again. It does not
6551 work for TYpeBuilders though. Ravi, can you please fix this?
6553 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6555 * expression.cs (Argument.Emit): Handle the case of ref objects
6556 being passed to ref functions;
6558 (ParameterReference.EmitLoad): Loads the content of the pointer
6559 without dereferencing.
6561 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6563 * cs-tokenizer.cs: Implemented the pre-processing expressions.
6565 2002-01-08 Ravi Pratap <ravi@ximian.com>
6567 * class.cs (Indexer.DefineMethod): Incorporate the interface
6568 type in the name of the method if we are doing explicit interface
6571 * expression.cs (ConversionExists): Remove as it is completely obsolete.
6573 (BetterConversion): Fix extremely trivial bug where we were referring to
6574 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6577 * ../errors/bug16.cs : Add although we have fixed it.
6579 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6581 * expression.cs (BaseIndexer): Begin implementation.
6583 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6585 * cs-parser.jay (indexer_declarator): Use qualified_identifier
6586 production directly to remove a shift/reduce, and implement
6587 explicit interface implementation.
6589 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6590 after a floating point suffix.
6592 * expression.cs (DoNumericPromotions): Improved the conversion for
6593 uint/uint. If we have a constant, we avoid doing a typecast to a
6596 * class.cs (Indexer): Implement explicit interface implementation
6599 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6601 * class.cs: make the default instance constructor public and hidebysig.
6603 2001-01-03 Ravi Pratap <ravi@ximian.com>
6605 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6606 so we can call it from elsewhere.
6608 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6609 we emit it internally if the class has a defined indexer; otherwise the user
6610 emits it by decorating the class definition with the DefaultMemberAttribute.
6612 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6613 attribute is not used on a type which defines an indexer.
6615 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6616 character when we skip whitespace.
6618 * ../errors/cs0646.cs : Add.
6620 2002-01-03 Miguel de Icaza <miguel@ximian.com>
6622 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
6625 * makefile: Add practical target `mcs3.exe' which builds the third
6626 generation compiler.
6628 * expression.cs (New): Fix structures constructor calling.
6630 * class.cs (Property, Method, Indexer): Emit Final flag on the
6631 method if we are an interface implementation and we are not
6634 * ecore.cs (PropertyExpr): New public field `IsBase', tells
6635 whether this property is referencing a `base' method.
6637 * expression.cs (Invocation.EmitCall): take an extra argument:
6638 is_base, this is used to determine whether the `call' or
6639 `callvirt' opcode should be used.
6642 * delegate.cs: update EmitCall.
6644 * class.cs (Method.Define): Set NewSlot for the cases where we are
6645 not implementing an interface method.
6647 (Property.Define): ditto.
6649 2002-01-02 Miguel de Icaza <miguel@ximian.com>
6651 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
6652 'r'. Allows mcs to parse itself fully.
6654 2002-01-02 Ravi Pratap <ravi@ximian.com>
6656 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
6657 of the number of initializers that require the InitializeArray method.
6659 (CheckIndices): Store the Expression in all cases - not the plain value. Also
6660 update the above field where necessary.
6662 (MakeByteBlob): Update accordingly.
6664 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
6667 (EmitDynamicInitializers): Update in accordance with the new optimization.
6669 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
6670 same OpCode applies.
6672 * cs-parser.jay : Fix some glaring errors I introduced.
6674 2002-01-01 Ravi Pratap <ravi@ximian.com>
6676 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
6677 so that we can check for name clashes there too.
6679 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
6680 for interface indexers.
6682 * interfaces.cs (Define): Emit the default member attribute.
6684 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
6685 variable was being referred to while setting the value ;-)
6687 2002-01-01 Miguel de Icaza <miguel@ximian.com>
6689 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
6690 byte-by-byte information when we know the data is zero.
6692 Make the block always a multiple of 4, because
6693 DefineInitializedData has a bug.
6695 * assign.cs: Fix, we should assign from the temporary, not from
6698 * expression.cs (MakeByteBlob): Fix my incorrect code.
6700 2001-12-31 Miguel de Icaza <miguel@ximian.com>
6702 * typemanager.cs (EnumToUnderlying): This function is used to get
6703 the underlying type from an enumeration, because it does not
6706 * constant.cs: Use the I4_S form for values between -128 and 127.
6708 * statement.cs (Block.LookupLabel): Looks up a label.
6709 (Block): Drop support for labeled blocks.
6711 (LabeledStatement): New kind of statement that represents a label
6714 (Goto): Finally implement this bad boy.
6716 * cs-parser.jay: Update to reflect new mechanism to implement
6719 2001-12-30 Miguel de Icaza <miguel@ximian.com>
6721 * codegen.cs (EmitContext.This): a codegen property that keeps the
6722 a single instance of this instead of creating many different this
6725 * delegate.cs (Delegate.DoResolve): Update to use the property;
6727 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
6729 * expression.cs (BaseAccess.DoResolve): Ditto.
6731 2001-12-29 Ravi Pratap <ravi@ximian.com>
6733 * typemanager.cs (methodimpl_attr_type): Add to hold the type
6734 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
6736 (InitCoreTypes): Update accordingly.
6738 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
6739 so we can quickly store the state.
6741 (ApplyAttributes): Set the correct implementation flags
6742 for InternalCall methods.
6744 2001-12-29 Miguel de Icaza <miguel@ximian.com>
6746 * expression.cs (EmitCall): if a method is not virtual, then do
6747 not use callvirt on it.
6749 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
6750 user defined stuff) requires the use of stobj, which takes an
6751 address on the stack instead of an array and an index. So emit
6752 the Ldelema operation for it.
6754 (EmitStoreOpcode): Use stobj for valuetypes.
6756 (UnaryMutator.EmitCode): Use the right 1 value depending on
6757 whether we are dealing with int64/uint64, float or doubles.
6759 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
6760 constructors that I implemented last night.
6762 (Constructor.IsDefault): Fix to work properly for static
6765 * cs-parser.jay (CheckDef): report method signature errors.
6766 Update error number 103 to be 132.
6768 * decl.cs: New AdditionResult enumeration value: MethodExists.
6769 Although we do this check for methods later on in the semantic
6770 analysis, catching repeated default constructors is so easy that
6771 we catch these here.
6773 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
6776 (ParameterReference.EmitAssign, Emit): handle
6779 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
6780 (ArrayAccess.EmitStoreOpcode): ditto.
6782 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
6784 * expression.cs (MakeByteBlob): Complete all the missing types
6785 (uint, short, ushort, byte, sbyte)
6787 * class.cs: Only init instance field initializers on instance
6790 Rename `constructors' to instance_constructors.
6792 (TypeContainer.AddConstructor): Only add constructors to the list
6793 if it is not static.
6795 Make sure that we handle default_static_constructor independently
6796 everywhere where we handle instance_constructors
6798 2001-12-28 Miguel de Icaza <miguel@ximian.com>
6800 * class.cs: Do not lookup or create a base initializer for a
6803 (ConstructorInitializer.Resolve): use the proper type to lookup
6806 * cs-parser.jay: Report error 1585 (modifiers between type and name).
6808 * enum.cs, interface.cs: Remove CloseType, this is taken care by
6811 * decl.cs: CloseType is now an virtual method, the default
6812 implementation just closes this type.
6814 2001-12-28 Ravi Pratap <ravi@ximian.com>
6816 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
6817 to PreserveSig by default. Also emit HideBySig on such methods.
6819 Basically, set the defaults to standard values.
6821 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
6822 argument, if candidate is better, it can't be worse than the best !
6824 (Invocation): Re-write bits to differentiate between methods being
6825 applicable in their expanded form and their normal form - for params
6828 Get rid of use_standard everywhere as only standard conversions are allowed
6829 in overload resolution.
6831 More spec conformance.
6833 2001-12-27 Miguel de Icaza <miguel@ximian.com>
6835 * driver.cs: Add --timestamp, to see where the compiler spends
6838 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
6839 `this' in static code.
6841 (SimpleName.DoResolve): Implement in terms of a helper function
6842 that allows static-references to be passed upstream to
6845 (Expression.ResolveWithSimpleName): Resolve specially simple
6846 names when called by MemberAccess to implement the special
6849 (Expression.ImplicitReferenceConversion): Handle conversions from
6850 Null to reference types before others, as Null's type is
6853 * expression.cs (Invocation.EmitCall): Handle the special case of
6854 calling methods declared on a reference type from a ValueType
6855 (Base classes System.Object and System.Enum)
6857 (MemberAccess.Resolve): Only perform lookups on Enumerations if
6858 the left hand side is a TypeExpr, not on every enumeration.
6860 (Binary.Resolve): If types are reference types, then do a cast to
6861 object on operators != and == of both arguments.
6863 * typemanager.cs (FindMembers): Extract instance and static
6864 members if requested.
6866 * interface.cs (PopulateProperty): Use void_type instead of null
6867 as the return type for the setter method.
6869 (PopulateIndexer): ditto.
6871 2001-12-27 Ravi Pratap <ravi@ximian.com>
6873 * support.cs (ReflectionParameters): Fix minor bug where we
6874 were examining the wrong parameter for the ParamArray attribute.
6876 Cope with requests for the type of the parameter at position
6877 greater than the params parameter's. We now return the element
6878 type of the params array as that makes more sense.
6880 * expression.cs (Invocation.IsParamsMethodApplicable): Update
6881 accordingly as we no longer have to extract the element type
6884 (Invocation.OverloadResolve): Update.
6886 2001-12-27 Miguel de Icaza <miguel@ximian.com>
6888 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
6889 against IEnumerator, test whether the return value is a descendant
6890 of the IEnumerator interface.
6892 * class.cs (Indexer.Define): Use an auxiliary method to implement
6893 the other bits of the method definition. Begin support for
6894 explicit interface implementation.
6896 (Property.DefineMethod): Use TypeManager.void_type instead of null
6897 for an empty return value.
6899 2001-12-26 Miguel de Icaza <miguel@ximian.com>
6901 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
6902 dealing with a FieldExpr which is composed of a FieldBuilder, in
6903 the code path we did extract the constant, but we should have
6904 obtained the underlying value to be able to cast it (otherwise we
6905 end up in an infinite loop, this is what Ravi was running into).
6907 (ArrayCreation.UpdateIndices): Arrays might be empty.
6909 (MemberAccess.ResolveMemberAccess): Add support for section
6910 14.5.4.1 that deals with the special case of E.I when E is a type
6911 and something else, that I can be a reference to a static member.
6913 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
6914 handle a particular array type to create byte blobs, it is just
6915 something we dont generate byteblobs for.
6917 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
6920 * location.cs (Push): remove the key from the hashtable that we
6921 are about to add. This happens for empty files.
6923 * driver.cs: Dispose files after we have parsed them.
6925 (tokenize): new function that only runs the tokenizer on its
6926 input, for speed testing.
6928 2001-12-26 Ravi Pratap <ravi@ximian.com>
6930 * class.cs (Event.Define): Define the private field only if there
6931 are no accessors defined.
6933 * expression.cs (ResolveMemberAccess): If there is no associated
6934 field with the event, that means we have an event defined with its
6935 own accessors and we should flag error cs0070 since transforming
6936 ourselves into a field is not valid in that case.
6938 * ecore.cs (SimpleName.DoResolve): Same as above.
6940 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
6941 and charset to sane values.
6943 2001-12-25 Ravi Pratap <ravi@ximian.com>
6945 * assign.cs (DoResolve): Perform check on events only if they
6946 are being accessed outside the declaring type.
6948 * cs-parser.jay (event_declarations): Update rules to correctly
6949 set the type of the implicit parameter etc.
6951 (add_accessor, remove_accessor): Set current local parameters.
6953 * expression.cs (Binary): For delegate addition and subtraction,
6954 cast the return value from the method into the appropriate delegate
6957 2001-12-24 Ravi Pratap <ravi@ximian.com>
6959 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
6960 of these as the workaround is unnecessary.
6962 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
6963 delegate data - none of that is needed at all.
6965 Re-write bits to extract the instance expression and the delegate method
6968 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
6971 * attribute.cs (ApplyAttributes): New method to take care of common tasks
6972 of attaching attributes instead of duplicating code everywhere.
6974 * everywhere : Update code to do attribute emission using the above method.
6976 2001-12-23 Miguel de Icaza <miguel@ximian.com>
6978 * expression.cs (IsParamsMethodApplicable): if there are not
6979 parameters, return immediately.
6981 * ecore.cs: The 0 literal can be implicity converted to an enum
6984 (SimpleName.DoResolve): First lookup the type, then lookup the
6987 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
6988 want to get its address. If the InstanceExpression is not
6989 addressable, store the result in a temporary variable, then get
6992 * codegen.cs: Only display 219 errors on warning level or above.
6994 * expression.cs (ArrayAccess): Make it implement the
6995 IMemoryLocation interface.
6997 (Binary.DoResolve): handle the operator == (object a, object b)
6998 and operator != (object a, object b) without incurring into a
6999 BoxedCast (because 5 != o should never be performed).
7001 Handle binary enumerator operators.
7003 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
7004 value type, otherwise use Ldelem_ref.
7006 Use precomputed names;
7008 (AddressOf): Implement address of
7010 * cs-parser.jay (labeled_statement): Fix recursive block
7011 addition by reworking the production.
7013 * expression.cs (New.DoEmit): New has a special case:
7015 If we are dealing with a ValueType, we have a few
7016 situations to deal with:
7018 * The target of New is a ValueType variable, that is
7019 easy, we just pass this as the variable reference
7021 * The target of New is being passed as an argument,
7022 to a boxing operation or a function that takes a
7025 In this case, we need to create a temporary variable
7026 that is the argument of New.
7029 2001-12-23 Ravi Pratap <ravi@ximian.com>
7031 * rootcontext.cs (LookupType): Check that current_type is not null before
7032 going about looking at nested types.
7034 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
7035 not implement the IAssignMethod interface any more.
7037 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
7038 where we tranform them into FieldExprs if they are being resolved from within
7041 * ecore.cs (SimpleName.DoResolve): Do the same here.
7043 * assign.cs (DoResolve, Emit): Clean up code considerably.
7045 * ../errors/bug10.cs : Add.
7047 * ../errors/cs0070.cs : Add.
7049 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
7051 * assign.cs : Get rid of EventIsLocal everywhere.
7053 2001-12-23 Miguel de Icaza <miguel@ximian.com>
7055 * ecore.cs (ConvertIntLiteral): finished the implementation.
7057 * statement.cs (SwitchLabel): Convert the value we are using as a
7058 key before looking up the table.
7060 2001-12-22 Miguel de Icaza <miguel@ximian.com>
7062 * codegen.cs (EmitTopBlock): Require a Location argument now.
7064 * cs-parser.jay (constructor_declarator): We need to setup
7065 current_local_parameters before we parse the
7066 opt_constructor_initializer, to allow the variables to be bound
7067 to the constructor arguments.
7069 * rootcontext.cs (LookupType): First lookup nested classes in our
7070 class and our parents before we go looking outside our class.
7072 * expression.cs (ConstantFold): Extract/debox the values at the
7075 * rootcontext.cs (EmitCode): Resolve the constants first before we
7076 resolve the types. This is not really needed, but it helps debugging.
7078 * statement.cs: report location.
7080 * cs-parser.jay: pass location to throw statement.
7082 * driver.cs: Small bug fix.
7084 * report.cs: Updated format to be 4-zero filled digits.
7086 2001-12-22 Ravi Pratap <ravi@ximian.com>
7088 * expression.cs (CheckIndices): Fix minor bug where the wrong
7089 variable was being referred to ;-)
7091 (DoEmit): Do not call EmitStaticInitializers when the
7092 underlying type is System.Object.
7094 2001-12-21 Ravi Pratap <ravi@ximian.com>
7096 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
7097 and do the usual workaround for SRE.
7099 * class.cs (MyEventBuilder.EventType): New member to get at the type
7100 of the event, quickly.
7102 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
7104 * assign.cs (Assign.DoResolve): Handle the case when the target
7105 is an EventExpr and perform the necessary checks.
7107 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
7110 (SimpleName.MemberStaticCheck): Include check for EventExpr.
7112 (EventExpr): Set the type in the constructor itself since we
7113 are meant to be born fully resolved.
7115 (EventExpr.Define): Revert code I wrote earlier.
7117 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
7118 instance expression is null. The instance expression is a This in that case
7119 or a null, depending on whether it is a static method or not.
7121 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
7122 refers to more than one method.
7124 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
7125 and accordingly flag errors.
7127 2001-12-21 Miguel de Icaza <miguel@ximian.com>
7129 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
7131 2001-12-22 Miguel de Icaza <miguel@ximian.com>
7133 * location.cs (ToString): Provide useful rutine.
7135 2001-12-21 Miguel de Icaza <miguel@ximian.com>
7137 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
7138 objects, return the actual integral boxed.
7140 * statement.cs (SwitchLabel): define an ILLabel for each
7143 (Switch.CheckSwitch): If the value is a Literal, extract
7144 the underlying literal.
7146 Also in the unused hashtable we had, add the SwitchLabel so we can
7147 quickly look this value up.
7149 * constant.cs: Implement a bunch of new constants. Rewrite
7150 Literal based on this. Made changes everywhere to adapt to this.
7152 * expression.cs (Expression.MakeByteBlob): Optimize routine by
7153 dereferencing array only once, and also copes with enumrations.
7155 bytes are two bytes wide, not one.
7157 (Cast): Perform constant conversions.
7159 * ecore.cs (TryImplicitIntConversion): Return literals instead of
7160 wrappers to the literals here.
7162 * expression.cs (DoNumericPromotions): long literals can converted
7163 to ulong implicity (this is taken care of elsewhere, but I was
7166 * ecore.cs (Expression.Literalize): Make the return type Literal,
7167 to improve type checking.
7169 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
7171 2001-12-20 Miguel de Icaza <miguel@ximian.com>
7173 * literal.cs: Revert code from ravi that checked the bounds. The
7174 bounds are sane by the definition of the type itself.
7176 * typemanager.cs: Fix implementation of ImplementsInterface. We
7177 need to actually look up in our parent hierarchy for interfaces
7180 * const.cs: Use the underlying type for enumerations
7182 * delegate.cs: Compute the basename for the delegate creation,
7183 that should fix the delegate test case, and restore the correct
7184 Type Lookup semantics in rootcontext
7186 * rootcontext.cs: Revert Ravi's last patch. The correct way of
7187 referencing a nested type with the Reflection API is using the "+"
7190 * cs-parser.jay: Do not require EOF token at the end.
7192 2001-12-20 Ravi Pratap <ravi@ximian.com>
7194 * rootcontext.cs (LookupType): Concatenate type names with
7195 a '.' instead of a '+' The test suite passes again.
7197 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7198 field of the enumeration.
7200 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
7201 the case when the member is an EventExpr.
7203 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
7204 static has an associated instance expression.
7206 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
7208 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
7210 * class.cs (Event.Define): Register event and perform appropriate checks
7213 We define the Add and Remove methods even if the use provides none because
7214 in that case, we provide default implementations ourselves.
7216 Define a private field of the type of the event. This is done by the CSC compiler
7217 and we should be doing it too ;-)
7219 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
7220 More methods we use in code we generate.
7222 (multicast_delegate_type, delegate_type): Two separate types since the distinction
7225 (InitCoreTypes): Update accordingly for the above.
7227 * class.cs (Event.Emit): Generate code for default accessors that we provide
7229 (EmitDefaultMethod): Do the job in the above.
7231 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
7234 2001-12-20 Miguel de Icaza <miguel@ximian.com>
7236 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
7237 builders even if we were missing one.
7239 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
7240 pass the Basename as our class name instead of the Name. The
7241 basename will be correctly composed for us.
7243 * parameter.cs (Paramters): Now takes a Location argument.
7245 * decl.cs (DeclSpace.LookupType): Removed convenience function and
7246 make all the code call directly LookupType in RootContext and take
7247 this chance to pass the Location information everywhere.
7249 * Everywhere: pass Location information.
7251 2001-12-19 Miguel de Icaza <miguel@ximian.com>
7253 * class.cs (Constructor.Define): Updated way of detecting the
7254 length of the parameters.
7256 (TypeContainer.DefineType): Use basename as the type name for
7259 (TypeContainer.Define): Do not recursively define types here, as
7260 definition is taken care in order by the RootContext.
7262 * tree.cs: Keep track of namespaces in a per-file basis.
7264 * parameter.cs (Parameter.ComputeSignature): Update to use
7267 (Parameters.GetSignature): ditto.
7269 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
7270 instead of a TypeContainer.
7272 (Interface.SemanticAnalysis): Use `this' instead of our parent to
7273 resolve names. Because we need to be resolve in our context, not
7276 * driver.cs: Implement response files.
7278 * class.cs (TypeContainer.DefineType): If we are defined, do not
7281 (Event.Emit): Emit the code for add/remove handlers.
7282 (Event.Define): Save the MethodBuilders for add/remove.
7284 * typemanager.cs: Use pair here too.
7286 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
7287 DictionaryEntry requires the first argument to be non-null.
7289 (enum_declaration): Compute full name for registering the
7292 (delegate_declaration): Instead of using
7293 formal_parameter_list, use opt_formal_parameter_list as the list
7296 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
7297 (EventParsing): New property that controls whether `add' and
7298 `remove' are returned as tokens or identifiers (for events);
7300 2001-12-19 Ravi Pratap <ravi@ximian.com>
7302 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
7303 use MyEventBuilder only and let it wrap the real builder for us.
7305 (MyEventBuilder): Revamp constructor etc.
7307 Implement all operations that we perform on EventBuilder in precisely the same
7310 (FindMembers): Update to use the EventBuilder member.
7312 (Event.Emit): Update accordingly.
7314 2001-12-18 Ravi Pratap <ravi@ximian.com>
7316 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
7317 by calling the appropriate methods.
7319 (GetCustomAttributes): Make stubs as they cannot possibly do anything
7322 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
7324 2001-12-17 Ravi Pratap <ravi@ximian.com>
7326 * delegate.cs (Delegate.Populate): Check that the return type
7327 and various parameters types are indeed accessible.
7329 * class.cs (Constructor.Define): Same here.
7331 (Field.Define): Ditto.
7333 (Event.Define): Ditto.
7335 (Operator.Define): Check that the underlying Method defined itself
7336 correctly - so it's MethodBuilder should not be null.
7338 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
7339 expression happens to be null.
7341 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
7342 members but as of now we don't seem to be able to do anything really useful with it.
7344 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
7345 not the EventBuilder.
7347 2001-12-18 Miguel de Icaza <miguel@ximian.com>
7349 * cs-tokenizer.cs: Add support for defines.
7350 Add support for #if, #elif, #else, #endif
7352 (eval_var): evaluates a variable.
7353 (eval): stubbed for evaluating functions.
7355 * cs-parser.jay: Pass the defines information
7357 * driver.cs: Add --define command line option.
7359 * decl.cs: Move MemberCore here.
7361 Make it the base class for DeclSpace. This allows us to catch and
7362 report 108 and 109 for everything now.
7364 * class.cs (TypeContainer.Define): Extract all the members
7365 before populating and emit the warning 108 (new keyword required
7366 to override) instead of having each member implement this.
7368 (MemberCore.Define): New abstract method, we will be using this in
7369 the warning reporting engine in Populate.
7371 (Operator.Define): Adjust to new MemberCore protocol.
7373 * const.cs (Const): This does not derive from Expression, it is a
7374 temporary object we use to create fields, it is a MemberCore.
7376 * class.cs (Method.Define): Allow the entry point to be in a
7379 * driver.cs: Rewrite the argument handler to clean it up a bit.
7381 * rootcontext.cs: Made it just an auxiliary namespace feature by
7382 making everything static.
7384 * driver.cs: Adapt code to use RootContext type name instead of
7387 * delegate.cs: Remove RootContext argument.
7389 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
7392 * class.cs (Event.Define): The lookup can fail.
7394 * cs-tokenizer.cs: Begin implementation of pre-procesor.
7396 * expression.cs: Resolve the this instance before invoking the code.
7398 2001-12-17 Miguel de Icaza <miguel@ximian.com>
7400 * cs-parser.jay: Add a production in element_access that allows
7401 the thing to become a "type" reference. This way we can parse
7402 things like "(string [])" as a type.
7404 Note that this still does not handle the more complex rules of
7408 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
7410 * ecore.cs: (CopyNewMethods): new utility function used to
7411 assemble the list of methods from running FindMembers.
7413 (MemberLookup): Rework FindMembers so that
7415 2001-12-16 Miguel de Icaza <miguel@ximian.com>
7417 * class.cs (TypeContainer): Remove Delegates who fail to be
7420 * delegate.cs (Populate): Verify that we dont get null return
7421 values. TODO: Check for AsAccessible.
7423 * cs-parser.jay: Use basename to emit error 574 (destructor should
7424 have the same name as container class), not the full name.
7426 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7427 possible representation.
7429 Also implements integer type suffixes U and L.
7431 2001-12-15 Miguel de Icaza <miguel@ximian.com>
7433 * expression.cs (ArrayCreation.DoResolve): We need to do the
7434 argument resolution *always*.
7436 * decl.cs: Make this hold the namespace. Hold the root context as
7438 (LookupType): Move here.
7440 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7442 * location.cs (Row, Name): Fixed the code, it was always returning
7443 references to the first file.
7445 * interface.cs: Register properties defined through interfaces.
7447 * driver.cs: Add support for globbing on the command line
7449 * class.cs (Field): Make it derive from MemberCore as well.
7452 2001-12-15 Ravi Pratap <ravi@ximian.com>
7454 * class.cs (Event::Define): Check that the type of the event is a delegate
7455 type else flag error #66.
7457 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7460 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7461 values of EntryPoint, CharSet etc etc.
7463 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7465 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7466 be null and we should ignore this. I am not sure if this is really clean. Apparently,
7467 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7468 which needs this to do its work.
7470 * ../errors/cs0066.cs : Add.
7472 2001-12-14 Miguel de Icaza <miguel@ximian.com>
7474 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7477 * class.cs: (MethodSignature.MethodSignature): Removed hack that
7478 clears out the parameters field.
7479 (MemberSignatureCompare): Cleanup
7481 (MemberCore): New base class used to share code between MethodCore
7484 (RegisterRequiredImplementations) BindingFlags.Public requires
7485 either BindingFlags.Instace or Static. Use instance here.
7487 (Property): Refactored code to cope better with the full spec.
7489 * parameter.cs (GetParameterInfo): Return an empty array instead
7492 * class.cs (Property): Abstract or extern properties have no bodies.
7494 * parameter.cs (GetParameterInfo): return a zero-sized array.
7496 * class.cs (TypeContainer.MethodModifiersValid): Move all the
7497 method modifier validation to the typecontainer so we can reuse
7500 (MethodCore.ParameterTypes): return an empty sized array of types.
7502 (Property.Define): Test property modifier validity.
7504 Add tests for sealed/override too.
7506 (Method.Emit): abstract or extern methods have no bodies.
7508 2001-12-14 Ravi Pratap <ravi@ximian.com>
7510 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7513 (Method::Define, ::Emit): Modify accordingly.
7515 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7517 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7519 * makefile: Pass in /unsafe.
7521 2001-12-13 Miguel de Icaza <miguel@ximian.com>
7523 * class.cs (MakeKey): Kill routine.
7525 * class.cs (TypeContainer.Define): Correctly define explicit
7526 method implementations (they require the full interface name plus
7529 * typemanager.cs: Deply the PtrHashtable here and stop using the
7530 lame keys. Things work so much better.
7532 This of course broke everyone who depended on `RegisterMethod' to
7533 do the `test for existance' test. This has to be done elsewhere.
7535 * support.cs (PtrHashtable): A hashtable that avoid comparing with
7536 the object stupid Equals method (because, that like fails all over
7537 the place). We still do not use it.
7539 * class.cs (TypeContainer.SetRequiredInterface,
7540 TypeContainer.RequireMethods): Killed these two routines and moved
7541 all the functionality to RegisterRequiredImplementations.
7543 (TypeContainer.RegisterRequiredImplementations): This routine now
7544 registers all the implementations required in an array for the
7545 interfaces and abstract methods. We use an array of structures
7546 which can be computed ahead of time to reduce memory usage and we
7547 also assume that lookups are cheap as most classes will not
7548 implement too many interfaces.
7550 We also avoid creating too many MethodSignatures.
7552 (TypeContainer.IsInterfaceMethod): Update and optionally does not
7553 clear the "pending" bit if we find that there are problems with
7556 (TypeContainer.VerifyPendingMethods): Update to report errors of
7557 methods that look like implementations but are not.
7559 (TypeContainer.Define): Add support for explicit interface method
7562 2001-12-12 Miguel de Icaza <miguel@ximian.com>
7564 * typemanager.cs: Keep track of the parameters here instead of
7565 being a feature of the TypeContainer.
7567 * class.cs: Drop the registration of parameters here, as
7568 InterfaceMethods are also interface declarations.
7570 * delegate.cs: Register methods with the TypeManager not only with
7571 the TypeContainer. This code was buggy.
7573 * interface.cs: Full registation here.
7575 2001-12-11 Miguel de Icaza <miguel@ximian.com>
7577 * expression.cs: Remove reducer for binary expressions, it can not
7580 * const.cs: Put here the code that used to go into constant.cs
7582 * constant.cs: Put here the code for constants, this is a new base
7585 * literal.cs: Make Literal derive from Constant.
7587 2001-12-09 Miguel de Icaza <miguel@ximian.com>
7589 * statement.cs (Return.Emit): Report error 157 if the user
7590 attempts to return from a finally block.
7592 (Return.Emit): Instead of emitting a return, jump to the end of
7595 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7596 LocalBuilder to store the result of the function. ReturnLabel is
7597 the target where we jump.
7600 2001-12-09 Radek Doulik <rodo@ximian.com>
7602 * cs-parser.jay: remember alias in current namespace
7604 * ecore.cs (SimpleName::DoResolve): use aliases for types or
7607 * class.cs (LookupAlias): lookup alias in my_namespace
7609 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7611 (LookupAlias): lookup alias in this and if needed in parent
7614 2001-12-08 Miguel de Icaza <miguel@ximian.com>
7618 * rootcontext.cs: (ModuleBuilder) Made static, first step into
7619 making things static. I need this to avoid passing the
7620 TypeContainer when calling ParameterType.
7622 * support.cs (InternalParameters.ParameterType): Remove ugly hack
7623 that did string manipulation to compute the type and then call
7624 GetType. Use Parameter.ParameterType instead.
7626 * cs-tokenizer.cs: Consume the suffix for floating values.
7628 * expression.cs (ParameterReference): figure out whether this is a
7629 reference parameter or not. Kill an extra variable by computing
7630 the arg_idx during emission.
7632 * parameter.cs (Parameters.GetParameterInfo): New overloaded
7633 function that returns whether a parameter is an out/ref value or not.
7635 (Parameter.ParameterType): The type of the parameter (base,
7636 without ref/out applied).
7638 (Parameter.Resolve): Perform resolution here.
7639 (Parameter.ExternalType): The full type (with ref/out applied).
7641 * statement.cs (Using.Emit, Using.EmitExpression): Implement
7642 support for expressions on the using statement.
7644 2001-12-07 Miguel de Icaza <miguel@ximian.com>
7646 * statement.cs (Using.EmitLocalVariableDecls): Split the
7647 localvariable handling of the using statement.
7649 (Block.EmitMeta): Keep track of variable count across blocks. We
7650 were reusing slots on separate branches of blocks.
7652 (Try.Emit): Emit the general code block, we were not emitting it.
7654 Check the type of the declaration to be an IDisposable or
7655 something that can be implicity converted to it.
7657 Emit conversions if required.
7659 * ecore.cs (EmptyExpression): New utility class.
7660 (Expression.ImplicitConversionExists): New utility function.
7662 2001-12-06 Miguel de Icaza <miguel@ximian.com>
7664 * statement.cs (Using): Implement.
7666 * expression.cs (LocalVariableReference): Support read only variables.
7668 * statement.cs: Remove the explicit emit for the Leave opcode.
7669 (VariableInfo): Add a readonly field.
7671 2001-12-05 Miguel de Icaza <miguel@ximian.com>
7673 * ecore.cs (ConvCast): new class used to encapsulate the various
7674 explicit integer conversions that works in both checked and
7677 (Expression.ConvertNumericExplicit): Use new ConvCast class to
7678 properly generate the overflow opcodes.
7680 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7682 * statement.cs: The correct type for the EmptyExpression is the
7683 element_type, not the variable type. Ravi pointed this out.
7685 2001-12-04 Ravi Pratap <ravi@ximian.com>
7687 * class.cs (Method::Define): Handle PInvoke methods specially
7688 by using DefinePInvokeMethod instead of the usual one.
7690 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
7691 above to do the task of extracting information and defining the method.
7693 2001-12-04 Ravi Pratap <ravi@ximian.com>
7695 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
7696 of the condition for string type.
7698 (Emit): Move that here.
7700 (ArrayCreation::CheckIndices): Keep string literals in their expression
7703 (EmitDynamicInitializers): Handle strings appropriately.
7705 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7707 * codegen.cs (EmitContext): Replace multiple variables with a
7708 single pointer to the current Switch statement.
7710 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
7713 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7717 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
7720 (Foreach.Emit): Foreach on arrays was not setting
7721 up the loop variables (for break/continue).
7723 (GotoCase): Semi-implented.
7725 2001-12-03 Ravi Pratap <ravi@ximian.com>
7727 * attribute.cs (CheckAttribute): Handle system attributes by using
7728 Attribute.GetAttributes to examine information we need.
7730 (GetValidPlaces): Same here.
7732 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
7734 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
7736 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
7738 (Method::Define): Set appropriate flags if we have a DllImport attribute.
7740 (Method::Emit): Handle the case when we are a PInvoke method.
7742 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7744 * expression.cs: Use ResolveWithSimpleName on compound names.
7746 2001-12-02 Ravi Pratap <ravi@ximian.com>
7748 * constant.cs (EmitConstant): Make sure we resolve the associated expression
7749 before trying to reduce it.
7751 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
7753 * constant.cs (LookupConstantValue): Implement.
7755 (EmitConstant): Use the above in emitting the constant.
7757 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
7758 that are user-defined by doing a LookupConstantValue on them.
7760 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
7763 2001-11-29 Miguel de Icaza <miguel@ximian.com>
7765 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
7767 (BaseAccess.DoResolve): Implement.
7769 (MemberAccess.DoResolve): Split this routine into a
7770 ResolveMemberAccess routine that can be used independently
7772 2001-11-28 Miguel de Icaza <miguel@ximian.com>
7774 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
7775 As that share bits of the implementation. Is returns a boolean,
7776 while As returns the Type that is being probed.
7778 2001-12-01 Ravi Pratap <ravi@ximian.com>
7780 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
7781 instead of a Literal - much easier.
7783 (EnumInTransit): Remove - utterly useless :-)
7785 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
7787 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
7789 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
7790 chain when we have no associated expression.
7792 2001-11-30 Ravi Pratap <ravi@ximian.com>
7794 * constant.cs (Define): Use Location while reporting the errror.
7796 Also emit a warning when 'new' is used and there is no inherited
7799 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
7802 (LookupEnumValue): Implement to lookup an enum member's value and define it
7805 (Populate): Re-write accordingly to use the above routine.
7807 2001-11-27 Miguel de Icaza <miguel@ximian.com>
7809 * expression.cs (This): Fix prototype for DoResolveLValue to
7810 override the base class DoResolveLValue.
7812 * cs-parser.cs: Report errors cs574 and cs575 (destructor
7815 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
7816 (we need to load the address of the field here). This fixes
7819 (FieldExpr.DoResolveLValue): Call the DoResolve
7820 function to initialize the Instance expression.
7822 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
7823 correctly the GetEnumerator operation on a value type.
7825 * cs-parser.jay: Add more simple parsing error catches.
7827 * statement.cs (Switch): Add support for string switches.
7828 Handle null specially.
7830 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
7832 2001-11-28 Ravi Pratap <ravi@ximian.com>
7834 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
7836 (declare_local_constant): New helper function.
7838 * statement.cs (AddConstant): Keep a separate record of constants
7840 (IsConstant): Implement to determine if a variable is a constant.
7842 (GetConstantExpression): Implement.
7844 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
7846 * statement.cs (IsVariableDefined): Re-write.
7848 2001-11-27 Ravi Pratap <ravi@ximian.com>
7850 * class.cs (TypeContainer::FindMembers): Look for constants
7851 in the case when we are looking for MemberTypes.Field
7853 * expression.cs (MemberAccess::DoResolve): Check that in the
7854 case we are a FieldExpr and a Literal, we are not being accessed
7855 by an instance reference.
7857 * cs-parser.jay (local_constant_declaration): Implement.
7859 (declaration_statement): Implement for constant declarations.
7861 2001-11-26 Miguel de Icaza <miguel@ximian.com>
7863 * statement.cs (Switch): Catch double defaults.
7865 (Switch): More work on the switch() statement
7866 implementation. It works for integral values now, need to finish
7870 2001-11-24 Miguel de Icaza <miguel@ximian.com>
7872 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
7873 integer literals into other integer literals. To be used by
7876 2001-11-24 Ravi Pratap <ravi@ximian.com>
7878 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
7881 (EmitDynamicInitializers): Cope with the above since we extract data
7882 directly from ArrayData now.
7884 (ExpectInitializers): Keep track of whether initializers are mandatory
7887 (Bounds): Make it a hashtable to prevent the same dimension being
7888 recorded for every element in that dimension.
7890 (EmitDynamicInitializers): Fix bug which prevented the Set array method
7893 Also fix bug which was causing the indices to be emitted in the reverse
7896 2001-11-24 Miguel de Icaza <miguel@ximian.com>
7898 * expression.cs (ArrayCreation): Implement the bits that Ravi left
7899 unfinished. They do not work, because the underlying code is
7902 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7904 * cs-parser.jay: Remove bogus fixme.
7906 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
7907 on Switch statement.
7909 2001-11-23 Ravi Pratap <ravi@ximian.com>
7911 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
7914 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
7915 parameter. Apparently, any expression is allowed.
7917 (ValidateInitializers): Update accordingly.
7919 (CheckIndices): Fix some tricky bugs thanks to recursion.
7921 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
7922 I was being completely brain-dead.
7924 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
7925 and re-write acordingly.
7927 (DelegateInvocation): Re-write accordingly.
7929 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
7931 (MakeByteBlob): Handle types more correctly.
7933 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
7934 initialization from expressions but it is incomplete because I am a complete
7937 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7939 * statement.cs (If.Emit): Fix a bug that generated incorrect code
7940 on If. Basically, we have to return `true' (ie, we do return to
7941 our caller) only if both branches of the if return.
7943 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
7944 short-circuit operators, handle them as short circuit operators.
7946 (Cast.DoResolve): Resolve type.
7947 (Cast.Cast): Take an expression as the target type.
7949 * cs-parser.jay (cast_expression): Remove old hack that only
7950 allowed a limited set of types to be handled. Now we take a
7951 unary_expression and we resolve to a type during semantic
7954 Use the grammar productions from Rhys to handle casts (this is
7955 not complete like Rhys syntax yet, we fail to handle that corner
7956 case that C# has regarding (-x), but we will get there.
7958 2001-11-22 Ravi Pratap <ravi@ximian.com>
7960 * class.cs (EmitFieldInitializer): Take care of the case when we have a
7961 field which is an array type.
7963 * cs-parser.jay (declare_local_variables): Support array initialization too.
7965 * typemanager.cs (MakeKey): Implement.
7967 (everywhere): Use the above appropriately.
7969 * cs-parser.jay (for_statement): Update for array initialization while
7970 declaring variables.
7972 * ecore.cs : The error message was correct, it's the variable's names that
7973 were misleading ;-) Make the code more readable.
7975 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
7976 the correct type etc.
7978 (ConvertExplicit): Handle Enum types by examining the underlying type.
7980 2001-11-21 Ravi Pratap <ravi@ximian.com>
7982 * parameter.cs (GetCallingConvention): Always return
7983 CallingConventions.Standard for now.
7985 2001-11-22 Miguel de Icaza <miguel@ximian.com>
7987 * expression.cs (Binary.ResolveOperator): Update the values of `l'
7988 and `r' after calling DoNumericPromotions.
7990 * ecore.cs: Fix error message (the types were in the wrong order).
7992 * statement.cs (Foreach.ProbeCollectionType): Need to pass
7993 BindingFlags.Instance as well
7995 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
7996 implicit int literal conversion in an empty cast so that we
7997 propagate the right type upstream.
7999 (UnboxCast): new class used to unbox value types.
8000 (Expression.ConvertExplicit): Add explicit type conversions done
8003 (Expression.ImplicitNumericConversion): Oops, forgot to test for
8004 the target type before applying the implicit LongLiterals to ULong
8007 2001-11-21 Miguel de Icaza <miguel@ximian.com>
8009 * cs-parser.jay (for_statement): Reworked the way For works: now
8010 we declare manually any variables that are introduced in
8011 for_initializer to solve the problem of having out-of-band code
8012 emition (that is what got for broken).
8014 (declaration_statement): Perform the actual variable declaration
8015 that used to be done in local_variable_declaration here.
8017 (local_variable_declaration): Do not declare anything, just pass
8018 the information on a DictionaryEntry
8020 2001-11-20 Ravi Pratap <ravi@ximian.com>
8022 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
8023 re-write of the logic to now make it recursive.
8025 (UpdateIndices): Re-write accordingly.
8027 Store element data in a separate ArrayData list in the above methods.
8029 (MakeByteBlob): Implement to dump the array data into a byte array.
8031 2001-11-19 Ravi Pratap <ravi@ximian.com>
8033 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
8036 * constant.cs (Define): Implement.
8038 (EmitConstant): Re-write fully.
8040 Pass in location info.
8042 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
8045 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
8046 DictionaryEntry since we need location info too.
8048 (constant_declaration): Update accordingly.
8050 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
8051 code into another method : UpdateIndices.
8053 2001-11-18 Ravi Pratap <ravi@ximian.com>
8055 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
8056 some type checking etc.
8058 2001-11-17 Ravi Pratap <ravi@ximian.com>
8060 * expression.cs (ArrayCreation::ValidateInitializers): Implement
8061 bits to provide dimension info if the user skips doing that.
8063 Update second constructor to store the rank correctly.
8065 2001-11-16 Ravi Pratap <ravi@ximian.com>
8067 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
8068 and try to implement.
8070 * ../errors/cs0150.cs : Add.
8072 * ../errors/cs0178.cs : Add.
8074 2001-11-16 Miguel de Icaza <miguel@ximian.com>
8076 * statement.cs: Implement foreach on multi-dimensional arrays.
8078 * parameter.cs (Parameters.GetParameterByName): Also lookup the
8079 name of the params argument.
8081 * expression.cs: Use EmitStoreOpcode to get the right opcode while
8082 initializing the array.
8084 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
8085 we can use this elsewhere.
8087 * statement.cs: Finish implementation of foreach for single
8090 * cs-parser.jay: Use an out-of-band stack to pass information
8091 around, I wonder why I need this.
8093 foreach_block: Make the new foreach_block the current_block.
8095 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
8096 function used to return a static Parameters structure. Used for
8097 empty parameters, as those are created very frequently.
8099 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
8101 2001-11-15 Ravi Pratap <ravi@ximian.com>
8103 * interface.cs : Default modifier is private, not public. The
8104 make verify test passes again.
8106 2001-11-15 Ravi Pratap <ravi@ximian.com>
8108 * support.cs (ReflectionParameters): Fix logic to determine
8109 whether the last parameter is a params one. Test 9 passes again.
8111 * delegate.cs (Populate): Register the builders we define with
8112 RegisterParameterForBuilder. Test 19 passes again.
8114 * cs-parser.jay (property_declaration): Reference $6 instead
8115 of $$ to get at the location.
8117 (indexer_declaration): Similar stuff.
8121 * class.cs (Property): Register parameters for the Get and Set methods
8122 if they exist. Test 23 passes again.
8124 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
8125 call to EmitArguments as we are sure there aren't any params arguments.
8126 Test 32 passes again.
8128 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
8129 IndexOutOfRangeException.
8131 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
8132 Test 33 now passes again.
8134 2001-11-15 Miguel de Icaza <miguel@ximian.com>
8136 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
8137 broke a bunch of things. Will have to come up with a better way
8138 of tracking locations.
8140 * statement.cs: Implemented foreach for single dimension arrays.
8142 2001-11-09 Miguel de Icaza <miguel@ximian.com>
8144 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
8145 an error. This removes the lookup from the critical path.
8147 * cs-parser.jay: Removed use of temporary_loc, which is completely
8150 2001-11-14 Miguel de Icaza <miguel@ximian.com>
8152 * support.cs (ReflectionParameters.ParameterModifier): Report
8153 whether the argument is a PARAMS argument or not.
8155 * class.cs: Set the attribute `ParamArrayAttribute' on the
8158 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
8159 and cons_param_array_attribute (ConstructorInfo for
8160 ParamArrayAttribute).,
8162 * codegen.cs: Emit the return using the `Return' statement, that
8163 way we can report the error correctly for missing return values.
8165 * class.cs (Method.Emit): Clean up.
8167 * expression.cs (Argument.Resolve): Take another argument: the
8168 location where this argument is used. Notice that this is not
8169 part of the "Argument" class as to reduce the size of the
8170 structure (we know the approximate location anyways).
8172 Test if the argument is a variable-reference, if not, then
8173 complain with a 206.
8175 (Argument.Emit): Emit addresses of variables.
8177 (Argument.FullDesc): Simplify.
8179 (Invocation.DoResolve): Update for Argument.Resolve.
8181 (ElementAccess.DoResolve): ditto.
8183 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8184 method should be virtual, as this method is always virtual.
8186 (NewDelegate.DoResolve): Update for Argument.Resolve.
8188 * class.cs (ConstructorInitializer.DoResolve): ditto.
8190 * attribute.cs (Attribute.Resolve): ditto.
8192 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8194 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8196 * expression.cs (ParameterReference): Drop IStackStorage and implement
8197 IAssignMethod instead.
8199 (LocalVariableReference): ditto.
8201 * ecore.cs (FieldExpr): Drop IStackStorage and implement
8202 IAssignMethod instead.
8204 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8206 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
8207 enumerations that are used in heavily used structures derive from
8208 byte in a laughable and pathetic attempt to reduce memory usage.
8209 This is the kind of pre-optimzations that you should not do at
8210 home without adult supervision.
8212 * expression.cs (UnaryMutator): New class, used to handle ++ and
8213 -- separatedly from the other unary operators. Cleans up the
8214 code, and kills the ExpressionStatement dependency in Unary.
8216 (Unary): Removed `method' and `Arguments' from this class, making
8217 it smaller, and moving it all to SimpleCall, so I can reuse this
8218 code in other locations and avoid creating a lot of transient data
8219 strucutres when not required.
8221 * cs-parser.jay: Adjust for new changes.
8223 2001-11-11 Miguel de Icaza <miguel@ximian.com>
8225 * enum.cs (Enum.Populate): If there is a failure during
8228 * cs-parser.jay (opt_enum_base): we used to catch type errors
8229 here, but this is really incorrect. The type error should be
8230 catched during semantic analysis.
8232 2001-12-11 Ravi Pratap <ravi@ximian.com>
8234 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
8235 current_local_parameters as expected since I, in my stupidity, had forgotten
8238 * attribute.cs (GetValidPlaces): Fix stupid bug.
8240 * class.cs (Method::Emit): Perform check on applicability of attributes.
8242 (Constructor::Emit): Ditto.
8244 (Field::Emit): Ditto.
8246 (Field.Location): Store location information.
8248 (Property, Event, Indexer, Operator): Ditto.
8250 * cs-parser.jay (field_declaration): Pass in location for each field.
8252 * ../errors/cs0592.cs : Add.
8254 2001-11-12 Ravi Pratap <ravi@ximian.com>
8256 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
8258 (InitCoreTypes): Update accordingly.
8260 (RegisterAttrType, LookupAttr): Implement.
8262 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
8263 info about the same.
8265 (Resolve): Update to populate the above as necessary.
8269 (GetValidPlaces): Helper to the above.
8271 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
8273 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
8275 2001-11-12 Ravi Pratap <ravi@ximian.com>
8277 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
8279 * ../errors/cs0617.cs : Add.
8281 2001-11-11 Ravi Pratap <ravi@ximian.com>
8283 * enum.cs (Emit): Rename to Populate to be more consistent with what
8284 we expect it to do and when exactly it is called.
8286 * class.cs, rootcontext.cs : Update accordingly.
8288 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
8289 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
8291 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
8293 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
8294 of a fieldinfo using the above, when dealing with a FieldBuilder.
8296 2001-11-10 Ravi Pratap <ravi@ximian.com>
8298 * ../errors/cs0031.cs : Add.
8300 * ../errors/cs1008.cs : Add.
8302 * ../errrors/cs0543.cs : Add.
8304 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
8307 (FindMembers): Implement.
8309 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
8310 enums and delegates too.
8312 (enum_types): Rename to builder_to_enum.
8314 (delegate_types): Rename to builder_to_delegate.
8316 * delegate.cs (FindMembers): Implement.
8318 2001-11-09 Ravi Pratap <ravi@ximian.com>
8320 * typemanager.cs (IsEnumType): Implement.
8322 * enum.cs (Emit): Re-write parts to account for the underlying type
8323 better and perform checking etc.
8325 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
8326 of the underlying type.
8328 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
8331 * enum.cs (error31): Helper to report error #31.
8333 * cs-parser.jay (enum_declaration): Store location of each member too.
8335 * enum.cs (member_to_location): New hashtable.
8337 (AddEnumMember): Update location hashtable.
8339 (Emit): Use the location of each member while reporting errors.
8341 2001-11-09 Miguel de Icaza <miguel@ximian.com>
8343 * cs-parser.jay: A for_initializer if is a
8344 local_variable_declaration really ammount to have an implicit
8345 block with the variable declaration and no initializer for for.
8347 * statement.cs (For.Emit): Cope with null initializers.
8349 This fixes the infinite loop on for initializers.
8351 2001-11-08 Miguel de Icaza <miguel@ximian.com>
8353 * enum.cs: More cleanup.
8355 * ecore.cs: Remove dead code.
8357 * class.cs (Property.Emit): More simplification.
8358 (Event.Emit): ditto.
8360 Reworked to have less levels of indentation.
8362 2001-11-08 Ravi Pratap <ravi@ximian.com>
8364 * class.cs (Property): Emit attributes.
8374 * enum.cs (Emit): Ditto.
8376 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
8379 * class.cs (Field, Event, etc.): Move attribute generation into the
8380 Emit method everywhere.
8382 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
8383 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
8384 as we had no way of defining nested enums !
8386 * rootcontext.cs : Adjust code accordingly.
8388 * typemanager.cs (AddEnumType): To keep track of enum types separately.
8390 2001-11-07 Ravi Pratap <ravi@ximian.com>
8392 * expression.cs (EvalConstantExpression): Move into ecore.cs
8394 * enum.cs (Enum): Rename some members and make them public and readonly
8395 according to our convention.
8397 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
8400 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
8402 (Enum::Emit): Write a simple version for now which doesn't try to compute
8403 expressions. I shall modify this to be more robust in just a while.
8405 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
8407 (TypeContainer::CloseType): Create the Enum types too.
8409 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
8411 * expression.cs (EvalConstantExpression): Get rid of completely.
8413 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
8414 user-defined values and other cases.
8416 (IsValidEnumLiteral): Helper function.
8418 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
8419 out there in the case we had a literal FieldExpr.
8421 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8423 (Literalize): Revamp a bit to take two arguments.
8425 (EnumLiteral): New class which derives from Literal to wrap enum literals.
8427 2001-11-06 Ravi Pratap <ravi@ximian.com>
8429 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8431 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8433 (Resolve): Use the above to ensure we have proper initializers.
8435 2001-11-05 Ravi Pratap <ravi@ximian.com>
8437 * expression.cs (Expression::EvalConstantExpression): New method to
8438 evaluate constant expressions.
8440 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8442 2001-11-07 Miguel de Icaza <miguel@ximian.com>
8444 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8447 (Binary.ResolveOperator): Handle operator != (object a, object b)
8448 and operator == (object a, object b);
8450 (Binary.DoNumericPromotions): Indicate whether the numeric
8451 promotion was possible.
8453 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8456 Made the ArrayAccess implement interface IAssignMethod instead of
8457 IStackStore as the order in which arguments are passed reflects
8460 * assign.cs: Instead of using expr.ExprClass to select the way of
8461 assinging, probe for the IStackStore/IAssignMethod interfaces.
8463 * typemanager.cs: Load InitializeArray definition.
8465 * rootcontext.cs (RootContext.MakeStaticData): Used to define
8466 static data that can be used to initialize arrays.
8468 2001-11-05 Miguel de Icaza <miguel@ximian.com>
8470 * expression.cs: Handle operator== and operator!= for booleans.
8472 (Conditioal.Reduce): Implement reducer for the ?: operator.
8474 (Conditional.Resolve): Implement dead code elimination.
8476 (Binary.Resolve): Catch string literals and return a new
8477 concatenated string.
8479 (Unary.Reduce): Implement reduction of unary expressions.
8481 * ecore.cs: Split out the expression core handling here.
8483 (Expression.Reduce): New method used to perform constant folding
8484 and CSE. This is needed to support constant-expressions.
8486 * statement.cs (Statement.EmitBoolExpression): Pass true and false
8487 targets, and optimize for !x.
8489 2001-11-04 Ravi Pratap <ravi@ximian.com>
8491 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8492 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8493 set custom atttributes.
8495 * literal.cs (Literal::GetValue): New abstract method to return the actual
8496 value of the literal, cast as an object.
8498 (*Literal): Implement GetValue method.
8500 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8501 expressions to the arraylist but objects of type Argument.
8503 * class.cs (TypeContainer::Emit): Emit our attributes too.
8505 (Method::Emit, Constructor::Emit): Ditto.
8507 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8508 to be ignoring earlier.
8510 2001-11-03 Ravi Pratap <ravi@ximian.com>
8512 * attribute.cs (AttributeSection::Define): Implement to do the business
8513 of constructing a CustomAttributeBuilder.
8515 (Attribute): New trivial class. Increases readability of code.
8517 * cs-parser.jay : Update accordingly.
8519 (positional_argument_list, named_argument_list, named_argument): New rules
8521 (attribute_arguments): Use the above so that we are more correct.
8523 2001-11-02 Ravi Pratap <ravi@ximian.com>
8525 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8526 to perform all checks for a method with a params parameter.
8528 (Invocation::OverloadResolve): Update to use the above method and therefore
8529 cope correctly with params method invocations.
8531 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
8534 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8535 constructors in our parent too because we can't afford to miss out on
8538 * attribute.cs (AttributeSection): New name for the class Attribute
8540 Other trivial changes to improve readability.
8542 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8543 use the new class names.
8545 2001-11-01 Ravi Pratap <ravi@ximian.com>
8547 * class.cs (Method::Define): Complete definition for params types too
8549 (Indexer::Define): Ditto.
8551 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8552 Cope everywhere with a request for info about the array parameter.
8554 2001-11-01 Ravi Pratap <ravi@ximian.com>
8556 * tree.cs (RecordNamespace): Fix up to check for the correct key.
8558 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
8559 local_variable_type to extract the string corresponding to the type.
8561 (local_variable_type): Fixup the action to use the new helper method.
8563 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
8566 * expression.cs : Clean out code which uses the above.
8568 2001-10-31 Ravi Pratap <ravi@ximian.com>
8570 * typemanager.cs (RegisterMethod): Check if we already have an existing key
8571 and bale out if necessary by returning a false.
8573 (RegisterProperty): Ditto.
8575 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8576 and print out appropriate error messages.
8578 * interface.cs (everywhere): Ditto.
8580 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8581 location to constructor.
8583 * class.cs (Property, Event, Indexer): Update accordingly.
8585 * ../errors/cs111.cs : Added.
8587 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8588 of a method, as laid down by the spec.
8590 (Invocation::OverloadResolve): Use the above method.
8592 2001-10-31 Ravi Pratap <ravi@ximian.com>
8594 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8595 now take a TypeContainer and a Parameters object.
8597 (ParameterData): Modify return type of ParameterModifier method to be
8598 Parameter.Modifier and not a string.
8600 (ReflectionParameters, InternalParameters): Update accordingly.
8602 * expression.cs (Argument::GetParameterModifier): Same here.
8604 * support.cs (InternalParameters::ParameterType): Find a better way of determining
8605 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8606 symbol in it at all so maybe this is only for now.
8608 2001-10-30 Ravi Pratap <ravi@ximian.com>
8610 * support.cs (InternalParameters): Constructor now takes an extra argument
8611 which is the actual Parameters class.
8613 (ParameterDesc): Update to provide info on ref/out modifiers.
8615 * class.cs (everywhere): Update call to InternalParameters to pass in
8616 the second argument too.
8618 * support.cs (ParameterData): Add ParameterModifier, which is a method
8619 to return the modifier info [ref/out etc]
8621 (InternalParameters, ReflectionParameters): Implement the above.
8623 * expression.cs (Argument::ParameterModifier): Similar function to return
8624 info about the argument's modifiers.
8626 (Invocation::OverloadResolve): Update to take into account matching modifiers
8629 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
8630 a new SetFormalParameters object which we pass to InternalParameters.
8632 2001-10-30 Ravi Pratap <ravi@ximian.com>
8634 * expression.cs (NewArray): Merge into the ArrayCreation class.
8636 2001-10-29 Ravi Pratap <ravi@ximian.com>
8638 * expression.cs (NewArray): Merge classes NewBuiltinArray and
8639 NewUserdefinedArray into one as there wasn't much of a use in having
8642 * expression.cs (Argument): Change field's name to ArgType from Type.
8644 (Type): New readonly property which returns the proper type, taking into
8645 account ref/out modifiers.
8647 (everywhere): Adjust code accordingly for the above.
8649 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
8650 whether we are emitting for a ref or out parameter.
8652 * expression.cs (Argument::Emit): Use the above field to set the state.
8654 (LocalVariableReference::Emit): Update to honour the flag and emit the
8657 * parameter.cs (Attributes): Set the correct flags for ref parameters.
8659 * expression.cs (Argument::FullDesc): New function to provide a full desc.
8661 * support.cs (ParameterData): Add method ParameterDesc to the interface.
8663 (ReflectionParameters, InternalParameters): Implement the above method.
8665 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
8668 (Invocation::FullMethodDesc): Ditto.
8670 2001-10-29 Miguel de Icaza <miguel@ximian.com>
8672 * cs-parser.jay: Add extra production for the second form of array
8675 * expression.cs (ArrayCreation): Update to reflect the above
8678 * Small changes to prepare for Array initialization.
8680 2001-10-28 Miguel de Icaza <miguel@ximian.com>
8682 * typemanager.cs (ImplementsInterface): interface might be null;
8683 Deal with this problem;
8685 Also, we do store negative hits on the cache (null values), so use
8686 this instead of calling t.GetInterfaces on the type everytime.
8688 2001-10-28 Ravi Pratap <ravi@ximian.com>
8690 * typemanager.cs (IsBuiltinType): New method to help determine the same.
8692 * expression.cs (New::DoResolve): Get rid of array creation code and instead
8693 split functionality out into different classes.
8695 (New::FormArrayType): Move into NewBuiltinArray.
8697 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
8700 (NewBuiltinArray): New class to handle creation of built-in arrays.
8702 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
8703 account creation of one-dimensional arrays.
8705 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
8707 (NewUserdefinedArray::DoResolve): Implement.
8709 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
8711 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
8712 we maintain inside the TypeManager. This is necessary to perform lookups on the
8715 (LookupType): Update to perform GetType on the module builders too.
8717 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
8719 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
8721 2001-10-23 Ravi Pratap <ravi@ximian.com>
8723 * expression.cs (New::DoResolve): Implement guts of array creation.
8725 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
8727 2001-10-27 Miguel de Icaza <miguel@ximian.com>
8729 * expression.cs: Fix bug I introduced lsat night that broke
8732 (Expression.Resolve): Report a 246 error (can not resolve name)
8733 if we find a SimpleName in the stream.
8735 (Expression.ResolveLValue): Ditto.
8737 (Expression.ResolveWithSimpleName): This function is a variant of
8738 ResolveName, this one allows SimpleNames to be returned without a
8739 warning. The only consumer of SimpleNames is MemberAccess
8741 2001-10-26 Miguel de Icaza <miguel@ximian.com>
8743 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
8744 might arrive here. I have my doubts that this is correct.
8746 * statement.cs (Lock): Implement lock statement.
8748 * cs-parser.jay: Small fixes to support `lock' and `using'
8750 * cs-tokenizer.cs: Remove extra space
8752 * driver.cs: New flag --checked, allows to turn on integer math
8755 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
8756 Threading.Monitor.Exit
8758 2001-10-23 Miguel de Icaza <miguel@ximian.com>
8760 * expression.cs (IndexerAccess::DoResolveLValue): Set the
8761 Expression Class to be IndexerAccess.
8763 Notice that Indexer::DoResolve sets the eclass to Value.
8765 2001-10-22 Miguel de Icaza <miguel@ximian.com>
8767 * class.cs (TypeContainer::Emit): Emit code for indexers.
8769 * assign.cs (IAssignMethod): New interface implemented by Indexers
8770 and Properties for handling assignment.
8772 (Assign::Emit): Simplify and reuse code.
8774 * expression.cs (IndexerAccess, PropertyExpr): Implement
8775 IAssignMethod, clean up old code.
8777 2001-10-22 Ravi Pratap <ravi@ximian.com>
8779 * typemanager.cs (ImplementsInterface): New method to determine if a type
8780 implements a given interface. Provides a nice cache too.
8782 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
8785 (ConvertReferenceExplicit): Ditto.
8787 * delegate.cs (Delegate::Populate): Update to define the parameters on the
8788 various methods, with correct names etc.
8790 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
8791 Operator.UnaryNegation.
8793 * cs-parser.jay (operator_declarator): Be a little clever in the case where
8794 we have a unary plus or minus operator.
8796 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
8799 * everywhere : update accordingly.
8801 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
8804 * class.cs (Method::Define): For the case where we are implementing a method
8805 inherited from an interface, we need to set the MethodAttributes.Final flag too.
8806 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
8808 2001-10-21 Ravi Pratap <ravi@ximian.com>
8810 * interface.cs (FindMembers): Implement to work around S.R.E
8813 * typemanager.cs (IsInterfaceType): Implement.
8815 (FindMembers): Update to handle interface types too.
8817 * expression.cs (ImplicitReferenceConversion): Re-write bits which
8818 use IsAssignableFrom as that is not correct - it doesn't work.
8820 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
8821 and accordingly override EmitStatement.
8823 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
8824 using the correct logic :-)
8826 2001-10-19 Ravi Pratap <ravi@ximian.com>
8828 * ../errors/cs-11.cs : Add to demonstrate error -11
8830 2001-10-17 Miguel de Icaza <miguel@ximian.com>
8832 * assign.cs (Assign::Resolve): Resolve right hand side first, and
8833 then pass this as a hint to ResolveLValue.
8835 * expression.cs (FieldExpr): Add Location information
8837 (FieldExpr::LValueResolve): Report assignment to readonly
8840 (Expression::ExprClassFromMemberInfo): Pass location information.
8842 (Expression::ResolveLValue): Add new method that resolves an
8845 (Expression::DoResolveLValue): Default invocation calls
8848 (Indexers): New class used to keep track of indexers in a given
8851 (IStackStore): Renamed from LValue, as it did not really describe
8852 what this did. Also ResolveLValue is gone from this interface and
8853 now is part of Expression.
8855 (ElementAccess): Depending on the element access type
8857 * typemanager.cs: Add `indexer_name_type' as a Core type
8858 (System.Runtime.CompilerServices.IndexerNameAttribute)
8860 * statement.cs (Goto): Take a location.
8862 2001-10-18 Ravi Pratap <ravi@ximian.com>
8864 * delegate.cs (Delegate::VerifyDelegate): New method to verify
8865 if two delegates are compatible.
8867 (NewDelegate::DoResolve): Update to take care of the case when
8868 we instantiate a delegate from another delegate.
8870 * typemanager.cs (FindMembers): Don't even try to look up members
8871 of Delegate types for now.
8873 2001-10-18 Ravi Pratap <ravi@ximian.com>
8875 * delegate.cs (NewDelegate): New class to take care of delegate
8878 * expression.cs (New): Split the delegate related code out into
8879 the NewDelegate class.
8881 * delegate.cs (DelegateInvocation): New class to handle delegate
8884 * expression.cs (Invocation): Split out delegate related code into
8885 the DelegateInvocation class.
8887 2001-10-17 Ravi Pratap <ravi@ximian.com>
8889 * expression.cs (New::DoResolve): Implement delegate creation fully
8890 and according to the spec.
8892 (New::DoEmit): Update to handle delegates differently.
8894 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
8895 because of which we were printing out arguments in reverse order !
8897 * delegate.cs (VerifyMethod): Implement to check if the given method
8898 matches the delegate.
8900 (FullDelegateDesc): Implement.
8902 (VerifyApplicability): Implement.
8904 * expression.cs (Invocation::DoResolve): Update to accordingly handle
8905 delegate invocations too.
8907 (Invocation::Emit): Ditto.
8909 * ../errors/cs1593.cs : Added.
8911 * ../errors/cs1594.cs : Added.
8913 * delegate.cs (InstanceExpression, TargetMethod): New properties.
8915 2001-10-16 Ravi Pratap <ravi@ximian.com>
8917 * typemanager.cs (intptr_type): Core type for System.IntPtr
8919 (InitCoreTypes): Update for the same.
8921 (iasyncresult_type, asynccallback_type): Ditto.
8923 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
8926 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
8929 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
8930 the builders for the 4 members of a delegate type :-)
8932 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
8935 * expression.cs (New::DoResolve): Implement guts for delegate creation.
8937 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
8939 2001-10-15 Miguel de Icaza <miguel@ximian.com>
8941 * statement.cs (Break::Emit): Implement.
8942 (Continue::Emit): Implement.
8944 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
8945 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
8946 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
8947 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
8950 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
8951 properties that track the label for the current loop (begin of the
8952 loop and end of the loop).
8954 2001-10-15 Ravi Pratap <ravi@ximian.com>
8956 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
8957 use of emitting anything at all.
8959 * class.cs, rootcontext.cs : Get rid of calls to the same.
8961 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
8963 (Populate): Define the constructor correctly and set the implementation
8966 * typemanager.cs (delegate_types): New hashtable to hold delegates that
8969 (AddDelegateType): Implement.
8971 (IsDelegateType): Implement helper method.
8973 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
8975 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
8976 and accordingly handle it.
8978 * delegate.cs (Populate): Take TypeContainer argument.
8979 Implement bits to define the Invoke method. However, I still haven't figured out
8980 how to take care of the native int bit :-(
8982 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
8983 Qualify the name of the delegate, not its return type !
8985 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
8988 (StandardConversionExists): Checking for array types turns out to be recursive.
8990 (ConvertReferenceExplicit): Implement array conversion.
8992 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
8994 2001-10-12 Ravi Pratap <ravi@ximian.com>
8996 * cs-parser.jay (delegate_declaration): Store the fully qualified
8997 name as it is a type declaration.
8999 * delegate.cs (ReturnType, Name): Rename members to these. Make them
9002 (DefineDelegate): Renamed from Define. Does the same thing essentially,
9003 as TypeContainer::DefineType.
9005 (Populate): Method in which all the definition of the various methods (Invoke)
9008 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
9011 (CloseDelegate): Finally creates the delegate.
9013 * class.cs (TypeContainer::DefineType): Update to define delegates.
9014 (Populate, Emit and CloseType): Do the same thing here too.
9016 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
9017 delegates in all these operations.
9019 2001-10-14 Miguel de Icaza <miguel@ximian.com>
9021 * expression.cs: LocalTemporary: a new expression used to
9022 reference a temporary that has been created.
9024 * assign.cs: Handle PropertyAccess back here, so that we can
9025 provide the proper semantic access to properties.
9027 * expression.cs (Expression::ConvertReferenceExplicit): Implement
9028 a few more explicit conversions.
9030 * modifiers.cs: `NEW' modifier maps to HideBySig.
9032 * expression.cs (PropertyExpr): Make this into an
9033 ExpressionStatement, and support the EmitStatement code path.
9035 Perform get/set error checking, clean up the interface.
9037 * assign.cs: recognize PropertyExprs as targets, and if so, turn
9038 them into toplevel access objects.
9040 2001-10-12 Miguel de Icaza <miguel@ximian.com>
9042 * expression.cs: PropertyExpr::PropertyExpr: use work around the
9045 * typemanager.cs: Keep track here of our PropertyBuilders again to
9046 work around lameness in SRE.
9048 2001-10-11 Miguel de Icaza <miguel@ximian.com>
9050 * expression.cs (LValue::LValueResolve): New method in the
9051 interface, used to perform a second resolution pass for LValues.
9053 (This::DoResolve): Catch the use of this in static methods.
9055 (This::LValueResolve): Implement.
9057 (This::Store): Remove warning, assigning to `this' in structures
9060 (Invocation::Emit): Deal with invocation of
9061 methods on value types. We need to pass the address to structure
9062 methods rather than the object itself. (The equivalent code to
9063 emit "this" for structures leaves the entire structure on the
9064 stack instead of a pointer to it).
9066 (ParameterReference::DoResolve): Compute the real index for the
9067 argument based on whether the method takes or not a `this' pointer
9068 (ie, the method is static).
9070 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
9071 value types returned from functions when we need to invoke a
9072 method on the sturcture.
9075 2001-10-11 Ravi Pratap <ravi@ximian.com>
9077 * class.cs (TypeContainer::DefineType): Method to actually do the business of
9078 defining the type in the Modulebuilder or Typebuilder. This is to take
9079 care of nested types which need to be defined on the TypeBuilder using
9082 (TypeContainer::GetClassBases): Implement. Essentially the code from the
9083 methods in RootContext, only ported to be part of TypeContainer.
9085 (TypeContainer::GetInterfaceOrClass): Ditto.
9087 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
9089 * interface.cs (Interface::DefineInterface): New method. Does exactly
9090 what RootContext.CreateInterface did earlier, only it takes care of nested types
9093 (Interface::GetInterfaces): Move from RootContext here and port.
9095 (Interface::GetInterfaceByName): Same here.
9097 * rootcontext.cs (ResolveTree): Re-write.
9099 (PopulateTypes): Re-write.
9101 * class.cs (TypeContainer::Populate): Populate nested types too.
9102 (TypeContainer::Emit): Emit nested members too.
9104 * typemanager.cs (AddUserType): Do not make use of the FullName property,
9105 instead just use the name argument passed in as it is already fully
9108 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
9109 to TypeContainer mapping to see if a type is user-defined.
9111 * class.cs (TypeContainer::CloseType): Implement.
9113 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
9114 the default constructor.
9116 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
9119 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
9121 * interface.cs (CloseType): Create the type here.
9123 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
9126 Remove all the methods which are now in TypeContainer.
9128 2001-10-10 Ravi Pratap <ravi@ximian.com>
9130 * delegate.cs (Define): Re-write bits to define the delegate
9133 2001-10-10 Miguel de Icaza <miguel@ximian.com>
9135 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
9137 * expression.cs (ImplicitReferenceConversion): handle null as well
9138 as a source to convert to any reference type.
9140 * statement.cs (Return): Perform any implicit conversions to
9141 expected return type.
9143 Validate use of return statement.
9145 * codegen.cs (EmitContext): Pass the expected return type here.
9147 * class.cs (Method, Constructor, Property): Pass expected return
9148 type to EmitContext.
9150 2001-10-09 Miguel de Icaza <miguel@ximian.com>
9152 * expression.cs: Make DoResolve take an EmitContext instead of a
9155 Replaced `l' and `location' for `loc', for consistency.
9157 (Error, Warning): Remove unneeded Tc argument.
9159 * assign.cs, literal.cs, constant.cs: Update to new calling
9162 * codegen.cs: EmitContext now contains a flag indicating whether
9163 code is being generated in a static method or not.
9165 * cs-parser.jay: DecomposeQI, new function that replaces the old
9166 QualifiedIdentifier. Now we always decompose the assembled
9167 strings from qualified_identifier productions into a group of
9170 2001-10-08 Miguel de Icaza <miguel@ximian.com>
9172 * rootcontext.cs: Deal with field-less struct types correctly now
9173 by passing the size option to Define Type.
9175 * class.cs: Removed hack that created one static field.
9177 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9179 * statement.cs: Moved most of the code generation here.
9181 2001-10-09 Ravi Pratap <ravi@ximian.com>
9183 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9186 (ElementAccess): Remove useless bits for now - keep checks as the spec
9189 2001-10-08 Ravi Pratap <ravi@ximian.com>
9191 * expression.cs (ElementAccess::DoResolve): Remove my crap code
9192 and start performing checks according to the spec.
9194 2001-10-07 Ravi Pratap <ravi@ximian.com>
9196 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9197 rank_specifiers instead.
9199 (rank_specifiers): Change the order in which the rank specifiers are stored
9201 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
9203 * expression.cs (ElementAccess): Implement the LValue interface too.
9205 2001-10-06 Ravi Pratap <ravi@ximian.com>
9207 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
9208 except that user defined conversions are not included.
9210 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
9211 perform the conversion of the return type, if necessary.
9213 (New::DoResolve): Check whether we are creating an array or an object
9214 and accordingly do the needful.
9216 (New::Emit): Same here.
9218 (New::DoResolve): Implement guts of array creation.
9220 (New::FormLookupType): Helper function.
9222 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9224 * codegen.cs: Removed most of the code generation here, and move the
9225 corresponding code generation bits to the statement classes.
9227 Added support for try/catch/finalize and throw.
9229 * cs-parser.jay: Added support for try/catch/finalize.
9231 * class.cs: Catch static methods having the flags override,
9232 virtual or abstract.
9234 * expression.cs (UserCast): This user cast was not really doing
9235 what it was supposed to do. Which is to be born in fully resolved
9236 state. Parts of the resolution were being performed at Emit time!
9240 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9242 * expression.cs: Implicity convert the result from UserCast.
9244 2001-10-05 Ravi Pratap <ravi@ximian.com>
9246 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
9247 prevented it from working correctly.
9249 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
9250 merely ConvertImplicit.
9252 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9254 * typemanager.cs: Make the LookupTypeContainer function static,
9255 and not per-instance.
9257 * class.cs: Make static FindMembers (the one that takes a Type
9260 * codegen.cs: Add EmitForeach here.
9262 * cs-parser.jay: Make foreach a toplevel object instead of the
9263 inline expansion, as we need to perform semantic analysis on it.
9265 2001-10-05 Ravi Pratap <ravi@ximian.com>
9267 * expression.cs (Expression::ImplicitUserConversion): Rename to
9268 UserDefinedConversion.
9270 (Expression::UserDefinedConversion): Take an extra argument specifying
9271 whether we look for explicit user conversions too.
9273 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
9275 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
9277 (ExplicitUserConversion): Make it a call to UserDefinedConversion
9278 with the appropriate arguments.
9280 * cs-parser.jay (cast_expression): Record location too.
9282 * expression.cs (Cast): Record location info.
9284 (Expression::ConvertExplicit): Take location argument.
9286 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
9287 to determine if we are doing explicit conversions.
9289 (UserCast::Emit): Update accordingly.
9291 (Expression::ConvertExplicit): Report an error if everything fails.
9293 * ../errors/cs0030.cs : Add.
9295 2001-10-04 Miguel de Icaza <miguel@ximian.com>
9297 * modifiers.cs: If the ABSTRACT keyword is present, also set the
9298 virtual and newslot bits.
9300 * class.cs (TypeContainer::RegisterRequiredImplementations):
9301 Record methods we need.
9303 (TypeContainer::MakeKey): Helper function to make keys for
9304 MethodBases, since the Methodbase key is useless.
9306 (TypeContainer::Populate): Call RegisterRequiredImplementations
9307 before defining the methods.
9309 Create a mapping for method_builders_to_methods ahead of time
9310 instead of inside a tight loop.
9312 (::RequireMethods): Accept an object as the data to set into the
9313 hashtable so we can report interface vs abstract method mismatch.
9315 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9317 * report.cs: Make all of it static.
9319 * rootcontext.cs: Drop object_type and value_type computations, as
9320 we have those in the TypeManager anyways.
9322 Drop report instance variable too, now it is a global.
9324 * driver.cs: Use try/catch on command line handling.
9326 Add --probe option to debug the error reporting system with a test
9329 * report.cs: Add support for exiting program when a probe
9330 condition is reached.
9332 2001-10-03 Ravi Pratap <ravi@ximian.com>
9334 * expression.cs (Binary::DoNumericPromotions): Fix the case when
9335 we do a forcible conversion regardless of type, to check if
9336 ForceConversion returns a null.
9338 (Binary::error19): Use location to report error.
9340 (Unary::error23): Use location here too.
9342 * ../errors/cs0019.cs : Check in.
9344 * ../errors/cs0023.cs : Check in.
9346 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
9347 case of a non-null MethodInfo object with a length of 0 !
9349 (Binary::ResolveOperator): Flag error if overload resolution fails to find
9350 an applicable member - according to the spec :-)
9351 Also fix logic to find members in base types.
9353 (Unary::ResolveOperator): Same here.
9355 (Unary::report23): Change name to error23 and make first argument a TypeContainer
9356 as I was getting thoroughly confused between this and error19 :-)
9358 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
9359 (::FindMostEncompassedType): Implement.
9360 (::FindMostEncompassingType): Implement.
9361 (::StandardConversionExists): Implement.
9363 (UserImplicitCast): Re-vamp. We now need info about most specific
9364 source and target types so that we can do the necessary conversions.
9366 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
9367 mathematical union with no duplicates.
9369 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9371 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
9372 in order from base classes to child classes, so that we can in
9373 child classes look up in our parent for method names and
9374 attributes (required for handling abstract, virtual, new, override
9375 constructs: we need to instrospect our base class, and if we dont
9376 populate the classes in order, the introspection might be
9377 incorrect. For example, a method could query its parent before
9378 the parent has any methods and would determine that the parent has
9379 no abstract methods (while it could have had them)).
9381 (RootContext::CreateType): Record the order in which we define the
9384 2001-10-02 Miguel de Icaza <miguel@ximian.com>
9386 * class.cs (TypeContainer::Populate): Also method definitions can
9387 fail now, keep track of this.
9389 (TypeContainer::FindMembers): Implement support for
9390 DeclaredOnly/noDeclaredOnly flag.
9392 (Constructor::Emit) Return the ConstructorBuilder.
9394 (Method::Emit) Return the MethodBuilder.
9395 Check for abstract or virtual methods to be public.
9397 * rootcontext.cs (RootContext::CreateType): Register all the
9398 abstract methods required for the class to be complete and the
9399 interface methods that must be implemented.
9401 * cs-parser.jay: Report error 501 (method requires body if it is
9402 not marked abstract or extern).
9404 * expression.cs (TypeOf::Emit): Implement.
9406 * typemanager.cs: runtime_handle_type, new global type.
9408 * class.cs (Property::Emit): Generate code for properties.
9410 2001-10-02 Ravi Pratap <ravi@ximian.com>
9412 * expression.cs (Unary::ResolveOperator): Find operators on base type
9413 too - we now conform exactly to the spec.
9415 (Binary::ResolveOperator): Same here.
9417 * class.cs (Operator::Define): Fix minor quirk in the tests.
9419 * ../errors/cs0215.cs : Added.
9421 * ../errors/cs0556.cs : Added.
9423 * ../errors/cs0555.cs : Added.
9425 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9427 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9428 single integer which is really efficient
9430 2001-10-01 Ravi Pratap <ravi@ximian.com>
9432 * expression.cs (Expression::ImplicitUserConversion): Use location
9433 even in the case when we are examining True operators.
9435 * class.cs (Operator::Define): Perform extensive checks to conform
9436 with the rules for operator overloading in the spec.
9438 * expression.cs (Expression::ImplicitReferenceConversion): Implement
9439 some of the other conversions mentioned in the spec.
9441 * typemanager.cs (array_type): New static member for the System.Array built-in
9444 (cloneable_interface): For System.ICloneable interface.
9446 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9447 we start resolving the tree and populating types.
9449 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9451 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9453 * expression.cs (Expression::ExprClassFromMemberInfo,
9454 Expression::Literalize): Create literal expressions from
9455 FieldInfos which are literals.
9457 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9458 type casts, because they were wrong. The test suite in tests
9461 (ImplicitNumericConversion): ushort to ulong requires a widening
9464 Int32 constant to long requires widening cast as well.
9466 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9467 for integers because the type on the stack is not i4.
9469 2001-09-30 Miguel de Icaza <miguel@ximian.com>
9471 * expression.cs (report118): require location argument.
9473 * parameter.cs: Do not dereference potential null value.
9475 * class.cs: Catch methods that lack the `new' keyword when
9476 overriding a name. Report warnings when `new' is used without
9477 anything being there to override.
9479 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9481 * class.cs: Only add constructor to hashtable if it is non-null
9482 (as now constructors can fail on define).
9484 (TypeManager, Class, Struct): Take location arguments.
9486 Catch field instance initialization in structs as errors.
9488 accepting_filter: a new filter for FindMembers that is static so
9489 that we dont create an instance per invocation.
9491 (Constructor::Define): Catch errors where a struct constructor is
9494 * cs-parser.jay: Pass location information for various new
9497 * delegate.cs (Delegate): take a location argument.
9499 * driver.cs: Do not call EmitCode if there were problesm in the
9500 Definition of the types, as many Builders wont be there.
9502 * decl.cs (Decl::Decl): Require a location argument.
9504 * cs-tokenizer.cs: Handle properly hex constants that can not fit
9505 into integers, and find the most appropiate integer for it.
9507 * literal.cs: Implement ULongLiteral.
9509 * rootcontext.cs: Provide better information about the location of
9510 failure when CreateType fails.
9512 2001-09-29 Miguel de Icaza <miguel@ximian.com>
9514 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9517 * expression.cs (Binary::CheckShiftArguments): Add missing type
9519 (Binary::ResolveOperator): Add type to the logical and and logical
9520 or, Bitwise And/Or and Exclusive Or code paths, it was missing
9523 (Binary::DoNumericPromotions): In the case where either argument
9524 is ulong (and most signed types combined with ulong cause an
9525 error) perform implicit integer constant conversions as well.
9527 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9529 * expression.cs (UserImplicitCast): Method should always be
9531 (Invocation::BetterConversion): Simplified test for IntLiteral.
9533 (Expression::ImplicitNumericConversion): Split this routine out.
9534 Put the code that performs implicit constant integer conversions
9537 (Expression::Resolve): Become a wrapper around DoResolve so we can
9538 check eclass and type being set after resolve.
9540 (Invocation::Badness): Remove this dead function
9542 (Binary::ResolveOperator): Do not compute the expensive argumnets
9543 unless we have a union for it.
9545 (Probe::Emit): Is needs to do an isinst and then
9546 compare against null.
9548 (::CanConvert): Added Location argument. If the Location argument
9549 is null (Location.Null), then we do not report errors. This is
9550 used by the `probe' mechanism of the Explicit conversion. We do
9551 not want to generate an error for something that the user
9552 explicitly requested to be casted. But the pipeline for an
9553 explicit cast first tests for potential implicit casts.
9555 So for now, if the Location is null, it means `Probe only' to
9556 avoid adding another argument. Might have to revise this
9559 (ClassCast): New class used to type cast objects into arbitrary
9560 classes (used in Explicit Reference Conversions).
9562 Implement `as' as well.
9564 Reverted all the patches from Ravi below: they were broken:
9566 * The use of `level' as a mechanism to stop recursive
9567 invocations is wrong. That was there just to catch the
9568 bug with a strack trace but not as a way of addressing
9571 To fix the problem we have to *understand* what is going
9572 on and the interactions and come up with a plan, not
9573 just get things going.
9575 * The use of the type conversion cache that I proposed
9576 last night had an open topic: How does this work across
9577 protection domains. A user defined conversion might not
9578 be public in the location where we are applying the
9579 conversion, a different conversion might be selected
9580 (ie, private A->B (better) but public B->A (worse),
9581 inside A, A->B applies, but outside it, B->A will
9584 * On top of that (ie, even if the above is solved),
9585 conversions in a cache need to be abstract. Ie, `To
9586 convert from an Int to a Short use an OpcodeCast', not
9587 `To convert from an Int to a Short use the OpcodeCast on
9588 the variable 5' (which is what this patch was doing).
9590 2001-09-28 Ravi Pratap <ravi@ximian.com>
9592 * expression.cs (Invocation::ConversionExists): Re-write to use
9593 the conversion cache
9595 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9596 cache all conversions done, not just user-defined ones.
9598 (Invocation::BetterConversion): The real culprit. Use ConversionExists
9599 to determine if a conversion exists instead of acutually trying to
9600 perform the conversion. It's faster too.
9602 (Expression::ConvertExplicit): Modify to use ConversionExists to check
9603 and only then attempt the implicit conversion.
9605 2001-09-28 Ravi Pratap <ravi@ximian.com>
9607 * expression.cs (ConvertImplicit): Use a cache for conversions
9608 already found. Check level of recursion and bail out if necessary.
9610 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9612 * typemanager.cs (string_concat_string_string, string_concat_object_object):
9613 Export standard methods that we expect for string operations.
9615 * statement.cs (Block::UsageWarning): Track usage of variables and
9616 report the errors for not used variables.
9618 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9621 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9623 * codegen.cs: remove unnneded code
9625 * expression.cs: Removed BuiltinTypeAccess class
9627 Fix the order in which implicit conversions are
9630 The previous fixed dropped support for boxed conversions (adding a
9631 test to the test suite now)
9633 (UserImplicitCast::CanConvert): Remove test for source being null,
9634 that code is broken. We should not feed a null to begin with, if
9635 we do, then we should track the bug where the problem originates
9636 and not try to cover it up here.
9638 Return a resolved expression of type UserImplicitCast on success
9639 rather than true/false. Ravi: this is what I was talking about,
9640 the pattern is to use a static method as a "constructor" for
9643 Also, do not create arguments until the very last minute,
9644 otherwise we always create the arguments even for lookups that
9645 will never be performed.
9647 (UserImplicitCast::Resolve): Eliminate, objects of type
9648 UserImplicitCast are born in a fully resolved state.
9650 * typemanager.cs (InitCoreTypes): Init also value_type
9653 * expression.cs (Cast::Resolve): First resolve the child expression.
9655 (LValue): Add new method AddressOf to be used by
9658 Change the argument of Store to take an EmitContext instead of an
9659 ILGenerator, because things like FieldExpr need to be able to call
9660 their children expression to generate the instance code.
9662 (Expression::Error, Expression::Warning): Sugar functions for
9665 (Expression::MemberLookup): Accept a TypeContainer instead of a
9666 Report as the first argument.
9668 (Expression::ResolvePrimary): Killed. I still want to improve
9669 this as currently the code is just not right.
9671 (Expression::ResolveMemberAccess): Simplify, but it is still
9674 (Unary::Resolve): Catch errors in AddressOf operators.
9676 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
9677 index to a byte for the short-version, or the compiler will choose
9678 the wrong Emit call, which generates the wrong data.
9680 (ParameterReference::Emit, ::Store): same.
9682 (FieldExpr::AddressOf): Implement.
9684 * typemanager.cs: TypeManager: made public variable instead of
9687 * driver.cs: document --fatal.
9689 * report.cs (ErrorMessage, WarningMessage): new names for the old
9690 Error and Warning classes.
9692 * cs-parser.jay (member_access): Turn built-in access to types
9693 into a normal simplename
9695 2001-09-27 Ravi Pratap <ravi@ximian.com>
9697 * expression.cs (Invocation::BetterConversion): Fix to cope
9698 with q being null, since this was introducing a bug.
9700 * expression.cs (ConvertImplicit): Do built-in conversions first.
9702 2001-09-27 Ravi Pratap <ravi@ximian.com>
9704 * expression.cs (UserImplicitCast::Resolve): Fix bug.
9706 2001-09-27 Ravi Pratap <ravi@ximian.com>
9708 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
9709 I had introduced long ago (what's new ?).
9711 * expression.cs (UserImplicitCast::CanConvert): Static method to do
9712 the work of all the checking.
9713 (ConvertImplicit): Call CanConvert and only then create object if necessary.
9714 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
9716 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
9717 that is the right way.
9719 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
9720 overloading resolution. Use everywhere instead of cutting and pasting code.
9722 (Binary::ResolveOperator): Use MakeUnionSet.
9724 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
9725 we have to convert to bool types. Not complete yet.
9727 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9729 * typemanager.cs (TypeManager::CSharpName): support ushort.
9731 * expression.cs (Expression::TryImplicitIntConversion): Attempts
9732 to provide an expression that performsn an implicit constant int
9733 conversion (section 6.1.6).
9734 (Expression::ConvertImplicitRequired): Reworked to include
9735 implicit constant expression conversions.
9737 (Expression::ConvertNumericExplicit): Finished.
9739 (Invocation::Emit): If InstanceExpression is null, then it means
9740 that we perform a call on this.
9742 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9744 * expression.cs (Unary::Emit): Remove some dead code.
9745 (Probe): Implement Resolve and Emit for `is'.
9746 (Expression::ConvertImplicitRequired): Attempt to do constant
9747 expression conversions here. Maybe should be moved to
9748 ConvertImplicit, but I am not sure.
9749 (Expression::ImplicitLongConstantConversionPossible,
9750 Expression::ImplicitIntConstantConversionPossible): New functions
9751 that tell whether is it possible to apply an implicit constant
9752 expression conversion.
9754 (ConvertNumericExplicit): Started work on explicit numeric
9757 * cs-parser.jay: Update operator constants.
9759 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
9760 (Parameters::GetSignature): Hook up VerifyArgs here.
9761 (Parameters::VerifyArgs): Verifies that no two arguments have the
9764 * class.cs (Operator): Update the operator names to reflect the
9765 ones that the spec expects (as we are just stringizing the
9768 * expression.cs (Unary::ResolveOperator): Fix bug: Use
9769 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
9770 previous usage did only work for our methods.
9771 (Expression::ConvertImplicit): Handle decimal implicit numeric
9772 conversions as well.
9773 (Expression::InternalTypeConstructor): Used to invoke constructors
9774 on internal types for default promotions.
9776 (Unary::Emit): Implement special handling for the pre/post
9777 increment/decrement for overloaded operators, as they need to have
9778 the same semantics as the other operators.
9780 (Binary::ResolveOperator): ditto.
9781 (Invocation::ConversionExists): ditto.
9782 (UserImplicitCast::Resolve): ditto.
9784 2001-09-26 Ravi Pratap <ravi@ximian.com>
9786 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
9787 operator, return after emitting body. Regression tests pass again !
9789 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
9790 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
9791 (Invocation::OverloadResolve): Ditto.
9792 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
9794 * everywhere : update calls to the above methods accordingly.
9796 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9798 * assign.cs (Assign): Make it inherit from ExpressionStatement.
9800 * expression.cs (ExpressionStatement): New base class used for
9801 expressions that can appear in statements, so that we can provide
9802 an alternate path to generate expression that do not leave a value
9805 (Expression::Emit, and all the derivatives): We no longer return
9806 whether a value is left on the stack or not. Every expression
9807 after being emitted leaves a single value on the stack.
9809 * codegen.cs (EmitContext::EmitStatementExpression): Use the
9810 facilties of ExpressionStatement if possible.
9812 * cs-parser.jay: Update statement_expression.
9814 2001-09-25 Miguel de Icaza <miguel@ximian.com>
9816 * driver.cs: Change the wording of message
9818 2001-09-25 Ravi Pratap <ravi@ximian.com>
9820 * expression.cs (Binary::ResolveOperator): Had forgottten to set
9821 the type of the expression to the return type of the method if
9822 we have an overloaded operator match ! The regression tests pass again !
9823 (Unary::ResolveOperator): Ditto.
9825 * expression.cs (Invocation::ConversionExists): Correct the member lookup
9826 to find "op_Implicit", not "implicit" ;-)
9827 (UserImplicitCast): New class to take care of user-defined implicit conversions.
9828 (ConvertImplicit, ForceConversion): Take TypeContainer argument
9830 * everywhere : Correct calls to the above accordingly.
9832 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
9833 (ConvertImplicit): Do user-defined conversion if it exists.
9835 2001-09-24 Miguel de Icaza <miguel@ximian.com>
9837 * assign.cs: track location.
9838 (Resolve): Use implicit conversions on assignment.
9840 * literal.cs: Oops. Not good, Emit of short access values should
9841 pass (Bytes) or the wrong argument will be selected.
9843 * expression.cs (Unary::Emit): Emit code for -expr.
9845 (Unary::ResolveOperator): Handle `Substract' for non-constants
9846 (substract from zero from the non-constants).
9847 Deal with Doubles as well.
9849 (Expression::ConvertImplicitRequired): New routine that reports an
9850 error if no implicit conversion exists.
9852 (Invocation::OverloadResolve): Store the converted implicit
9853 expressions if we make them
9855 2001-09-24 Ravi Pratap <ravi@ximian.com>
9857 * class.cs (ConstructorInitializer): Take a Location argument.
9858 (ConstructorBaseInitializer): Same here.
9859 (ConstructorThisInitializer): Same here.
9861 * cs-parser.jay : Update all calls accordingly.
9863 * expression.cs (Unary, Binary, New): Take location argument.
9864 Update accordingly everywhere.
9866 * cs-parser.jay : Update all calls to the above to take a location
9871 2001-09-24 Ravi Pratap <ravi@ximian.com>
9873 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
9874 (Invocation::BetterConversion): Same here
9875 (Invocation::ConversionExists): Ditto.
9877 (Invocation::ConversionExists): Implement.
9879 2001-09-22 Ravi Pratap <ravi@ximian.com>
9881 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
9882 Also take an additional TypeContainer argument.
9884 * All over : Pass in TypeContainer as argument to OverloadResolve.
9886 * typemanager.cs (CSharpName): Update to check for the string type and return
9889 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
9892 2001-09-21 Ravi Pratap <ravi@ximian.com>
9894 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
9895 (Invocation::BetterFunction): Implement.
9896 (Invocation::BetterConversion): Implement.
9897 (Invocation::ConversionExists): Skeleton, no implementation yet.
9899 Okay, things work fine !
9901 2001-09-21 Miguel de Icaza <miguel@ximian.com>
9903 * typemanager.cs: declare and load enum_type, delegate_type and
9906 * expression.cs (Expression::Emit): Now emit returns a value that
9907 tells whether a value is left on the stack or not. This strategy
9908 might be reveted tomorrow with a mechanism that would address
9909 multiple assignments.
9910 (Expression::report118): Utility routine to report mismatches on
9913 (Unary::Report23): Report impossible type/operator combination
9916 (Unary::IsIncrementableNumber): Whether the type can be
9917 incremented or decremented with add.
9918 (Unary::ResolveOperator): Also allow enumerations to be bitwise
9920 (Unary::ResolveOperator): Implement ++, !, ~,
9922 (Invocation::Emit): Deal with new Emit convetion.
9924 * All Expression derivatives: Updated their Emit method to return
9925 whether they leave values on the stack or not.
9927 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
9928 stack for expressions that are statements.
9930 2001-09-20 Miguel de Icaza <miguel@ximian.com>
9932 * expression.cs (LValue): New interface. Must be implemented by
9934 (LocalVariableReference, ParameterReference, FieldExpr): Implement
9937 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
9938 interface for generating code, simplifies the code.
9940 2001-09-20 Ravi Pratap <ravi@ximian.com>
9942 * expression.cs (everywhere): Comment out return statements in ::Resolve
9943 methods to avoid the warnings.
9945 2001-09-20 Miguel de Icaza <miguel@ximian.com>
9947 * driver.cs (parse): Report error 2001 if we can not open the
9950 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
9953 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
9956 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
9957 otherwise nested blocks end up with the same index.
9959 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
9961 * expression.cs: Instead of having FIXMEs in the Resolve
9962 functions, throw exceptions so it is obvious that we are facing a
9965 * cs-parser.jay (invocation_expression): Pass Location information.
9967 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
9968 Use a basename for those routines because .NET does not like paths
9971 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
9974 2001-09-19 Miguel de Icaza <miguel@ximian.com>
9976 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
9977 are loading the correct data types (throws an exception if not).
9978 (TypeManager::InitCoreTypes): Use CoreLookupType
9980 * expression.cs (Unary::ResolveOperator): return the child
9981 expression for expressions which are just +expr.
9982 (Unary::ResolveOperator): Return negative literals for -LITERAL
9983 expressions (otherwise they are Unary {Literal}).
9984 (Invocation::Badness): Take into account `Implicit constant
9985 expression conversions'.
9987 * literal.cs (LongLiteral): Implement long literal class.
9988 (IntLiteral): export the `Value' of the intliteral.
9990 2001-09-19 Ravi Pratap <ravi@ximian.com>
9992 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
9994 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
9995 instead of 'Operator'
9997 * expression.cs (Binary::ResolveOperator): Update accordingly.
9998 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
10001 * cs-parser.jay (unary_expression): Update to use the new names.
10003 * gen-treedump.cs (GetUnary): Same here.
10005 * expression.cs (Unary::Resolve): Implement.
10006 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
10007 operators are found instead of making noise ;-)
10008 (Unary::ResolveOperator): New method to do precisely the same thing which
10009 Binary::ResolveOperator does for Binary expressions.
10010 (Unary.method, .Arguments): Add.
10011 (Unary::OperName): Implement.
10012 (Unary::ForceConversion): Copy and Paste !
10014 * class.cs (Operator::Define): Fix a small bug for the case when we have
10017 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
10018 for the inbuilt operators. Only overloading works for now ;-)
10020 2001-09-18 Miguel de Icaza <miguel@ximian.com>
10022 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
10023 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
10025 * expression.cs (This::Emit): Implement.
10026 (This::Resolve): Implement.
10027 (TypeOf:Resolve): Implement.
10028 (Expression::ResolveSimpleName): Add an implicit this to instance
10030 (MemberAccess::Resolve): Deal with Parameters and Fields.
10031 Bind instance variable to Field expressions.
10032 (FieldExpr::Instance): New field used to track the expression that
10033 represents the object instance.
10034 (FieldExpr::Resolve): Track potential errors from MemberLookup not
10036 (FieldExpr::Emit): Implement.
10038 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
10039 the last instruction contains a return opcode to avoid generating
10040 the last `ret' instruction (this generates correct code, and it is
10041 nice to pass the peverify output).
10043 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
10044 initializer for static and instance variables.
10045 (Constructor::Emit): Allow initializer to be null in the case of
10046 static constructors. Only emit initializer for instance
10049 (TypeContainer::FindMembers): Return a null array if there are no
10052 Also fix the code for the MemberTypes.Method branch, as it was not
10053 scanning that for operators (or tried to access null variables before).
10055 * assign.cs (Assign::Emit): Handle instance and static fields.
10059 * driver.cs: Stop compilation if there are parse errors.
10061 * cs-parser.jay (constructor_declaration): Provide default base
10062 initializer for non-static constructors.
10063 (constructor_declarator): Do not provide a default base
10064 initializers if none was specified.
10065 Catch the fact that constructors should not have parameters.
10067 * class.cs: Do not emit parent class initializers for static
10068 constructors, that should be flagged as an error.
10070 2001-09-18 Ravi Pratap <ravi@ximian.com>
10072 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
10073 Move back code into TypeContainer::Populate.
10075 2001-09-18 Ravi Pratap <ravi@ximian.com>
10077 * class.cs (TypeContainer::AddConstructor): Fix the check to
10078 compare against Name, not Basename.
10079 (Operator::OpType): Change Plus and Minus to Add and Subtract.
10081 * cs-parser.jay : Update accordingly.
10083 * class.cs (TypeContainer::FindMembers): For the case where we are searching
10084 for methods, don't forget to look into the operators too.
10085 (RegisterMethodBuilder): Helper method to take care of this for
10086 methods, constructors and operators.
10087 (Operator::Define): Completely revamp.
10088 (Operator.OperatorMethod, MethodName): New fields.
10089 (TypeContainer::Populate): Move the registering of builders into
10090 RegisterMethodBuilder.
10091 (Operator::Emit): Re-write.
10093 * expression.cs (Binary::Emit): Comment out code path to emit method
10094 invocation stuff for the case when we have a user defined operator. I am
10095 just not able to get it right !
10097 2001-09-17 Miguel de Icaza <miguel@ximian.com>
10099 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
10102 (Expression::MemberLookup): Provide a version that allows to
10103 specify the MemberTypes and BindingFlags.
10105 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
10106 so it was not fetching variable information from outer blocks.
10108 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
10109 Beforefieldinit as it was buggy.
10111 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
10112 that Ravi put here.
10114 * class.cs (Constructor::Emit): Only emit if block is not null.
10115 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
10116 deal with this by semantically definining it as if the user had
10119 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
10120 constructors as we now "emit" them at a higher level.
10122 (TypeContainer::DefineDefaultConstructor): Used to define the
10123 default constructors if none was provided.
10125 (ConstructorInitializer): Add methods Resolve and Emit.
10127 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
10129 2001-09-17 Ravi Pratap <ravi@ximian.com>
10131 * class.cs (TypeContainer::EmitDefaultConstructor): Register
10132 the default constructor builder with our hashtable for methodbuilders
10135 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
10136 and argument_count is 0 in which case we have a match.
10137 (Binary::ResolveOperator): More null checking and miscellaneous coding
10140 2001-09-17 Ravi Pratap <ravi@ximian.com>
10142 * rootcontext.cs (IsNameSpace): Compare against null.
10144 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
10146 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
10147 and Unary::Operator.
10149 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
10152 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
10153 we have overloaded operators.
10154 (Binary::ResolveOperator): Implement the part which does the operator overload
10157 * class.cs (Operator::Emit): Implement.
10158 (TypeContainer::Emit): Emit the operators we have too.
10160 * expression.cs (Binary::Emit): Update to emit the appropriate code for
10161 the case when we have a user-defined operator.
10163 2001-09-17 Miguel de Icaza <miguel@ximian.com>
10165 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
10167 2001-09-16 Ravi Pratap <ravi@ximian.com>
10169 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
10170 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
10171 (Constructor::Emit): Implement.
10172 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
10173 if we have no work to do.
10174 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
10177 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
10178 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10180 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10183 2001-09-15 Ravi Pratap <ravi@ximian.com>
10185 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10187 (Tree::RecordNamespace): Method to do what the name says ;-)
10188 (Tree::Namespaces): Property to get at the namespaces hashtable.
10190 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
10193 * rootcontext.cs (IsNamespace): Fixed it :-)
10195 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10197 * class.cs (TypeContainer::FindMembers): Add support for
10199 (MethodCore): New class that encapsulates both the shared aspects
10200 of a Constructor and a Method.
10201 (Method, Constructor): Factored pieces into MethodCore.
10203 * driver.cs: Added --fatal which makes errors throw exceptions.
10204 Load System assembly as well as part of the standard library.
10206 * report.cs: Allow throwing exceptions on errors for debugging.
10208 * modifiers.cs: Do not use `parent', instead use the real type
10209 container to evaluate permission settings.
10211 * class.cs: Put Ravi's patch back in. He is right, and we will
10212 have to cope with the
10214 2001-09-14 Ravi Pratap <ravi@ximian.com>
10216 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
10217 FamORAssem, not FamANDAssem.
10219 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10221 * driver.cs: Added --parse option that only parses its input files
10224 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
10225 incorrect. IsTopLevel is not used to tell whether an object is
10226 root_types or not (that can be achieved by testing this ==
10227 root_types). But to see if this is a top-level *class* (not
10228 necessarly our "toplevel" container).
10230 2001-09-14 Ravi Pratap <ravi@ximian.com>
10232 * enum.cs (Enum::Define): Modify to call the Lookup method on the
10233 parent instead of a direct call to GetType.
10235 2001-09-14 Ravi Pratap <ravi@ximian.com>
10237 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
10238 Modifiers.TypeAttr. This should just be a call to that method.
10240 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
10241 object so that we can determine if we are top-level or not.
10243 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
10246 * enum.cs (Enum::Define): Ditto.
10248 * modifiers.cs (FieldAttr): Re-write.
10250 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
10251 (TypeContainer::HaveStaticConstructor): New property to provide access
10252 to precisely that info.
10254 * modifiers.cs (MethodAttr): Re-write.
10255 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
10257 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
10258 of top-level types as claimed.
10260 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10262 * expression.cs (MemberLookup): Fruitless attempt to lookup
10263 constructors. Maybe I need to emit default constructors? That
10264 might be it (currently .NET emits this for me automatically).
10265 (Invocation::OverloadResolve): Cope with Arguments == null.
10266 (Invocation::EmitArguments): new function, shared by the new
10267 constructor and us.
10268 (Invocation::Emit): Handle static and instance methods. Emit
10269 proper call instruction for virtual or non-virtual invocations.
10270 (New::Emit): Implement.
10271 (New::Resolve): Implement.
10272 (MemberAccess:Resolve): Implement.
10273 (MethodGroupExpr::InstanceExpression): used conforming to the spec
10274 to track instances.
10275 (FieldExpr::Resolve): Set type.
10277 * support.cs: Handle empty arguments.
10279 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
10280 SimpleLookup): Auxiliary routines to help parse a qualifier
10283 Update qualifier_identifier rule.
10285 * codegen.cs: Removed debugging messages.
10287 * class.cs: Make this a global thing, this acts just as a "key" to
10288 objects that we might have around.
10290 (Populate): Only initialize method_builders_to_methods once.
10292 * expression.cs (PropertyExpr): Initialize type from the
10295 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
10296 Resolve pattern. Attempt to implicitly convert value to boolean.
10299 * expression.cs: Set the type for the int32/int32 argument case.
10300 (Binary::ResolveOperator): Set the return type to boolean for
10301 comparission operators
10303 * typemanager.cs: Remove debugging print code.
10305 (Invocation::Resolve): resolve type.
10307 * class.cs: Allocate a MemberInfo of the correct size, as the code
10308 elsewhere depends on the test to reflect the correct contents.
10310 (Method::) Keep track of parameters, due to System.Reflection holes
10312 (TypeContainer::Populate): Keep track of MethodBuilders to Method
10315 (TypeContainer::FindMembers): Use ArrayList and then copy an array
10316 of the exact size and return that.
10318 (Class::LookupMethodByBuilder): New function that maps
10319 MethodBuilders to its methods. Required to locate the information
10320 on methods because System.Reflection bit us again.
10322 * support.cs: New file, contains an interface ParameterData and
10323 two implementations: ReflectionParameters and InternalParameters
10324 used to access Parameter information. We will need to grow this
10327 * expression.cs (Invocation::GetParameterData): implement a cache
10328 and a wrapper around the ParameterData creation for methods.
10329 (Invocation::OverloadResolve): Use new code.
10331 2001-09-13 Ravi Pratap <ravi@ximian.com>
10333 * class.cs (TypeContainer::EmitField): Remove and move into
10334 (Field::Define): here and modify accordingly.
10335 (Field.FieldBuilder): New member.
10336 (TypeContainer::Populate): Update accordingly.
10337 (TypeContainer::FindMembers): Implement.
10339 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10341 * statement.cs: (VariableInfo::VariableType): New field to be
10342 initialized with the full type once it is resolved.
10344 2001-09-12 Miguel de Icaza <miguel@ximian.com>
10346 * parameter.cs (GetParameterInfo): Use a type cache to compute
10347 things only once, and to reuse this information
10349 * expression.cs (LocalVariableReference::Emit): Implement.
10350 (OpcodeCast::Emit): fix.
10352 (ParameterReference::Resolve): Implement.
10353 (ParameterReference::Emit): Implement.
10355 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
10356 that are expressions need to stay as Expressions.
10358 * typemanager.cs (CSharpName): Returns the C# name of a type if
10361 * expression.cs (Expression::ConvertImplicit): New function that
10362 implements implicit type conversions.
10364 (Expression::ImplicitReferenceConversion): Implements implicit
10365 reference conversions.
10367 (EmptyCast): New type for transparent casts.
10369 (OpcodeCast): New type for casts of types that are performed with
10370 a sequence of bytecodes.
10372 (BoxedCast): New type used for casting value types into reference
10373 types. Emits a box opcode.
10375 (Binary::DoNumericPromotions): Implements numeric promotions of
10376 and computation of the Binary::Type.
10378 (Binary::EmitBranchable): Optimization.
10380 (Binary::Emit): Implement code emission for expressions.
10382 * typemanager.cs (TypeManager): Added two new core types: sbyte
10385 2001-09-12 Ravi Pratap <ravi@ximian.com>
10387 * class.cs (TypeContainer::FindMembers): Method which does exactly
10388 what Type.FindMembers does, only we don't have to use reflection. No
10389 implementation yet.
10391 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
10392 typecontainer objects as we need to get at them.
10393 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
10395 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
10396 typecontainer object.
10398 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
10399 of just a Report object.
10401 2001-09-11 Ravi Pratap <ravi@ximian.com>
10403 * class.cs (Event::Define): Go back to using the prefixes "add_" and
10405 (TypeContainer::Populate): Now define the delegates of the type too.
10406 (TypeContainer.Delegates): Property to access the list of delegates defined
10409 * delegates.cs (Delegate::Define): Implement partially.
10411 * modifiers.cs (TypeAttr): Handle more flags.
10413 2001-09-11 Ravi Pratap <ravi@ximian.com>
10415 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10417 (Operator::Define): Re-write logic to get types by using the LookupType method
10418 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10419 (Indexer::Define): Ditto.
10420 (Event::Define): Ditto.
10421 (Property::Define): Ditto.
10423 2001-09-10 Ravi Pratap <ravi@ximian.com>
10425 * class.cs (TypeContainer::Populate): Now define operators too.
10426 (TypeContainer.Operators): New property to access the list of operators
10428 (Operator.OperatorMethodBuilder): New member to hold the method builder
10429 for the operator we are defining.
10430 (Operator::Define): Implement.
10432 2001-09-10 Ravi Pratap <ravi@ximian.com>
10434 * class.cs (Event::Define): Make the prefixes of the accessor methods
10435 addOn_ and removeOn_
10437 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10438 of the location being passed in too. Ideally, this should go later since all
10439 error reporting should be done through the Report object.
10441 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10442 (Populate): Iterate thru the indexers we have and define them too.
10443 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10444 for the get and set accessors.
10445 (Indexer::Define): Implement.
10447 2001-09-09 Miguel de Icaza <miguel@ximian.com>
10449 * expression.cs (Binary::Resolve): Beginning of it. I scratched
10450 my previous implementation, did not work.
10452 * typemanager.cs: Add a couple of missing types (the longs).
10454 * literal.cs: Use TypeManager.bool_type instead of getting it.
10456 * expression.cs (EventExpr): New kind of expressions.
10457 (Expressio::ExprClassFromMemberInfo): finish
10459 2001-09-08 Miguel de Icaza <miguel@ximian.com>
10461 * assign.cs: Emit stores to static fields differently.
10463 2001-09-08 Ravi Pratap <ravi@ximian.com>
10465 * Merge in changes and adjust code to tackle conflicts. Backed out my
10466 code in Assign::Resolve ;-)
10468 2001-09-08 Ravi Pratap <ravi@ximian.com>
10470 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10471 instead Report.Error and also pass in the location.
10472 (CSharpParser::Lexer): New readonly property to return the reference
10473 to the Tokenizer object.
10474 (declare_local_variables): Use Report.Error with location instead of plain
10478 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10479 (Operator.CheckBinaryOperator): Ditto.
10481 * cs-parser.jay (operator_declarator): Update accordingly.
10483 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10484 (CheckBinaryOperator): Same here.
10486 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10487 on the name without any prefixes of namespace names etc. This is because we
10488 already might have something already fully qualified like
10489 'System.Console.WriteLine'
10491 * assign.cs (Resolve): Begin implementation. Stuck ;-)
10493 2001-09-07 Ravi Pratap <ravi@ximian.com>
10495 * cs-tokenizer.cs (location): Return a string which also contains
10498 * expression.cs (ElementAccess): New class for expressions of the
10499 type 'element access.'
10500 (BaseAccess): New class for expressions of the type 'base access.'
10501 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10504 * cs-parser.jay (element_access): Implement action.
10505 (base_access): Implement actions.
10506 (checked_expression, unchecked_expression): Implement.
10508 * cs-parser.jay (local_variable_type): Correct and implement.
10509 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10511 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10513 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10514 name and the specifiers.
10516 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10518 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
10519 making them all public ;-)
10521 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10524 2001-09-07 Miguel de Icaza <miguel@ximian.com>
10526 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10528 (FieldExpr, PropertyExprs): New resolved expressions.
10529 (SimpleName::MemberStaticCheck): Perform static checks for access
10530 to non-static fields on static methods. Maybe this should be
10531 generalized for MemberAccesses.
10532 (SimpleName::ResolveSimpleName): More work on simple name
10535 * cs-parser.jay (primary_expression/qualified_identifier): track
10536 the parameter index.
10538 * codegen.cs (CodeGen::Save): Catch save exception, report error.
10539 (EmitContext::EmitBoolExpression): Chain to expression generation
10540 instead of temporary hack.
10541 (::EmitStatementExpression): Put generic expression code generation.
10543 * assign.cs (Assign::Emit): Implement variable assignments to
10544 local variables, parameters and fields.
10546 2001-09-06 Miguel de Icaza <miguel@ximian.com>
10548 * statement.cs (Block::GetVariableInfo): New method, returns the
10549 VariableInfo for a variable name in a block.
10550 (Block::GetVariableType): Implement in terms of GetVariableInfo
10552 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10553 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10555 2001-09-06 Ravi Pratap <ravi@ximian.com>
10557 * cs-parser.jay (operator_declaration): Continue on my quest : update
10558 to take attributes argument.
10559 (event_declaration): Ditto.
10560 (enum_declaration): Ditto.
10561 (indexer_declaration): Ditto.
10563 * class.cs (Operator::Operator): Update constructor accordingly.
10564 (Event::Event): Ditto.
10566 * delegate.cs (Delegate::Delegate): Same here.
10568 * enum.cs (Enum::Enum): Same here.
10570 2001-09-05 Ravi Pratap <ravi@ximian.com>
10572 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10574 * ../tests/cs0658.cs : New file to demonstrate error 0658.
10576 * attribute.cs (Attributes): New class to encapsulate all attributes which were
10577 being passed around as an arraylist.
10578 (Attributes::AddAttribute): Method to add attribute sections.
10580 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10581 (struct_declaration): Update accordingly.
10582 (constant_declaration): Update.
10583 (field_declaration): Update.
10584 (method_header): Update.
10585 (fixed_parameter): Update.
10586 (parameter_array): Ditto.
10587 (property_declaration): Ditto.
10588 (destructor_declaration): Ditto.
10590 * class.cs (Struct::Struct): Update constructors accordingly.
10591 (Class::Class): Ditto.
10592 (Field::Field): Ditto.
10593 (Method::Method): Ditto.
10594 (Property::Property): Ditto.
10595 (TypeContainer::OptAttribute): update property's return type.
10597 * interface.cs (Interface.opt_attributes): New member.
10598 (Interface::Interface): Update to take the extra Attributes argument.
10600 * parameter.cs (Parameter::Parameter): Ditto.
10602 * constant.cs (Constant::Constant): Ditto.
10604 * interface.cs (InterfaceMemberBase): New OptAttributes field.
10605 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
10606 the attributes as a parameter.
10607 (InterfaceProperty): Update constructor call.
10608 (InterfaceEvent): Ditto.
10609 (InterfaceMethod): Ditto.
10610 (InterfaceIndexer): Ditto.
10612 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
10613 pass the attributes too.
10614 (interface_event_declaration): Ditto.
10615 (interface_property_declaration): Ditto.
10616 (interface_method_declaration): Ditto.
10617 (interface_declaration): Ditto.
10619 2001-09-05 Miguel de Icaza <miguel@ximian.com>
10621 * class.cs (Method::Define): Track the "static Main" definition to
10622 create an entry point.
10624 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
10625 EntryPoint if we find it.
10627 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
10628 (EmitContext::ig): Make this variable public.
10630 * driver.cs: Make the default output file be the first file name
10631 with the .exe extension.
10633 Detect empty compilations
10635 Handle various kinds of output targets. Handle --target and
10636 rename -t to --dumper.
10638 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
10639 methods inherited from Expression return now an Expression. This
10640 will is used during the tree rewriting as we resolve them during
10643 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
10644 the spec. Missing entirely is the information about
10645 accessability of elements of it.
10647 (Expression::ExprClassFromMemberInfo): New constructor for
10648 Expressions that creates a fully initialized Expression based on
10649 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
10652 (Invocation::Resolve): Begin implementing resolution of invocations.
10654 * literal.cs (StringLiteral): Implement Emit.
10656 2001-09-05 Ravi Pratap <ravi@ximian.com>
10658 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
10661 2001-09-04 Ravi Pratap <ravi@ximian.com>
10663 * cs-parser.jay (attribute_arguments): Implement actions.
10664 (attribute): Fix bug in production. Implement action.
10665 (attribute_list): Implement.
10666 (attribute_target): Implement.
10667 (attribute_target_specifier, opt_target_specifier): Implement
10668 (CheckAttributeTarget): New method to check if the attribute target
10670 (attribute_section): Implement.
10671 (opt_attributes): Implement.
10673 * attribute.cs : New file to handle attributes.
10674 (Attribute): Class to hold attribute info.
10676 * cs-parser.jay (opt_attribute_target_specifier): Remove production
10677 (attribute_section): Modify production to use 2 different rules to
10678 achieve the same thing. 1 s/r conflict down !
10679 Clean out commented, useless, non-reducing dimension_separator rules.
10681 * class.cs (TypeContainer.attributes): New member to hold list
10682 of attributes for a type.
10683 (Struct::Struct): Modify to take one more argument, the attribute list.
10684 (Class::Class): Ditto.
10685 (Field::Field): Ditto.
10686 (Method::Method): Ditto.
10687 (Property::Property): Ditto.
10689 * cs-parser.jay (struct_declaration): Update constructor call to
10690 pass in the attributes too.
10691 (class_declaration): Ditto.
10692 (constant_declaration): Ditto.
10693 (field_declaration): Ditto.
10694 (method_header): Ditto.
10695 (fixed_parameter): Ditto.
10696 (parameter_array): Ditto.
10697 (property_declaration): Ditto.
10699 * constant.cs (Constant::Constant): Update constructor similarly.
10700 Use System.Collections.
10702 * parameter.cs (Parameter::Parameter): Update as above.
10704 2001-09-02 Ravi Pratap <ravi@ximian.com>
10706 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
10707 (TypeContainer.delegates): New member to hold list of delegates.
10709 * cs-parser.jay (delegate_declaration): Implement the action correctly
10710 this time as I seem to be on crack ;-)
10712 2001-09-02 Miguel de Icaza <miguel@ximian.com>
10714 * rootcontext.cs (RootContext::IsNamespace): new function, used to
10715 tell whether an identifier represents a namespace.
10717 * expression.cs (NamespaceExpr): A namespace expression, used only
10718 temporarly during expression resolution.
10719 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
10720 utility functions to resolve names on expressions.
10722 2001-09-01 Miguel de Icaza <miguel@ximian.com>
10724 * codegen.cs: Add hook for StatementExpressions.
10726 * class.cs: Fix inverted test for static flag in methods.
10728 2001-09-02 Ravi Pratap <ravi@ximian.com>
10730 * class.cs (Operator::CheckUnaryOperator): Correct error number used
10731 to make it coincide with MS' number.
10732 (Operator::CheckBinaryOperator): Ditto.
10734 * ../errors/errors.txt : Remove error numbers added earlier.
10736 * ../errors/cs1019.cs : Test case for error # 1019
10738 * ../errros/cs1020.cs : Test case for error # 1020
10740 * cs-parser.jay : Clean out commented cruft.
10741 (dimension_separators, dimension_separator): Comment out. Ostensibly not
10742 used anywhere - non-reducing rule.
10743 (namespace_declarations): Non-reducing rule - comment out.
10745 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
10746 with TypeContainer::AddEnum.
10748 * delegate.cs : New file for delegate handling classes.
10749 (Delegate): Class for declaring delegates.
10751 * makefile : Update.
10753 * cs-parser.jay (delegate_declaration): Implement.
10755 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
10757 * class.cs (Event::Define): Implement.
10758 (Event.EventBuilder): New member.
10760 * class.cs (TypeContainer::Populate): Update to define all enums and events
10762 (Events): New property for the events arraylist we hold. Shouldn't we move to using
10763 readonly fields for all these cases ?
10765 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10767 * class.cs (Property): Revamp to use the convention of making fields readonly.
10768 Accordingly modify code elsewhere.
10770 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
10771 the Define method of the Property class.
10773 * class.cs : Clean up applied patch and update references to variables etc. Fix
10775 (TypeContainer::Populate): Update to define all the properties we have. Also
10776 define all enumerations.
10778 * enum.cs (Define): Implement.
10780 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10782 * cs-parser.jay (overloadable_operator): The semantic value is an
10783 enum of the Operator class.
10784 (operator_declarator): Implement actions.
10785 (operator_declaration): Implement.
10787 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
10788 validity of definitions.
10789 (Operator::CheckBinaryOperator): Static method to check for binary operators
10790 (TypeContainer::AddOperator): New method to add an operator to a type.
10792 * cs-parser.jay (indexer_declaration): Added line to actually call the
10793 AddIndexer method so it gets added ;-)
10795 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
10796 already taken care of by the MS compiler ?
10798 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10800 * class.cs (Operator): New class for operator declarations.
10801 (Operator::OpType): Enum for the various operators.
10803 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10805 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
10806 ostensibly handle this in semantic analysis.
10808 * cs-parser.jay (general_catch_clause): Comment out
10809 (specific_catch_clauses, specific_catch_clause): Ditto.
10810 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
10811 (catch_args, opt_catch_args): New productions.
10812 (catch_clause): Rewrite to use the new productions above
10813 (catch_clauses): Modify accordingly.
10814 (opt_catch_clauses): New production to use in try_statement
10815 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
10816 and re-write the code in the actions to extract the specific and
10817 general catch clauses by being a little smart ;-)
10819 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
10820 Hooray, try and catch statements parse fine !
10822 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10824 * statement.cs (Block::GetVariableType): Fix logic to extract the type
10825 string from the hashtable of variables.
10827 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
10828 I end up making that mistake ;-)
10829 (catch_clauses): Fixed gross error which made Key and Value of the
10830 DictionaryEntry the same : $1 !!
10832 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10834 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
10836 * cs-parser.jay (event_declaration): Correct to remove the semicolon
10837 when the add and remove accessors are specified.
10839 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
10841 * cs-parser.jay (IndexerDeclaration): New helper class to hold
10842 information about indexer_declarator.
10843 (indexer_declarator): Implement actions.
10844 (parsing_indexer): New local boolean used to keep track of whether
10845 we are parsing indexers or properties. This is necessary because
10846 implicit_parameters come into picture even for the get accessor in the
10847 case of an indexer.
10848 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
10850 * class.cs (Indexer): New class for indexer declarations.
10851 (TypeContainer::AddIndexer): New method to add an indexer to a type.
10852 (TypeContainer::indexers): New member to hold list of indexers for the
10855 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
10857 * cs-parser.jay (add_accessor_declaration): Implement action.
10858 (remove_accessor_declaration): Implement action.
10859 (event_accessors_declaration): Implement
10860 (variable_declarators): swap statements for first rule - trivial.
10862 * class.cs (Event): New class to hold information about event
10864 (TypeContainer::AddEvent): New method to add an event to a type
10865 (TypeContainer::events): New member to hold list of events.
10867 * cs-parser.jay (event_declaration): Implement actions.
10869 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
10871 * cs-parser.jay (dim_separators): Implement. Make it a string
10872 concatenating all the commas together, just as they appear.
10873 (opt_dim_separators): Modify accordingly
10874 (rank_specifiers): Update accordingly. Basically do the same
10875 thing - instead, collect the brackets here.
10876 (opt_rank_sepcifiers): Modify accordingly.
10877 (array_type): Modify to actually return the complete type string
10878 instead of ignoring the rank_specifiers.
10879 (expression_list): Implement to collect the expressions
10880 (variable_initializer): Implement. We make it a list of expressions
10881 essentially so that we can handle the array_initializer case neatly too.
10882 (variable_initializer_list): Implement.
10883 (array_initializer): Make it a list of variable_initializers
10884 (opt_array_initializer): Modify accordingly.
10886 * expression.cs (New::NType): Add enumeration to help us
10887 keep track of whether we have an object/delegate creation
10888 or an array creation.
10889 (New:NewType, New::Rank, New::Indices, New::Initializers): New
10890 members to hold data about array creation.
10891 (New:New): Modify to update NewType
10892 (New:New): New Overloaded contructor for the array creation
10895 * cs-parser.jay (array_creation_expression): Implement to call
10896 the overloaded New constructor.
10898 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
10900 * class.cs (TypeContainer::Constructors): Return member
10901 constructors instead of returning null.
10903 2001-08-26 Miguel de Icaza <miguel@ximian.com>
10905 * typemanager.cs (InitCoreTypes): Initialize the various core
10906 types after we have populated the type manager with the user
10907 defined types (this distinction will be important later while
10908 compiling corlib.dll)
10910 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
10911 on Expression Classification. Now all expressions have a method
10912 `Resolve' and a method `Emit'.
10914 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
10915 generation from working. Also add some temporary debugging
10918 2001-08-24 Miguel de Icaza <miguel@ximian.com>
10920 * codegen.cs: Lots of code generation pieces. This is only the
10921 beginning, will continue tomorrow with more touches of polish. We
10922 handle the fundamentals of if, while, do, for, return. Others are
10923 trickier and I need to start working on invocations soon.
10925 * gen-treedump.cs: Bug fix, use s.Increment here instead of
10928 * codegen.cs (EmitContext): New struct, used during code
10929 emission to keep a context. Most of the code generation will be
10932 * cs-parser.jay: Add embedded blocks to the list of statements of
10933 this block. So code generation proceeds in a top down fashion.
10935 2001-08-23 Miguel de Icaza <miguel@ximian.com>
10937 * statement.cs: Add support for multiple child blocks.
10939 2001-08-22 Miguel de Icaza <miguel@ximian.com>
10941 * codegen.cs (EmitCode): New function, will emit the code for a
10942 Block of code given a TypeContainer and its ILGenerator.
10944 * statement.cs (Block): Standard public readonly optimization.
10945 (Block::Block constructors): Link children.
10946 (Block::Child): Child Linker.
10947 (Block::EmitVariables): Emits IL variable declarations.
10949 * class.cs: Drop support for MethodGroups here, delay until
10951 (Method::): Applied the same simplification that I did before, and
10952 move from Properties to public readonly fields.
10953 (Method::ParameterTypes): Returns the parameter types for the
10954 function, and implements a cache that will be useful later when I
10955 do error checking and the semantic analysis on the methods is
10957 (Constructor::GetCallingConvention): Renamed from CallingConvetion
10958 and made a method, optional argument tells whether this is a class
10959 or a structure to apply the `has-this' bit.
10960 (Method::GetCallingConvention): Implement, returns the calling
10962 (Method::Define): Defines the type, a second pass is performed
10963 later to populate the methods.
10965 (Constructor::ParameterTypes): implement a cache similar to the
10966 one on Method::ParameterTypes, useful later when we do semantic
10969 (TypeContainer::EmitMethod): New method. Emits methods.
10971 * expression.cs: Removed MethodGroup class from here.
10973 * parameter.cs (Parameters::GetCallingConvention): new method.
10975 2001-08-21 Miguel de Icaza <miguel@ximian.com>
10977 * class.cs (TypeContainer::Populate): Drop RootContext from the
10980 (Constructor::CallingConvention): Returns the calling convention.
10981 (Constructor::ParameterTypes): Returns the constructor parameter
10984 (TypeContainer::AddConstructor): Keep track of default constructor
10985 and the default static constructor.
10987 (Constructor::) Another class that starts using `public readonly'
10988 instead of properties.
10990 (Constructor::IsDefault): Whether this is a default constructor.
10992 (Field::) use readonly public fields instead of properties also.
10994 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
10995 track of static constructors; If none is used, turn on
10996 BeforeFieldInit in the TypeAttributes.
10998 * cs-parser.jay (opt_argument_list): now the return can be null
10999 for the cases where there are no arguments.
11001 (constructor_declarator): If there is no implicit `base' or
11002 `this', then invoke the default parent constructor.
11004 * modifiers.cs (MethodAttr): New static function maps a set of
11005 modifiers flags into a MethodAttributes enum
11006 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
11007 MethodAttr, TypeAttr to represent the various mappings where the
11008 modifiers are used.
11009 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
11011 2001-08-19 Miguel de Icaza <miguel@ximian.com>
11013 * parameter.cs (GetParameterInfo): Fix bug where there would be no
11016 * interface.cs (PopulateIndexer): Implemented the code generator
11017 for interface indexers.
11019 2001-08-17 Miguel de Icaza <miguel@ximian.com>
11021 * interface.cs (InterfaceMemberBase): Now we track the new status
11024 (PopulateProperty): Implement property population. Woohoo! Got
11025 Methods and Properties going today.
11027 Removed all the properties for interfaces, and replaced them with
11028 `public readonly' fields.
11030 2001-08-16 Miguel de Icaza <miguel@ximian.com>
11032 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
11033 initialize their hashtables/arraylists only when they are needed
11034 instead of doing this always.
11036 * parameter.cs: Handle refs and out parameters.
11038 * cs-parser.jay: Use an ArrayList to construct the arguments
11039 instead of the ParameterCollection, and then cast that to a
11042 * parameter.cs: Drop the use of ParameterCollection and use
11043 instead arrays of Parameters.
11045 (GetParameterInfo): Use the Type, not the Name when resolving
11048 2001-08-13 Miguel de Icaza <miguel@ximian.com>
11050 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
11051 and instead use public readonly fields.
11053 * class.cs: Put back walking code for type containers.
11055 2001-08-11 Miguel de Icaza <miguel@ximian.com>
11057 * class.cs (MakeConstant): Code to define constants.
11059 * rootcontext.cs (LookupType): New function. Used to locate types
11062 2001-08-08 Miguel de Icaza <miguel@ximian.com>
11064 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
11065 this System.Reflection code is. Kudos to Microsoft
11067 * typemanager.cs: Implement a type cache and avoid loading all
11068 types at boot time. Wrap in LookupType the internals. This made
11069 the compiler so much faster. Wow. I rule!
11071 * driver.cs: Make sure we always load mscorlib first (for
11072 debugging purposes, nothing really important).
11074 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
11075 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
11077 * rootcontext.cs: Lookup types on their namespace; Lookup types
11078 on namespaces that have been imported using the `using' keyword.
11080 * class.cs (TypeContainer::TypeAttr): Virtualize.
11081 (Class::TypeAttr): Return attributes suitable for this bad boy.
11082 (Struct::TypeAttr): ditto.
11083 Handle nested classes.
11084 (TypeContainer::) Remove all the type visiting code, it is now
11085 replaced with the rootcontext.cs code
11087 * rootcontext.cs (GetClassBases): Added support for structs.
11089 2001-08-06 Miguel de Icaza <miguel@ximian.com>
11091 * interface.cs, statement.cs, class.cs, parameter.cs,
11092 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
11093 Drop use of TypeRefs, and use strings instead.
11095 2001-08-04 Miguel de Icaza <miguel@ximian.com>
11099 * class.cs (Struct::Struct): set the SEALED flags after
11100 checking the modifiers.
11101 (TypeContainer::TypeAttr): new property, returns the
11102 TypeAttributes for a class.
11104 * cs-parser.jay (type_list): Oops, list production was creating a
11105 new list of base types.
11107 * rootcontext.cs (StdLib): New property.
11108 (GetInterfaceTypeByName): returns an interface by type name, and
11109 encapsulates error handling here.
11110 (GetInterfaces): simplified.
11111 (ResolveTree): Encapsulated all the tree resolution here.
11112 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
11115 * driver.cs: Add support for --nostdlib, to avoid loading the
11116 default assemblies.
11117 (Main): Do not put tree resolution here.
11119 * rootcontext.cs: Beginning of the class resolution.
11121 2001-08-03 Miguel de Icaza <miguel@ximian.com>
11123 * rootcontext.cs: Provide better error reporting.
11125 * cs-parser.jay (interface_base): set our $$ to be interfaces.
11127 * rootcontext.cs (CreateInterface): Handle the case where there
11128 are no parent interfaces.
11130 (CloseTypes): Routine to flush types at the end.
11131 (CreateInterface): Track types.
11132 (GetInterfaces): Returns an array of Types from the list of
11133 defined interfaces.
11135 * typemanager.c (AddUserType): Mechanism to track user types (puts
11136 the type on the global type hash, and allows us to close it at the
11139 2001-08-02 Miguel de Icaza <miguel@ximian.com>
11141 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
11142 RecordInterface instead.
11144 * cs-parser.jay: Updated to reflect changes above.
11146 * decl.cs (Definition): Keep track of the TypeBuilder type that
11147 represents this type here. Not sure we will use it in the long
11148 run, but wont hurt for now.
11150 * driver.cs: Smaller changes to accomodate the new code.
11152 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
11155 * rootcontext.cs (CreateInterface): New method, used to create
11156 the System.TypeBuilder type for interfaces.
11157 (ResolveInterfaces): new entry point to resolve the interface
11159 (CodeGen): Property, used to keep track of the code generator.
11161 2001-07-26 Miguel de Icaza <miguel@ximian.com>
11163 * cs-parser.jay: Add a second production for delegate_declaration
11166 (enum_body): Put an opt_comma here instead of putting it on
11167 enum_body or enum_member_declarations so we can handle trailing
11168 commas on enumeration members. Gets rid of a shift/reduce.
11170 (type_list): Need a COMMA in the middle.
11172 (indexer_declaration): Tell tokenizer to recognize get/set
11174 * Remove old targets.
11176 * Re-add the parser target.
11178 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11180 * cs-parser.jay: Add precendence rules for a number of operators
11181 ot reduce the number of shift/reduce conflicts in the grammar.
11183 2001-07-17 Miguel de Icaza <miguel@ximian.com>
11185 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11188 Get rid of old crufty code.
11190 * rootcontext.cs: Use this to keep track of the parsed
11191 representation and the defined types available to the program.
11193 * gen-treedump.cs: adjust for new convention.
11195 * type.cs: Split out the type manager, and the assembly builder
11198 * typemanager.cs: the type manager will live here now.
11200 * cil-codegen.cs: And the code generator here.
11202 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
11204 * makefile: Fixed up for easy making.
11206 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11208 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
11211 (unary_expression): Expand pre_increment_expression and
11212 post_decrement_expression to reduce a shift/reduce.
11214 2001-07-11 Simon Cozens
11216 * cs-tokenizer.cs: Hex numbers should begin with a 0.
11218 Improve allow_keyword_as_indent name.
11220 2001-06-19 Miguel de Icaza <miguel@ximian.com>
11222 * Adjustments for Beta2.
11224 2001-06-13 Miguel de Icaza <miguel@ximian.com>
11226 * decl.cs: Added `Define' abstract method.
11227 (InTransit): new property, used to catch recursive definitions.
11229 * interface.cs: Implement `Define'.
11231 * modifiers.cs: Map Modifiers.constants to
11232 System.Reflection.TypeAttribute flags.
11234 * class.cs: Keep track of types and user-defined types.
11235 (BuilderInit): New method for creating an assembly
11236 (ResolveType): New function to launch the resolution process, only
11237 used by interfaces for now.
11239 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
11240 that are inserted into the name space.
11242 2001-06-08 Miguel de Icaza <miguel@ximian.com>
11244 * ARGH. I have screwed up my tree so many times due to the use of
11245 rsync rather than using CVS. Going to fix this at once.
11247 * driver.cs: Objetify driver. Load assemblies, use assemblies to
11250 2001-06-07 Miguel de Icaza <miguel@ximian.com>
11252 * Experiment successful: Use System.Type rather that our own
11255 2001-05-25 Miguel de Icaza <miguel@ximian.com>
11257 * cs-parser.jay: Removed nsAliases from here.
11259 Use new namespaces, handle `using XXX;'
11261 * namespace.cs: Reimplemented namespace handling, use a recursive
11262 definition of the class. Now we can keep track of using clauses
11263 and catch invalid using clauses.
11265 2001-05-24 Miguel de Icaza <miguel@ximian.com>
11267 * gen-treedump.cs: Adapted for all the renaming.
11269 * expression.cs (Expression): this class now has a Type property
11270 which returns an expression Type.
11272 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
11273 `Type', as this has a different meaning now in the base
11275 2001-05-22 Miguel de Icaza <miguel@ximian.com>
11277 * interface.cs, class.cs: Removed from all the sources the
11278 references to signature computation, as we can not do method
11279 signature computation during the parsing time, as we are not
11280 trying to solve at that point distinguishing:
11284 void a (NS.Blah x) {}
11287 Which depending on the context might be valid or not, as we do not
11288 know if Blah is the same thing as NS.Blah at that point.
11290 * Redid everything so the code uses TypeRefs now instead of
11291 Types. TypeRefs are just temporary type placeholders, that need
11292 to be resolved. They initially have a pointer to a string and the
11293 current scope in which they are used. This is used later by the
11294 compiler to resolve the reference to an actual Type.
11296 * DeclSpace is no longer a CIR.Type, and neither are
11297 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
11298 are all DeclSpaces, but no Types.
11300 * type.cs (TypeRefManager): This implements the TypeRef manager,
11301 which keeps track of all the types that need to be resolved after
11302 the parsing has finished.
11304 2001-05-13 Miguel de Icaza <miguel@ximian.com>
11306 * ARGH. We are going to have to store `foreach' as a class rather
11307 than resolving it, as we need to verify error 1579 after name
11308 resolution. *OR* we could keep a flag that says `This request to
11309 IEnumerator comes from a foreach statement' which we can then use
11310 to generate the error.
11312 2001-05-10 Miguel de Icaza <miguel@ximian.com>
11314 * class.cs (TypeContainer.AddMethod): we now add methods to the
11315 MethodGroup instead of the method hashtable.
11317 * expression.cs: Add MethodGroup abstraction, which gets us one
11318 step closer to the specification in the way we handle method
11321 * cs-parser.jay (primary_expression): qualified_identifier now
11322 tried to match up an identifier to a local variable reference or
11323 to a parameter reference.
11325 current_local_parameters is now a parser global variable that
11326 points to the current parameters for the block, used during name
11329 (property_declaration): Now creates an implicit `value' argument to
11332 2001-05-09 Miguel de Icaza <miguel@ximian.com>
11334 * parameter.cs: Do not use `param' arguments as part of the
11335 signature, per the spec.
11337 2001-05-08 Miguel de Icaza <miguel@ximian.com>
11339 * decl.cs: Base class for classes, structs and interfaces. This
11340 is the "Declaration Space"
11342 * cs-parser.jay: Use CheckDef for checking declaration errors
11343 instead of having one on each function.
11345 * class.cs: Factor out some code for handling error handling in
11346 accordance to the "Declarations" section in the "Basic Concepts"
11347 chapter in the ECMA C# spec.
11349 * interface.cs: Make all interface member classes derive from
11350 InterfaceMemberBase.
11352 2001-05-07 Miguel de Icaza <miguel@ximian.com>
11354 * Many things: all interfaces are parsed and generated in
11355 gen-treedump. Support for member variables, constructors,
11356 destructors, properties, constants is there.
11358 Beginning of the IL backend, but very little done, just there for
11361 2001-04-29 Miguel de Icaza <miguel@ximian.com>
11363 * cs-parser.jay: Fix labeled statement.
11365 * cs-tokenizer.cs (escape): Escape " and ' always.
11366 ref_line, ref_name: keep track of the line/filename as instructed
11367 by #line by the compiler.
11370 2001-04-27 Miguel de Icaza <miguel@ximian.com>
11372 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
11373 to match the values in System.CodeDOM.
11375 Divid renamed to Divide.
11377 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
11379 (Statements.set): remove.
11381 * System.CodeDOM/CodeCatchClause.cs: always have a valid
11384 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
11385 falseStatements always have valid values.
11387 * cs-parser.jay: Use System.CodeDOM now.