1 2003-05-11 Miguel de Icaza <miguel@ximian.com>
3 * const.cs: Create our own emit context during the Definition
4 stage, so that constants are evaluated in the proper context, when
5 a recursive definition happens.
7 2003-05-11 Martin Baulig <martin@ximian.com>
9 * statement.cs (Block.CreateSwitchBlock): New method. Creates a
10 new block for a switch section.
11 (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
12 the adding/lookup in the switch block. Fixes #39828.
14 2003-05-09 Miguel de Icaza <miguel@ximian.com>
16 * expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
17 functionality: I needed to convert the data after I had performed
18 the add/sub operation into the operands type size.
20 * ecore.cs (ImplicitReferenceConversion): When boxing an interface
21 pass the type for the box operation, otherwise the resulting
22 object would have been of type object.
24 (BoxedCast): Add constructor to specify the type to box as.
26 2003-05-07 Miguel de Icaza <miguel@ximian.com>
28 * iterators.cs: I was reusing the `count' variable inadvertently,
29 take steps to not allow this to happen.
31 2003-05-06 Miguel de Icaza <miguel@ximian.com>
33 * attribute.cs (Attribute.Resolve): Params attributes are encoded
34 by creating an array at the point where the params starts and
35 putting all those arguments there, then adjusting the size of the
38 2003-05-05 Miguel de Icaza <miguel@ximian.com>
40 * expression.cs (New.AddressOf): Implement interface
41 IMemoryLocation. This is used when the `new' operator is used in
42 the context of an invocation to a method on a value type.
44 See http://bugzilla.ximian.com/show_bug.cgi?id=#42390 for an
47 * namespace.cs: Also check the using aliases here.
49 * driver.cs: Move the test for using validity after the types have
50 been entered, so we do a single pass that also includes the using
53 * statement.cs (Try.Resolve): Avoid crashing if there is a failure
54 in the regular case. CreateSiblingForFinally is doing extra
57 * attribute.cs (GetAttributeArgumentExpression): Store the result
58 on an out value, and use the return value to indicate failure
59 instead of using null (which is a valid return for Constant.GetValue).
61 * statement.cs: Perform the analysis flow for the increment
62 portion after the statement, because this will be the real flow of
63 execution. Fixes #42385
65 * codegen.cs (EmitContext.EmitArgument,
66 EmitContext.EmitStoreArgument): New helper functions when the
67 RemapToProxy flag is set.
69 * expression.cs (ParameterReference.EmitLdarg): Expose this useful
72 Add support for remapping parameters.
74 * iterators.cs: Propagate parameter values; Store parameter
75 values in the proxy classes.
77 2003-05-04 Miguel de Icaza <miguel@ximian.com>
79 * ecore.cs (FieldExpr): Fix an obvious bug. static fields do not
80 need a proxy reference; I do not know what I was thinking
82 * cs-parser.jay (constructor_initializer): catch another error,
83 and display nice message.
85 (field_declaration): catch void field declaration
86 to flag a better error.
88 * class.cs (MemberBase.CheckBase): Report an error instead of a
89 warning if a new protected member is declared in a struct.
90 (Field.Define): catch the error of readonly/volatile.
92 * ecore.cs (FieldExpr.EmitAssign): reuse the field lookup.
94 (FieldExpr.AddressOf): ditto. Catch error where the address of a
95 volatile variable is taken
97 2003-05-02 Miguel de Icaza <miguel@ximian.com>
99 * statement.cs (Fixed.Resolve): Report an error if we are not in
102 2003-05-01 Miguel de Icaza <miguel@ximian.com>
104 * typemanager.cs: reuse the code that handles type clashes for
105 delegates and enumerations.
107 * class.cs (Report28): Always report.
109 * expression.cs (EncodeAsAttribute): Allow nulls here.
111 2003-04-28 Miguel de Icaza <miguel@ximian.com>
113 * attribute.cs (Attribute.GetAttributeArgumentExpression): Moved
114 the functionality for testing whether an expression is valid for
115 an attribute here. Also handle the case of arrays of elements
118 * expression.cs (ArrayCreation.EncodeAsAttribute): Add support for
119 encoding a linear array into an array of objects that are suitable
120 to be passed to an CustomAttributeBuilder.
122 * delegate.cs: Check unsafe types being used outside of an Unsafe context.
124 * ecore.cs: (FieldExpr): Handle field remapping here.
126 * iteratators.cs: Pass the instance variable (if the method is an
127 instance method) to the constructors, so we can access the field
128 variables on the class.
130 TODO: Test this with structs. I think the THIS variable on
131 structs might have to be a pointer, and not a refenrece
133 2003-04-27 Miguel de Icaza <miguel@ximian.com>
135 * codegen.cs (EmitContext.Mapvariable): Adds a mechanism to map
136 local variables to fields in a proxy class.
138 * iterators.cs (PopulateProxy): Rename our internal fields to
140 Create a <THIS> field if we are an instance method, so we can
141 reference our parent container variables.
142 (MapVariable): Called back from the EmitContext code to enter a
143 new variable to field mapping into the proxy class (we just create
147 (LocalVariableReference.{Emit,EmitAssign,AddressOf}): Add support
148 for using the remapped locals to fields.
150 I placed the code here, because that gives the same semantics to
151 local variables, and only changes the Emit code.
153 * statement.cs (Fixed.Resolve): it is not allowed to have fixed
154 statements inside iterators.
155 (VariableInfo): Add a FieldBuilder for the cases when we are
156 remapping local variables to fields in a proxy class
158 * ecore.cs (SimpleNameResolve): Avoid testing two times for
159 current_block != null.
161 * statement.cs (Swithc.SimpleSwitchEmit): Removed code that did
162 not cope with strings, as it has been moved to the
163 TableSwitchEmit. Fixed bug in switch generation.
165 * expression.cs (New.DoResolve): Provide more context for the user
166 when reporting an error.
168 * ecore.cs (Expression.LoadFromPtr): Use ldind_i when loading
171 * expression.cs (MemberAccess.DoResolve): When we get a type back,
172 check the permissions for it. Note than in a type-resolution
173 context the check was already present in DeclSpace.ResolveType,
174 but was missing from the MemberAccess.
176 (ArrayCreation.CheckIndices): warn if the user has
177 more nested levels of expressions, but there are no more
178 dimensions specified. Avoids crash on bug 41906.
180 2003-04-26 Miguel de Icaza <miguel@ximian.com>
182 * statement.cs (Block): replace Implicit bool, for a generic
184 New flag: `Unchecked'. This is used during the EmitMeta phase
185 (which is out-of-line with the regular Resolve/Emit process for a
186 statement, as this is done ahead of time, but still gets a chance
187 to call constant resolve).
189 (Block.Flags): new enum for adding a new flag.
191 (Block.EmitMeta): track the state of unchecked.
193 (Unchecked): Set the "UnChecked" flags on any blocks we enclose,
194 to enable constant resolution to work there as well.
196 2003-04-22 Miguel de Icaza <miguel@ximian.com>
198 * typemanager.cs (ienumerable_type): Also look up
199 System.Collections.IEnumerable.
201 2003-04-21 Miguel de Icaza <miguel@ximian.com>
203 TODO: Test more than one conditional per method.
205 * class.cs (Indexer.Define): Report the location where the user is
206 referencing the unsupported feature.
208 (MethodData): Overload the use of `conditionals' to
209 minimize the creation of needless ArrayLists. This saves roughly
212 (Method): Implement the new IIteratorContainer interface.
213 (Method.SetYields): Implement the method by setting the ModFlags
214 to contain METHOD_YIELDS.
216 * expression.cs (Unary.ResolveOperator): Use expr_type, not Expr,
217 which just got set to null.
219 * iterators.cs: New file.
221 (Yield, YieldBreak): New statements.
223 * statement.cs (Return.Resolve): Flag an error if we are used in
226 * codegen.cs (InIterator): New flag set if the code is being
227 compiled in an iterator method.
229 * modifiers.cs: New flag METHOD_YIELDS. This modifier is an
230 internal modifier, and we just use it to avoid adding extra
231 fields, as this is seldom used.
233 * cs-parser.jay: Add yield_statement (yield and yield break).
235 * driver.cs: New flag -v2 to turn on version 2 features.
237 * cs-tokenizer.cs (Tokenizer): Add yield and __yield to the
238 hashtable when v2 is enabled.
240 2003-04-20 Miguel de Icaza <miguel@ximian.com>
242 * typemanager.cs (TypeManager.NamespaceClash): Use to check if
243 there is already a namespace defined with this name.
245 (TypeManager.InitCoreTypes): Remove the temporary workaround, as
246 people upgraded their corlibs.
248 (TypeManager.CoreLookupType): Use LookupTypeDirect, as we
249 always use fully qualified types, no need to use the compiler
252 (TypeManager.IsNamespace): Use binarysearch.
254 * class.cs (AddClass, AddStruct, AddInterface, AddEvent,
255 AddDelegate): I did not quite use the new IsValid API properly: I
256 have to pass the short-name and the fullname. I was passing only
257 the basename instead of the fullname sometimes.
259 (TypeContainer.DefineType): call NamespaceClash.
261 * interface.cs (Interface.DefineType): use NamespaceClash before
264 * delegate.cs (Delegate.DefineType): use NamespaceClash before
267 * enum.cs: (Enum.DefineType): use NamespaceClash before
270 * typemanager.cs (: 3-line patch that gives us some tasty 11%
271 speed increase. First, use the negative_hits cache when we get a
272 negative. Second, add the type with its full original name
273 instead of the new . and + encoded name (reflection uses + to
274 separate type from a nested type). Use LookupTypeReflection
275 directly which bypasses the type->name hashtable (that we already
276 know does not contain the type.
278 * decl.cs (DeclSpace.ResolveTypeExpr): track the
279 location/container type.
281 * driver.cs: When passing utf8, use directly the UTF8Encoding.
283 2003-04-19 Miguel de Icaza <miguel@ximian.com>
285 * decl.cs (ResolveTypeExpr): Mirror check acess here too.
287 * delegate.cs (NewDelegate.Resolve): Test whether an instance
288 method is being referenced in the method group from a static
289 context, and report error 120 if so.
291 * expression.cs, ecore.cs (Error_UnexpectedKind): New name for
294 * typemanager.cs: Add intermediate namespaces (if a namespace A.B
295 is created, we create the A namespace).
297 * cs-parser.jay: A namespace also introduces a DeclarationFound.
300 2003-04-18 Miguel de Icaza <miguel@ximian.com>
302 * typemanager.cs (GetReferenceType, GetPointerType): In .NET each
303 invocation to ModuleBuilder.GetType with the same values will
304 return a new type instance, so we need to cache its return
307 * expression.cs (Binary.ResolveOperator): Only allow the compare
308 operators on enums if they are of the same type.
310 * ecore.cs (Expression.ImplicitReferenceConversion): handle target
311 types of ValueType on their own case. Before we were giving them
312 the same treatment as objects.
314 * decl.cs (DeclSpace.IsValid): IsValid takes the short name and
315 fullname. Short name is used to compare against container name.
316 Fullname is used to check against defined namespace names.
318 * class.cs (AddProperty, AddField, AddClass, AddStruct, AddEnum,
319 AddDelegate, AddEvent): Pass new parameter to DeclSpace.IsValid
321 (Method.CheckBase): Call parent.
322 (MemberBase.CheckBase): Check for protected members on sealed
324 (PropertyBase.CheckBase): Call parent.
325 (Field.Define): Call parent.
327 * report.cs: Negative error codes are now mapped to 8000 - code,
328 so that the display is render more nicely.
330 * typemanager.cs: Do not use try/catch, instead report a regular
333 (GetPointerType, GetReferenceType): These methods provide
334 mechanisms to obtain the T* and T& from a T. We had the code
335 previously scattered around the code base, and it also used
336 TypeManager.LookupType that would go through plenty of caches.
337 This one goes directly to the type source.
339 In some places we did the Type.GetType followed by
340 ModuleBuilder.GetType, but not in others, so this unifies the
343 * namespace.cs (VerifyUsing): Perform a non-lazy approach to using
344 statements now that we have namespace information.
346 * typemanager.cs (IsNamespace): New method, returns whether the
347 string presented is a namespace or not.
349 (ComputeNamespaces): New public entry point, computes the list of
350 available namespaces, using the GetNamespaces API call in Mono, or
351 the slower version in MS.NET.
353 Now before we start the semantic analysis phase, we have a
354 complete list of namespaces including everything that the user has
357 Deleted old code to cache namespaces in .nsc files.
359 2003-04-17 Miguel de Icaza <miguel@ximian.com>
361 * class.cs: (TypeContainer.DefineDefaultConstructor): Use the
362 class/struct location definition Location for the implicit
363 constructor location.
365 (Operator.Define): Use the location of the operator for the
366 implicit Method definition.
368 (Constructor.Emit): use the constructor location for the implicit
369 base initializer constructor.
371 * ecore.cs: Remove ITypeExpression. This interface is now gone,
372 and the Expression class now contains two new methods:
374 ResolveAsTypeStep and ResolveAsTypeTerminal. This is used to
375 isolate type lookup from the rest of the resolution process.
377 Since we use Expressions to hold type definitions due to the way
378 we parse the input we have historically overloaded Resolve to
379 perform the Type lookups if a special flag is passed. Now this is
380 eliminated and two methods take their place.
382 The differences in the two methods between xStep and xTerminal is
383 that xStep is involved in our current lookup system that uses
384 SimpleNames to compose a name, while xTerminal is used just to
385 catch the case where the simplename lookup failed.
387 2003-04-16 Miguel de Icaza <miguel@ximian.com>
389 * expression.cs (ResolveMemberAccess): Remove redundant code.
390 TypeExpr expressions are always born fully resolved.
392 * interface.cs (PopulateMethod): Do not lookup the types twice.
393 We were doing it once during SemanticAnalysis and once during
396 * cs-parser.jay: Due to our hack in the grammar, things like A.B[]
397 in local variable type definitions, were being returned as a
398 SimpleName (we decomposed everything into a string), that is
399 because primary_expression was being used instead of a type in the
400 grammar (reduce/reduce conflicts).
402 The part that was wrong is that we converted the expression into a
403 string (an oversimplification in one hand, compounded with primary
404 expressions doing string concatenation).
410 Would return "A.B.C[]" as a SimpleName. This stopped things like
411 using clauses from working on this particular context. And a type
412 was being matched directly against "A.B.C[]".
414 We now use the correct approach, and allow for ComposedCast to be
415 part of the unary expression. So the "A.B.C []" become a composed
416 cast of "A.B.C" (as a nested group of MemberAccess with a
417 SimpleName at the end) plus the rank composition "[]".
421 2003-04-10 Miguel de Icaza <miguel@ximian.com>
423 * decl.cs (CheckAccessLevel): Implement the NestedPrivate rules
424 for the access level checking.
426 * class.cs: Cosmetic changes. Renamed `TypeContainer parent' to
427 `TypeContainer container', because I kept getting confused when I
428 was debugging this code.
430 * expression.cs (Indexers): Instead of tracking getters/setters,
431 we now track them in parallel. We create one arraylist less, but
432 most importantly it is possible now for the LValue code to find a
433 matching get for a set.
435 (IndexerAccess.DoResolveLValue): Update the code.
436 GetIndexersForType has been modified already to extract all the
437 indexers from a type. The code assumed it did not.
439 Also make the code set the correct return type for the indexer.
440 This was fixed a long time ago for properties, but was missing for
441 indexers. It used to be void_type.
443 (Binary.Emit): Test first for doubles instead of
444 floats, as they are more common.
446 (Binary.EmitBranchable): Use the .un version of the branch opcodes
447 when dealing with floats and the <=, >= operators. This fixes bug
450 * statement.cs (Foreach.EmitArrayForeach): bug fix: The code used
451 to load the array value by emitting a load on the foreach variable
452 type. This was incorrect.
454 We now emit the code to load an element using the the array
455 variable type, and then we emit the conversion operator.
459 2003-04-10 Zoltan Varga <vargaz@freemail.hu>
461 * attribute.cs: Avoid allocation of ArrayLists in the common case.
463 2003-04-09 Miguel de Icaza <miguel@ximian.com>
465 * class.cs (MethodSignature.InheritableMemberSignatureCompare):
466 test for protection before we test for signatures.
468 (MethodSignature.ToString): implement.
470 * expression.cs (Unary.TryReduceNegative): Add missing minus sign
471 to the case where we reduced into a LongConstant.
473 * decl.cs (CheckAccessLevel): If the type is an array, we can not
474 depend on whether the information is acurrate, because the
475 Microsoft runtime will always claim that the array type is public,
476 regardless of the real state.
478 If the type is a pointer, another problem happens: the type is
479 reported as non-public in Microsoft.
481 In both cases we have to call CheckAccessLevel recursively with
482 the underlying type as the argument to be tested.
484 2003-04-08 Miguel de Icaza <miguel@ximian.com>
486 * assign.cs (Assign.Emit): If we are dealing with a compound
487 assignment expression, we should use the code path that stores the
488 intermediate result in a temporary value. This fixes #40903.
490 *expression.cs (Indirection.ToString): Provide ToString method for
493 2003-04-08 Zoltan Varga <vargaz@freemail.hu>
495 * class.cs: Null out fields holding references to Block objects so
496 they can be garbage collected.
498 * expression.cs (OverloadResolve): Remove unused local.
500 2003-04-07 Martin Baulig <martin@ximian.com>
502 * codegen.cs (EmitContext.CurrentFile): New public field.
503 (EmitContext.Mark): Use the CurrentFile to check whether the
504 location is in the correct file.
505 (EmitContext.EmitTopBlock): Initialize CurrentFile here.
507 2003-04-07 Martin Baulig <martin@ximian.com>
509 * ecore.cs (Expression.ResolveBoolean): Don't call ec.Mark().
511 * codegen.cs (EmitContext.EmitTopBlock): Don't call Mark() on the
512 location. [FIXME: The location argument which gets passed to this
513 method is sometimes wrong!]
515 2003-04-07 Nick Drochak <ndrochak@gol.com>
517 * codegen.cs: Be more verbose when we can't find the symbol writer dll.
519 2003-04-07 Miguel de Icaza <miguel@ximian.com>
521 * expression.cs (Indirection.EmitAssign): We were using the
522 temporary, but returning immediately instead of continuing the
525 2003-04-06 Martin Baulig <martin@ximian.com>
527 * ecore.cs (SimpleName.SimpleNameResolve): Don't report an error
528 if it's a nested child, but also deriving from the outer class.
531 * typemanager.cs (IsNestedChildOf): Make this work if it's a
532 nested child, but also deriving from the outer class. See
534 (FilterWithClosure): We may access private members of the outer
535 class if we're a nested child and deriving from the outer class.
536 (RealMemberLookup): Only set `closure_private_ok' if the
537 `original_bf' contained BindingFlags.NonPublic.
539 2003-04-05 Martin Baulig <martin@ximian.com>
541 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #40670.
543 2003-04-02 Miguel de Icaza <miguel@ximian.com>
545 * class.cs (Event.Define): Do not allow abstract events to have
548 2003-04-01 Miguel de Icaza <miguel@ximian.com>
550 * cs-parser.jay: Add error productions for ADD/REMOVE missing a
551 block in event declarations.
553 * ecore.cs (FieldExpr.AddressOf): If our instance expression is a
554 value type, get its address.
556 * expression.cs (Is.Emit): For action `LeaveOnStack' we were
557 leaving a class on the stack instead of a boolean value (int
558 0/1). Change the code so we compare against null, and then the
561 * class.cs (TypeContainer.GetClassBases): We were checking for the
562 parent class being sealed too late.
564 * expression.cs (Binary.Emit): For <= and >= when dealing with
565 floating point values, use cgt.un and clt.un instead of cgt and
568 2003-04-01 Zoltan Varga <vargaz@freemail.hu>
570 * statement.cs: Apply the same optimization as MS: skip the
571 GetEnumerator returning an IEnumerator, and use the one returning a
572 CharEnumerator instead. This allows us to avoid the try-finally block
575 2003-03-31 Gaurav Vaish <gvaish_mono@lycos.com>
577 * cs-parser.jay: Attributes cannot be applied to
578 namespaces. Fixes #40473
580 2003-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
583 (Add*): check if the name is valid using the full name for constants,
584 fields, properties and events.
586 2003-03-28 Miguel de Icaza <miguel@ximian.com>
588 * enum.cs (Enum.DefineType, Enum.IsValidEnumConstant): Also allow
589 char constants to be part of the enumeration.
591 * expression.cs (Conditional.DoResolve): Add support for operator
592 true. Implements the missing functionality from 14.12
594 * class.cs (TypeContainer.CheckPairedOperators): Report error for missmatch on
595 operator true/false as required by the spec.
597 * expression.cs (Unary.ResolveOperator): In LogicalNot, do an
598 implicit conversion to boolean.
600 * statement.cs (Statement.ResolveBoolean): A boolean expression is
601 also one where the type implements `operator true'.
603 * ecore.cs (Expression.GetOperatorTrue): New helper routine to
604 get an expression that will invoke operator true based on an
607 (GetConversionOperators): Removed the hack that called op_True
610 (Expression.ResolveBoolean): Move this from Statement.
612 2003-03-17 Miguel de Icaza <miguel@ximian.com>
614 * ecore.cs (FieldExpr): do not allow initialization of initonly
615 fields on derived classes
617 2003-03-13 Martin Baulig <martin@ximian.com>
619 * statement.cs (Block.Emit): Call ig.BeginScope() and
620 ig.EndScope() when compiling with debugging info; call
621 LocalBuilder.SetLocalSymInfo _after_ opening the scope.
623 2003-03-08 Miguel de Icaza <miguel@ximian.com>
625 * expression.cs (Indexers): Do not construct immediately, allow
626 for new members to be appended as we go. Fixes 38143
628 2003-03-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
630 * expression.cs: save/restore context when resolving an unchecked
633 2003-03-05 Miguel de Icaza <miguel@ximian.com>
635 * cfold.cs: Catch division by zero in modulus operator during
638 2003-03-03 Miguel de Icaza <miguel@ximian.com>
640 * interface.cs (Interface.DefineMembers): Avoid defining members
643 2003-02-27 Miguel de Icaza <miguel@ximian.com>
645 * driver.cs: handle the +/- options for -noconfig
647 * statement.cs (Unckeched.Resolve): Also track the state of
648 unchecked in the Resolve phase.
650 2003-02-27 Martin Baulig <martin@ximian.com>
652 * ecore.cs (Expression.MemberLookup): Don't create a
653 MethodGroupExpr for something which is not a method. Fixes #38291.
655 2003-02-25 Miguel de Icaza <miguel@ximian.com>
657 * class.cs (MemberBase.CheckParameters): Also check that the type
658 is unmanaged if it is a pointer.
660 * expression.cs (SizeOf.Resolve): Add location information.
662 * statement.cs (Block.EmitMeta): Flag error (208) if a pointer to
663 a managed type is declared.
665 * expression.cs (Invocation.VerifyArgumentsCompat): Check for the
666 parameter modifiers as well. Fixes bug 38606
668 * class.cs: Very sad. Am backing out the speed up changes
669 introduced by the ArrayList -> Array in the TypeContainer, as they
670 were not actually that much faster, and introduced a bug (no error
671 reports on duplicated methods).
673 * assign.cs (CompoundAssign.DoLResolve): Resolve the original
674 source first, this will guarantee that we have a valid expression
675 before calling in lower levels functions that will require a
676 resolved object. Then use this original_source in the
677 target.ResolveLValue instead of the original source that was
680 Another change. Use target.Resolve instead of LValueResolve.
681 Although we are resolving for LValues, we will let the Assign code
682 take care of that (it will be called again from Resolve). This
683 basically allows code like this:
685 class X { X operator + (X x, object o) {} X this [int idx] { get; set; } }
686 class Y { void A (X x) { x [0] += o; }
688 The problem was that the indexer was trying to resolve for
689 set_Item (idx, object o) and never finding one. The real set_Item
690 was set_Item (idx, X). By delaying the process we get the right
695 2003-02-23 Martin Baulig <martin@ximian.com>
697 * statement.cs (Block.Emit): Override this and set ec.CurrentBlock
698 while calling DoEmit ().
700 * codegen.cs (EmitContext.Mark): Don't mark locations in other
701 source files; if you use the #line directive inside a method, the
702 compiler stops emitting line numbers for the debugger until it
703 reaches the end of the method or another #line directive which
704 restores the original file.
706 2003-02-23 Martin Baulig <martin@ximian.com>
708 * statement.cs (FlowBranching.UsageVector.MergeChildren): Fix bug #37708.
710 2003-02-23 Martin Baulig <martin@ximian.com>
712 * statement.cs (Block.AddChildVariableNames): We need to call this
713 recursively, not just for our immediate children.
715 2003-02-23 Martin Baulig <martin@ximian.com>
717 * class.cs (Event.Define): Always make the field private, like csc does.
719 * typemanager.cs (TypeManager.RealMemberLookup): Make events
720 actually work, fixes bug #37521.
722 2003-02-23 Miguel de Icaza <miguel@ximian.com>
724 * delegate.cs: When creating the various temporary "Parameters"
725 classes, make sure that we call the ComputeAndDefineParameterTypes
726 on those new parameters (just like we do with the formal ones), to
727 allow them to be resolved in the context of the DeclSpace.
729 This fixes the bug that Dick observed in Bugzilla #38530.
731 2003-02-22 Miguel de Icaza <miguel@ximian.com>
733 * expression.cs (ResolveMemberAccess): When resolving a constant,
734 do not attempt to pull a constant if the value was not able to
735 generate a valid constant.
737 * const.cs (LookupConstantValue): Do not report more errors than required.
739 2003-02-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
741 * expression.cs: fixes bug #38328.
743 2003-02-18 Miguel de Icaza <miguel@ximian.com>
745 * class.cs: Changed all the various members that can be part of a
746 class from being an ArrayList to be an Array of the right type.
747 During the DefineType type_list, interface_list, delegate_list and
748 enum_list are turned into types, interfaces, delegates and enums
751 And during the member population, indexer_list, event_list,
752 constant_list, field_list, instance_constructor_list, method_list,
753 operator_list and property_list are turned into their real arrays.
755 Although we could probably perform this operation earlier, for
756 good error reporting we need to keep the lists and remove the
757 lists for longer than required.
759 This optimization was triggered by Paolo profiling the compiler
760 speed on the output of `gen-sample-program.pl' perl script.
762 * decl.cs (DeclSpace.ResolveType): Set the ContainerType, so we do
763 not crash in methods like MemberLookupFailed that use this field.
765 This problem arises when the compiler fails to resolve a type
766 during interface type definition for example.
768 2003-02-18 Miguel de Icaza <miguel@ximian.com>
770 * expression.cs (Indexers.GetIndexersForType): Interfaces do not
771 inherit from System.Object, so we have to stop at null, not only
772 when reaching System.Object.
774 2003-02-17 Miguel de Icaza <miguel@ximian.com>
776 * expression.cs: (Indexers.GetIndexersForType): Martin's fix used
777 DeclaredOnly because the parent indexer might have had a different
778 name, but did not loop until the top of the hierarchy was reached.
780 The problem this one fixes is 35492: when a class implemented an
781 indexer from an interface, we were getting the interface method
782 (which was abstract) and we were flagging an error (can not invoke
785 This also keeps bug 33089 functioning, and test-148 functioning.
787 * typemanager.cs (IsSpecialMethod): The correct way of figuring
788 out if a method is special is to see if it is declared in a
789 property or event, or whether it is one of the predefined operator
790 names. This should fix correctly #36804.
792 2003-02-15 Miguel de Icaza <miguel@ximian.com>
794 The goal here is to remove the dependency on EmptyCast.Peel ().
795 Killing it completely.
797 The problem is that currently in a number of places where
798 constants are expected, we have to "probe" for an EmptyCast, and
799 Peel, which is not the correct thing to do, as this will be
800 repetitive and will likely lead to errors.
802 The idea is to remove any EmptyCasts that are used in casts that
803 can be reduced to constants, so we only have to cope with
806 This bug hunt was triggered by Bug 37363 and the desire to remove
807 the duplicate pattern where we were "peeling" emptycasts to check
808 whether they were constants. Now constants will always be
811 * ecore.cs: Use an enumconstant here instead of wrapping with
814 * expression.cs (Cast.TryReduce): Ah, the tricky EnumConstant was
815 throwing me off. By handling this we can get rid of a few hacks.
817 * statement.cs (Switch): Removed Peel() code.
819 2003-02-14 Miguel de Icaza <miguel@ximian.com>
821 * class.cs: Location information for error 508
823 * expression.cs (New.DoResolve): Add a guard against double
824 resolution of an expression.
826 The New DoResolve might be called twice when initializing field
827 expressions (see EmitFieldInitializers, the call to
828 GetInitializerExpression will perform a resolve on the expression,
829 and later the assign will trigger another resolution
831 This leads to bugs (#37014)
833 * delegate.cs: The signature for EndInvoke should contain any ref
834 or out parameters as well. We were not doing this in the past.
836 * class.cs (Field.Define): Do not overwrite the type definition
837 inside the `volatile' group. Turns out that volatile enumerations
838 were changing the type here to perform a validity test, which
841 2003-02-12 Miguel de Icaza <miguel@ximian.com>
843 * ecore.cs (FieldExpr.AddressOf): In the particular case of This
844 and structs, we do not want to load the instance variable
846 (ImplicitReferenceConversion, ImplicitReferenceConversionExists):
847 enum_type has to be handled like an object reference (implicit
848 conversions exists from this to object), but the regular IsClass
849 and IsValueType tests will never return true for this one.
851 Also we use TypeManager.IsValueType instead of type.IsValueType,
852 just for consistency with the rest of the code (this is only
853 needed if we ever use the construct exposed by test-180.cs inside
854 corlib, which we dont today).
856 2003-02-12 Zoltan Varga <vargaz@freemail.hu>
858 * attribute.cs (ApplyAttributes): apply all MethodImplAttributes, not
861 2003-02-09 Martin Baulig <martin@ximian.com>
863 * namespace.cs (Namespace..ctor): Added SourceFile argument.
864 (Namespace.DefineNamespaces): New static public method; this is
865 called when we're compiling with debugging to add all namespaces
868 * tree.cs (Tree.RecordNamespace): Added SourceFile argument and
869 pass it to the Namespace's .ctor.
871 * symbolwriter.cs (SymbolWriter.OpenMethod): Added TypeContainer
872 and MethodBase arguments; pass the namespace ID to the symwriter;
873 pass the MethodBase instead of the token to the symwriter.
874 (SymbolWriter.DefineNamespace): New method to add a namespace to
877 2003-02-09 Martin Baulig <martin@ximian.com>
879 * symbolwriter.cs: New file. This is a wrapper around
880 ISymbolWriter with a cleaner API. We'll dynamically Invoke()
881 methods here in near future.
883 2003-02-09 Martin Baulig <martin@ximian.com>
885 * codegen.cs (EmitContext.Mark): Just pass the arguments to
886 ILGenerator.MarkSequencePoint() which are actually used by the
889 2003-02-09 Martin Baulig <martin@ximian.com>
891 * location.cs (SourceFile): New public sealed class. This
892 contains the name and an index which is used in the location's token.
893 (Location): Reserve an appropriate number of bits in the token for
894 the source file instead of walking over that list, this gives us a
895 really huge performance improvement when compiling with debugging.
897 * driver.cs (Driver.parse, Driver.tokenize_file): Take a
898 `SourceFile' argument instead of a string.
899 (Driver.ProcessFile): Add all the files via Location.AddFile(),
900 but don't parse/tokenize here, we need to generate the list of all
901 source files before we do that.
902 (Driver.ProcessFiles): New static function. Parses/tokenizes all
905 * cs-parser.jay (CSharpParser): Take a `SourceFile' argument
908 * cs-tokenizer.cs (Tokenizer): Take `SourceFile' argument instead
911 2003-02-09 Martin Baulig <martin@ximian.com>
913 * cs-tokenizer.cs (Tokenizer.PreProcessLine): Also reset the
914 filename on `#line default'.
916 Sat Feb 8 17:03:16 CET 2003 Paolo Molaro <lupus@ximian.com>
918 * statement.cs: don't clear the pinned var when the fixed statement
919 returns from the method (fixes bug#37752).
921 Sat Feb 8 12:58:06 CET 2003 Paolo Molaro <lupus@ximian.com>
923 * typemanager.cs: fix from mathpup@mylinuxisp.com (Marcus Urban)
926 2003-02-07 Martin Baulig <martin@ximian.com>
928 * driver.cs: Removed the `--debug-args' command line argument.
930 * codegen.cs (CodeGen.SaveSymbols): Removed, this is now done
931 automatically by the AsssemblyBuilder.
932 (CodeGen.InitializeSymbolWriter): We don't need to call any
933 initialization function on the symbol writer anymore. This method
934 doesn't take any arguments.
936 2003-02-03 Miguel de Icaza <miguel@ximian.com>
938 * driver.cs: (AddAssemblyAndDeps, LoadAssembly): Enter the types
939 from referenced assemblies as well.
941 2003-02-02 Martin Baulig <martin@ximian.com>
943 * class.cs (MethodData.Emit): Generate debugging info for external methods.
945 2003-02-02 Martin Baulig <martin@ximian.com>
947 * class.cs (Constructor.Emit): Open the symbol writer before
948 emitting the constructor initializer.
949 (ConstructorInitializer.Emit): Call ec.Mark() to allow
950 single-stepping through constructor initializers.
952 2003-01-30 Miguel de Icaza <miguel@ximian.com>
954 * class.cs: Handle error 549: do not allow virtual methods in
957 2003-02-01 Jackson Harper <jackson@latitudegeo.com>
959 * decl.cs: Check access levels when resolving types
961 2003-01-31 Jackson Harper <jackson@latitudegeo.com>
963 * statement.cs: Add parameters and locals set in catch blocks that might
966 2003-01-29 Miguel de Icaza <miguel@ximian.com>
968 * class.cs (Operator): Set the SpecialName flags for operators.
970 * expression.cs (Invocation.DoResolve): Only block calls to
971 accessors and operators on SpecialName methods.
973 (Cast.TryReduce): Handle conversions from char constants.
976 Tue Jan 28 17:30:57 CET 2003 Paolo Molaro <lupus@ximian.com>
978 * statement.cs: small memory and time optimization in FlowBranching.
980 2003-01-28 Pedro Mart <yoros@wanadoo.es>
982 * expression.cs (IndexerAccess.DoResolveLValue): Resolve the same
983 problem that the last fix but in the other sid (Set).
985 * expression.cs (IndexerAccess.DoResolve): Fix a problem with a null
986 access when there is no indexer in the hierarchy.
988 2003-01-27 Jackson Harper <jackson@latitudegeo.com>
990 * class.cs: Combine some if statements.
992 2003-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
994 * driver.cs: fixed bug #37187.
996 2003-01-27 Pedro Martinez Juliá <yoros@wanadoo.es>
998 * expression.cs (IndexerAccess.DoResolve): Before trying to resolve
999 any indexer, it's needed to build a list with all the indexers in the
1000 hierarchy (AllGetters), else we have problems. Fixes #35653.
1002 2003-01-23 Miguel de Icaza <miguel@ximian.com>
1004 * class.cs (MethodData.Define): It is wrong for an interface
1005 implementation to be static in both cases: explicit and implicit.
1006 We were only handling this in one case.
1008 Improve the if situation there to not have negations.
1010 * class.cs (Field.Define): Turns out that we do not need to check
1011 the unsafe bit on field definition, only on usage. Remove the test.
1013 2003-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1015 * driver.cs: use assembly.Location instead of Codebase (the latest
1016 patch made mcs fail when using MS assemblies).
1018 2003-01-21 Tim Haynes <thaynes@openlinksw.com>
1020 * driver.cs: use DirectorySeparatorChar instead of a hardcoded "/" to
1021 get the path to *corlib.dll.
1023 2003-01-21 Nick Drochak <ndrochak@gol.com>
1027 * typemanager.cs: Remove compiler warnings
1029 2003-01-20 Duncan Mak <duncan@ximian.com>
1031 * AssemblyInfo.cs: Bump the version number to 0.19.
1033 2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1035 * cs-tokenizer.cs: little fixes to line numbering when #line is used.
1037 2003-01-18 Zoltan Varga <vargaz@freemail.hu>
1039 * class.cs (Constructor::Emit): Emit debugging info for constructors.
1041 2003-01-17 Miguel de Icaza <miguel@ximian.com>
1043 * cs-parser.jay: Small fix: we were not comparing the constructor
1044 name correctly. Thanks to Zoltan for the initial pointer.
1046 2003-01-16 Jackson Harper <jackson@latitudegeo.com>
1048 * cs-tokenizer.cs: Set file name when specified with #line
1050 2003-01-15 Miguel de Icaza <miguel@ximian.com>
1052 * cs-parser.jay: Only perform the constructor checks here if we
1053 are named like the class; This will help provider a better
1054 error. The constructor path is taken when a type definition is
1055 not found, but most likely the user forgot to add the type, so
1056 report that rather than the constructor error.
1058 Tue Jan 14 10:36:49 CET 2003 Paolo Molaro <lupus@ximian.com>
1060 * class.cs, rootcontext.cs: small changes to avoid unnecessary memory
1063 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1065 * cs-parser.jay: Add cleanup call.
1067 2003-01-13 Duncan Mak <duncan@ximian.com>
1069 * cs-tokenizer.cs (Cleanup): Rename to 'cleanup' to make it more
1070 consistent with other methods.
1072 2003-01-13 Jackson Harper <jackson@latitudegeo.com>
1074 * cs-tokenizer.cs: Add Cleanup method, also fix #region error messages.
1076 Sun Jan 12 19:58:42 CET 2003 Paolo Molaro <lupus@ximian.com>
1078 * attribute.cs: only set GuidAttr to true when we have a
1081 2003-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1085 * typemanager.cs: fixes to allow mcs compile corlib with the new
1086 Type.IsSubclassOf fix.
1088 2003-01-08 Miguel de Icaza <miguel@ximian.com>
1090 * expression.cs (LocalVariableReference.DoResolve): Classify a
1091 constant as a value, not as a variable. Also, set the type for
1094 * cs-parser.jay (fixed_statement): take a type instead of a
1095 pointer_type, so we can produce a better error message later.
1097 * statement.cs (Fixed.Resolve): Flag types that are not pointers
1100 (For.DoEmit): Make inifinite loops have a
1101 non-conditional branch back.
1103 (Fixed.DoEmit): First populate the pinned variables, then emit the
1104 statement, then clear the variables. Before I was emitting the
1105 code once for each fixed piece.
1108 2003-01-08 Martin Baulig <martin@ximian.com>
1110 * statement.cs (FlowBranching.MergeChild): A break in a
1111 SWITCH_SECTION does not leave a loop. Fixes #36155.
1113 2003-01-08 Martin Baulig <martin@ximian.com>
1115 * statement.cs (FlowBranching.CheckOutParameters): `struct_params'
1116 lives in the same number space than `param_map'. Fixes #36154.
1118 2003-01-07 Miguel de Icaza <miguel@ximian.com>
1120 * cs-parser.jay (constructor_declaration): Set the
1121 Constructor.ModFlags before probing for it. This makes the
1122 compiler report 514, 515 and 132 (the code was there, but got
1125 * statement.cs (Goto.Resolve): Set `Returns' to ALWAYS.
1126 (GotoDefault.Resolve): Set `Returns' to ALWAYS.
1127 (GotoCase.Resolve): Set `Returns' to ALWAYS.
1129 Tue Jan 7 18:32:24 CET 2003 Paolo Molaro <lupus@ximian.com>
1131 * enum.cs: create the enum static fields using the enum type.
1133 Tue Jan 7 18:23:44 CET 2003 Paolo Molaro <lupus@ximian.com>
1135 * class.cs: don't try to create the ParamBuilder for the return
1136 type if it's not needed (and handle it breaking for the ms runtime
1139 2003-01-06 Jackson Harper <jackson@latitudegeo.com>
1141 * cs-tokenizer.cs: Add REGION flag to #region directives, and add checks to make sure that regions are being poped correctly
1143 2002-12-29 Miguel de Icaza <miguel@ximian.com>
1145 * cs-tokenizer.cs (get_cmd_arg): Fixups to allow \r to terminate
1146 the command. This showed up while compiling the JANET source
1147 code, which used \r as its only newline separator.
1149 2002-12-28 Miguel de Icaza <miguel@ximian.com>
1151 * class.cs (Method.Define): If we are an operator (because it
1152 reuses our code), then set the SpecialName and HideBySig. #36128
1154 2002-12-22 Miguel de Icaza <miguel@ximian.com>
1156 * ecore.cs (FieldExpr.DoResolve): Instead of throwing an
1157 exception, report error 120 `object reference required'.
1159 * driver.cs: Add --pause option, used during to measure the size
1160 of the process as it goes with --timestamp.
1162 * expression.cs (Invocation.DoResolve): Do not allow methods with
1163 SpecialName to be invoked.
1165 2002-12-21 Miguel de Icaza <miguel@ximian.com>
1167 * cs-tokenizer.cs: Small fix to the parser: compute the ascii
1168 number before adding it.
1170 2002-12-21 Ravi Pratap <ravi@ximian.com>
1172 * ecore.cs (StandardImplicitConversion): When in an unsafe
1173 context, we allow conversion between void * to any other pointer
1174 type. This fixes bug #35973.
1176 2002-12-20 Jackson Harper <jackson@latitudegeo.com>
1178 * codegen.cs: Use Path.GetFileNameWithoutExtension so an exception
1179 is not thrown when extensionless outputs are used
1181 2002-12-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1183 * rootcontext.cs: fixed compilation of corlib.
1185 2002-12-19 Miguel de Icaza <miguel@ximian.com>
1187 * attribute.cs (Attributes.Contains): Add new method.
1189 * class.cs (MethodCore.LabelParameters): if the parameter is an
1190 `out' parameter, check that no attribute `[In]' has been passed.
1192 * enum.cs: Handle the `value__' name in an enumeration.
1194 2002-12-14 Jaroslaw Kowalski <jarek@atm.com.pl>
1196 * decl.cs: Added special case to allow overrides on "protected
1199 2002-12-18 Ravi Pratap <ravi@ximian.com>
1201 * attribute.cs (Attributes.AddAttributeSection): Rename to this
1202 since it makes much more sense.
1204 (Attributes.ctor): Don't require a Location parameter.
1206 * rootcontext.cs (AddGlobalAttributeSection): Rename again.
1208 * attribute.cs (ApplyAttributes): Remove extra Location parameters
1209 since we already have that information per attribute.
1211 * everywhere : make appropriate changes.
1213 * class.cs (LabelParameters): Write the code which actually
1214 applies attributes to the return type. We can't do this on the MS
1215 .NET runtime so we flag a warning in the case an exception is
1218 2002-12-18 Miguel de Icaza <miguel@ximian.com>
1220 * const.cs: Handle implicit null conversions here too.
1222 2002-12-17 Ravi Pratap <ravi@ximian.com>
1224 * class.cs (MethodCore.LabelParameters): Remove the extra
1225 Type [] parameter since it is completely unnecessary. Instead
1226 pass in the method's attributes so that we can extract
1227 the "return" attribute.
1229 2002-12-17 Miguel de Icaza <miguel@ximian.com>
1231 * cs-parser.jay (parse): Use Report.Error to flag errors instead
1232 of ignoring it and letting the compile continue.
1234 * typemanager.cs (ChangeType): use an extra argument to return an
1235 error condition instead of throwing an exception.
1237 2002-12-15 Miguel de Icaza <miguel@ximian.com>
1239 * expression.cs (Unary.TryReduce): mimic the code for the regular
1240 code path. Perform an implicit cast in the cases where we can
1241 implicitly convert to one of the integral types, and then reduce
1242 based on that constant. This fixes bug #35483.
1244 2002-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1246 * typemanager.cs: fixed cut & paste error in GetRemoveMethod.
1248 2002-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1250 * namespace.cs: fixed bug #35489.
1252 2002-12-12 Miguel de Icaza <miguel@ximian.com>
1254 * class.cs: Remove some dead code.
1256 * cs-parser.jay: Estimate the number of methods needed
1257 (RootContext.MethodCount);
1259 * cs-tokenizer.cs: Use char arrays for parsing identifiers and
1260 numbers instead of StringBuilders.
1262 * support.cs (PtrHashtable): Add constructor with initial size;
1263 We can now reduce reallocations of the method table.
1265 2002-12-10 Ravi Pratap <ravi@ximian.com>
1267 * attribute.cs (ApplyAttributes): Keep track of the emitted
1268 attributes on a per-target basis. This fixes bug #35413.
1270 2002-12-10 Miguel de Icaza <miguel@ximian.com>
1272 * driver.cs (MainDriver): On rotor encoding 28591 does not exist,
1273 default to the Windows 1252 encoding.
1275 (UnixParseOption): Support version, thanks to Alp for the missing
1278 * AssemblyInfo.cs: Add nice assembly information.
1280 * cs-tokenizer.cs: Add fix from Felix to the #if/#else handler
1283 * cs-parser.jay: Allow a trailing comma before the close bracked
1284 in the attribute_section production.
1286 * ecore.cs (FieldExpr.AddressOf): Until I figure out why the
1287 address of the instance was being taken, I will take this out,
1288 because we take the address of the object immediately here.
1290 2002-12-09 Ravi Pratap <ravi@ximian.com>
1292 * typemanager.cs (AreMultipleAllowed): Take care of the most
1293 obvious case where attribute type is not in the current assembly -
1296 2002-12-08 Miguel de Icaza <miguel@ximian.com>
1298 * ecore.cs (SimpleName.DoResolve): First perform lookups on using
1299 definitions, instead of doing that afterwards.
1301 Also we use a nice little hack, depending on the constructor, we
1302 know if we are a "composed" name or a simple name. Hence, we
1303 avoid the IndexOf test, and we avoid
1305 * codegen.cs: Add code to assist in a bug reporter to track down
1306 the source of a compiler crash.
1308 2002-12-07 Ravi Pratap <ravi@ximian.com>
1310 * attribute.cs (Attribute.ApplyAttributes) : Keep track of which attribute
1311 types have been emitted for a given element and flag an error
1312 if something which does not have AllowMultiple set is used more
1315 * typemanager.cs (RegisterAttributeAllowMultiple): Keep track of
1316 attribute types and their corresponding AllowMultiple properties
1318 (AreMultipleAllowed): Check the property for a given type.
1320 * attribute.cs (Attribute.ApplyAttributes): Register the AllowMultiple
1321 property in the case we have a TypeContainer.
1323 (Attributes.AddAttribute): Detect duplicates and just skip on
1324 adding them. This trivial fix catches a pretty gross error in our
1325 attribute emission - global attributes were being emitted twice!
1327 Bugzilla bug #33187 is now fixed.
1329 2002-12-06 Miguel de Icaza <miguel@ximian.com>
1331 * cs-tokenizer.cs (pp_expr): Properly recurse here (use pp_expr
1334 * expression.cs (Binary.ResolveOperator): I can only use the
1335 Concat (string, string, string) and Concat (string, string,
1336 string, string) if the child is actually a concatenation of
1339 2002-12-04 Miguel de Icaza <miguel@ximian.com>
1341 * cs-tokenizer.cs: Small fix, because decimal_digits is used in a
1342 context where we need a 2-character lookahead.
1344 * pending.cs (PendingImplementation): Rework so we can keep track
1345 of interface types all the time, and flag those which were
1346 implemented by parents as optional.
1348 2002-12-03 Miguel de Icaza <miguel@ximian.com>
1350 * expression.cs (Binary.ResolveOperator): Use
1351 String.Concat(string,string,string) or
1352 String.Concat(string,string,string,string) when possible.
1354 * typemanager: More helper methods.
1357 Tue Dec 3 19:32:04 CET 2002 Paolo Molaro <lupus@ximian.com>
1359 * pending.cs: remove the bogus return from GetMissingInterfaces()
1360 (see the 2002-11-06 entry: the mono runtime is now fixed in cvs).
1362 2002-12-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1364 * namespace.cs: avoid duplicated 'using xxx' being added to
1365 using_clauses. This prevents mcs from issuing and 'ambiguous type' error
1366 when we get more than one 'using' statement for the same namespace.
1367 Report a CS0105 warning for it.
1369 2002-11-30 Miguel de Icaza <miguel@ximian.com>
1371 * cs-tokenizer.cs (consume_identifier): use read directly, instead
1372 of calling getChar/putback, uses internal knowledge of it.
1374 (xtoken): Reorder tokenizer so most common patterns are checked
1375 first. This reduces the compilation time in another 5% (from 8.11s
1376 average to 7.73s for bootstrapping mcs on my Mobile p4/1.8ghz).
1378 The parsing time is 22% of the compilation in mcs, and from that
1379 64% is spent on the tokenization process.
1381 I tried using a binary search for keywords, but this is slower
1382 than the hashtable. Another option would be to do a couple of
1385 * Not use a StringBuilder, instead use an array of chars,
1386 with a set value. Notice that this way we could catch
1387 the 645 error without having to do it *afterwards*.
1389 * We could write a hand-parser to avoid the hashtable
1390 compares altogether.
1392 The identifier consumption process takes 37% of the tokenization
1393 time. Another 15% is spent on is_number. 56% of the time spent
1394 on is_number is spent on Int64.Parse:
1396 * We could probably choose based on the string length to
1397 use Int32.Parse or Int64.Parse and avoid all the 64-bit
1400 Another 3% is spend on wrapping `xtoken' in the `token' function.
1402 Handle 0xa0 as whitespace (#34752)
1404 2002-11-26 Miguel de Icaza <miguel@ximian.com>
1406 * typemanager.cs (IsCLRType): New routine to tell whether a type
1407 is one of the builtin types.
1409 Maybe it needs to use TypeCodes to be faster. Maybe we could use
1410 typecode in more places instead of doing pointer comparissions.
1411 We could leverage some knowledge about the way the typecodes are
1414 New code to cache namespaces in assemblies, it is currently not
1415 invoked, to be used soon.
1417 * decl.cs (DeclSpace.MakeFQN): Simple optimization.
1419 * expression.cs (Binary.ResolveOperator): specially handle
1420 strings, and do not perform user-defined operator overloading for
1423 2002-11-24 Miguel de Icaza <miguel@ximian.com>
1425 * cs-tokenizer.cs: Avoid calling Char.IsDigit which is an
1426 internalcall as it is a pretty simple operation; Avoid whenever
1427 possible to call Char.IsLetter.
1429 (consume_identifier): Cut by half the number of
1430 hashtable calls by merging the is_keyword and GetKeyword behavior.
1432 Do not short-circuit, because if we do, we
1433 report errors (ie, #if false && true would produce an invalid
1437 2002-11-24 Martin Baulig <martin@ximian.com>
1439 * expression.cs (Cast.TryReduce): If we're in checked syntax,
1440 check constant ranges and report a CS0221. Fixes #33186.
1442 2002-11-24 Martin Baulig <martin@ximian.com>
1444 * cs-parser.jay: Make this work for uninitialized variable
1445 declarations in the `for' initializer. Fixes #32416.
1447 2002-11-24 Martin Baulig <martin@ximian.com>
1449 * ecore.cs (Expression.ConvertExplicit): Make casting from/to
1450 System.Enum actually work. Fixes bug #32269, added verify-6.cs.
1452 2002-11-24 Martin Baulig <martin@ximian.com>
1454 * expression.cs (Binary.DoNumericPromotions): Added `check_user_conv'
1455 argument; if true, we also check for user-defined conversions.
1456 This is only needed if both arguments are of a user-defined type.
1457 Fixes #30443, added test-175.cs.
1458 (Binary.ForceConversion): Pass the location argument to ConvertImplicit.
1460 * ecore.cs (Expression.ImplicitUserConversionExists): New method.
1462 2002-11-24 Martin Baulig <martin@ximian.com>
1464 * expression.cs (ArrayAccess.GetStoreOpcode): New public static
1465 function to get the store opcode.
1466 (Invocation.EmitParams): Call ArrayAccess.GetStoreOpcode() and
1467 only emit the Ldelema if the store opcode is Stobj. You must run
1468 both test-34 and test-167 to test this. Fixes #34529.
1470 2002-11-23 Martin Baulig <martin@ximian.com>
1472 * ecore.cs (Expression.MemberLookup): Added additional
1473 `qualifier_type' argument which is used when we're being called
1474 from MemberAccess.DoResolve() and null if we're called from a
1476 (Expression.MemberLookupFailed): New method to report errors; this
1477 does the CS1540 check and reports the correct error message.
1479 * typemanager.cs (MemberLookup): Added additional `qualifier_type'
1480 argument for the CS1540 check and redone the way how we're dealing
1481 with private members. See the comment in the source code for details.
1482 (FilterWithClosure): Reverted this back to revision 1.197; renamed
1483 `closure_start_type' to `closure_qualifier_type' and check whether
1484 it's not null. It was not this filter being broken, it was just
1485 being called with the wrong arguments.
1487 * expression.cs (MemberAccess.DoResolve): use MemberLookupFinal()
1488 and pass it the correct `qualifier_type'; this also does the error
1491 2002-11-22 Miguel de Icaza <miguel@ximian.com>
1493 * expression.cs (Invocation.EmitParams): If the we are dealing
1494 with a non-built-in value type, load its address as well.
1496 (ArrayCreation): Use a a pretty constant instead
1497 of the hardcoded value 2. Use 6 instead of 2 for the number of
1498 static initializers.
1500 (ArrayCreation.EmitDynamicInitializers): Peel enumerations,
1501 because they are not really value types, just glorified integers.
1503 * driver.cs: Do not append .exe, the CSC compiler does not do it.
1505 * ecore.cs: Remove redundant code for enumerations, make them use
1506 the same code path as everything else, fixes the casting issue
1507 with enumerations in Windows.Forms.
1509 * attribute.cs: Do only cast to string if it is a string, the
1510 validation happens later.
1512 * typemanager.cs: Temproary hack to avoid a bootstrap issue until
1513 people upgrade their corlibs.
1515 * ecore.cs: Oops, enumerations were not following the entire code path
1517 2002-11-21 Miguel de Icaza <miguel@ximian.com>
1519 * typemanager.cs (FilterWithClosure): Commented out the test for
1520 1540 in typemanager.cs, as it has problems when accessing
1521 protected methods from a parent class (see test-174.cs).
1523 * attribute.cs (Attribute.ValidateGuid): new method.
1524 (Attribute.Resolve): Use above.
1526 2002-11-19 Miguel de Icaza <miguel@ximian.com>
1528 * enum.cs: In FindMembers, perform a recursive lookup for values. (34308)
1530 * ecore.cs (SimpleName.SimpleNameResolve): Remove the special
1531 handling for enumerations, as we only needed the TypeContainer
1532 functionality to begin with (this is required for the fix below to
1533 work for enums that reference constants in a container class for
1536 * codegen.cs (EmitContext): Make TypeContainer a DeclSpace.
1538 * enum.cs (Enum.Define): Use `this' instead of parent, so we have
1539 a valid TypeBuilder to perform lookups on.o
1541 * class.cs (InheritableMemberSignatureCompare): Use true in the
1542 call to GetGetMethod and GetSetMethod, because we are comparing
1543 the signature, and we need to get the methods *even* if they are
1546 (PropertyBase.CheckBase): ditto.
1548 * statement.cs (Switch.ResolveAndReduce, Block.EmitMeta,
1549 GotoCase.Resolve): Use Peel on EmpytCasts.
1551 * ecore.cs (EmptyCast): drop child, add Peel method.
1553 2002-11-17 Martin Baulig <martin@ximian.com>
1555 * ecore.cs (EmptyCast.Child): New public property.
1557 * statement.cs (SwitchLabel.ResolveAndReduce): Check whether the
1558 label resolved to an EmptyCast. Fixes #34162.
1559 (GotoCase.Resolve): Likewise.
1560 (Block.EmitMeta): Likewise.
1562 2002-11-17 Martin Baulig <martin@ximian.com>
1564 * expression.cs (Invocation.BetterConversion): Prefer int over
1565 uint; short over ushort; long over ulong for integer literals.
1566 Use ImplicitConversionExists instead of StandardConversionExists
1567 since we also need to check for user-defined implicit conversions.
1568 Fixes #34165. Added test-173.cs.
1570 2002-11-16 Martin Baulig <martin@ximian.com>
1572 * expression.cs (Binary.EmitBranchable): Eliminate comparisions
1573 with the `true' and `false' literals. Fixes #33151.
1575 2002-11-16 Martin Baulig <martin@ximian.com>
1577 * typemanager.cs (RealMemberLookup): Reverted Miguel's patch from
1578 October 22nd; don't do the cs1540 check for static members.
1580 * ecore.cs (PropertyExpr.ResolveAccessors): Rewrote this; we're
1581 now using our own filter here and doing the cs1540 check again.
1583 2002-11-16 Martin Baulig <martin@ximian.com>
1585 * support.cs (InternalParameters): Don't crash if we don't have
1586 any fixed parameters. Fixes #33532.
1588 2002-11-16 Martin Baulig <martin@ximian.com>
1590 * decl.cs (MemberCache.AddMethods): Use BindingFlags.FlattenHierarchy
1591 when looking up static methods to make this work on Windows.
1594 2002-11-16 Martin Baulig <martin@ximian.com>
1596 * ecore.cs (PropertyExpr.VerifyAssignable): Check whether we have
1597 a setter rather than using PropertyInfo.CanWrite.
1599 2002-11-15 Nick Drochak <ndrochak@gol.com>
1601 * class.cs: Allow acces to block member by subclasses. Fixes build
1604 2002-11-14 Martin Baulig <martin@ximian.com>
1606 * class.cs (Constructor.Emit): Added the extern/block check.
1609 2002-11-14 Martin Baulig <martin@ximian.com>
1611 * expression.cs (IndexerAccess.DoResolve): Do a DeclaredOnly
1612 iteration while looking for indexers, this is needed because the
1613 indexer may have a different name in our base classes. Fixed the
1614 error reporting (no indexers at all, not get accessor, no
1615 overloaded match). Fixes bug #33089.
1616 (IndexerAccess.DoResolveLValue): Likewise.
1618 2002-11-14 Martin Baulig <martin@ximian.com>
1620 * class.cs (PropertyBase.CheckBase): Make this work for multiple
1621 indexers. Fixes the first part of bug #33089.
1622 (MethodSignature.InheritableMemberSignatureCompare): Added support
1625 2002-11-13 Ravi Pratap <ravi@ximian.com>
1627 * attribute.cs (Attribute.Resolve): Catch the
1628 NullReferenceException and report it since it isn't supposed to
1631 2002-11-12 Miguel de Icaza <miguel@ximian.com>
1633 * expression.cs (Binary.EmitBranchable): Also handle the cases for
1634 LogicalOr and LogicalAnd that can benefit from recursively
1635 handling EmitBranchable. The code now should be nice for Paolo.
1637 2002-11-08 Miguel de Icaza <miguel@ximian.com>
1639 * typemanager.cs (LookupType): Added a negative-hit hashtable for
1640 the Type lookups, as we perform quite a number of lookups on
1641 non-Types. This can be removed once we can deterministically tell
1642 whether we have a type or a namespace in advance.
1644 But this might require special hacks from our corlib.
1648 * ecore.cs (TryImplicitIntConversion): Handle conversions to float
1649 and double which avoids a conversion from an integer to a double.
1651 * expression.cs: tiny optimization, avoid calling IsConstant,
1652 because it effectively performs the lookup twice.
1654 2002-11-06 Miguel de Icaza <miguel@ximian.com>
1656 But a bogus return here to keep the semantics of the old code
1657 until the Mono runtime is fixed.
1659 * pending.cs (GetMissingInterfaces): New method used to remove all
1660 the interfaces that are already implemented by our parent
1661 classes from the list of pending methods.
1663 * interface.cs: Add checks for calls after ResolveTypeExpr.
1665 2002-11-05 Miguel de Icaza <miguel@ximian.com>
1667 * class.cs (Class.Emit): Report warning 67: event not used if the
1668 warning level is beyond 3.
1670 * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
1671 being a NullLiteral.
1673 * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
1676 * class.cs (TypeContainer.GetClassBases): Cover a missing code
1677 path that might fail if a type can not be resolved.
1679 * expression.cs (Binary.Emit): Emit unsigned versions of the
1682 * driver.cs: use error 5.
1684 2002-11-02 Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
1686 * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
1688 2002-11-01 Miguel de Icaza <miguel@ximian.com>
1690 * cs-parser.jay (switch_section): A beautiful patch from Martin
1691 Baulig that fixed 33094.
1693 2002-10-31 Miguel de Icaza <miguel@ximian.com>
1695 * ecore.cs (PropertyExpr.DoResolveLValue, PropertyExpr.DoResolve):
1696 Check whether the base is abstract and report an error if so.
1698 * expression.cs (IndexerAccess.DoResolveLValue,
1699 IndexerAccess.DoResolve): ditto.
1701 (Invocation.DoResolve): ditto.
1703 (Invocation.FullMethodDesc): Improve the report string.
1705 * statement.cs (Block): Eliminate IsVariableDefined as it is
1706 basically just a wrapper for GetVariableInfo.
1708 * ecore.cs (SimpleName): Use new
1710 * support.cs (ReflectionParamter.ParameterType): We unwrap the
1711 type, as we return the actual parameter ref/unref state on a
1714 2002-10-30 Miguel de Icaza <miguel@ximian.com>
1716 * support.cs: Return proper flags REF/OUT fixing the previous
1719 * expression.cs: Reverted last patch, that was wrong. Is_ref is
1720 not used to mean `ref' but `ref or out' in ParameterReference
1722 * delegate.cs (FullDelegateDesc): use ParameterDesc to get the
1723 full type signature instead of calling TypeManger.CSharpName
1726 * support.cs (InternalParameters.ParameterDesc): Do not compare
1727 directly to the modflags, because REF/OUT will actually be bitsets
1730 * delegate.cs (VerifyMethod): Check also the modifiers.
1732 * cs-tokenizer.cs: Fix bug where floating point values with an
1733 exponent where a sign was missing was ignored.
1735 * driver.cs: Allow multiple assemblies to be specified in a single
1738 2002-10-28 Miguel de Icaza <miguel@ximian.com>
1740 * cs-parser.jay: Ugly. We had to add a multiplicative_expression,
1741 because identifiers after a parenthesis would end up in this kind
1742 of production, and we needed to desamiguate it for having casts
1745 (UserDefinedType *) xxx
1747 2002-10-24 Miguel de Icaza <miguel@ximian.com>
1749 * typemanager.cs (RealMemberLookup): when we deal with a subclass,
1750 we should set on the Bindingflags.NonPublic, but not turn on
1751 private_ok. private_ok controls whether a Private member is
1752 returned (this is chekced on the filter routine), while the
1753 BindingFlags.NonPublic just controls whether private/protected
1754 will be allowed. This fixes the problem part of the problem of
1755 private properties being allowed to be used in derived classes.
1757 * expression.cs (BaseAccess): Provide an DoResolveLValue method,
1758 so we can call the children DoResolveLValue method (this will
1759 properly signal errors on lvalue assignments to base properties)
1761 * ecore.cs (PropertyExpr.ResolveAccessors): If both setter and
1762 getter are null, and we have a property info, we know that this
1763 happened because the lookup failed, so we report an error 122 for
1764 protection level violation.
1766 We also silently return if setter and getter are null in the
1767 resolve functions, this condition only happens if we have flagged
1768 the error before. This is the other half of the problem.
1770 (PropertyExpr.ResolveAccessors): Turns out that PropertyInfo does
1771 not have accessibility information, that is why we were returning
1772 true in the filter function in typemanager.cs.
1774 To properly report 122 (property is inaccessible because of its
1775 protection level) correctly, we report this error in ResolveAccess
1776 by failing if both the setter and the getter are lacking (ie, the
1779 DoResolve and DoLResolve have been modified to check for both
1780 setter/getter being null and returning silently, the reason being
1781 that I did not want to put the knowledge about this error in upper
1784 int old = Report.Errors;
1785 x = new PropertyExpr (...);
1786 if (old != Report.Errors)
1791 So the property expr is returned, but it is invalid, so the error
1792 will be flagged during the resolve process.
1794 * class.cs: Remove InheritablePropertySignatureCompare from the
1795 class, as we no longer depend on the property signature to compute
1796 whether it is possible to implement a method or not.
1798 The reason is that calling PropertyInfo.GetGetMethod will return
1799 null (in .NET, in Mono it works, and we should change this), in
1800 cases where the Get Method does not exist in that particular
1805 class X { public virtual int A { get { return 1; } } }
1807 class Z : Y { public override int A { get { return 2; } } }
1809 Would fail in Z because the parent (Y) would not have the property
1810 defined. So we avoid this completely now (because the alternative
1811 fix was ugly and slow), and we now depend exclusively on the
1814 (PropertyBase.CheckBase): Use a method-base mechanism to find our
1815 reference method, instead of using the property.
1817 * typemanager.cs (GetPropertyGetter, GetPropertySetter): These
1818 routines are gone now.
1820 * typemanager.cs (GetPropertyGetter, GetPropertySetter): swap the
1821 names, they were incorrectly named.
1823 * cs-tokenizer.cs: Return are more gentle token on failure.
1825 * pending.cs (PendingImplementation.InterfaceMethod): This routine
1826 had an out-of-sync index variable, which caused it to remove from
1827 the list of pending methods the wrong method sometimes.
1829 2002-10-22 Miguel de Icaza <miguel@ximian.com>
1831 * ecore.cs (PropertyExpr): Do not use PropertyInfo.CanRead,
1832 CanWrite, because those refer to this particular instance of the
1833 property, and do not take into account the fact that we can
1834 override single members of a property.
1836 Constructor requires an EmitContext. The resolution process does
1837 not happen here, but we need to compute the accessors before,
1838 because the resolution does not always happen for properties.
1840 * typemanager.cs (RealMemberLookup): Set private_ok if we are a
1841 subclass, before we did not update this flag, but we did update
1844 (GetAccessors): Drop this routine, as it did not work in the
1845 presence of partially overwritten set/get methods.
1847 Notice that this broke the cs1540 detection, but that will require
1850 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1854 * driver.cs: issue a warning instead of an error if we don't support
1855 debugging for the platform. Also ignore a couple of errors that may
1856 arise when trying to write the symbols. Undo my previous patch.
1858 2002-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1860 * driver.cs: ignore /debug switch except for Unix platforms.
1862 2002-10-23 Nick Drochak <ndrochak@gol.com>
1864 * makefile: Remove mcs2.exe and mcs3.exe on 'make clean'
1866 2002-10-21 Miguel de Icaza <miguel@ximian.com>
1868 * driver.cs: Do not make mcs-debug conditional, so we do not break
1871 * statement.cs (UsageVector.MergeChildren): I would like Martin to
1872 review this patch. But basically after all the children variables
1873 have been merged, the value of "Breaks" was not being set to
1874 new_breaks for Switch blocks. I think that it should be set after
1875 it has executed. Currently I set this to the value of new_breaks,
1876 but only if new_breaks is FlowReturn.ALWAYS, which is a bit
1877 conservative, but I do not understand this code very well.
1879 I did not break anything in the build, so that is good ;-)
1881 * cs-tokenizer.cs: Also allow \r in comments as a line separator.
1883 2002-10-20 Mark Crichton <crichton@gimp.org>
1885 * cfold.cs: Fixed compile blocker. Really fixed it this time.
1887 2002-10-20 Nick Drochak <ndrochak@gol.com>
1889 * cfold.cs: Fixed compile blocker.
1891 2002-10-20 Miguel de Icaza <miguel@ximian.com>
1893 * driver.cs: I was chekcing the key, not the file.
1895 2002-10-19 Ravi Pratap <ravi@ximian.com>
1897 * ecore.cs (UserDefinedConversion): Get rid of the bogus error
1898 message that we were generating - we just need to silently return
1901 2002-10-19 Miguel de Icaza <miguel@ximian.com>
1903 * class.cs (Event.Define): Change my previous commit, as this
1904 breaks the debugger. This is a temporary hack, as it seems like
1905 the compiler is generating events incorrectly to begin with.
1907 * expression.cs (Binary.ResolveOperator): Added support for
1908 "U operator - (E x, E y)"
1910 * cfold.cs (BinaryFold): Added support for "U operator - (E x, E
1913 * ecore.cs (FieldExpr.AddressOf): We had a special code path for
1914 init-only variables, but this path did not take into account that
1915 there might be also instance readonly variables. Correct this
1918 This fixes bug 32253
1920 * delegate.cs (NewDelegate.DoResolve): Catch creation of unsafe
1923 * driver.cs: Change the extension for modules to `netmodule'
1925 * cs-parser.jay: Improved slightly the location tracking for
1926 the debugger symbols.
1928 * class.cs (Event.Define): Use Modifiers.FieldAttr on the
1929 modifiers that were specified instead of the hardcoded value
1930 (FamAndAssem). This was basically ignoring the static modifier,
1931 and others. Fixes 32429.
1933 * statement.cs (Switch.SimpleSwitchEmit): Simplified the code, and
1934 fixed a bug in the process (32476)
1936 * expression.cs (ArrayAccess.EmitAssign): Patch from
1937 hwang_rob@yahoo.ca that fixes bug 31834.3
1939 2002-10-18 Miguel de Icaza <miguel@ximian.com>
1941 * driver.cs: Make the module extension .netmodule.
1943 2002-10-16 Miguel de Icaza <miguel@ximian.com>
1945 * driver.cs: Report an error if the resource file is not found
1946 instead of crashing.
1948 * ecore.cs (PropertyExpr.EmitAssign): Pass IsBase instead of
1949 false, like Emit does.
1951 2002-10-16 Nick Drochak <ndrochak@gol.com>
1953 * typemanager.cs: Remove unused private member. Also reported mcs
1954 bug to report this as a warning like csc.
1956 2002-10-15 Martin Baulig <martin@gnome.org>
1958 * statement.cs (Statement.Emit): Made this a virtual method; emits
1959 the line number info and calls DoEmit().
1960 (Statement.DoEmit): New protected abstract method, formerly knows
1961 as Statement.Emit().
1963 * codegen.cs (EmitContext.Mark): Check whether we have a symbol writer.
1965 2002-10-11 Miguel de Icaza <miguel@ximian.com>
1967 * class.cs: Following the comment from 2002-09-26 to AddMethod, I
1968 have fixed a remaining problem: not every AddXXXX was adding a
1969 fully qualified name.
1971 Now everyone registers a fully qualified name in the DeclSpace as
1972 being defined instead of the partial name.
1974 Downsides: we are slower than we need to be due to the excess
1975 copies and the names being registered this way.
1977 The reason for this is that we currently depend (on the corlib
1978 bootstrap for instance) that types are fully qualified, because
1979 we dump all the types in the namespace, and we should really have
1980 types inserted into the proper namespace, so we can only store the
1981 basenames in the defined_names array.
1983 2002-10-10 Martin Baulig <martin@gnome.org>
1985 * expression.cs (ArrayAccess.EmitStoreOpcode): Reverted the patch
1986 from bug #31834, see the bug report for a testcase which is
1989 2002-10-10 Martin Baulig <martin@gnome.org>
1991 * codegen.cs (EmitContext.Breaks): Removed, we're now using the
1992 flow analysis code for this.
1994 * statement.cs (Do, While, For): Tell the flow analysis code about
1996 (FlowBranching.UsageVector): Added support for infinite loops.
1997 (Block.Resolve): Moved the dead code elimination here and use flow
2000 2002-10-09 Miguel de Icaza <miguel@ximian.com>
2002 * class.cs (Field.Define): Catch cycles on struct type
2005 * typemanager.cs (IsUnmanagedtype): Do not recursively check
2006 fields if the fields are static. We only need to check instance
2009 * expression.cs (As.DoResolve): Test for reference type.
2011 * statement.cs (Using.ResolveExpression): Use
2012 ConvertImplicitRequired, not ConvertImplicit which reports an
2014 (Using.ResolveLocalVariableDecls): ditto.
2016 * expression.cs (Binary.ResolveOperator): Report errors in a few
2017 places where we had to.
2019 * typemanager.cs (IsUnmanagedtype): Finish implementation.
2021 2002-10-08 Miguel de Icaza <miguel@ximian.com>
2023 * expression.cs: Use StoreFromPtr instead of extracting the type
2024 and then trying to use Stelem. Patch is from hwang_rob@yahoo.ca
2026 * ecore.cs (ImplicitReferenceConversion): It is possible to assign
2027 an enumeration value to a System.Enum, but System.Enum is not a
2028 value type, but an class type, so we need to box.
2030 (Expression.ConvertExplicit): One codepath could return
2031 errors but not flag them. Fix this. Fixes #31853
2033 * parameter.cs (Resolve): Do not allow void as a parameter type.
2035 2002-10-06 Martin Baulig <martin@gnome.org>
2037 * statemenc.cs (FlowBranching.SetParameterAssigned): Don't crash
2038 if it's a class type and not a struct. Fixes #31815.
2040 2002-10-06 Martin Baulig <martin@gnome.org>
2042 * statement.cs: Reworked the flow analysis code a bit to make it
2043 usable for dead code elimination.
2045 2002-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2047 * cs-parser.jay: allow empty source files. Fixes bug #31781.
2049 2002-10-04 Miguel de Icaza <miguel@ximian.com>
2051 * expression.cs (ComposedCast.DoResolveType): A quick workaround
2052 to fix the test 165, will investigate deeper.
2054 2002-10-04 Martin Baulig <martin@gnome.org>
2056 * statement.cs (FlowBranching.UsageVector.MergeChildren): Make
2057 finally blocks actually work.
2058 (Try.Resolve): We don't need to create a sibling for `finally' if
2059 there is no finally block.
2061 2002-10-04 Martin Baulig <martin@gnome.org>
2063 * class.cs (Constructor.Define): The default accessibility for a
2064 non-default constructor is private, not public.
2066 2002-10-04 Miguel de Icaza <miguel@ximian.com>
2068 * class.cs (Constructor): Make AllowedModifiers public, add
2071 * cs-parser.jay: Perform the modifiers test here, as the
2072 constructor for the Constructor class usually receives a zero
2073 because of the way we create it (first we create, later we
2074 customize, and we were never checking the modifiers).
2076 * typemanager.cs (Typemanager.LookupTypeDirect): This new function
2077 is a version of LookupTypeReflection that includes the type-name
2078 cache. This can be used as a fast path for functions that know
2079 the fully qualified name and are only calling into *.GetType() to
2080 obtain a composed type.
2082 This is also used by TypeManager.LookupType during its type
2085 (LookupType): We now also track the real type name, as sometimes
2086 we can get a quey for the real type name from things like
2087 ComposedCast. This fixes bug 31422.
2089 * expression.cs (ComposedCast.Resolve): Since we are obtaining a
2090 complete type fullname, it does not have to go through the type
2091 resolution system to obtain the composed version of the type (for
2092 obtaining arrays or pointers).
2094 (Conditional.Emit): Use the EmitBoolExpression to
2095 generate nicer code, as requested by Paolo.
2097 (ArrayCreation.CheckIndices): Use the patch from
2098 hwang_rob@yahoo.ca to validate the array initializers.
2100 2002-10-03 Miguel de Icaza <miguel@ximian.com>
2102 * class.cs (ConstructorInitializer.Emit): simplify code by using
2103 Invocation.EmitCall, and at the same time, fix the bugs in calling
2104 parent constructors that took variable arguments.
2106 * ecore.cs (Expression.ConvertNumericExplicit,
2107 Expression.ImplicitNumericConversion): Remove the code that
2108 manually wrapped decimal (InternalTypeConstructor call is now gone
2111 * expression.cs (Cast.TryReduce): Also handle decimal types when
2112 trying to perform a constant fold on the type.
2114 * typemanager.cs (IsUnmanagedtype): Partially implemented.
2116 * parameter.cs: Removed ResolveAndDefine, as it was not needed, as
2117 that only turned off an error report, and did nothing else.
2119 2002-10-02 Miguel de Icaza <miguel@ximian.com>
2121 * driver.cs: Handle and ignore /fullpaths
2123 2002-10-01 Miguel de Icaza <miguel@ximian.com>
2125 * expression.cs (Binary.ResolveOperator): Catch the case where
2126 DoNumericPromotions returns true,
2128 (Binary.DoNumericPromotions): Simplify the code, and the tests.
2130 2002-09-27 Miguel de Icaza <miguel@ximian.com>
2132 * ecore.cs (EventExpr.Emit): Instead of emitting an exception,
2135 2002-09-26 Miguel de Icaza <miguel@ximian.com>
2137 * ecore.cs (ConvertNumericExplicit): It is not enough that the
2138 conversion exists, but it is also required that the conversion be
2139 performed. This manifested in "(Type64Enum) 2".
2141 * class.cs (TypeManager.AddMethod): The fix is not to change
2142 AddEnum, because that one was using a fully qualified name (every
2143 DeclSpace derivative does), but to change the AddMethod routine
2144 that was using an un-namespaced name. This now correctly reports
2145 the duplicated name.
2147 Revert patch until I can properly fix it. The issue
2148 is that we have a shared Type space across all namespaces
2149 currently, which is wrong.
2151 Options include making the Namespace a DeclSpace, and merge
2152 current_namespace/current_container in the parser.
2154 2002-09-25 Miguel de Icaza <miguel@ximian.com>
2156 * cs-parser.jay: Improve error reporting when we get a different
2157 kind of expression in local_variable_type and
2158 local_variable_pointer_type.
2160 Propagate this to avoid missleading errors being reported.
2162 * ecore.cs (ImplicitReferenceConversion): treat
2163 TypeManager.value_type as a target just like object_type. As
2168 Is valid, and needs to result in the int 1 being boxed before it
2169 is assigned to the value type v.
2171 * class.cs (TypeContainer.AddEnum): Use the basename, not the name
2172 to validate the enumeration name.
2174 * expression.cs (ArrayAccess.EmitAssign): Mimic the same test from
2175 EmitDynamicInitializers for the criteria to use Ldelema. Thanks
2176 to hwang_rob@yahoo.ca for finding the bug and providing a patch.
2178 * ecore.cs (TryImplicitIntConversion): When doing an
2179 implicit-enumeration-conversion, check if the type is 64-bits and
2180 perform a conversion before passing to EnumConstant.
2182 2002-09-23 Miguel de Icaza <miguel@ximian.com>
2184 * decl.cs (Error_AmbiguousTypeReference); New routine used to
2185 report ambiguous type references. Unlike the MS version, we
2186 report what the ambiguity is. Innovation at work ;-)
2188 (DeclSpace.FindType): Require a location argument to
2189 display when we display an ambiguous error.
2191 * ecore.cs: (SimpleName.DoResolveType): Pass location to FindType.
2193 * interface.cs (GetInterfaceTypeByName): Pass location to FindType.
2195 * expression.cs (EmitDynamicInitializers): Apply patch from
2196 hwang_rob@yahoo.ca that fixes the order in which we emit our
2199 2002-09-21 Martin Baulig <martin@gnome.org>
2201 * delegate.cs (Delegate.VerifyApplicability): Make this work if the
2202 delegate takes no arguments.
2204 2002-09-20 Miguel de Icaza <miguel@ximian.com>
2206 * constant.cs: Use Conv_U8 instead of Conv_I8 when loading longs
2209 * expression.cs: Extract the underlying type.
2211 * ecore.cs (StoreFromPtr): Use TypeManager.IsEnumType instad of IsEnum
2213 * decl.cs (FindType): Sorry about this, fixed the type lookup bug.
2215 2002-09-19 Miguel de Icaza <miguel@ximian.com>
2217 * class.cs (TypeContainer.DefineType): We can not use the nice
2218 PackingSize with the size set to 1 DefineType method, because it
2219 will not allow us to define the interfaces that the struct
2222 This completes the fixing of bug 27287
2224 * ecore.cs (Expresion.ImplicitReferenceConversion): `class-type S'
2225 means also structs. This fixes part of the problem.
2226 (Expresion.ImplicitReferenceConversionExists): ditto.
2228 * decl.cs (DeclSparce.ResolveType): Only report the type-not-found
2229 error if there were no errors reported during the type lookup
2230 process, to avoid duplicates or redundant errors. Without this
2231 you would get an ambiguous errors plus a type not found. We have
2232 beaten the user enough with the first error.
2234 (DeclSparce.FindType): Emit a warning if we have an ambiguous
2237 * ecore.cs (SimpleName.DoResolveType): If an error is emitted
2238 during the resolution process, stop the lookup, this avoids
2239 repeated error reports (same error twice).
2241 * rootcontext.cs: Emit a warning if we have an ambiguous reference.
2243 * typemanager.cs (LookupType): Redo the type lookup code to match
2244 the needs of System.Reflection.
2246 The issue is that System.Reflection requires references to nested
2247 types to begin with a "+" sign instead of a dot. So toplevel
2248 types look like: "NameSpace.TopLevelClass", and nested ones look
2249 like "Namespace.TopLevelClass+Nested", with arbitrary nesting
2252 2002-09-19 Martin Baulig <martin@gnome.org>
2254 * codegen.cs (EmitContext.EmitTopBlock): If control flow analysis
2255 says that a method always returns or always throws an exception,
2256 don't report the CS0161.
2258 * statement.cs (FlowBranching.UsageVector.MergeChildren): Always
2259 set `Returns = new_returns'.
2261 2002-09-19 Martin Baulig <martin@gnome.org>
2263 * expression.cs (MemberAccess.ResolveMemberAccess): When resolving
2264 to an enum constant, check for a CS0176.
2266 2002-09-18 Miguel de Icaza <miguel@ximian.com>
2268 * class.cs (TypeContainer.CheckPairedOperators): Now we check
2269 for operators that must be in pairs and report errors.
2271 * ecore.cs (SimpleName.DoResolveType): During the initial type
2272 resolution process, when we define types recursively, we must
2273 check first for types in our current scope before we perform
2274 lookups in the enclosing scopes.
2276 * expression.cs (MakeByteBlob): Handle Decimal blobs.
2278 (Invocation.VerifyArgumentsCompat): Call
2279 TypeManager.TypeToCoreType on the parameter_type.GetElementType.
2280 I thought we were supposed to always call this, but there are a
2281 few places in the code where we dont do it.
2283 2002-09-17 Miguel de Icaza <miguel@ximian.com>
2285 * driver.cs: Add support in -linkres and -resource to specify the
2286 name of the identifier.
2288 2002-09-16 Miguel de Icaza <miguel@ximian.com>
2290 * ecore.cs (StandardConversionExists): Sync with the conversion
2291 code: allow anything-* to void* conversions.
2293 (FindMostSpecificSource): Use an Expression argument
2294 instead of a Type, because we might be handed over a Literal which
2295 gets a few more implicit conversions that plain types do not. So
2296 this information was being lost.
2298 Also, we drop the temporary type-holder expression when not
2301 2002-09-17 Martin Baulig <martin@gnome.org>
2303 * class.cs (PropertyBase.CheckBase): Don't check the base class if
2304 this is an explicit interface implementation.
2306 2002-09-17 Martin Baulig <martin@gnome.org>
2308 * class.cs (PropertyBase.CheckBase): Make this work for indexers with
2309 different `IndexerName' attributes.
2311 * expression.cs (BaseIndexerAccess): Rewrote this class to use IndexerAccess.
2312 (IndexerAccess): Added special protected ctor for BaseIndexerAccess and
2313 virtual CommonResolve().
2315 2002-09-16 Miguel de Icaza <miguel@ximian.com>
2317 * enum.cs (LookupEnumValue): Use the EnumConstant declared type,
2318 and convert that to the UnderlyingType.
2320 * statement.cs (Foreach.Resolve): Indexers are just like variables
2321 or PropertyAccesses.
2323 * cs-tokenizer.cs (consume_string): Track line numbers and columns
2324 inside quoted strings, we were not doing this before.
2326 2002-09-16 Martin Baulig <martin@gnome.org>
2328 * ecore.cs (MethodGroupExpr.DoResolve): If we have an instance expression,
2329 resolve it. This is needed for the definite assignment check of the
2330 instance expression, fixes bug #29846.
2331 (PropertyExpr.DoResolve, EventExpr.DoResolve): Likewise.
2333 2002-09-16 Nick Drochak <ndrochak@gol.com>
2335 * parameter.cs: Fix compile error. Cannot reference static member
2336 from an instance object. Is this an mcs bug?
2338 2002-09-14 Martin Baulig <martin@gnome.org>
2340 * decl.cs (MemberCache.SetupCacheForInterface): Don't add an interface
2341 multiple times. Fixes bug #30295, added test-166.cs.
2343 2002-09-14 Martin Baulig <martin@gnome.org>
2345 * statement.cs (Block.Emit): Don't emit unreachable code.
2346 (Switch.SimpleSwitchEmit, Switch.TableSwitchEmit): Check for missing
2348 (Goto.Emit, Continue.Emit): Set ec.Breaks = true.
2350 2002-09-14 Martin Baulig <martin@gnome.org>
2352 * parameter.cs (Parameter.Attributes): Make this work if Modifier.ISBYREF
2355 2002-09-14 Martin Baulig <martin@gnome.org>
2357 * typemanager.cs (TypeManager.IsNestedChildOf): This must return false
2358 if `type == parent' since in this case `type.IsSubclassOf (parent)' will
2359 be false on the ms runtime.
2361 2002-09-13 Martin Baulig <martin@gnome.org>
2363 * ecore.cs (SimpleName.SimpleNameResolve): Include the member name in
2364 the CS0038 error message.
2366 2002-09-12 Miguel de Icaza <miguel@ximian.com>
2368 * expression.cs (CheckedExpr, UnCheckedExpr): If we have a
2369 constant inside, return it.
2371 2002-09-12 Martin Baulig <martin@gnome.org>
2373 * cfold.cs (ConstantFold.DoConstantNumericPromotions): Check whether an
2374 implicit conversion can be done between enum types.
2376 * enum.cs (Enum.LookupEnumValue): If the value is an EnumConstant,
2377 check whether an implicit conversion to the current enum's UnderlyingType
2378 exists and report an error if not.
2380 * codegen.cs (CodeGen.Init): Delete the symbol file when compiling
2381 without debugging support.
2383 * delegate.cs (Delegate.CloseDelegate): Removed, use CloseType instead.
2384 Fixes bug #30235. Thanks to Ricardo Fernández Pascual.
2386 2002-09-12 Martin Baulig <martin@gnome.org>
2388 * typemanager.cs (TypeManager.IsNestedChildOf): New method.
2390 * ecore.cs (IMemberExpr.DeclaringType): New property.
2391 (SimpleName.SimpleNameResolve): Check whether we're accessing a
2392 nonstatic member of an outer type (CS0038).
2394 2002-09-11 Miguel de Icaza <miguel@ximian.com>
2396 * driver.cs: Activate the using-error detector at warning level
2397 4 (at least for MS-compatible APIs).
2399 * namespace.cs (VerifyUsing): Small buglett fix.
2401 * pending.cs (PendingImplementation): pass the container pointer.
2403 * interface.cs (GetMethods): Allow for recursive definition. Long
2404 term, I would like to move every type to support recursive
2405 definitions, not the current ordering mechanism that we have right
2408 The situation is this: Attributes are handled before interfaces,
2409 so we can apply attributes to interfaces. But some attributes
2410 implement interfaces, we will now handle the simple cases
2411 (recursive definitions will just get an error).
2413 * parameter.cs: Only invalidate types at the end if we fail to
2416 2002-09-09 Martin Baulig <martin@gnome.org>
2418 * ecore.cs (PropertyExpr.Emit): Also check for
2419 TypeManager.system_int_array_get_length so this'll also work when
2420 compiling corlib. Fixes #30003.
2422 2002-09-09 Martin Baulig <martin@gnome.org>
2424 * expression.cs (ArrayCreation.MakeByteBlob): Added support for enums
2425 and throw an exception if we can't get the type's size. Fixed #30040,
2428 2002-09-09 Martin Baulig <martin@gnome.org>
2430 * ecore.cs (PropertyExpr.DoResolve): Added check for static properies.
2432 * expression.cs (SizeOf.DoResolve): Sizeof is only allowed in unsafe
2433 context. Fixes bug #30027.
2435 * delegate.cs (NewDelegate.Emit): Use OpCodes.Ldvirtftn for
2436 virtual functions. Fixes bug #30043, added test-164.cs.
2438 2002-09-08 Ravi Pratap <ravi@ximian.com>
2440 * attribute.cs : Fix a small NullRef crash thanks to my stupidity.
2442 2002-09-08 Nick Drochak <ndrochak@gol.com>
2444 * driver.cs: Use an object to get the windows codepage since it's not a
2447 2002-09-08 Miguel de Icaza <miguel@ximian.com>
2449 * statement.cs (For.Emit): for infinite loops (test == null)
2450 return whether there is a break inside, not always "true".
2452 * namespace.cs (UsingEntry): New struct to hold the name of the
2453 using definition, the location where it is defined, and whether it
2454 has been used in a successful type lookup.
2456 * rootcontext.cs (NamespaceLookup): Use UsingEntries instead of
2461 2002-09-06 Ravi Pratap <ravi@ximian.com>
2463 * attribute.cs : Fix incorrect code which relied on catching
2464 a NullReferenceException to detect a null being passed in
2465 where an object was expected.
2467 2002-09-06 Miguel de Icaza <miguel@ximian.com>
2469 * statement.cs (Try): flag the catch variable as assigned
2471 * expression.cs (Cast): Simplified by using ResolveType instead of
2474 * statement.cs (Catch): Fix bug by using ResolveType.
2476 2002-09-06 Ravi Pratap <ravi@ximian.com>
2478 * expression.cs (BetterConversion): Special case for when we have
2479 a NullLiteral as the argument and we have to choose between string
2480 and object types - we choose string the way csc does.
2482 * attribute.cs (Attribute.Resolve): Catch the
2483 NullReferenceException and report error #182 since the Mono
2484 runtime no more has the bug and having this exception raised means
2485 we tried to select a constructor which takes an object and is
2488 2002-09-05 Ravi Pratap <ravi@ximian.com>
2490 * expression.cs (Invocation.OverloadResolve): Flag a nicer error
2491 message (1502, 1503) when we can't locate a method after overload
2492 resolution. This is much more informative and closes the bug
2495 * interface.cs (PopulateMethod): Return if there are no argument
2496 types. Fixes a NullReferenceException bug.
2498 * attribute.cs (Attribute.Resolve): Ensure we allow TypeOf
2499 expressions too. Previously we were checking only in one place for
2500 positional arguments leaving out named arguments.
2502 * ecore.cs (ImplicitNumericConversion): Conversion from underlying
2503 type to the enum type is not allowed. Remove code corresponding to
2506 (ConvertNumericExplicit): Allow explicit conversions from
2507 the underlying type to enum type. This precisely follows the spec
2508 and closes a bug filed by Gonzalo.
2510 2002-09-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2513 * compiler.csproj.user: patch from Adam Chester (achester@bigpond.com).
2515 2002-09-03 Miguel de Icaza <miguel@ximian.com>
2517 * statement.cs (SwitchLabel.ResolveAndReduce): In the string case,
2518 it was important that we stored the right value after the
2519 reduction in `converted'.
2521 2002-09-04 Martin Baulig <martin@gnome.org>
2523 * location.cs (Location.SymbolDocument): Use full pathnames for the
2526 2002-08-30 Miguel de Icaza <miguel@ximian.com>
2528 * expression.cs (ComposedCast): Use DeclSparce.ResolveType instead
2529 of the expression resolve mechanism, because that will catch the
2530 SimpleName error failures.
2532 (Conditional): If we can not resolve the
2533 expression, return, do not crash.
2535 2002-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2538 (location): display token name instead of its number.
2540 2002-08-28 Martin Baulig <martin@gnome.org>
2542 * expression.cs (Binary.ResolveOperator): Don't silently return
2543 but return an error if an operator cannot be applied between two
2546 2002-08-28 Martin Baulig <martin@gnome.org>
2548 * class.cs (Constructor.Define): Set the permission attributes
2549 correctly instead of making all constructors public.
2551 2002-08-28 Martin Baulig <martin@gnome.org>
2553 * ecore.cs (Expression.DoResolve): Do a TypeManager.MemberLook
2554 for private members before reporting a CS0103; if we find anything,
2557 2002-08-28 Martin Baulig <martin@gnome.org>
2559 * typemanager.cs (TypeManager.FilterWithClosure): It's not enough
2560 to check whether `closure_start_type == closure_invocation_type',
2561 we also need to check whether `m.DeclaringType == closure_invocation_type'
2562 before bypassing the permission checks. We might be accessing
2563 protected/private members from the base class.
2564 (TypeManager.RealMemberLookup): Only set private_ok if private
2565 members were requested via BindingFlags.NonPublic.
2567 * ecore.cs (MethodGroupExpr.IsExplicitImpl): New property.
2569 * expression.cs (MemberAccess.ResolveMemberAccess): Set
2570 MethodGroupExpr.IsExplicitImpl if appropriate.
2571 (Invocation.DoResolve): Don't report the CS0120 for explicit
2572 interface implementations.
2574 2002-08-27 Martin Baulig <martin@gnome.org>
2576 * expression.cs (Invocation.DoResolve): If this is a static
2577 method and we don't have an InstanceExpression, we must report
2580 2002-08-25 Martin Baulig <martin@gnome.org>
2582 * expression.cs (Binary.ResolveOperator): Don't allow `!=' and
2583 `==' between a valuetype and an object.
2585 2002-08-25 Miguel de Icaza <miguel@ximian.com>
2587 * ecore.cs (TypeExpr): Provide a ToString method.
2589 2002-08-24 Martin Baulig <martin@gnome.org>
2591 * codegen.cs (CodeGen.InitMonoSymbolWriter): The symbol file is
2592 now called proggie.dbg and it's a binary file.
2594 2002-08-23 Martin Baulig <martin@gnome.org>
2596 * decl.cs (MemberCache.AddMethods): Ignore varargs methods.
2598 2002-08-23 Martin Baulig <martin@gnome.org>
2600 * struct.cs (MyStructInfo.ctor): Make this work with empty
2601 structs; it's not allowed to use foreach() on null.
2603 2002-08-23 Martin Baulig <martin@gnome.org>
2605 * codegen.cs (CodeGen.InitMonoSymbolWriter): Tell the symbol
2606 writer the full pathname of the generated assembly.
2608 2002-08-23 Martin Baulig <martin@gnome.org>
2610 * statements.cs (FlowBranching.UsageVector.MergeChildren):
2611 A `finally' block never returns or breaks; improved handling of
2614 2002-08-23 Martin Baulig <martin@gnome.org>
2616 * statement.cs (Throw.Resolve): Allow `throw null'.
2618 2002-08-23 Martin Baulig <martin@gnome.org>
2620 * expression.cs (MemberAccess.ResolveMemberAccess): If this is an
2621 EventExpr, don't do a DeclaredOnly MemberLookup, but check whether
2622 `ee.EventInfo.DeclaringType == ec.ContainerType'. The
2623 MemberLookup would return a wrong event if this is an explicit
2624 interface implementation and the class has an event with the same
2627 2002-08-23 Martin Baulig <martin@gnome.org>
2629 * statement.cs (Block.AddChildVariableNames): New public method.
2630 (Block.AddChildVariableName): Likewise.
2631 (Block.IsVariableNameUsedInChildBlock): Likewise.
2632 (Block.AddVariable): Check whether a variable name has already
2633 been used in a child block.
2635 * cs-parser.jay (declare_local_variables): Mark all variable names
2636 from the current block as being used in a child block in the
2639 2002-08-23 Martin Baulig <martin@gnome.org>
2641 * codegen.cs (CodeGen.InitializeSymbolWriter): Abort if we can't
2642 find the symbol writer.
2644 * driver.cs: csc also allows the arguments to /define being
2645 separated by commas, not only by semicolons.
2647 2002-08-23 Martin Baulig <martin@gnome.org>
2649 * interface.cs (Interface.GetMembers): Added static check for events.
2651 2002-08-15 Martin Baulig <martin@gnome.org>
2653 * class.cs (MethodData.EmitDestructor): In the Expression.MemberLookup
2654 call, use ec.ContainerType.BaseType as queried_type and invocation_type.
2656 * ecore.cs (Expression.MemberLookup): Added documentation and explained
2657 why the MethodData.EmitDestructor() change was necessary.
2659 2002-08-20 Martin Baulig <martin@gnome.org>
2661 * class.cs (TypeContainer.FindMembers): Added static check for events.
2663 * decl.cs (MemberCache.AddMembers): Handle events like normal members.
2665 * typemanager.cs (TypeHandle.GetMembers): When queried for events only,
2666 use Type.GetEvents(), not Type.FindMembers().
2668 2002-08-20 Martin Baulig <martin@gnome.org>
2670 * decl.cs (MemberCache): Added a special method cache which will
2671 be used for method-only searched. This ensures that a method
2672 search will return a MethodInfo with the correct ReflectedType for
2675 2002-08-20 Martin Baulig <martin@gnome.org>
2677 * decl.cs (DeclSpace.FindMembers): Made this public.
2679 2002-08-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2681 * delegate.cs: fixed build on windows.
2682 [FIXME: Filed as bug #29150: MCS must report these errors.]
2684 2002-08-19 Ravi Pratap <ravi@ximian.com>
2686 * ecore.cs (StandardConversionExists): Return a false
2687 if we are trying to convert the void type to anything else
2688 since that is not allowed.
2690 * delegate.cs (DelegateInvocation.DoResolve): Ensure that
2691 we flag error 70 in the event an event is trying to be accessed
2692 directly from outside the declaring type.
2694 2002-08-20 Martin Baulig <martin@gnome.org>
2696 * typemanager.cs, decl.cs: Moved MemberList, IMemberContainer and
2697 MemberCache from typemanager.cs to decl.cs.
2699 2002-08-19 Martin Baulig <martin@gnome.org>
2701 * class.cs (TypeContainer): Implement IMemberContainer.
2702 (TypeContainer.DefineMembers): Create the MemberCache.
2703 (TypeContainer.FindMembers): Do better BindingFlags checking; only
2704 return public members if BindingFlags.Public was given, check
2705 whether members are static.
2707 2002-08-16 Martin Baulig <martin@gnome.org>
2709 * decl.cs (DeclSpace.Define): Splitted this in Define and
2710 DefineMembers. DefineMembers is called first and initializes the
2713 * rootcontext.cs (RootContext.DefineMembers): New function. Calls
2714 DefineMembers() on all our DeclSpaces.
2716 * class.cs (TypeContainer.Define): Moved all code to DefineMembers(),
2717 but call DefineMembers() on all nested interfaces. We call their
2718 Define() in our new Define() function.
2720 * interface.cs (Interface): Implement IMemberContainer.
2721 (Interface.Define): Moved all code except the attribute stuf to
2723 (Interface.DefineMembers): Initialize the member cache.
2725 * typemanager.cs (IMemberFinder): Removed this interface, we don't
2726 need this anymore since we can use MemberCache.FindMembers directly.
2728 2002-08-19 Martin Baulig <martin@gnome.org>
2730 * typemanager.cs (MemberCache): When creating the cache for an
2731 interface type, add all inherited members.
2732 (TypeManager.MemberLookup_FindMembers): Changed `ref bool searching'
2733 to `out bool used_cache' and documented it.
2734 (TypeManager.MemberLookup): If we already used the cache in the first
2735 iteration, we don't need to do the interfaces check.
2737 2002-08-19 Martin Baulig <martin@gnome.org>
2739 * decl.cs (DeclSpace.FindMembers): New abstract method. Moved this
2740 here from IMemberFinder and don't implement this interface anymore.
2741 (DeclSpace.MemberCache): Moved here from IMemberFinder.
2743 * typemanager.cs (IMemberFinder): This interface is now only used by
2744 classes which actually support the member cache.
2745 (TypeManager.builder_to_member_finder): Renamed to builder_to_declspace
2746 since we only put DeclSpaces into this Hashtable.
2747 (MemberLookup_FindMembers): Use `builder_to_declspace' if the type is
2748 a dynamic type and TypeHandle.GetTypeHandle() otherwise.
2750 2002-08-16 Martin Baulig <martin@gnome.org>
2752 * typemanager.cs (ICachingMemberFinder): Removed.
2753 (IMemberFinder.MemberCache): New property.
2754 (TypeManager.FindMembers): Merged this with RealFindMembers().
2755 This function will never be called from TypeManager.MemberLookup()
2756 so we can't use the cache here, just the IMemberFinder.
2757 (TypeManager.MemberLookup_FindMembers): Check whether the
2758 IMemberFinder has a MemberCache and call the cache's FindMembers
2760 (MemberCache): Rewrote larger parts of this yet another time and
2761 cleaned it up a bit.
2763 2002-08-15 Miguel de Icaza <miguel@ximian.com>
2765 * driver.cs (LoadArgs): Support quoting.
2767 (Usage): Show the CSC-like command line arguments.
2769 Improved a few error messages.
2771 2002-08-15 Martin Baulig <martin@gnome.org>
2773 * typemanager.cs (IMemberContainer.Type): New property.
2774 (IMemberContainer.IsInterface): New property.
2776 The following changes are conditional to BROKEN_RUNTIME, which is
2777 defined at the top of the file.
2779 * typemanager.cs (MemberCache.MemberCache): Don't add the base
2780 class'es members, but add all members from TypeHandle.ObjectType
2781 if we're an interface.
2782 (MemberCache.AddMembers): Set the Declared flag if member.DeclaringType
2783 is the current type.
2784 (MemberCache.CacheEntry.Container): Removed this field.
2785 (TypeHandle.GetMembers): Include inherited members.
2787 2002-08-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2789 * typemanager.cs: fixed compilation and added a comment on a field that
2792 2002-08-15 Martin Baulig <martin@gnome.org>
2794 * class.cs (ConstructorInitializer.Resolve): In the
2795 Expression.MemberLookup call, use the queried_type as
2798 * typemanager.cs (IMemberContainer.GetMembers): Removed the `bool
2799 declared' attribute, it's always true.
2800 (IMemberContainer.Parent, IMemberContainer.Name): New properties.
2801 (TypeManager.MemberLookup_FindMembers): [FIXME FIXME FIXME] Added
2802 temporary wrapper for FindMembers which tells MemberLookup whether
2803 members from the base classes are included in the return value.
2804 This will go away soon.
2805 (TypeManager.MemberLookup): Use this temporary hack here; once the
2806 new MemberCache is completed, we don't need to do the DeclaredOnly
2807 looping here anymore since the MemberCache will take care of this.
2808 (TypeManager.IsSubclassOrNestedChildOf): Allow `type == parent'.
2809 (MemberCache): When creating the MemberCache for a class, get
2810 members from the current class and all its base classes.
2811 (MemberCache.CacheEntry.Container): New field. This is a
2812 temporary hack until the Mono runtime is fixed to distinguish
2813 between ReflectedType and DeclaringType. It allows us to use MCS
2814 with both the MS runtime and the unfixed Mono runtime without
2815 problems and without accecting performance.
2816 (MemberCache.SearchMembers): The DeclaredOnly looping from
2817 TypeManager.MemberLookup is now done here.
2819 2002-08-14 Martin Baulig <martin@gnome.org>
2821 * statement.cs (MyStructInfo.MyStructInfo): Don't call
2822 Type.GetFields on dynamic types but get the fields from the
2823 corresponding TypeContainer.
2824 (MyStructInfo.GetStructInfo): Added check for enum types.
2826 * typemanager.cs (MemberList.IsSynchronized): Implemented.
2827 (MemberList.SyncRoot): Implemented.
2828 (TypeManager.FilterWithClosure): No need to check permissions if
2829 closure_start_type == closure_invocation_type, don't crash if
2830 closure_invocation_type is null.
2832 2002-08-13 Martin Baulig <martin@gnome.org>
2834 Rewrote TypeContainer.FindMembers to use a member cache. This
2835 gives us a speed increase of about 35% for the self-hosting MCS
2836 build and of about 15-20% for the class libs (both on GNU/Linux).
2838 * report.cs (Timer): New class to get enhanced profiling. This
2839 whole class is "TIMER" conditional since it remarkably slows down
2842 * class.cs (MemberList): New class. This is an IList wrapper
2843 which we're now using instead of passing MemberInfo[]'s around to
2844 avoid copying this array unnecessarily.
2845 (IMemberFinder.FindMember): Return a MemberList, not a MemberInfo [].
2846 (ICachingMemberFinder, IMemberContainer): New interface.
2847 (TypeManager.FilterWithClosure): If `criteria' is null, the name
2848 has already been checked, otherwise use it for the name comparision.
2849 (TypeManager.FindMembers): Renamed to RealMemberFinder and
2850 provided wrapper which tries to use ICachingMemberFinder.FindMembers
2851 if possible. Returns a MemberList, not a MemberInfo [].
2852 (TypeHandle): New class, implements IMemberContainer. We create
2853 one instance of this class per type, it contains a MemberCache
2854 which is used to do the member lookups.
2855 (MemberCache): New class. Each instance of this class contains
2856 all members of a type and a name-based hash table.
2857 (MemberCache.FindMembers): This is our new member lookup
2858 function. First, it looks up all members of the requested name in
2859 the hash table. Then, it walks this list and sorts out all
2860 applicable members and returns them.
2862 2002-08-13 Martin Baulig <martin@gnome.org>
2864 In addition to a nice code cleanup, this gives us a performance
2865 increase of about 1.4% on GNU/Linux - not much, but it's already
2866 half a second for the self-hosting MCS compilation.
2868 * typemanager.cs (IMemberFinder): New interface. It is used by
2869 TypeManager.FindMembers to call FindMembers on a TypeContainer,
2870 Enum, Delegate or Interface.
2871 (TypeManager.finder_to_member_finder): New PtrHashtable.
2872 (TypeManager.finder_to_container): Removed.
2873 (TypeManager.finder_to_delegate): Removed.
2874 (TypeManager.finder_to_interface): Removed.
2875 (TypeManager.finder_to_enum): Removed.
2877 * interface.cs (Interface): Implement IMemberFinder.
2879 * delegate.cs (Delegate): Implement IMemberFinder.
2881 * enum.cs (Enum): Implement IMemberFinder.
2883 * class.cs (TypeContainer): Implement IMemberFinder.
2885 2002-08-12 Martin Baulig <martin@gnome.org>
2887 * ecore.cs (TypeExpr.DoResolveType): Mark this as virtual.
2889 2002-08-12 Martin Baulig <martin@gnome.org>
2891 * ecore.cs (ITypeExpression): New interface for expressions which
2893 (TypeExpression): Renamed to TypeLookupExpression.
2894 (Expression.DoResolve): If we're doing a types-only lookup, the
2895 expression must implement the ITypeExpression interface and we
2896 call DoResolveType() on it.
2897 (SimpleName): Implement the new ITypeExpression interface.
2898 (SimpleName.SimpleNameResolve): Removed the ec.OnlyLookupTypes
2899 hack, the situation that we're only looking up types can't happen
2900 anymore when this method is called. Moved the type lookup code to
2901 DoResolveType() and call it.
2902 (SimpleName.DoResolveType): This ITypeExpression interface method
2903 is now doing the types-only lookup.
2904 (TypeExpr, TypeLookupExpression): Implement ITypeExpression.
2905 (ResolveFlags): Added MaskExprClass.
2907 * expression.cs (MemberAccess): Implement the ITypeExpression
2909 (MemberAccess.DoResolve): Added support for a types-only lookup
2910 when we're called via ITypeExpression.DoResolveType().
2911 (ComposedCast): Implement the ITypeExpression interface.
2913 * codegen.cs (EmitContext.OnlyLookupTypes): Removed. Call
2914 Expression.Resolve() with ResolveFlags.Type instead.
2916 2002-08-12 Martin Baulig <martin@gnome.org>
2918 * interface.cs (Interface.Define): Apply attributes.
2920 * attribute.cs (Attribute.ApplyAttributes): Added support for
2921 interface attributes.
2923 2002-08-11 Martin Baulig <martin@gnome.org>
2925 * statement.cs (Block.Emit): Only check the "this" variable if we
2926 do not always throw an exception.
2928 * ecore.cs (PropertyExpr.DoResolveLValue): Implemented, check
2929 whether the property has a set accessor.
2931 2002-08-11 Martin Baulig <martin@gnome.org>
2933 Added control flow analysis support for structs.
2935 * ecore.cs (ResolveFlags): Added `DisableFlowAnalysis' to resolve
2936 with control flow analysis turned off.
2937 (IVariable): New interface.
2938 (SimpleName.SimpleNameResolve): If MemberAccess.ResolveMemberAccess
2939 returns an IMemberExpr, call DoResolve/DoResolveLValue on it.
2940 (FieldExpr.DoResolve): Resolve the instance expression with flow
2941 analysis turned off and do the definite assignment check after the
2942 resolving when we know what the expression will resolve to.
2944 * expression.cs (LocalVariableReference, ParameterReference):
2945 Implement the new IVariable interface, only call the flow analysis
2946 code if ec.DoFlowAnalysis is true.
2947 (This): Added constructor which takes a Block argument. Implement
2948 the new IVariable interface.
2949 (MemberAccess.DoResolve, MemberAccess.DoResolveLValue): Call
2950 DoResolve/DoResolveLValue on the result of ResolveMemberLookup().
2951 This does the definite assignment checks for struct members.
2953 * class.cs (Constructor.Emit): If this is a non-static `struct'
2954 constructor which doesn't have any initializer, call
2955 Block.AddThisVariable() to tell the flow analysis code that all
2956 struct elements must be initialized before control returns from
2959 * statement.cs (MyStructInfo): New public class.
2960 (UsageVector.this [VariableInfo vi]): Added `int field_idx'
2961 argument to this indexer. If non-zero, check an individual struct
2962 member, not the whole struct.
2963 (FlowBranching.CheckOutParameters): Check struct members.
2964 (FlowBranching.IsVariableAssigned, SetVariableAssigned): Added
2965 overloaded versions of these methods which take an additional
2966 `int field_idx' argument to check struct members.
2967 (FlowBranching.IsParameterAssigned, SetParameterAssigned): Added
2968 overloaded versions of these methods which take an additional
2969 `string field_name' argument to check struct member.s
2970 (VariableInfo): Implement the IVariable interface.
2971 (VariableInfo.StructInfo): New public property. Returns the
2972 MyStructInfo instance of the variable if it's a struct or null.
2973 (Block.AddThisVariable): New public method. This is called from
2974 Constructor.Emit() for non-static `struct' constructor which do
2975 not have any initializer. It creates a special variable for the
2976 "this" instance variable which will be checked by the flow
2977 analysis code to ensure that all of the struct's fields are
2978 initialized before control returns from the constructor.
2979 (UsageVector): Added support for struct members. If a
2980 variable/parameter is a struct with N members, we reserve a slot
2981 in the usage vector for each member. A struct is considered fully
2982 initialized if either the struct itself (slot 0) or all its
2983 members are initialized.
2985 2002-08-08 Martin Baulig <martin@gnome.org>
2987 * driver.cs (Driver.MainDriver): Only report an error CS5001
2988 if there were no compilation errors.
2990 * codegen.cs (EmitContext.EmitContext): Use the DeclSpace's
2991 `UnsafeContext' property to determine whether the parent is in
2992 unsafe context rather than checking the parent's ModFlags:
2993 classes nested in an unsafe class are unsafe as well.
2995 2002-08-08 Martin Baulig <martin@gnome.org>
2997 * statement.cs (UsageVector.MergeChildren): Distinguish between
2998 `Breaks' and `Returns' everywhere, don't set `Breaks' anymore if
2999 we return. Added test17() and test18() to test-154.cs.
3001 2002-08-08 Martin Baulig <martin@gnome.org>
3003 * typemanager.cs (TypeManager.FilterWithClosure): If we have
3004 Family access, make sure the invoking type isn't a subclass of the
3005 queried type (that'd be a CS1540).
3007 * ecore.cs (Expression.MemberLookup): Added overloaded version of
3008 this method which takes an additional `Type invocation_type'.
3010 * expression.cs (BaseAccess.DoResolve): Use the base type as
3011 invocation and query type.
3012 (MemberAccess.DoResolve): If the lookup failed and we're about to
3013 report a CS0122, try a lookup with the ec.ContainerType - if this
3014 succeeds, we must report a CS1540.
3016 2002-08-08 Martin Baulig <martin@gnome.org>
3018 * ecore.cs (IMemberExpr): Added `bool IsInstance' property.
3019 (MethodGroupExpr): Implement the IMemberExpr interface.
3021 * expression (MemberAccess.ResolveMemberAccess): No need to have
3022 any special code for MethodGroupExprs anymore, they're now
3025 2002-08-08 Martin Baulig <martin@gnome.org>
3027 * typemanager.cs (TypeManager.FilterWithClosure): Check Assembly,
3028 Family, FamANDAssem and FamORAssem permissions.
3029 (TypeManager.IsSubclassOrNestedChildOf): New public method.
3031 2002-08-08 Martin Baulig <martin@gnome.org>
3033 * statement.cs (FlowBranchingType): Added LOOP_BLOCK.
3034 (UsageVector.MergeChildren): `break' breaks unless we're in a switch
3037 Thu Aug 8 10:28:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
3039 * driver.cs: implemented /resource option to embed managed resources.
3041 2002-08-07 Martin Baulig <martin@gnome.org>
3043 * class.cs (FieldBase.Initializer): Renamed to `init' and made private.
3044 (FieldBase.HasFieldInitializer): New public property.
3045 (FieldBase.GetInitializerExpression): New public method. Resolves and
3046 returns the field initializer and makes sure it is only resolved once.
3047 (TypeContainer.EmitFieldInitializers): Call
3048 FieldBase.GetInitializerExpression to get the initializer, this ensures
3049 that it isn't resolved multiple times.
3051 * codegen.cs (EmitContext): Added `bool IsFieldInitialier'. This tells
3052 the resolving process (SimpleName/MemberLookup) that we're currently
3053 emitting a field initializer (which must not access any instance members,
3054 this is an error CS0236).
3056 * ecore.cs (SimpleName.Error_ObjectRefRequired): Added EmitContext
3057 argument, if the `IsFieldInitializer' flag is set, we must report and
3058 error CS0236 and not an error CS0120.
3060 2002-08-07 Martin Baulig <martin@gnome.org>
3062 * ecore.cs (IMemberExpr): New public interface.
3063 (FieldExpr, PropertyExpr, EventExpr): Implement IMemberExpr.
3064 (SimpleName.SimpleNameResolve): Call MemberAccess.ResolveMemberAccess
3065 if the expression is an IMemberExpr.
3067 * expression.cs (MemberAccess.ResolveMemberAccess): Allow `left'
3068 to be null, implicitly default to `this' if we're non-static in
3069 this case. Simplified the code a lot by using the new IMemberExpr
3070 interface. Also fixed bug #28176 here.
3072 2002-08-06 Martin Baulig <martin@gnome.org>
3074 * cs-parser.jay (SimpleLookup): Removed. We need to create
3075 ParameterReferences during semantic analysis so that we can do a
3076 type-only search when resolving Cast, TypeOf and SizeOf.
3077 (block): Pass the `current_local_parameters' to the Block's
3080 * class.cs (ConstructorInitializer): Added `Parameters parameters'
3081 argument to the constructor.
3082 (ConstructorInitializer.Resolve): Create a temporary implicit
3083 block with the parameters.
3085 * ecore.cs (SimpleName.SimpleNameResolve): Resolve parameter
3086 references here if we aren't doing a type-only search.
3088 * statement.cs (Block): Added constructor which takes a
3089 `Parameters parameters' argument.
3090 (Block.Parameters): New public property.
3092 * support.cs (InternalParameters.Parameters): Renamed `parameters'
3093 to `Parameters' and made it public readonly.
3095 2002-08-06 Martin Baulig <martin@gnome.org>
3097 * ecore.cs (Expression.Warning): Made this public as well.
3099 * report.cs (Report.Debug): Print the contents of collections.
3101 2002-08-06 Martin Baulig <martin@gnome.org>
3103 * ecore.cs (Expression.ResolveFlags): New [Flags] enum. This is
3104 used to tell Resolve() which kinds of expressions it may return.
3105 (Expression.Resolve): Added overloaded version of this method which
3106 takes a `ResolveFlags flags' argument. This can be used to tell
3107 Resolve() which kinds of expressions it may return. Reports a
3109 (Expression.ResolveWithSimpleName): Removed, use Resolve() with
3110 ResolveFlags.SimpleName.
3111 (Expression.Error118): Added overloaded version of this method which
3112 takes a `ResolveFlags flags' argument. It uses the flags to determine
3113 which kinds of expressions are allowed.
3115 * expression.cs (Argument.ResolveMethodGroup): New public method.
3116 Resolves an argument, but allows a MethodGroup to be returned.
3117 This is used when invoking a delegate.
3119 * TODO: Updated a bit.
3121 2002-08-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3123 Fixed compilation with csc.
3125 * ecore.cs: Expression.Error made public. Is this correct? Should
3126 Warning be made public too?
3128 * expression.cs: use ea.Location instead of ea.loc.
3129 [FIXME: Filed as bug #28607: MCS must report these errors.]
3131 2002-08-06 Martin Baulig <martin@gnome.org>
3133 * ecore.cs (Expression.loc): Moved the location here instead of
3134 duplicating it in all derived classes.
3135 (Expression.Location): New public property.
3136 (Expression.Error, Expression.Warning): Made them non-static and
3137 removed the location argument.
3138 (Expression.Warning): Added overloaded version which takes an
3139 `int level' argument.
3140 (Expression.Error118): Make this non-static and removed the
3141 expression and location arguments.
3142 (TypeExpr): Added location argument to the constructor.
3144 * expression.cs (StaticCallExpr): Added location argument to
3146 (Indirection, PointerArithmetic): Likewise.
3147 (CheckedExpr, UnCheckedExpr): Likewise.
3148 (ArrayAccess, IndexerAccess, UserCast, ArrayPtr): Likewise.
3149 (StringPtr): Likewise.
3152 2002-08-05 Martin Baulig <martin@gnome.org>
3154 * expression.cs (BaseAccess.DoResolve): Actually report errors.
3156 * assign.cs (Assign.DoResolve): Check whether the source
3157 expression is a value or variable.
3159 * statement.cs (Try.Resolve): Set ec.InTry/InCatch/InFinally
3160 while resolving the corresponding blocks.
3162 * interface.cs (Interface.GetInterfaceTypeByName): Actually report
3163 an error, don't silently return null.
3165 * statement.cs (Block.AddVariable): Do the error reporting here
3166 and distinguish between CS0128 and CS0136.
3167 (Block.DoResolve): Report all unused labels (warning CS0164).
3168 (LabeledStatement): Pass the location to the constructor.
3169 (LabeledStatement.HasBeenReferenced): New property.
3170 (LabeledStatement.Resolve): Set it to true here.
3172 * statement.cs (Return.Emit): Return success even after reporting
3173 a type mismatch error (CS0126 or CS0127), this is what csc does and
3174 it avoids confusing the users with any consecutive errors.
3176 2002-08-05 Martin Baulig <martin@gnome.org>
3178 * enum.cs (Enum.LookupEnumValue): Catch circular definitions.
3180 * const.cs (Const.LookupConstantValue): Catch circular definitions.
3182 * expression.cs (MemberAccess.DoResolve): Silently return if an
3183 error has already been reported.
3185 * ecore.cs (Expression.MemberLookupFinal): Silently return if an
3186 error has already been reported.
3188 2002-08-05 Martin Baulig <martin@gnome.org>
3190 * statement.cs (UsageVector): Only initialize the `parameters'
3191 vector if we actually have any "out" parameters.
3193 2002-08-05 Martin Baulig <martin@gnome.org>
3195 * expression.cs (Binary.ResolveOperator): When combining delegates,
3196 they must have the same type.
3198 2002-08-05 Martin Baulig <martin@gnome.org>
3200 * typemanager.cs (TypeManager.GetArgumentTypes): Don't call
3201 PropertyInfo.GetIndexParameters() on dynamic types, this doesn't
3202 work with the ms runtime and we also don't need it: if we're a
3203 PropertyBuilder and not in the `indexer_arguments' hash, then we
3204 are a property and not an indexer.
3206 * class.cs (TypeContainer.AsAccessible): Use Type.IsArray,
3207 Type.IsPointer and Type.IsByRef instead of Type.HasElementType
3208 since the latter one doesn't work with the ms runtime.
3210 2002-08-03 Martin Baulig <martin@gnome.org>
3212 Fixed bugs #27998 and #22735.
3214 * class.cs (Method.IsOperator): New public field.
3215 (Method.CheckBase): Report CS0111 if there's already a method
3216 with the same parameters in the current class. Report CS0508 when
3217 attempting to change the return type of an inherited method.
3218 (MethodData.Emit): Report CS0179 if a method doesn't have a body
3219 and it's not marked abstract or extern.
3220 (PropertyBase): New abstract base class for Property and Indexer.
3221 (PropertyBase.CheckBase): Moved here from Property and made it work
3223 (PropertyBase.Emit): Moved here from Property.Emit, Indexer.Emit is
3224 the same so we can reuse it there.
3225 (Property, Indexer): Derive from PropertyBase.
3226 (MethodSignature.inheritable_property_signature_filter): New delegate
3227 to find properties and indexers.
3229 * decl.cs (MemberCore.CheckMethodAgainstBase): Added `string name'
3230 argument and improved error reporting.
3232 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): Renamed to
3233 EmptyReadOnlyParameters and made it a property.
3235 * typemanager.cs (TypeManager.GetArgumentTypes): Added overloaded
3236 version of this method which takes a `PropertyInfo indexer'.
3237 (TypeManager.RegisterIndexer): New method.
3239 * class.cs: Added myself as author of this file :-)
3241 2002-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3243 * class.cs: fixed compilation on windoze.
3245 2002-08-03 Martin Baulig <martin@gnome.org>
3247 * interface.cs (Interface.GetInterfaceBases): Check whether all
3248 base interfaces are at least as accessible than the current one.
3250 * class.cs (TypeContainer.GetClassBases): Check whether base types
3251 are at least as accessible than the current type.
3252 (TypeContainer.AsAccessible): Implemented and made non-static.
3253 (MemberBase.CheckParameters): Report errors if the accessibility
3256 * delegate.cs (Delegate.Delegate): The default visibility is
3257 internal for top-level types and private for nested types.
3258 (Delegate.Define): Report errors if the accessibility checks fail.
3260 * enum.cs (Enum.Enum): The default visibility is internal for
3261 top-level types and private for nested types.
3262 (Enum.DefineType): Compute the correct visibility.
3264 * modifiers.cs (Modifiers.TypeAttr): Added a version of this
3265 function which takes a `bool is_toplevel' instead of a TypeContainer.
3267 * typemanager.cs (TypeManager.IsBuiltinType): `void' is also a
3270 2002-08-02 Martin Baulig <martin@gnome.org>
3272 * expression.cs (LocalVariableReferenc): Added constructor which
3273 takes additional `VariableInfo vi' and `bool is_readonly' arguments.
3274 (LocalVariableReference.IsReadOnly): New property.
3275 (LocalVariableReference.DoResolveLValue): Report a CS1604 if the
3276 variable is readonly, use our own readonly flag to do this; you can
3277 use the new constructor to get a writable reference to a read-only
3280 * cs-parser.jay (foreach_statement, using_statement): Get a writable
3281 reference to the local variable.
3283 2002-08-01 Miguel de Icaza <miguel@ximian.com>
3285 * rootcontext.cs (ResolveCore): Also include System.Exception
3287 * statement.cs (Block.Emit): Do not emit the dead-code warnings if
3288 we reach an EmptyStatement.
3290 (Catch.DoResolve, Throw.DoResolve): Throwing the System.Exception
3293 * expression.cs (Binary.ResolveOperator): Check error result in
3296 use brtrue/brfalse directly and avoid compares to null.
3298 2002-08-02 Martin Baulig <martin@gnome.org>
3300 * class.cs (TypeContainer.Define): Define all nested interfaces here.
3301 Fixes bug #28407, added test-155.cs.
3303 2002-08-01 Martin Baulig <martin@gnome.org>
3305 * class.cs (Event.EmitDefaultMethod): Make this work with static
3306 events. Fixes #28311, added verify-3.cs.
3308 2002-08-01 Martin Baulig <martin@gnome.org>
3310 * statement.cs (ForeachHelperMethods): Added `enumerator_type' and
3311 `is_disposable' fields.
3312 (Foreach.GetEnumeratorFilter): Set `hm.enumerator_type' and
3313 `hm.is_disposable' if we're using the collection pattern.
3314 (Foreach.EmitCollectionForeach): Use the correct type for the
3315 enumerator's local variable, only emit the try/finally block if
3316 necessary (fixes #27713).
3318 2002-08-01 Martin Baulig <martin@gnome.org>
3320 * ecore.cs (Expression.report118): Renamed to Error118 and made
3323 * statement.cs (Throw.Resolve): Check whether the expression is of
3324 the correct type (CS0118) and whether the type derives from
3325 System.Exception (CS0155).
3326 (Catch.Resolve): New method. Do the type lookup here and check
3327 whether it derives from System.Exception (CS0155).
3328 (Catch.CatchType, Catch.IsGeneral): New public properties.
3330 * typemanager.cs (TypeManager.exception_type): Added.
3332 2002-07-31 Miguel de Icaza <miguel@ximian.com>
3334 * driver.cs: Updated About function.
3336 2002-07-31 Martin Baulig <martin@gnome.org>
3338 Implemented Control Flow Analysis.
3340 * codegen.cs (EmitContext.DoFlowAnalysis): New public variable.
3341 (EmitContext.CurrentBranching): Added.
3342 (EmitContext.StartFlowBranching): Added.
3343 (EmitContext.EndFlowBranching): Added.
3344 (EmitContext.KillFlowBranching): Added.
3345 (EmitContext.IsVariableAssigned): Added.
3346 (EmitContext.SetVariableAssigned): Added.
3347 (EmitContext.IsParameterAssigned): Added.
3348 (EmitContext.SetParameterAssigned): Added.
3349 (EmitContext.EmitTopBlock): Added `InternalParameters ip' argument.
3350 Added control flow analysis stuff here.
3352 * expression.cs (Unary.DoResolve): If the operator is Oper.AddressOf,
3353 resolve the expression as lvalue.
3354 (LocalVariableReference.DoResolve): Check whether the variable has
3355 already been assigned.
3356 (ParameterReference.DoResolveLValue): Override lvalue resolve to mark
3357 the parameter as assigned here.
3358 (ParameterReference.DoResolve): Check whether the parameter has already
3360 (Argument.Resolve): If it's a `ref' or `out' argument, resolve the
3361 expression as lvalue.
3363 * statement.cs (FlowBranching): New class for the flow analysis code.
3364 (Goto): Resolve the label in Resolve, not in Emit; added flow analysis.
3365 (LabeledStatement.IsDefined): New public property.
3366 (LabeledStatement.AddUsageVector): New public method to tell flow
3367 analyis that the label may be reached via a forward jump.
3368 (GotoCase): Lookup and resolve the label in Resolve, not in Emit; added
3370 (VariableInfo.Number): New public field. This is used by flow analysis
3371 to number all locals of a block.
3372 (Block.CountVariables): New public property. This is the number of
3373 local variables in this block (including the locals from all parent
3375 (Block.EmitMeta): Number all the variables.
3377 * statement.cs: Added flow analysis support to all classes.
3379 2002-07-31 Martin Baulig <martin@gnome.org>
3381 * driver.cs: Added "--mcs-debug" argument if MCS_DEBUG is defined.
3382 To get debugging messages, compile mcs with /define:MCS_DEBUG and
3383 then use this argument.
3385 * report.cs (Report.Debug): Renamed to conditional to "MCS_DEBUG".
3387 * makefile.gnu (MCS_FLAGS): Include $(MCS_DEFINES), the user may
3388 use this to specify /define options.
3390 2002-07-29 Martin Baulig <martin@gnome.org>
3392 * statement.cs (Fixed): Moved all code that does variable lookups
3393 and resolvings from Emit to Resolve.
3395 * statement.cs (For): Moved all code that does variable lookups
3396 and resolvings from Emit to Resolve.
3398 * statement.cs (Using): Moved all code that does variable lookups
3399 and resolvings from Emit to Resolve.
3401 2002-07-29 Martin Baulig <martin@gnome.org>
3403 * attribute.cs (Attribute.Resolve): Explicitly catch a
3404 System.NullReferenceException when creating the
3405 CustromAttributeBuilder and report a different warning message.
3407 2002-07-29 Martin Baulig <martin@gnome.org>
3409 * support.cs (ParameterData.ParameterName): Added method to
3410 get the name of a parameter.
3412 * typemanager.cs (TypeManager.IsValueType): New public method.
3414 2002-07-29 Martin Baulig <martin@gnome.org>
3416 * parameter.cs (Parameter.Modifier): Added `ISBYREF = 8'. This
3417 is a flag which specifies that it's either ref or out.
3418 (Parameter.GetParameterInfo (DeclSpace, int, out bool)): Changed
3419 the out parameter to `out Parameter.Modifier mod', also set the
3420 Parameter.Modifier.ISBYREF flag on it if it's either ref or out.
3422 * support.cs (InternalParameters.ParameterModifier): Distinguish
3423 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3424 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3426 * expression.cs (Argument.GetParameterModifier): Distinguish
3427 between Parameter.Modifier.OUT and Parameter.Modifier.REF, set the
3428 Parameter.Modifier.ISBYREF flag if it's either ref or out.
3430 2002-07-29 Martin Baulig <martin@gnome.org>
3432 * expression.cs (ParameterReference.ParameterReference): Added
3433 `Location loc' argument to the constructor.
3435 * cs-parser.jay: Pass location to ParameterReference.
3437 2002-07-28 Miguel de Icaza <miguel@ximian.com>
3439 * statement.cs (Try): Initialize the location.
3441 * cs-parser.jay: pass location to Try.
3443 * expression.cs (Unary.Reduce): Change the prototype to return
3444 whether a constant fold could be performed or not. The result is
3445 returned in an out parameters. In the case of Indirection and
3446 AddressOf, we want to perform the full tests.
3448 2002-07-26 Miguel de Icaza <miguel@ximian.com>
3450 * statement.cs (Statement.Emit): Flag dead code.
3452 2002-07-27 Andrew Birkett <andy@nobugs.org>
3454 * expression.cs (Unary.Reduce): Handle AddressOf and Indirection.
3456 2002-07-27 Martin Baulig <martin@gnome.org>
3458 * class.cs (MethodData.Define): Put back call to
3459 TypeManager.AddMethod(), accidentally commented this out.
3461 * report.cs (Debug): New public method to print debugging information,
3462 this is `[Conditional ("DEBUG")]'.
3464 2002-07-26 Martin Baulig <martin@gnome.org>
3466 * cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
3467 (switch_statement): Push the current_block to the switch_stack and
3468 pop it again when we're done with the switch.
3469 (switch_section): The new block is a child of the current_block.
3470 Fixes bug #24007, added test-152.cs.
3472 2002-07-27 Martin Baulig <martin@gnome.org>
3474 * expression.cs (Invocation.EmitArguments): When calling a varargs
3475 function with only its fixed arguments, we need to pass an empty
3478 2002-07-27 Martin Baulig <martin@gnome.org>
3480 Mono 0.13 has been released.
3482 2002-07-25 Miguel de Icaza <miguel@ximian.com>
3484 * driver.cs: Rename --resource to --linkres, because that is what
3485 we do currently, we dont support --resource yet.
3487 * cs-tokenizer.cs: Fix test for reporting endif mismatches.
3489 2002-07-25 Martin Baulig <martin@gnome.org>
3491 * class.cs (MethodData): New public class. This is a `method builder'
3492 class for a method or one accessor of a Property/Indexer/Event.
3493 (MethodData.GetMethodFlags): Moved here from MemberBase.
3494 (MethodData.ApplyAttributes): Likewise.
3495 (MethodData.ApplyObsoleteAttribute): Likewise.
3496 (MethodData.ApplyConditionalAttribute): Likewise.
3497 (MethodData.ApplyDllImportAttribute): Likewise.
3498 (MethodData.CheckAbstractAndExternal): Likewise.
3499 (MethodData.Define): Formerly knows as MemberBase.DefineMethod().
3500 (MethodData.Emit): Formerly known as Method.Emit().
3501 (MemberBase): Moved everything which was specific to a single
3502 accessor/method to MethodData.
3503 (Method): Create a new MethodData and call Define() and Emit() on it.
3504 (Property, Indexer, Event): Create a new MethodData objects for each
3505 accessor and call Define() and Emit() on them.
3507 2002-07-25 Martin Baulig <martin@gnome.org>
3509 Made MethodCore derive from MemberBase to reuse the code from there.
3510 MemberBase now also checks for attributes.
3512 * class.cs (MethodCore): Derive from MemberBase, not MemberCore.
3513 (MemberBase.GetMethodFlags): Moved here from class Method and marked
3515 (MemberBase.DefineAccessor): Renamed to DefineMethod(), added
3516 `CallingConventions cc' and `Attributes opt_attrs' arguments.
3517 (MemberBase.ApplyAttributes): New virtual method; applies the
3518 attributes to a method or accessor.
3519 (MemberBase.ApplyObsoleteAttribute): New protected virtual method.
3520 (MemberBase.ApplyConditionalAttribute): Likewise.
3521 (MemberBase.ApplyDllImportAttribute): Likewise.
3522 (MemberBase.CheckAbstractAndExternal): Likewise.
3523 (MethodCore.ParameterTypes): This is now a property instead of a
3524 method, it's initialized from DoDefineParameters().
3525 (MethodCore.ParameterInfo): Removed the set accessor.
3526 (MethodCore.DoDefineParameters): New protected virtual method to
3527 initialize ParameterTypes and ParameterInfo.
3528 (Method.GetReturnType): We can now simply return the MemberType.
3529 (Method.GetMethodFlags): Override the MemberBase version and add
3530 the conditional flags.
3531 (Method.CheckBase): Moved some code from Define() here, call
3532 DoDefineParameters() here.
3533 (Method.Define): Use DoDefine() and DefineMethod() from MemberBase
3534 here to avoid some larger code duplication.
3535 (Property.Emit, Indexer.Emit): Call CheckAbstractAndExternal() to
3536 ensure that abstract and external accessors don't declare a body.
3538 * attribute.cs (Attribute.GetValidPieces): Make this actually work:
3539 `System.Attribute.GetCustomAttributes (attr.Type)' does a recursive
3540 lookup in the attribute's parent classes, so we need to abort as soon
3541 as we found the first match.
3542 (Attribute.Obsolete_GetObsoleteMessage): Return the empty string if
3543 the attribute has no arguments.
3545 * typemanager.cs (TypeManager.AddMethod): Now takes a MemberBase instead
3548 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3550 * cs-parser.jay: reverted previous patch.
3552 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3554 * cs-parser.jay: fixed bug #22119.
3556 2002-07-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3558 * attribute.cs: fixed compilation. The error was:
3559 "attribute.cs(571,17): error CS0177: The out parameter 'is_error' must
3560 be assigned to before control leaves the current method."
3561 [FIXME: Filed as bug #28186: MCS must report this error.]
3563 2002-07-25 Martin Baulig <martin@gnome.org>
3565 * attribute.cs (Attribute.Conditional_GetConditionName): New static
3566 method to pull the condition name ouf of a Conditional attribute.
3567 (Attribute.Obsolete_GetObsoleteMessage): New static method to pull
3568 the obsolete message and error flag out of an Obsolete attribute.
3570 * class.cs (Method.GetMethodFlags): New public method to get the
3571 TypeManager.MethodFlags for this method.
3572 (Method.ApplyConditionalAttribute, Method.ApplyObsoleteAttribute): New
3574 (Method.Define): Get and apply the Obsolete and Conditional attributes;
3575 if we're overriding a virtual function, set the new private variable
3576 `parent_method'; call the new TypeManager.AddMethod().
3578 * typemanager.cs (TypeManager.AddMethod): New static method. Stores
3579 the MethodBuilder and the Method in a PtrHashtable.
3580 (TypeManager.builder_to_method): Added for this purpose.
3581 (TypeManager.MethodFlags): Added IsObsoleteError.
3582 (TypeManager.GetMethodFlags): Added `Location loc' argument. Lookup
3583 Obsolete and Conditional arguments in MethodBuilders. If we discover
3584 an Obsolete attribute, emit an appropriate warning 618 / error 619 with
3585 the message from the attribute.
3587 2002-07-24 Martin Baulig <martin@gnome.org>
3589 * cs-tokenizer.cs: Eat up trailing whitespaces and one-line comments in
3590 preprocessor directives, ensure that the argument to #define/#undef is
3591 exactly one identifier and that it's actually an identifier.
3593 Some weeks ago I did a `#define DEBUG 1' myself and wondered why this
3596 2002-07-24 Martin Baulig <martin@gnome.org>
3598 * statement.cs (Foreach.ForeachHelperMethods): Added `Type element_type',
3599 initialize it to TypeManager.object_type in the constructor.
3600 (Foreach.GetEnumeratorFilter): Set `hm.element_type' to the return type
3601 of the `hm.get_current' method if we're using the collection pattern.
3602 (Foreach.EmitCollectionForeach): Use `hm.element_type' as the source type
3603 for the explicit conversion to make it work when we're using the collection
3604 pattern and the `Current' property has a different return type than `object'.
3607 2002-07-24 Martin Baulig <martin@gnome.org>
3609 * delegate.cs (Delegate.VerifyMethod): Simply return null if the method
3610 does not match, but don't report any errors. This method is called in
3611 order for all methods in a MethodGroupExpr until a matching method is
3612 found, so we don't want to bail out if the first method doesn't match.
3613 (NewDelegate.DoResolve): If none of the methods in the MethodGroupExpr
3614 matches, report the 123. Fixes #28070.
3616 2002-07-24 Martin Baulig <martin@gnome.org>
3618 * expression.cs (ArrayAccess.EmitStoreOpcode): Moved the
3619 TypeManager.TypeToCoreType() to the top of the method so the
3620 following equality checks will work. Fixes #28107.
3622 2002-07-24 Martin Baulig <martin@gnome.org>
3624 * cfold.cs (ConstantFold.DoConstantNumericPromotions): "If either
3625 operand is of type uint, and the other operand is of type sbyte,
3626 short or int, the operands are converted to type long." -
3627 Actually do what this comment already told us. Fixes bug #28106,
3630 2002-07-24 Martin Baulig <martin@gnome.org>
3632 * class.cs (MethodBase): New abstract class. This is now a base
3633 class for Property, Indexer and Event to avoid some code duplication
3634 in their Define() and DefineMethods() methods.
3635 (MethodBase.DoDefine, MethodBase.DefineAccessor): Provide virtual
3636 generic methods for Define() and DefineMethods().
3637 (FieldBase): Derive from MemberBase, not MemberCore.
3638 (Property): Derive from MemberBase, not MemberCore.
3639 (Property.DefineMethod): Moved all the code from this method to the
3640 new MethodBase.DefineAccessor(), just call it with appropriate
3642 (Property.Define): Call the new Property.DoDefine(), this does some
3643 sanity checks and we don't need to duplicate the code everywhere.
3644 (Event): Derive from MemberBase, not MemberCore.
3645 (Event.Define): Use the new MethodBase.DefineAccessor() to define the
3646 accessors, this will also make them work with interface events.
3647 (Indexer): Derive from MemberBase, not MemberCore.
3648 (Indexer.DefineMethod): Removed, call MethodBase.DefineAccessor() insstead.
3649 (Indexer.Define): Use the new MethodBase functions.
3651 * interface.cs (InterfaceEvent.InterfaceEvent): Added `Location loc'
3652 argument to the constructor.
3653 (Interface.FindMembers): Added support for interface events.
3654 (Interface.PopluateEvent): Implemented.
3656 Added test-149.cs for this. This also fixes bugs #26067 and #24256.
3658 2002-07-22 Miguel de Icaza <miguel@ximian.com>
3660 * class.cs (TypeContainer.AddMethod): Adding methods do not use IsValid,
3661 but this is required to check for a method name being the same as
3662 the containing class.
3666 2002-07-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3668 * interface.cs: initialize variable.
3670 2002-07-23 Martin Baulig <martin@gnome.org>
3672 Implemented the IndexerName attribute in interfaces.
3674 * class.cs (TypeContainer.DefineIndexers): Don't set the indexer
3675 name if this is an explicit interface implementation.
3676 (Indexer.InterfaceIndexerName): New public variable. If we're
3677 implementing an interface indexer, this is the IndexerName in that
3678 interface. Otherwise, it's the IndexerName.
3679 (Indexer.DefineMethod): If we're implementing interface indexer,
3680 set InterfaceIndexerName. Use the new Pending.IsInterfaceIndexer
3681 and Pending.ImplementIndexer methods.
3682 (Indexer.Define): Also define the PropertyBuilder if we're
3683 implementing an interface indexer and this is neither an explicit
3684 interface implementation nor do the IndexerName match the one in
3687 * pending.cs (TypeAndMethods): Added `MethodInfo [] need_proxy'.
3688 If a method is defined here, then we always need to create a proxy
3689 for it. This is used when implementing interface indexers.
3690 (Pending.IsInterfaceIndexer): New public method.
3691 (Pending.ImplementIndexer): New public method.
3692 (Pending.InterfaceMethod): Added `MethodInfo need_proxy' argument.
3693 This is used when implementing interface indexers to define a proxy
3695 (Pending.VerifyPendingMethods): Look in the `need_proxy' array and
3696 define a proxy if necessary.
3698 * interface.cs (Interface.IndexerName): New public variable.
3699 (Interface.PopulateIndexer): Set the IndexerName.
3700 (Interface.DefineIndexers): New private method. Populate all the
3701 indexers and make sure their IndexerNames match.
3703 * typemanager.cs (IndexerPropertyName): Added support for interface
3706 2002-07-22 Martin Baulig <martin@gnome.org>
3708 * codegen.cs (EmitContext.HasReturnLabel): New public variable.
3709 (EmitContext.EmitTopBlock): Always mark the ReturnLabel and emit a
3710 ret if HasReturnLabel.
3711 (EmitContext.TryCatchLevel, LoopBeginTryCatchLevel): New public
3714 * statement.cs (Do.Emit, While.Emit, For.Emit, Foreach.Emit): Save
3715 and set the ec.LoopBeginTryCatchLevel.
3716 (Try.Emit): Increment the ec.TryCatchLevel while emitting the block.
3717 (Continue.Emit): If the ec.LoopBeginTryCatchLevel is smaller than
3718 the current ec.TryCatchLevel, the branch goes out of an exception
3719 block. In this case, we need to use Leave and not Br.
3721 2002-07-22 Martin Baulig <martin@gnome.org>
3723 * statement.cs (Try.Emit): Emit an explicit ret after the end of the
3724 block unless the block does not always return or it is contained in
3725 another try { ... } catch { ... } block. Fixes bug #26506.
3726 Added verify-1.cs to the test suite.
3728 2002-07-22 Martin Baulig <martin@gnome.org>
3730 * statement.cs (Switch.TableSwitchEmit): If we don't have a default,
3731 then we do not always return. Fixes bug #24985.
3733 2002-07-22 Martin Baulig <martin@gnome.org>
3735 * expression.cs (Invocation.OverloadedResolve): Do the BetterFunction()
3736 lookup on a per-class level; ie. walk up the class hierarchy until we
3737 found at least one applicable method, then choose the best among them.
3738 Fixes bug #24463 and test-29.cs.
3740 2002-07-22 Martin Baulig <martin@gnome.org>
3742 * typemanager.cs (TypeManager.ArrayContainsMethod): Don't check the
3743 return types of the methods. The return type is not part of the
3744 signature and we must not check it to make the `new' modifier work.
3745 Fixes bug #27999, also added test-147.cs.
3746 (TypeManager.TypeToCoreType): Added TypeManager.type_type.
3748 * expression.cs (Invocation.DoResolve): Call TypeManager.TypeToCoreType()
3749 on the method's return type.
3751 2002-07-21 Martin Baulig <martin@gnome.org>
3753 * assign.cs: Make this work if the rightmost source is a constant and
3754 we need to do an implicit type conversion. Also adding a few more tests
3755 to test-38.cs which should have caught this.
3757 * makefile.gnu: Disable debugging, there's already the mcs-mono2.exe
3758 target in the makefile for this. The makefile.gnu is primarily intended
3759 for end-users who don't want to debug the compiler.
3761 2002-07-21 Martin Baulig <martin@gnome.org>
3763 * assign.cs: Improved the Assign class so it can now handle embedded
3764 assignments (X = Y = Z = something). As a side-effect this'll now also
3765 consume less local variables. test-38.cs now passes with MCS, added
3766 a few new test cases to that test.
3768 2002-07-20 Martin Baulig <martin@gnome.org>
3770 * expression.cs (Binary.EmitBranchable): Emit correct unsigned branch
3771 instructions. Fixes bug #27977, also added test-146.cs.
3773 2002-07-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3775 * cs-tokenizer.cs: fixed getHex ().
3777 2002-07-19 Martin Baulig <martin@gnome.org>
3779 * expression.cs (Invocation.EmitParams): Use TypeManager.LookupType(),
3780 not Type.GetType() to lookup the array type. This is needed when
3781 we're constructing an array of a user-defined type.
3782 (ArrayAccess.EmitDynamicInitializers): Only emit the Ldelema for
3783 single-dimensional arrays, but also for single-dimensial arrays of
3786 2002-07-19 Martin Baulig <martin@gnome.org>
3788 * expression.cs (New.DoEmit): Create a new LocalTemporary each time
3789 this function is called, it's not allowed to share LocalBuilders
3792 2002-07-19 Martin Baulig <martin@gnome.org>
3794 * expression.cs (Argument.Resolve): Report an error 118 when trying
3795 to pass a type as argument.
3797 2002-07-18 Martin Baulig <martin@gnome.org>
3799 * ecore.cs (Expression.ImplicitNumericConversion): Don't emit a
3800 Conv_R_Un for the signed `long' type.
3802 2002-07-15 Miguel de Icaza <miguel@ximian.com>
3804 * expression.cs (MemberAccess.DoResolve): Do not reuse the field
3805 `expr' for the temporary result, as that will fail if we do
3806 multiple resolves on the same expression.
3808 2002-07-05 Miguel de Icaza <miguel@ximian.com>
3810 * ecore.cs (SimpleNameResolve): Use ec.DeclSpace instead of
3811 ec.TypeContainer for looking up aliases.
3813 * class.cs (TypeContainer): Remove LookupAlias from here.
3815 * decl.cs (DeclSpace); Move here.
3817 2002-07-01 Miguel de Icaza <miguel@ximian.com>
3819 * class.cs (FindMembers): Only call filter if the constructor
3820 bulider is not null.
3822 Also handle delegates in `NestedTypes' now. Now we will perform
3823 type lookups using the standard resolution process. This also
3826 * decl.cs (DeclSpace.ResolveType): New type resolution routine.
3827 This uses Expressions (the limited kind that can be parsed by the
3828 tree) instead of strings.
3830 * expression.cs (ComposedCast.ToString): Implement, used to flag
3831 errors since now we have to render expressions.
3833 (ArrayCreation): Kill FormElementType. Use ComposedCasts in
3836 * ecore.cs (SimpleName.ToString): ditto.
3838 * cs-parser.jay: Instead of using strings to assemble types, use
3839 Expressions to assemble the type (using SimpleName, ComposedCast,
3840 MemberAccess). This should fix the type lookups in declarations,
3841 because we were using a different code path for this.
3843 * statement.cs (Block.Resolve): Continue processing statements
3844 even when there is an error.
3846 2002-07-17 Miguel de Icaza <miguel@ximian.com>
3848 * class.cs (Event.Define): Also remove the `remove' method from
3849 the list of pending items.
3851 * expression.cs (ParameterReference): Use ldarg.N (0..3) to
3852 generate more compact code.
3854 2002-07-17 Martin Baulig <martin@gnome.org>
3856 * const.cs (Const.LookupConstantValue): Add support for constant
3857 `unchecked' and `checked' expressions.
3858 Also adding test case test-140.cs for this.
3860 2002-07-17 Martin Baulig <martin@gnome.org>
3862 * statement.cs (Foreach.GetEnumeratorFilter): When compiling corlib,
3863 check whether mi.ReturnType implements the IEnumerator interface; the
3864 `==' and the IsAssignableFrom() will fail in this situation.
3866 2002-07-16 Ravi Pratap <ravi@ximian.com>
3868 * ecore.cs (SimpleName.SimpleNameResolve) : Apply Gonzalo's fix
3871 2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
3873 * expression.cs: fixed bug #27811.
3875 2002-07-14 Miguel de Icaza <miguel@ximian.com>
3877 * expression.cs (ParameterReference.AddressOf): Patch from Paolo
3878 Molaro: when we are a ref, the value already contains a pointer
3879 value, do not take the address of it.
3881 2002-07-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
3882 * removed mb-parser.jay and mb-tokenizer.cs
3884 Sat Jul 13 19:38:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
3886 * expression.cs: check against the building corlib void type.
3888 Sat Jul 13 19:35:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
3890 * ecore.cs: fix for valuetype static readonly fields: when
3891 initializing them, we need their address, not the address of a copy.
3893 Sat Jul 13 17:32:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
3895 * typemanager.cs: register also enum_type in corlib.
3897 Sat Jul 13 15:59:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
3899 * class.cs: allow calling this (but not base) initializers in structs.
3901 Sat Jul 13 15:12:06 CEST 2002 Paolo Molaro <lupus@ximian.com>
3903 * ecore.cs: make sure we compare against the building base types
3906 Sat Jul 13 15:10:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
3908 * typemanager.cs: fix TypeToCoreType() to handle void and object
3909 (corlib gets no more typerefs after this change).
3911 2002-07-12 Miguel de Icaza <miguel@ximian.com>
3913 * expression.cs (ArrayCreation.EmitArrayArguments): use
3914 Conv.Ovf.U4 for unsigned and Conv.Ovf.I4 for signed.
3916 (ArrayAccess.LoadArrayAndArguments): Use Conv_Ovf_I and
3917 Conv_Ovf_I_Un for the array arguments. Even if C# allows longs as
3918 array indexes, the runtime actually forbids them.
3920 * ecore.cs (ExpressionToArrayArgument): Move the conversion code
3921 for array arguments here.
3923 * expression.cs (EmitLoadOpcode): System.Char is a U2, use that
3924 instead of the default for ValueTypes.
3926 (New.DoEmit): Use IsValueType instead of
3927 IsSubclassOf (value_type)
3928 (New.DoResolve): ditto.
3929 (Invocation.EmitCall): ditto.
3931 * assign.cs (Assign): ditto.
3933 * statement.cs (Unsafe): Ok, so I got the semantics wrong.
3934 Statements *are* currently doing part of their resolution during
3937 Expressions do always resolve during resolve, but statements are
3938 only required to propagate resolution to their children.
3940 2002-07-11 Miguel de Icaza <miguel@ximian.com>
3942 * driver.cs (CSCParseOption): Finish the /r: and /lib: support.
3944 (LoadAssembly): Do not add the dll if it is already specified
3946 (MainDriver): Add the System directory to the link path at the end,
3947 after all the other -L arguments.
3949 * expression.cs (ArrayAccess.EmitLoadOpcode): I was using the
3950 wrong opcode for loading bytes and bools (ldelem.i1 instead of
3951 ldelem.u1) and using the opposite for sbytes.
3953 This fixes Digger, and we can finally run it.
3955 * driver.cs (UnixParseOption): Move the option parsing here.
3956 (CSCParseOption): Implement CSC-like parsing of options.
3958 We now support both modes of operation, the old Unix way, and the
3959 new CSC-like way. This should help those who wanted to make cross
3962 The only thing broken is that /r:, /reference: and /lib: are not
3963 implemented, because I want to make those have the same semantics
3964 as the CSC compiler has, and kill once and for all the confussion
3965 around this. Will be doing this tomorrow.
3967 * statement.cs (Unsafe.Resolve): The state is checked during
3968 resolve, not emit, so we have to set the flags for IsUnsfe here.
3970 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3972 * expression.cs (MemberAccess.ResolveMemberAccess): Since we can
3973 not catch the Error_ObjectRefRequired in SimpleName (as it is
3974 possible to have a class/instance variable name that later gets
3975 deambiguated), we have to check this here.
3977 2002-07-10 Ravi Pratap <ravi@ximian.com>
3979 * class.cs (TypeContainer.GetFieldFromEvent): Move away from here,
3980 make static and put into Expression.
3982 (Event.Define): Register the private field of the event with the
3983 TypeManager so that GetFieldFromEvent can get at it.
3985 (TypeManager.RegisterPrivateFieldOfEvent): Implement to
3986 keep track of the private field associated with an event which
3989 (TypeManager.GetPrivateFieldOfEvent): Implement to get at the
3992 * ecore.cs (GetFieldFromEvent): RE-write to use the above methods.
3994 2002-07-10 Miguel de Icaza <miguel@ximian.com>
3996 * expression.cs (Binary.EmitBranchable): this routine emits the
3997 Binary expression in a branchable context. This basically means:
3998 we need to branch somewhere, not just get the value on the stack.
4000 This works together with Statement.EmitBoolExpression.
4002 * statement.cs (Statement.EmitBoolExpression): Use
4005 2002-07-09 Miguel de Icaza <miguel@ximian.com>
4007 * statement.cs (For): Reduce the number of jumps in loops.
4009 (For): Implement loop inversion for the For statement.
4011 (Break): We can be breaking out of a Try/Catch controlled section
4012 (foreach might have an implicit try/catch clause), so we need to
4013 use Leave instead of Br.
4015 * ecore.cs (FieldExpr.AddressOf): Fix for test-139 (augmented
4016 now). If the instace expression supports IMemoryLocation, we use
4017 the AddressOf method from the IMemoryLocation to extract the
4018 address instead of emitting the instance.
4020 This showed up with `This', as we were emitting the instance
4021 always (Emit) instead of the Address of This. Particularly
4022 interesting when This is a value type, as we dont want the Emit
4023 effect (which was to load the object).
4025 2002-07-08 Miguel de Icaza <miguel@ximian.com>
4027 * attribute.cs: Pass the entry point to the DefinePInvokeMethod
4029 * statement.cs (Checked): Set the CheckedState during the resolve
4030 process too, as the ConvCast operations track the checked state on
4031 the resolve process, and not emit.
4033 * cs-parser.jay (namespace_member_declaration): Flag that we have
4034 found a declaration when we do. This is used to flag error 1529
4036 * driver.cs: Report ok when we display the help only.
4038 2002-07-06 Andrew Birkett <adb@tardis.ed.ac.uk>
4040 * cs-tokenizer.cs (xtoken): Improve handling of string literals.
4042 2002-07-04 Miguel de Icaza <miguel@ximian.com>
4044 * cs-tokenizer.cs (define): We also have to track locally the
4045 defines. AllDefines is just used for the Conditional Attribute,
4046 but we also need the local defines for the current source code.
4048 2002-07-03 Miguel de Icaza <miguel@ximian.com>
4050 * statement.cs (While, For, Do): These loops can exit through a
4051 Break statement, use this information to tell whether the
4052 statement is the last piece of code.
4054 (Break): Flag that we break.
4056 * codegen.cs (EmitContexts): New `Breaks' state variable.
4058 2002-07-03 Martin Baulig <martin@gnome.org>
4060 * class.cs (TypeContainer.MethodModifiersValid): Allow override
4061 modifiers in method declarations in structs. Otherwise, you won't
4062 be able to override things like Object.Equals().
4064 2002-07-02 Miguel de Icaza <miguel@ximian.com>
4066 * class.cs (Method, Property, Indexer): Do not allow the public
4067 modifier to be used in explicit interface implementations.
4069 (TypeContainer.MethodModifiersValid): Catch virtual, abstract and
4070 override modifiers in method declarations in structs
4072 2002-07-02 Andrew Birkett <adb@tardis.ed.ac.uk>
4074 * cs-tokenizer.cs (adjust_int, adjust_real): Do not abort on
4075 integer or real overflow, report an error
4077 2002-07-02 Martin Baulig <martin@gnome.org>
4079 * typemanager.cs (TypeManager.InitCoreTypes): When compiling
4080 corlib, dynamically call AssemblyBuilder.SetCorlibTypeBuilders()
4081 to tell the runtime about our newly created System.Object and
4082 System.ValueType types.
4084 2002-07-02 Miguel de Icaza <miguel@ximian.com>
4086 * expression.cs (This): Use Stobj/Ldobj when we are a member of a
4087 struct instead of Ldarg/Starg.
4089 2002-07-02 Martin Baulig <martin@gnome.org>
4091 * expression.cs (Indirection.Indirection): Call
4092 TypeManager.TypeToCoreType() on `expr.Type.GetElementType ()'.
4094 2002-07-02 Martin Baulig <martin@gnome.org>
4096 * expression.cs (ArrayAccess.EmitStoreOpcode): If the type is a
4097 ValueType, call TypeManager.TypeToCoreType() on it.
4098 (Invocations.EmitParams): Call TypeManager.TypeToCoreType() on
4099 the OpCodes.Newarr argument.
4101 2002-07-02 Martin Baulig <martin@gnome.org>
4103 * expression.cs (Invocation.EmitCall): When compiling corlib,
4104 replace all calls to the system's System.Array type to calls to
4105 the newly created one.
4107 * typemanager.cs (TypeManager.InitCodeHelpers): Added a few more
4108 System.Array methods.
4109 (TypeManager.InitCoreTypes): When compiling corlib, get the methods
4110 from the system's System.Array type which must be replaced.
4112 Tue Jul 2 19:05:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
4114 * typemanager.cs: load unverifiable_code_ctor so we can build
4115 corlib using the correct type. Avoid using GetTypeCode() with
4117 * rootcontext.cs: uses TypeManager.unverifiable_code_ctor and
4118 TypeManager.object_type to allow building corlib.
4120 Tue Jul 2 19:03:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
4122 * ecore.cs: handle System.Enum separately in LoadFromPtr().
4124 2002-07-01 Martin Baulig <martin@gnome.org>
4126 * class.cs: Make the last change actually work, we need to check
4127 whether `ifaces != null' to avoid a crash.
4129 Mon Jul 1 16:15:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
4131 * class.cs: when we build structs without fields that implement
4132 interfaces, we need to add the interfaces separately, since there is
4133 no API to both set the size and add the interfaces at type creation
4136 Mon Jul 1 14:50:47 CEST 2002 Paolo Molaro <lupus@ximian.com>
4138 * expression.cs: the dimension arguments to the array constructors
4139 need to be converted if they are a long.
4141 Mon Jul 1 12:26:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
4143 * class.cs: don't emit ldarg.0 if there is no parent constructor
4144 (fixes showstopper for corlib).
4146 2002-06-29 Martin Baulig <martin@gnome.org>
4148 MCS now compiles corlib on GNU/Linux :-)
4150 * attribute.cs (Attribute.ApplyAttributes): Treat Accessors like Method,
4151 ie. check for MethodImplOptions.InternalCall.
4153 * class.cs (TypeContainer.DefineType): When compiling corlib, both parent
4154 and TypeManager.attribute_type are null, so we must explicitly check
4155 whether parent is not null to find out whether it's an attribute type.
4156 (Property.Emit): Always call Attribute.ApplyAttributes() on the GetBuilder
4157 and SetBuilder, not only if the property is neither abstract nor external.
4158 This is necessary to set the MethodImplOptions on the accessor methods.
4159 (Indexer.Emit): Call Attribute.ApplyAttributes() on the GetBuilder and
4160 SetBuilder, see Property.Emit().
4162 * rootcontext.cs (RootContext.PopulateTypes): When compiling corlib, don't
4163 populate "System.Object", "System.ValueType" and "System.Attribute" since
4164 they've already been populated from BootCorlib_PopulateCoreTypes().
4166 2002-06-29 Martin Baulig <martin@gnome.org>
4168 * ecore.cs (Expression.ImplicitReferenceConversionExists): If expr
4169 is the NullLiteral, we also need to make sure that target_type is not
4172 2002-06-29 Martin Baulig <martin@gnome.org>
4174 * rootcontext.cs (RootContext.ResolveCore): We must initialize
4175 `TypeManager.multicast_delegate_type' and `TypeManager.delegate_type'
4176 before calling BootstrapCorlib_ResolveDelegate ().
4178 2002-06-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
4180 * statement.cs: fixed build-breaker. All tests passed ok.
4182 2002-06-27 Martin Baulig <martin@gnome.org>
4184 * typemanager.cs (TypeManager.VerifyUnManaged): Added explicit check
4185 for System.Decimal when compiling corlib.
4187 2002-06-27 Martin Baulig <martin@gnome.org>
4189 * statement.cs (Switch.TableSwitchEmit): Make this work with empty
4190 switch blocks which contain nothing but a default clause.
4192 2002-06-26 Andrew <adb@tardis.ed.ac.uk>
4194 * ../errors/cs1501-3.cs: Added new test for struct ctr typechecks.
4196 2002-06-27 Martin Baulig <martin@gnome.org>
4198 * ecore.cs (PropertyExpr.PropertyExpr): Call
4199 TypeManager.TypeToCoreType() on the `pi.PropertyType'.
4201 * typemanager.cs (TypeManager.TypeToCoreType): Return if the type
4202 is already a TypeBuilder.
4204 2002-06-27 Martin Baulig <martin@gnome.org>
4206 * ecore.cs (Expression.ImplicitReferenceConversionExists): Use
4207 `target_type == TypeManager.array_type', not IsAssignableFrom() in
4208 the "from an array-type to System.Array" case. This makes it work
4209 when compiling corlib.
4211 2002-06-27 Martin Baulig <martin@gnome.org>
4213 * ecore.cs (Expression.SimpleNameResolve): If the expression is a
4214 non-static PropertyExpr, set its InstanceExpression. This makes
4215 the `ICollection.Count' property work in System/Array.cs.
4217 2002-06-25 Andrew Birkett <adb@tardis.ed.ac.uk>
4219 * driver.cs: Made error handling more consistent. Errors now
4220 tracked by Report class, so many methods which used to return int
4221 now return void. Main() now prints success/failure and
4222 errors/warnings message.
4224 Renamed '--probe' compiler argument to '--expect-error'. Removed
4225 the magic number return values (123 and 124). Now, if the
4226 expected error occurs, the compiler exits with success (exit value
4227 0). If the compilation completes without seeing that particular
4228 error, the compiler exits with failure (exit value 1). The
4229 makefile in mcs/errors has been changed to handle the new behaviour.
4231 * report.cs: Made 'expected error' number a property and renamed
4232 it from 'Probe' to 'ExpectedError'.
4234 * genericparser.cs: Removed error handling support, since it is
4235 now all done by Report class.
4237 * cs-parser.jay, mb-parser.jay: Errors are tracked by Report
4238 class, so parse() no longer returns an int.
4240 * namespace.cs: Use Report.Error instead of GenericParser.error
4242 2002-06-22 Miguel de Icaza <miguel@ximian.com>
4244 * class.cs (TypeContainer.AddMethod, TypeContainer.AddIndexer,
4245 TypeContainer.AddOperator): At the front of the list put the
4246 explicit implementations, so they get resolved/defined first.
4248 2002-06-21 Miguel de Icaza <miguel@ximian.com>
4250 * class.cs (TypeContainer.VerifyImplements): Verifies that a given
4251 interface type is implemented by this TypeContainer. Used during
4252 explicit interface implementation.
4254 (Property.Define, Indexer.Define, Method.Define): Validate that
4255 the given interface in the explicit implementation is one of the
4256 base classes for the containing type.
4258 Also if we are explicitly implementing an interface, but there is
4259 no match in the pending implementation table, report an error.
4261 (Property.Define): Only define the property if we are
4262 not explicitly implementing a property from an interface. Use the
4263 correct name also for those properties (the same CSC uses,
4264 although that is really not needed).
4266 (Property.Emit): Do not emit attributes for explicitly implemented
4267 properties, as there is no TypeBuilder.
4269 (Indexer.Emit): ditto.
4271 Hiding then means that we do not really *implement* a pending
4272 implementation, which makes code fail.
4274 2002-06-22 Martin Baulig <martin@gnome.org>
4276 * ecore.cs (Expression.Constantify): Call TypeManager.TypeToCoreType() on
4277 the return value of Object.GetType(). [FIXME: we need to do this whenever
4278 we get a type back from the reflection library].
4280 Fri Jun 21 13:37:57 CEST 2002 Paolo Molaro <lupus@ximian.com>
4282 * typemanager.cs: make ExpandInterfaces() slip duplicated interfaces.
4284 2002-06-20 Miguel de Icaza <miguel@ximian.com>
4286 * attribute.cs: Return null if we can not look up the type.
4288 * class.cs (TypeContainer.GetClassBases): Use ExpandInterfaces on
4289 the interface types found.
4291 * interface.cs (Interface.GetInterfaceBases): Use ExpandInterfaces on the
4292 interface types found.
4294 * typemanager.cs (GetInterfaces): Make this routine returns alll
4295 the interfaces and work around the lame differences between
4296 System.Type and System.Reflection.Emit.TypeBuilder in the results
4297 result for GetInterfaces.
4299 (ExpandInterfaces): Given an array of interface types, expand and
4300 eliminate repeated ocurrences of an interface. This expands in
4301 context like: IA; IB : IA; IC : IA, IB; the interface "IC" to
4304 2002-06-21 Martin Baulig <martin@gnome.org>
4306 * typemanager.cs (TypeManager.EnumToUnderlying): It's now safe to call this function
4309 2002-06-21 Martin Baulig <martin@gnome.org>
4311 * typemanager.cs (TypeManager.TypeToCoreType): New function. When compiling corlib
4312 and called with one of the core types, return the corresponding typebuilder for
4315 * expression.cs (ArrayAccess.DoResolve): Call TypeManager.TypeToCoreType() on the
4318 2002-06-21 Martin Baulig <martin@gnome.org>
4320 * ecore.cs (Expression.ExplicitReferenceConversionExists): Use
4321 `target_type.IsArray' instead of `target_type.IsSubclassOf (TypeManager.array_type)'.
4322 (Expression.ConvertReferenceExplicit): Likewise.
4324 * expression.cs (ElementAccess.DoResolve): Likewise.
4325 (ElementAccess.DoResolveLValue): Likewise.
4327 2002-06-10 Martin Baulig <martin@gnome.org>
4329 * interface.cs (Interface.PopulateIndexer): When creating the setter, we need to
4330 add the "value" parameter to the parameter list.
4332 * statement.cs (Fixed.Emit): Pass the return value of the child block's Emit()
4335 2002-06-19 Miguel de Icaza <miguel@ximian.com>
4337 * expression.cs (ArrayCreation.ExpressionToArrayArgument): Convert
4338 the argument to an int, uint, long or ulong, per the spec. Also
4339 catch negative constants in array creation.
4341 Thu Jun 20 17:56:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
4343 * class.cs: do not allow the same interface to appear twice in
4344 the definition list.
4346 Wed Jun 19 22:33:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
4348 * ecore.cs: don't use ldlen with System.Array.
4350 Wed Jun 19 20:57:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
4352 * ecore.cs: stobj requires a type argument. Handle indirect stores on enums.
4354 Wed Jun 19 20:17:59 CEST 2002 Paolo Molaro <lupus@ximian.com>
4356 * modifiers.cs: produce correct field attributes for protected
4357 internal. Easy fix so miguel can work on ther harder stuff:-)
4359 2002-06-18 Miguel de Icaza <miguel@ximian.com>
4361 * pending.cs: New file. Move the code from class.cs here.
4362 Support clearning the pending flag for all methods (when not doing
4363 explicit interface implementation).
4365 Tue Jun 18 10:36:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
4367 * rootcontext.cs: added a couple more types needed to bootstrap.
4369 2002-06-17 Miguel de Icaza <miguel@ximian.com>
4371 * typemanager.cs (GetConstructor): Use DeclaredOnly to look the
4372 constructor in the type, instead of any constructor in the type
4373 hierarchy. Thanks to Paolo for finding this bug (it showed up as
4374 a bug in the Mono runtime when applying the params attribute).
4376 2002-06-16 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
4377 * changed namespace.cs to use "GenericParser.error(...)" instead of "CSharpParser.error(...)"
4379 2002-06-14 Rachel Hestilow <hestilow@ximian.com>
4381 * expression.cs (Unary.ResolveOperator): Use TypeManager
4382 to resolve the type.
4384 2002-06-13 Ravi Pratap <ravi@ximian.com>
4386 * cs-parser.jay (enum_member_declaration): Pass in the attributes
4389 * enum.cs (AddEnumMember): Add support to store the attributes associated
4390 with each member too.
4392 * attribute.cs (CheckAttribute, ApplyAttributes): Update to handle
4393 field builders too - this takes care of the enum member case.
4395 2002-06-10 Rachel Hestilow <hestilow@ximian.com>
4397 * typemanager.cs (TypeManager.VerifyUnManaged): Allow
4398 address-of operator on both value types and pointers.
4400 2002-06-10 Martin Baulig <martin@gnome.org>
4402 * interface.cs (Interface.PopulateIndexer): Add the indexer's
4403 PropertyBuilder to the `property_builders' list.
4405 * expression.cs (Indexers.GetIndexersForTypeOrInterface): New private method.
4406 (Indexers.GetIndexersForType): Call GetIndexersForTypeOrInterface() on the
4407 `lookup_type' and all its interfaces. Unfortunately, Type.FindMembers() won't
4408 find any indexers which are inherited from an interface.
4410 2002-06-09 Martin Baulig <martin@gnome.org>
4412 * const.cs (Const.LookupConstantValue): Convert `Expr' to a literal of
4413 the same type as the constant if necessary. There's also a test-130.cs
4416 * enum.cs (Enum.ChangeEnumType): Moved to typemanager.cs and made public.
4418 * typemanager.cs (TypeManager.ChangeType): Previously known as
4419 Enum.ChangeEnumType().
4421 2002-06-09 Martin Baulig <martin@gnome.org>
4423 * expression.cs (Cast.TryReduce): Added support for consts.
4425 2002-06-08 Ravi Pratap <ravi@ximian.com>
4427 * class.cs (Accessor): Hold attributes information so we can pass
4430 * cs-parser.jay (get_accessor_declaration, set_accessor_declaration):
4431 Modify to pass in attributes attached to the methods.
4433 (add_accessor_declaration, remove_accessor_declaration): Ditto.
4435 * attribute.cs (ApplyAttributes, CheckAttribute): Update accordingly
4436 to handle the Accessor kind :-)
4438 * class.cs (Property.Emit, Event.Emit): Apply attributes to the accessors
4440 2002-06-08 Martin Baulig <martin@gnome.org>
4442 * expression.cs (Unary.TryReduceNegative): Added support for
4445 2002-06-08 Martin Baulig <martin@gnome.org>
4447 * enum.cs (Enum.LookupEnumValue): Don't report an error if the
4448 name can't be found in the `defined_names' - the caller will do a
4449 MemberLookup in this case and thus find methods in System.Enum
4450 such as Enum.IsDefined().
4452 2002-06-08 Martin Baulig <martin@gnome.org>
4454 * enum.cs (Enum.ChangeEnumType): This is a custom version of
4455 Convert.ChangeType() which works with TypeBuilder created types.
4456 (Enum.LookupEnumValue, Enum.Define): Use it here.
4458 * class.cs (TypeContainer.RegisterRequiredImplementations): Added
4459 `TypeBuilder.BaseType != null' check.
4460 (TypeContainer.FindMembers): Only lookup parent members if we
4461 actually have a parent.
4462 (Method.EmitDestructor): Added `ec.ContainerType.BaseType != null' check.
4463 (ConstructorInitializer.Resolve): Likewise.
4465 * interface.cs (Interface.FindMembers): Added
4466 `TypeBuilder.BaseType != null' check.
4468 * rootcontext.cs (RootContext.ResolveCore): Added
4469 "System.Runtime.CompilerServices.IndexerNameAttribute" to
4470 classes_second_stage.
4472 * typemanager.cs (TypeManager.InitCoreTypes): Don't initialize
4473 debug_type and trace_type when compiling with --nostdlib.
4475 2002-06-07 Martin Baulig <martin@gnome.org>
4477 * class.cs (TypeContainer): Added `have_nonstatic_fields' field.
4478 (AddField): Set it to true when adding a non-static field.
4479 (DefineType): Use `have_nonstatic_fields' to find out whether we
4480 have non-static fields, not `Fields != null'.
4482 2002-06-02 Miguel de Icaza <miguel@ximian.com>
4484 * ecore.cs (SimpleNameResolve): Removed simple bug (we were
4485 dereferencing a null on the static-field code path)
4487 2002-05-30 Martin Baulig <martin@gnome.org>
4489 * codegen.cs (InitMonoSymbolWriter): Added `string[] args' argument
4490 to take command line arguments. Use reflection to call the new
4491 custom `Initialize' function on the symbol writer and pass it the
4492 command line arguments.
4494 * driver.cs (--debug-args): New command line argument to pass command
4495 line arguments to the symbol writer.
4497 2002-05-28 Miguel de Icaza <miguel@ximian.com>
4499 * assign.cs (DoResolve): Forgot to do the implicit conversion to
4500 the target type for indexers and properties. Thanks to Joe for
4503 2002-05-27 Miguel de Icaza <miguel@ximian.com>
4505 * typemanager.cs (MethodFlags): returns the method flags
4506 (Obsolete/ShouldIgnore) that control warning emission and whether
4507 the invocation should be made, or ignored.
4509 * expression.cs (Invocation.Emit): Remove previous hack, we should
4510 not do this on matching a base type, we should do this based on an attribute
4512 Only emit calls to System.Diagnostics.Debug and
4513 System.Diagnostics.Trace if the TRACE and DEBUG defines are passed
4514 on the command line.
4516 * rootcontext.cs: Global settings for tracing and debugging.
4518 * cs-tokenizer.cs (define): New utility function to track
4519 defines. Set the global settings for TRACE and DEBUG if found.
4521 2002-05-25 Ravi Pratap <ravi@ximian.com>
4523 * interface.cs (Populate*): Pass in the TypeContainer as well as
4524 the DeclSpace as parameters so that we can create EmitContexts and
4525 then use that to apply attributes etc.
4527 (PopulateMethod, PopulateEvent, PopulateProperty)
4528 (PopulateIndexer): Apply attributes everywhere.
4530 * attribute.cs (CheckAttribute): Include InterfaceMethod, InterfaceEvent
4533 (ApplyAttributes): Update accordingly.
4535 We now apply interface attributes for all members too.
4537 2002-05-26 Miguel de Icaza <miguel@ximian.com>
4539 * class.cs (Indexer.Define); Correctly check if we are explicit
4540 implementation (instead of checking the Name for a ".", we
4541 directly look up if the InterfaceType was specified).
4543 Delay the creation of the PropertyBuilder.
4545 Only create the PropertyBuilder if we are not an explicit
4546 interface implementation. This means that explicit interface
4547 implementation members do not participate in regular function
4548 lookups, and hence fixes another major ambiguity problem in
4549 overload resolution (that was the visible effect).
4551 (DefineMethod): Return whether we are doing an interface
4554 * typemanager.cs: Temporary hack until we get attributes in
4555 interfaces (Ravi is working on that) and we get IndexerName
4556 support in interfaces.
4558 * interface.cs: Register the indexers as properties.
4560 * attribute.cs (Attribute.Resolve): Catch the error, and emit a
4561 warning, I have verified that this is a bug in the .NET runtime
4562 (JavaScript suffers of the same problem).
4564 * typemanager.cs (MemberLookup): When looking up members for
4565 interfaces, the parent of an interface is the implicit
4566 System.Object (so we succeed in searches of Object methods in an
4567 interface method invocation. Example: IEnumerable x; x.ToString
4570 2002-05-25 Miguel de Icaza <miguel@ximian.com>
4572 * class.cs (Event): Events should also register if they do
4573 implement the methods that an interface requires.
4575 * typemanager.cs (MemberLookup); use the new GetInterfaces
4578 (GetInterfaces): The code used to lookup interfaces for a type is
4579 used in more than one place, factor it here.
4581 * driver.cs: Track the errors at the bottom of the file, we kept
4584 * delegate.cs (NewDelegate.Emit): We have to emit a null as the
4585 instance if the method we are calling is static!
4587 2002-05-24 Miguel de Icaza <miguel@ximian.com>
4589 * attribute.cs (ApplyAttributes): Make this function filter out
4590 the IndexerName attribute (as that attribute in reality is never
4591 applied) and return the string constant for the IndexerName
4594 * class.cs (TypeContainer.Emit): Validate that all the indexers
4595 have the same IndexerName attribute, and if so, set the
4596 DefaultName attribute on the class.
4598 * typemanager.cs: The return value might contain other stuff (not
4599 only methods). For instance, consider a method with an "Item"
4600 property and an Item method.
4602 * class.cs: If there is a problem with the parameter types,
4605 2002-05-24 Ravi Pratap <ravi@ximian.com>
4607 * ecore.cs (ImplicitConversionExists): Wrapper function which also
4608 looks at user defined conversion after making a call to
4609 StandardConversionExists - we need this for overload resolution.
4611 * expression.cs : Update accordingly the various method calls.
4613 This fixes 2 bugs filed against implicit user defined conversions
4615 2002-05-22 Miguel de Icaza <miguel@ximian.com>
4617 * statement.cs: Track the result of the assignment.
4619 2002-05-21 Miguel de Icaza <miguel@ximian.com>
4621 * expression.cs (MemberAccess): Improved error reporting for
4622 inaccessible members.
4624 2002-05-22 Martin Baulig <martin@gnome.org>
4626 * makefile (mcs-mono2.exe): New target. This is mcs compiled with
4627 itself with debugging support.
4629 2002-05-22 Martin Baulig <martin@gnome.org>
4631 * typemanager.cs ("System.Runtime.InteropServices.StructLayoutAttribute"):
4632 Removed, this isn't needed anymore.
4634 2002-05-20 Martin Baulig <martin@gnome.org>
4636 * typemanager.cs (InitEnumUnderlyingTypes): "System.Char" can't
4637 be underlying type for an enum.
4639 2002-05-20 Miguel de Icaza <miguel@ximian.com>
4641 * typemanager.cs (InitEnumUnderlyingTypes): New helper function
4642 that splits out the loading of just the core types.
4644 * rootcontext.cs (ResolveCore): Split the struct resolution in
4645 two, so we can load the enumeration underlying types before any
4648 * expression.cs (Is): Bandaid until we fix properly Switch (see
4649 bug #24985 for details).
4651 * typemanager.cs (ImplementsInterface): The hashtable will contain
4652 a null if there are no interfaces implemented.
4654 2002-05-18 Miguel de Icaza <miguel@ximian.com>
4656 * cs-parser.jay (indexer_declarator): It is fine to have array
4659 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4661 * typemanager.cs: (RegisterBuilder): New function used to register
4662 TypeBuilders that implement interfaces. Since
4663 TypeBuilder.GetInterfaces (as usual) does not work with lame
4665 (AddUserType): register interfaces.
4667 (ImplementsInterface): Use the builder_to_ifaces hash if we are
4668 dealing with TypeBuilder. Also, arrays are showing up as
4669 SymbolTypes, which are not TypeBuilders, but whose GetInterfaces
4670 methods can not be invoked on them!
4672 * ecore.cs (ExplicitReferenceConversionExists): Made public.
4673 (ImplicitReferenceConversionExists): Split out from
4674 StandardConversionExists.
4676 * expression.cs (As): We were only implementing one of the three
4677 cases for the as operator. We now implement them all.
4678 (Is): Implement the various other cases for Is as well.
4680 * typemanager.cs (CACHE): New define used to control if we want or
4681 not the FindMembers cache. Seems to have a negative impact on
4682 performance currently
4684 (MemberLookup): Nested types have full acess to
4685 enclosing type members
4687 Remove code that coped with instance/static returns for events, we
4688 now catch this in RealFindMembers.
4690 (RealFindMembers): only perform static lookup if the instance
4691 lookup did not return a type or an event.
4693 2002-05-17 Miguel de Icaza <miguel@ximian.com>
4695 * assign.cs (CompoundAssign): We pass more semantic information
4696 now to Compound Assignments than we did before: now we have all
4697 the information at hand, and now we resolve the target *before* we
4698 do the expression expansion, which allows the "CacheValue" method
4699 to have the effect we intended (before, a [x] += 1 would generate
4700 two differen ArrayAccess expressions from the ElementAccess,
4701 during the resolution process).
4703 (CompoundAssign.DoResolve): Resolve target and original_source here.
4705 2002-05-16 Miguel de Icaza <miguel@ximian.com>
4707 * expression.cs (ArrayAccess): dropped debugging information.
4709 * typemanager.cs: Small bug fix: I was always returning i_members,
4710 instead of one of i_members or s_members (depending on which had
4713 * assign.cs (IAssignMethod.CacheTemporaries): New method. This
4714 method is invoked before any code generation takes place, and it
4715 is a mechanism to inform that the expression will be invoked more
4716 than once, and that the method should use temporary values to
4717 avoid having side effects
4719 (Assign.Emit): Call CacheTemporaries in the IAssignMethod.
4721 * ecore.cs (Expression.CacheTemporaries): Provide empty default
4724 * expression.cs (Indirection, ArrayAccess): Add support for
4725 CacheTemporaries in these two bad boys.
4727 * ecore.cs (LoadFromPtr): figure out on our own if we need to use
4729 (StoreFromPtr): Handle stobj as well.
4731 * expression.cs (UnaryMutator): Share more code.
4733 * typemanager.cs (FindMembers): Thanks to Paolo for tracking this
4734 down: I was not tracking the Filter function as well, which
4735 was affecting the results of the cache.
4737 2002-05-15 Miguel de Icaza <miguel@ximian.com>
4739 * attribute.cs: Remove the hack to handle the CharSet property on
4742 2002-05-14 Miguel de Icaza <miguel@ximian.com>
4744 * attribute.cs (DoResolve): More uglyness, we now only try to
4745 resolve the attribute partially, to extract the CharSet
4746 information (only if we are a StructLayout attribute). Otherwise
4748 (GetExtraTypeInfo): Add some code to conditionally kill in the
4749 future this. I am more and more convinced that the .NET
4750 framework has special code to handle the attribute setting on
4753 * expression.cs (IsParamsMethodApplicable): Revert my previous
4754 foreach change here, it was wrong.
4756 2002-05-13 Miguel de Icaza <miguel@ximian.com>
4758 * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
4759 (pp_expr): do not abort on unknown input, just return.
4760 (eval): abort if there are pending chars.
4762 * attribute.cs (Attribute.Resolve): Positional parameters are
4763 optional. Deal with that case.
4765 * class.cs (DefineType): Call Attribute.GetExtraTypeInfo to fetch
4766 the Ansi/Unicode/Auto information for the type.
4768 (TypeContainer.DefineType): instantiate the EmitContext here, as
4769 we will be using it during the type definition (to resolve
4770 attributes) and during the emit phase.
4772 * attribute.cs (Attribute.GetExtraTypeInfo): This routine is used
4773 to pull type information out of the attributes
4775 (Attribute.Resolve): track the constructor builder, and allow for
4776 multiple invocations (structs and classes will use this).
4778 * ecore.cs (MemberLookupFinal): new version with all the
4779 parameters customizable.
4781 * expression.cs (New.DoResolve): Use MemberLookupFinal to locate
4782 constructors. Return if the result value is null (as the error
4783 would have been flagged already by MemberLookupFinal)
4785 Do not allow instances of abstract classes or interfaces to be
4788 * class.cs: (MethodSignature.InheritableMemberSignatureCompare):
4789 We have to compare the assembly property here when dealing with
4790 FamANDAssem and Assembly access modifiers, because we might be
4791 creating an assembly from *modules* (that means that we are not
4792 getting TypeBuilders for types defined in other modules that are
4793 part of this assembly).
4795 (Method.Emit): If the method is marked abstract and has a body,
4798 (TypeContainer.DefineMembers): If both the defined member and the
4799 parent name match are methods, then do not emit any warnings: let
4800 the Method.Define routine take care of flagging warnings. But if
4801 there is a mismatch (method overrides something else, or method is
4802 overriwritten by something, then emit warning).
4804 (MethodSignature.MemberSignatureCompare): If the sig.ret_type is
4805 set to null, this means `do not check for the return type on the
4808 (Method.Define): set the return type for the method signature to
4809 null, so that we get methods with the same name and parameters and
4810 different return types. This is used to flag warning 114 (you are
4811 hiding a method, and you probably want to use the new/override
4814 * typemanager.cs (MemberLookup): Implemented proper access
4815 control, closing a long standing set of bug reports. The problem
4816 was that the Framework only has two bits: Public and NonPublic,
4817 and NonPublic includes private and protected methods, but we need
4818 to enforce the FamANDAssem, FamOrAssem and Family.
4820 2002-05-11 Miguel de Icaza <miguel@ximian.com>
4822 * statement.cs (GotoCase): Return true: Ammounts to giving up
4823 knowledge on whether we return or not, and letting the other case
4824 be responsible for it.
4826 2002-05-10 Miguel de Icaza <miguel@ximian.com>
4828 * driver.cs: Do not load directories for each file processed, only
4829 do it if there is a pattern.
4831 * ecore.cs: Report readonly assigns here as well, as we might have
4832 been resolved only by MemberAccess.
4834 (SimpleName.SimpleNameResolve): Also be useful for LValue
4835 resolution. We need this to propagate assign to local readonly variables
4837 * typemanager.cs: Use a ptrhashtable for the criteria, because we
4838 do not want to reuse potential criteria memory.
4840 * class.cs (MyEventBuilder): Set reflected_type;
4842 * ecore.cs (Constantify): Added support for constifying bools.
4844 (RootContext.LookupType): Added a cache for values looked up in
4845 the declaration space.
4847 * typemanager.cs (FindMembers): Now is a front-end to
4848 RealFindMembers, and provides a two-level hashtable-based cache to
4851 15% performance improvement: from 22.5 to 19.2 seconds.
4853 * expression.cs (IsParamsMethodApplicable): use foreach.
4854 (Invocation.DoResolve): ditto.
4855 (New.DoResolve): ditto.
4856 (ArrayCreation.DoResolve): ditto.
4858 * ecore.cs (FindMostEncompassingType): use foreach.
4860 * delegate.cs (NewDelegate.DoResolve): Use foreach
4862 * ecore.cs (Expression.FindMostSpecificSource): Use foreach.
4863 (RemoveMethods): use foreach.
4865 * expression.cs (Invocation.MakeUnionSet): Optimization: Use two
4866 nested foreach statements instead of for, and also break out of
4867 the inner loop once a match is found.
4869 (Invocation.OverloadResolve): Use foreach, simplify the code.
4871 2002-05-08 Miguel de Icaza <miguel@ximian.com>
4873 * cfold.cs (BinaryFold): During an enumeration evaluation context,
4874 we actually unwrap the expression to allow for extra information
4877 * expression.cs: Use Shr_Un on unsigned operations.
4879 2002-05-08 Ravi Pratap <ravi@ximian.com>
4881 * ecore.cs (FindMostEncompass*): Fix trivial bug where the set of
4882 applicable operators was not being considered correctly. This closes
4883 the bug Miguel reported.
4885 Wed May 8 16:40:50 CEST 2002 Paolo Molaro <lupus@ximian.com>
4887 * attribute.cs: check that the type derives from System.Attribute
4888 and report the correct error in that case (moved the duplicate code to
4889 its own method, too).
4891 Wed May 8 11:50:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
4893 * attribute.cs: lookup attribute type name as the spec says: first the
4894 bare attribute name and then name + "Attribute" (nant compiles with
4895 mcs after this fix).
4897 2002-05-07 Miguel de Icaza <miguel@ximian.com>
4899 * expression.cs (Unary.TryReduceNegative): Ah! Tricky! Tricky!
4900 Because of the way we parse things, we should try to see if a
4901 UIntConstant can fit in an integer.
4903 2002-05-07 Ravi Pratap <ravi@ximian.com>
4905 * ecore.cs (GetConversionOperators): Do not pick up op_True operators
4906 when we are in an explicit context.
4908 (ConvertReferenceExplicit): When converting from Iface type S to Class
4909 T make sure the rules are implemented as an OR.
4911 * parameter.cs (ParameterType): Make it a property for now although the
4912 purpose really isn't anything immediate.
4914 * expression.cs (Is*Applicable): Do better checking on the parameter type
4915 of a ref/out parameter. The ones from the system assemblies are already
4916 marked with the correct type so we don't need to do any correction.
4918 * ecore.cs (StandardConversionExists): Conversion from Interface types to
4919 the object type is standard too so include that.
4921 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4923 * ecore.cs (StandardConversionExists): Augment with missing code:
4924 deal with IntConstant, LongConstants and Enumerations.
4926 * assign.cs: Report the error, instead of failing silently
4928 * rootcontext.cs (AddGlobalAttributes): Track attributes on the
4929 typecontainer that they are declared, because the
4930 typecontainer/namespace will have the list of using clauses that
4933 Assembly Attributes were escaping the normal registration
4936 (EmitCode): Apply attributes within an EmitContext that represents
4937 the container they were declared on.
4939 * cs-parser.jay: Track bases for structs. How did I get this wrong?
4941 2002-05-06 Ravi Pratap <ravi@ximian.com>
4943 * ecore.cs (FindMostEncompassingType, FindMostEncompassedType):
4944 Revamp completely - make much cleaner as we now operate only
4947 (FindMostSpecificSource, FindMostSpecificTarget): New methods
4948 to implement the logic detailed in the spec more correctly.
4950 (UserDefinedConversion): Update accordingly.
4952 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4954 * statement.cs: Return flow analysis information up.
4956 * cs-tokenizer.cs (adjust_real): Share code between LITERAL_DOUBLE
4959 (token): Do not consume an extra character before calling
4962 2002-05-06 Piers Haken <piersh@friskit.com>
4964 * cs-parser.jay: add 'override' attribute to System.Object.Finalize
4966 2002-05-06 Miguel de Icaza <miguel@ximian.com>
4968 * class.cs (Constructor.Emit): Set the IsStatic flag in the
4969 EmitContext during the instance constructor initializer
4970 resolution, to stop access to instance variables.
4972 This is mandated by the spec, last paragraph of the `constructor
4973 initializers' section.
4975 2002-05-05 Miguel de Icaza <miguel@ximian.com>
4977 * cs-parser.jay, class.cs (Accessor): new class used to represent
4978 an accessor (get or set). In the past we used `null' to represent
4979 a missing accessor. But this is ambiguous because there was no
4980 way to tell in abstract indexers/properties if one of them was
4983 Now there is a way of addressing that.
4985 * expression.cs (Indexers.GetIndexersForType): Use TypeManager.MemberLookup
4986 instead of FindMembers.
4988 * class.cs (TypeContainer.EmitFieldInitializer): Do not typecast
4989 the result of Assign.Resolve as Assign, but rather as ExpressionStatement.
4991 * attribute.cs: Treat indexers and properties as the same in terms
4992 of applying attributes
4994 * ecore.cs (FindMostEncompassedType): Use statically initialized
4995 EmptyExpressions()s like we do elsewhere to avoid creating useless
4996 objects (and we take this out of the tight loop).
4998 (GetConversionOperators): Move the code to extract the actual
4999 operators to a separate routine to clean things up.
5001 2002-05-04 Miguel de Icaza <miguel@ximian.com>
5003 * ecore.cs (FieldExpr): Remove un-needed tests for null, since now
5004 events are always registered FieldBuilders.
5006 * class.cs (FieldBase): New class shared by Fields
5008 * delegate.cs: If we are a toplevel delegate, use our full name.
5009 If we are a nested delegate, then only use our tail name.
5011 2002-05-02 Ravi Pratap <ravi@ximian.com>
5013 * expression.cs (IsApplicable): Ensure that we add the "&" to
5014 ref/out types before comparing it with the type of the argument.
5016 (IsParamsMethodApplicable): Ditto.
5018 (Argument.Type): Use TypeManager.LookupType instead of Type.GetType -
5021 * delegate.cs : Handle the case when we have more than one applicable
5022 method. Flag an error only when we finish checking all.
5024 2002-05-02 Miguel de Icaza <miguel@ximian.com>
5026 * expression.cs: Add support for boolean static initializers.
5028 2002-05-01 Miguel de Icaza <miguel@ximian.com>
5030 * attribute.cs: Use proper cast for Events, since we use a MyEventBuilder.
5032 * parameter.cs (ComputeParameterTypes,
5033 ComputeAndDefineParameterTypes): Better error handling: now we
5034 clear the `types' cache if we fail during any of the type lookups.
5035 We also return the status code correctly to our caller
5037 * delegate.cs: If we fail to define a delegate, abort the extra
5040 * expression.cs (Binary.ResolveOperator): for
5041 operator==(object,object) and operator !=(object, object) we also
5042 have to verify that there is an implicit conversion from one to
5045 (ArrayAccess.DoResolve): Array Access can operate on
5048 2002-04-30 Miguel de Icaza <miguel@ximian.com>
5050 * assign.cs (CompoundAssign): A new class used as a "flag" that
5051 the assignment actually is happening as part of a compound
5052 assignment operator.
5054 During compound assignment, a few new rules exist to enable things
5061 x op= y can be evaluated as x = (T) (x op y) (ie, an explicit cast
5062 to the type of x) if y is implicitly convertible to the type of x,
5063 and the operator is a builtin operator and the return type of the
5064 operator is explicitly convertible to the type of x.
5066 * rootcontext.cs: Reset warning level to 2. 4 catches various
5067 "interesting" features in mcs, we must clean this up at some
5068 point, but currently am trying to kill other bugs ;-)
5070 * ecore.cs (SimpleName.SimpleNameResolve): Perform member lookups
5071 in container classes as well.
5073 * expression.cs (Binary.ResolveOperator): Handle string case
5074 before anything else (as operator overloading does emit an error
5075 before doing anything else).
5077 This code could go away when we move to a table driven model, but
5078 i could not come up with a good plan last night.
5080 2002-04-30 Lawrence Pit <loz@cable.a2000.nl>
5082 * typemanager.cs (CSharpName): reimplementation using regex.
5083 * class.cs: added null check for fields in Emit
5084 * rootcontext.cs: set warninglevel to 4
5086 2002-04-29 Miguel de Icaza <miguel@ximian.com>
5088 * typemanager.cs (CSharpName): reimplemented with Lupus
5091 2002-04-28 Miguel de Icaza <miguel@ximian.com>
5093 * statement.cs (If): correclty implement Resolve, because we were
5094 not catching sem errors in there. The same process is needed
5096 (Return, StatementExpression, For, While, Do, Throw, Lock): Implement Resolve
5099 (Statement.Warning_DeadCodeFound): Factorize code.
5100 (While): Report dead code here too.
5102 (Statement): Added Resolve virtual method to allow
5103 for resolution split from the emit code.
5105 2002-04-26 Miguel de Icaza <miguel@ximian.com>
5107 * statement.cs (EmitBoolExpression): No longer try to resolve the
5109 (MakeBoolean): New utility function that resolve, implicitly
5110 converts to boolean and tags the expression.
5113 (If, Do): Implement dead code elimination.
5114 (While): Implement loop inversion
5116 (Do, While, For, If): Resolve the expression prior to calling our
5119 2002-04-22 Lawrence Pit <loz@cable.a2000.nl>
5122 - added method Report28 (warning: program has more than one entry point)
5123 - added method IsEntryPoint, implements paragraph 10.1 of the spec
5124 - modified method Method.Define, the part at the end of the method
5126 * rootcontext.cs: added static public Location EntryPointLocation;
5128 * ../errors/cs0028.cs : Add test case for the above warning.
5131 - modified method CSharpName to allow arrays of primitive type to
5132 be printed nicely (e.g. instead of System.Int32[][] it now prints
5134 - added method CSharpSignature: returns the signature of a method
5135 in string format to be used in reporting errors, warnings, etc.
5137 * support.cs: InternalParameters.ParameterDesc variable tmp initialized
5140 2002-04-26 Ravi Pratap <ravi@ximian.com>
5142 * delegate.cs (Define): Fix extremely silly bug where I was
5143 setting the type of the 'object' parameter of the BeginInvoke
5144 method to System.IAsyncResult instead of System.Object ;-)
5146 2002-04-26 Miguel de Icaza <miguel@ximian.com>
5148 * class.cs (ConstructorInitializer.Resolve): Also use DeclaredOnly
5151 (Constructor.Emit): return if we fail to initialize the
5152 constructor. Another door closed!
5154 * expression.cs (New.DoResolve): Improve error message (from -6 to
5155 1501). Use DeclaredOnly lookup to find the exact constructor.
5157 * typemanager.cs (MemberLookup): If DeclaredOnly is set, do not
5158 loop. This is useful.
5160 * cs-parser.jay: Adjust the default parameters so that destructors
5161 have the proper signature.
5163 2002-04-26 Martin Baulig <martin@gnome.org>
5165 * driver.cs (LoadAssembly): If `assembly' contains any characters
5166 which are only valid in path names and not in assembly names
5167 (currently slash, backslash and point), use Assembly.LoadFrom ()
5168 instead of Assembly.Load () on the `assembly' (before iteration
5169 over the link_paths).
5171 2002-04-26 Martin Baulig <martin@gnome.org>
5173 * cs-tokenizer.cs (is_hex): Correctly handle lowercase chars.
5175 2002-04-25 Miguel de Icaza <miguel@ximian.com>
5177 * class.cs (Property): use the new typemanager.MemberLookup
5179 (TypeContainer.MemberLookup): Implement using the
5180 TypeManager.MemberLookup now.
5182 * typemanager.cs: Make MemberLookup a function of the TypeManager,
5183 and return MemberInfos, so that these can be used without an
5184 EmitContext (what we had before).
5186 2002-04-24 Miguel de Icaza <miguel@ximian.com>
5188 * expression.cs: Fix the case where the argument to params if the
5189 type of the params. I omitted handling this before. Fixed
5191 2002-04-22 Miguel de Icaza <miguel@ximian.com>
5193 * driver.cs: Call BootCorlib_PopulateCoreType
5195 * class.cs (Property.CheckBase): Check for properties only, not
5198 * interface.cs: Temporary hack: try/catch around the
5199 CustomAttributeBuilder, because I am getting an exception that I
5202 * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
5203 types whose definitions are required to be there (attributes are
5204 defined before standard types).
5206 Compute definitions as we boot the various types, as they are used
5207 immediately (value_type class will need object_type, but if we do
5208 not initialize object_type, we will pass a null, which will let
5209 the runtime pick the System.Object from the existing corlib, which
5210 is not what we want).
5212 2002-04-22 Patrik Torstensson <totte@labs2.com>
5214 * cs-tokenizer.cs: fixed a number of trim() issues.
5216 2002-04-22 Ravi Pratap <ravi@ximian.com>
5218 * expression.cs (Argument.Type): Ensure that we return the correct
5219 type when we have out or ref parameters [in which case we
5222 2002-04-22 Miguel de Icaza <miguel@ximian.com>
5224 * class.cs (Property, Indexer): Allow extern modifier in there.
5226 * typemanager.cs (InitBaseTypes): Initializes object_type and
5227 value_type, since those will be used early on during the bootstrap
5228 process to compile corlib.
5230 (InitCoreTypes): Move code from here to InitBaseTypes.
5232 2002-04-21 Miguel de Icaza <miguel@ximian.com>
5234 * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
5235 single-dimension arrays as using the ldlen opcode.
5237 Daniel Lewis discovered this optimization.
5239 * typemanager.cs: Add signature for System.Array::get_Length
5241 2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5243 * statement.cs: report the error when the foreach does not apply to an
5244 array nor a collection.
5246 2002-04-19 Miguel de Icaza <miguel@ximian.com>
5248 * expression.cs: Add implicit conversions to the operator ~.
5250 * constant.cs (DecimalConstant.Emit): Emit decimal value.
5252 * typemanager.cs: Locate the decimal constructor.
5254 2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5256 * attribute.cs: use the new property of TypeOf.
5257 * expression.cs: added 'get' property around typearg.
5259 These changes fix a build breaker reported by NickD. Is this the
5260 correct way to fix? If not, please, revert my changes and make it
5263 2002-04-17 Miguel de Icaza <miguel@ximian.com>
5265 * attribute.cs: Add support for typeof in attribute invocations.
5266 I am not sure that this is right though.
5268 2002-04-14 Duncan Mak <duncan@ximian.com>
5270 * cfold.cs (BinaryFold): Catch DivideByZeroException in the
5271 Binary.Operator.Division case.
5273 2002-04-13 Ravi Pratap <ravi@ximian.com>
5275 * class.cs (DefineType): Ensure that we do a proper check on
5276 attribute types and also register it with the TypeManager.
5278 (TypeContainer.Targets): The default for attribute types is
5279 AttributeTargets.All.
5281 * attribute.cs (ApplyAttributes): Registering the attribute type
5282 is done elsewhere, not when we discover we have a Usage attribute.
5284 2002-04-12 Ravi Pratap <ravi@ximian.com>
5286 * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
5287 and get rid of is_delegate parameter.
5289 * everywhere : update.
5291 2002-04-12 Ravi Pratap <ravi@ximian.com>
5293 * cs-parser.jay (compilation_unit): Revamp completely to use
5294 some new ideas that I got from Rhys' grammar to solve the problems
5295 with assembly level attributes.
5297 (outer_declaration): New grammar production.
5299 (attribute_sections): Add.
5301 (opt_attributes): Base on attribute_sections
5303 (namespace_declaration): Allow opt_attributes to tackle the case
5304 when we have assembly level attributes - we are clever in this
5307 * attribute.cs (ApplyAttributes): Do not worry about assembly
5308 attributes in the non-global context.
5310 * rootcontext.cs (AddGlobalAttributes): Go back to using this
5311 instead of SetGlobalAttributes.
5313 * class.cs, rootcontext.cs : Ensure we define and generate
5314 attribute types before anything else.
5316 * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
5317 and flag the new error -20 for the case when the attribute type
5318 does not have valid targets specified. csc does not catch this.
5320 * ../errors/errors.txt : update for error # -20
5322 2002-04-11 Ravi Pratap <ravi@ximian.com>
5324 * support.cs (InternalParameters.ParameterModifier): Do some null
5325 checking and return sane values.
5327 * class.cs (Method.Define): If we are a PInvoke method, ensure
5328 that we are static and extern. Report error # 601
5330 * ../errors/cs0601.cs : Add test case for the above error.
5332 2002-04-07 Ravi Pratap <ravi@ximian.com>
5334 * rootcontext.cs (attribute_types): We need to keep type of
5335 all attribute types separately and emit code for them first.
5337 (RegisterAttribute) : Implement.
5339 * class.cs (DefineType): Check if the current Type is a custom
5340 attribute type and register it accordingly.
5342 * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
5343 adding the first attribute twice and rename to
5345 (SetGlobalAttributes): this.
5347 * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
5350 * attribute.cs (ApplyAttributes): Take an additional argument telling us
5351 if we are processing global arguments. Hmm, I am unsure of this.
5353 2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
5355 * expression.cs: added static array of strings to avoid calling
5356 Enum.ToString () for Operator in Binary. Significant recover of
5359 2002-04-10 Miguel de Icaza <miguel@ximian.com>
5361 * class.cs (FindMembers): Allow the Builders of the various
5362 members to be null. If they are skip them. This only happens
5363 during the PInvoke declaration.
5365 2002-04-09 Miguel de Icaza <miguel@ximian.com>
5367 * parameter.cs (Parameters.ComputeParameterTypes): Flag the
5368 failure, so we do not keep going afterwards.
5370 * expression.cs: (Invocation.OverloadResolve): I believe Ravi
5371 wanted to pass `false' as the `is_delegate' argument. If this is
5372 the case, why not use delegate_type == null to mean `is_delegate =
5373 false' and anything else as is_delegate = true.
5375 Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
5377 * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
5378 code for the section, not the beginning of the tests.
5380 2002-04-08 Miguel de Icaza <miguel@ximian.com>
5382 * cfold.cs: Handle operator + (Enum x, Underlying x)
5384 * expression.cs (Binary): same. Warn about errors where we have
5385 Enum/Enum in operator + as well.
5387 Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
5390 - added support for switch(bool)
5391 - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
5392 - add TableSwitchEmit() to handle table-based switch statements
5394 2002-04-05 Ravi Pratap <ravi@ximian.com>
5396 * expression.cs (Invocation.OverloadResolve): Factor out code which
5397 does parameter compatibility checking with arguments so that we can
5398 re-use the code even from Delegate.VerifyApplicability
5400 (VerifyArgumentsCompat): Move above code here.
5402 * delegate.cs (VerifyApplicability): Get rid of duplicate code
5403 and instead make a call to the above method.
5405 2002-03-31 Ravi Pratap <ravi@ximian.com>
5407 * typemanager.cs (attribute_type): Corresponds to System.Attribute.
5408 We use it to keep track of classes which are attribute types.
5410 2002-04-02 Miguel de Icaza <miguel@ximian.com>
5412 * delegate.cs (Delegate.Define): Correctly define the types in the
5413 presence of fixed and array parameters.
5415 * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
5418 * ecore.cs (Expression.MemberLookup): Reset binding flags to not
5419 include NonPublic after the first iteration.
5421 * class.cs (Indexer.CheckBase): Only check if both parents are
5424 * cs-parser.jay (accessor_body): If empty, set to null.
5426 * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
5427 same code path here to resolve constants names that we did have in
5428 MemberAccess.DoResolve. There is too much code duplicated here.
5430 2002-04-01 Miguel de Icaza <miguel@ximian.com>
5432 * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
5434 * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
5437 * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
5438 tokens, numbers and strings.
5440 * ecore.cs (MethodGroupExpr): Make Emit warn about missing
5443 * delegate.cs: Use ComputeAndDefineParameterTypes for both the
5444 asyncronous parameters and the regular parameters.
5446 * codegen.cs (CodeGen.Init): Use the constructor that allows us to
5447 specify the target directory.
5449 * expression.cs: (This.DoResolve): Simplify
5450 (As.Emit): Optimize, do not generate IsInst if the expression is
5451 always of the given type.
5453 (Is.DoResolve): Bug fix, we were reporting both always/never for
5456 * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
5457 creating too many unnecessary arrays.
5459 2002-03-31 Miguel de Icaza <miguel@ximian.com>
5461 * class.cs (EmitFieldInitializer): Use Assign expression to assign
5462 fields instead of rolling our own initializer. Takes care of all
5463 implicit conversions, and drops unnecessary static checks/argument.
5465 2002-03-31 Dick Porter <dick@ximian.com>
5467 * driver.cs: use the GetDirectories() return values properly, and
5468 use "/" as path separator.
5470 2002-03-30 Miguel de Icaza <miguel@ximian.com>
5472 * expression.cs (Unary): Optimize - - expr into expr.
5473 (Binary): Optimize a + (-b) into a -b.
5475 * codegen.cs (CodeGen): Made all methods static.
5477 2002-03-29 Miguel de Icaza <miguel@ximian.com>
5481 * decl.cs: Rename `definition' into `TypeBuilder' and drop the
5482 TypeBuilder property.
5484 * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
5487 * tree.cs: Removed the various RecordXXXX, and replaced with a
5488 single RecordDecl. Removed all the accessor methods, and just
5489 left a single access point Type
5491 * enum.cs: Rename DefineEnum to DefineType.
5493 * decl.cs: New abstract method `DefineType' used to unify the
5494 Defines for Enumerations, Interfaces, TypeContainers and
5497 (FindType): Moved LookupInterfaceOrClass here. Moved the
5498 LookupBaseClasses method that used to live in class.cs and
5499 interface.cs here, and renamed to FindType.
5501 * delegate.cs: Implement DefineType. Take advantage of the
5502 refactored pattern for locating the parent builder without taking
5503 the parent_builder argument (which we know does not work if we are
5504 nested, and triggering a toplevel definition).
5506 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5508 * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
5509 accessibility of a member has changed during override and report
5512 * class.cs (Method.Define, Property.Define): Only complain on
5513 overrides if the method is private, any other accessibility is
5514 fine (and since we just checked the permission is the same, we are
5517 * cs-tokenizer.cs: only line, region, endregion, if, endif, else
5518 and elif are processed always. The other pre-processing
5519 directives are only processed if we are "taking" the path
5521 2002-03-29 Martin Baulig <martin@gnome.org>
5523 * class.cs (Method.Emit): Only emit symbolic debugging info if the
5524 current location is not Null.
5526 * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
5527 a separate method so we can profile it.
5529 * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
5530 `span.Seconds' are just seconds, but no minutes or hours.
5531 (MainDriver): Profile the CodeGen.SaveSymbols calls.
5533 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5535 * class.cs (Method.Define), (Property.Define), (Indexer.Define):
5536 Remove the gratuitous set of Final:
5538 // If an interface implementation, then we can set Final.
5539 if (((flags & MethodAttributes.Abstract) == 0) &&
5540 implementing.DeclaringType.IsInterface)
5541 flags |= MethodAttributes.Final;
5543 I do not know what I was smoking when I used that.
5546 * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
5547 step into fixing the name resolution issues for delegates and
5548 unifying the toplevel name resolution.
5550 2002-03-28 Martin Baulig <martin@gnome.org>
5552 * class.cs (Method.Emit): If we have a symbol writer, call its
5553 OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
5554 tell it about the current method.
5556 * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
5557 writer that we're going to emit the first byte of IL code for a new
5558 statement (a new source line).
5559 (EmitContext.EmitTopBlock): If we have a symbol writer, call
5560 EmitContext.Mark() before emitting any code.
5562 * location.cs (SymbolDocument): Return null when we're Null.
5564 * statement.cs (Statement): Moved the `Location loc' variable here.
5565 (Statement.EmitBoolExpression): If we have a symbol writer, call
5566 ec.Mark() before emitting any code to tell it that we're at the
5567 beginning of a new statement.
5568 (StatementExpression): Added `Location' argument to the constructor.
5569 (Block): Added public readonly variable `StartLocation' and public
5570 variable `EndLocation'. The latter is to be set using SetEndLocation().
5571 (Block): Added constructor which takes a start and end location.
5572 (Block.SetEndLocation): New method. This sets the end location.
5573 (Block.EmitMeta): If we have a symbol writer, tell it the names of the
5574 local variables we create.
5575 (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
5576 each statement and do also mark the begin and end of the block.
5578 * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
5579 tell it the current lexer.Location, use Location.Null for the end of the
5581 (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
5582 current block, set its end location using SetEndLocation().
5583 (statement_expression): StatementExpression constructor now takes the
5584 lexer.Location as additional argument.
5585 (for_statement, declare_local_variables): Likewise.
5586 (declare_local_variables): When creating a new implicit block, use the
5587 new Block constructor and pass it the lexer.Location.
5589 2002-03-28 Miguel de Icaza <miguel@ximian.com>
5591 * ecore.cs (Expression.MemberLookup): On interfaces, lookup
5592 members also on the parent interfaces recursively.
5594 2002-03-27 Miguel de Icaza <miguel@ximian.com>
5596 * report.cs: Use new formats, since Gonzalo finished the missing
5599 * expression.cs (Binary.ResolveOperator): added missing operator|
5600 operator& and operator^ for bool/bool.
5602 * cs-parser.jay: CheckDef now takes a Location argument that is
5603 used to report errors more precisly (instead of reporting the end
5604 of a definition, we try to track something which is a lot closer
5605 to the source of the problem).
5607 * cs-tokenizer.cs: Track global token use, so we can properly flag
5608 the use of #define/#undef after the first token has been seen.
5610 Also, rename the reportXXXX to Error_DescriptiveName
5612 * decl.cs (DeclSpace.IsTopLevel): Move property here from
5613 TypeContainer, so that Enum and Interface can use this too.
5615 * class.cs (TypeContainer.LookupInterfaceOrClass,
5616 GetInterfaceOrClass, GetClassBases, DefineType): Drop the
5617 `builder' argument. Typically this was used to pass the parent
5618 builder (a ModuleBuilder or a TypeBuilder from whoever triggered
5621 The problem is that a nested class could trigger the definition of
5622 a toplevel class, and the builder would be obviously wrong in that
5625 So we drop this argument, and we compute dynamically the
5626 TypeBuilder/ModuleBuilder (the correct information was available
5627 to us anyways from DeclSpace.Parent)
5629 * interface.cs (Interface.DefineInterface): Drop builder
5630 parameter cleanup like class.cs
5632 * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
5635 * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
5638 (Try.Emit): Propagate the returns value from the statement.
5640 (Return.Emit): Even if we are leavning
5642 * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
5644 * modifiers.cs: Fix the computation of MethodAttributes flags.
5646 Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
5648 * driver.cs: allow compilation of files that start with '/'.
5649 Add a default case when checking the argument of --target.
5651 2002-03-25 Miguel de Icaza <miguel@ximian.com>
5653 * interface.cs: Implement the same search algorithm for types in
5656 * delegate.cs: Do not allow multiple definition.
5658 * Recovered ChangeLog that got accidentally amputated
5660 * interface.cs (Interface.DefineInterface): Prevent from double definitions.
5662 * rootcontext.cs: Load manually enum to allow core classes to
5663 contain enumerations.
5665 * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
5666 Update to new static methods in TypeManager.
5668 * typemanager.cs (GetMethod, GetConstructor): Use our
5669 implementation of FindMembers to find the members, since during
5670 corlib compilation, the types are TypeBuilders and GetMethod and
5671 GetConstructor do not work.
5673 Make all methods in TypeManager static.
5675 (InitCodeHelpers): Split the functionality from
5676 the InitCodeTypes function.
5678 * driver.cs: Call InitCodeHelpers after we have populated the
5681 * cs-parser.jay (delegate_declaration): we did not used to compute
5682 the delegate name correctly for void delegates.
5684 2002-03-24 Miguel de Icaza <miguel@ximian.com>
5686 * rootcontext.cs (RootContext): Init the interface_resolve_order
5687 and type_container_resolve_order always.
5689 (ResolveCore, BootstrapCorlib_ResolveClass,
5690 BootstrapCorlib_ResolveStruct): New functions to bootstrap the
5691 compiler when compiling with --nostdlib
5693 * class.cs (TypeContainer.DefineType): Check that our parent is
5694 not null. This test is most important when we are bootstraping
5697 * codegen.cs: Split out the symbol writing code.
5699 2002-03-25 Martin Baulig <martin@gnome.org>
5701 * driver.cs (-g): Made -g an alias for --debug.
5703 2002-03-24 Martin Baulig <martin@gnome.org>
5705 * codegen.cs (SymbolWriter): New public variable. Returns the
5706 current symbol writer.
5707 (CodeGen): Added `bool want_debugging_support' argument to the
5708 constructor. If true, tell the ModuleBuild that we want debugging
5709 support and ask it for the ISymbolWriter.
5710 (Save): If we have a symbol writer, call it's Close() method after
5711 saving the assembly.
5713 * driver.c (--debug): New command line argument to create a
5714 debugger information file.
5716 * location.cs (SymbolDocument): New public property. Returns an
5717 ISymbolDocumentWriter object for the current source file or null
5718 if we don't have a symbol writer.
5720 2002-03-21 Miguel de Icaza <miguel@ximian.com>
5722 * driver.cs (LoadAssembly): Correctly return when all the paths
5723 have been tried and not before.
5725 * statement.cs (Switch.Emit): return the actual coverage for this
5726 statement (returns/not-returns)
5728 (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
5729 switch of the statement if we are the last switch section. That
5730 kills two problems: try/catch problems (we used to emit an empty
5731 nop at the end) and switch statements where all branches would
5734 2002-03-19 Miguel de Icaza <miguel@ximian.com>
5736 * driver.cs: Add default assemblies (the equivalent to the
5737 Microsoft CSC.RSP file)
5739 * cs-tokenizer.cs: When updating `cols and setting it to zero,
5740 also update tokens_seen and set it to false.
5742 * driver.cs: Implement --recurse for Mike.
5744 * driver.cs (SplitPathAndPattern): Small bug fix, I was not
5745 correctly splitting out the paths.
5747 2002-03-18 Miguel de Icaza <miguel@ximian.com>
5749 * interface.cs (Interface.PopulateProperty): Instead of using
5750 `parent' as the declaration space for the set parameters, use
5753 * support.cs (InternalParameters): InternalParameters constructor
5754 takes a DeclSpace instead of a TypeContainer.
5756 * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
5757 types are being initialized, load the address of it before calling
5760 (New): Provide a mechanism to disable the generation of local
5761 value type temporaries when the caller will be providing us with
5762 an address to store it.
5764 (ArrayCreation.EmitDynamicInitializers): Use it.
5766 2002-03-17 Miguel de Icaza <miguel@ximian.com>
5768 * expression.cs (Invocation.EmitArguments): Only probe for array
5769 property if there is more than one argument. Sorry about that.
5771 * class.cs (Invocation.EmitArguments): Fix to emit arguments for
5774 * class.cs (Method.LabelParameters): Fix incorrect code path that
5775 prevented the `ParamArrayAttribute' from being applied to the
5778 2002-03-16 Miguel de Icaza <miguel@ximian.com>
5780 * support.cs (ReflectionParameters): Correctly compute whether the
5781 last argument is a params array. Fixes the problem with
5784 * typemanager.cs: Make the assemblies array always be non-null
5785 (empty, but non-null)
5787 * tree.cs (RecordDecl): New function that abstracts the recording
5788 of names. This reports error 101, and provides a pointer to the
5789 previous declaration. Fixes a crash in the compiler.
5791 * cs-parser.jay (constructor_declaration): Update to new grammar,
5792 and provide a constructor_body that can be empty.
5794 2002-03-15 Miguel de Icaza <miguel@ximian.com>
5796 * driver.cs: Add support for --resources.
5798 * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
5799 Make all types for the various array helper methods be integer.
5801 * ecore.cs (Expression.ConvertNumericExplicit): Pass the
5802 CheckState to ConvCast.
5804 (ConvCast): Now it takes a `checked' state argument, to avoid
5805 depending on the emit context for the conversion, and just using
5806 the resolve time setting.
5808 * expression.cs (ArrayCreation.EmitArrayArguments): New function,
5809 instead of Invocation.EmitArguments. We do not emit the original
5810 arguments, instead we emit those which have been converted to
5811 unsigned int expressions.
5813 * statement.cs (Block.EmitMeta): Drop tracking of indexes.
5815 * codegen.cs: ditto.
5817 * expression.cs (LocalVariableReference): Drop the use of the
5818 Store function that depended on the variable index.
5820 * statement.cs (VariableInfo): Drop the `Idx' property from this
5821 class, as this is not taking into account the indexes for
5822 temporaries tat we generate during the execution, getting the
5825 * class.cs: First emit class initializers, then call the parent
5828 * expression.cs (Binary): Fix opcode emision.
5829 (UnaryMutator.EmitCode): Support checked code generation
5831 * ecore.cs (MemberLookup): TypeManager.FindMembers will return
5832 matches for events for both the Static and Instance scans,
5833 pointing to the same element. Fix that.
5835 2002-03-14 Miguel de Icaza <miguel@ximian.com>
5837 * rootcontext.cs (ResolveTree): Always set the
5838 interface_resolve_order, because nested interfaces will be calling
5841 * class.cs (GetInterfaceOrClass): Track the same resolution
5842 process used by TypeManager.LookupType. This fixes the nested
5843 type lookups in class declarations (separate path from
5846 (TypeContainer.DefineType): Also define nested interfaces.
5847 (TypeContainer.RegisterOrder): New public function used to
5848 register the order in which child interfaces need to be closed.
5850 Nested interfaces need to be closed after their parents have been
5853 * interface.cs (InterfaceAttr): Put all the logic for computing
5854 the interface attribute here.
5856 (DefineInterface): Register our interface order with the
5857 RootContext or with the TypeContainer depending on the case.
5859 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5861 * cs-parser.jay: rework foreach statement to work with the new
5862 changes to the policy on SimpleNames.
5864 * report.cs: support Stacktrace on warnings as well.
5866 * makefile: drop --unsafe and /unsafe from the compile.
5868 2002-03-13 Ravi Pratap <ravi@ximian.com>
5870 * ecore.cs (StandardConversionExists): Modify to take an Expression
5871 as the first parameter. Ensure we do null -> reference type conversion
5874 * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
5875 temporary Expression objects.
5877 Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
5879 * interface.cs: workaround bug in method overloading resolution
5880 (there is already a bugzilla bug for it).
5882 2002-03-12 Miguel de Icaza <miguel@ximian.com>
5884 We could also solve this problem by having a separate path for
5885 performing type lookups, instead of DoResolve, we could have a
5886 ResolveType entry point, and only participating pieces of the
5887 production (simplename, deref, array) would implement this.
5889 * codegen.cs (EmitContext): New field OnlyLookupTypes used to
5890 signal SimpleName to only resolve type names and not attempt to
5891 resolve anything else.
5893 * expression.cs (Cast): Set the flag.
5895 * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
5897 * class.cs: Only report 108 if there is no `new' modifier.
5899 * cs-parser.jay: rework foreach statement to work with the new
5900 changes to the policy on SimpleNames.
5902 * report.cs: support Stacktrace on warnings as well.
5904 * makefile: drop --unsafe and /unsafe from the compile.
5906 2002-03-11 Miguel de Icaza <miguel@ximian.com>
5908 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5909 lookups here, instead of doing that at parse time. This means
5910 that our grammar will not introduce `LocalVariableReferences' as
5911 expressions at this point. That solves the problem of code like
5919 This is only half the fix. The full fix requires parameters to
5920 also be handled in this way.
5922 * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
5923 makes the use more obvious of the DeclSpace. The
5924 ec.TypeContainer.TypeBuilder is now only used to pull the
5927 My theory is that I can get rid of the TypeBuilder completely from
5928 the EmitContext, and have typecasts where it is used (from
5929 DeclSpace to where it matters).
5931 The only pending problem is that the code that implements Aliases
5932 is on TypeContainer, and probably should go in DeclSpace.
5934 * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
5935 lookups here, instead of doing that at parse time. This means
5936 that our grammar will not introduce `LocalVariableReferences' as
5937 expressions at this point. That solves the problem of code like
5945 This is only half the fix. The full fix requires parameters to
5946 also be handled in this way.
5948 * class.cs (Property.DefineMethod): When implementing an interface
5949 method, set newslot, when implementing an abstract method, do not
5950 set the flag (before we tried never setting it, or always setting
5951 it, which is the difference).
5952 (Indexer.DefineMethod): same.
5953 (Method.DefineMethod): same.
5955 * ecore.cs: Only set the status used flag if we get back a Field.
5957 * attribute.cs: Temporary hack, so Paolo can keep working.
5959 2002-03-08 Ravi Pratap <ravi@ximian.com>
5961 * attribute.cs (Attribute.UnmanagedType): This is to keep track of
5962 the unmanaged type in the case we have a MarshalAs attribute.
5964 (Resolve): Handle the case when we are parsing the special MarshalAs
5965 attribute [we need to store the unmanaged type to use later]
5967 * typemanager.cs (marshal_as_attr_type): Built in type for the
5968 MarshalAs Attribute.
5970 * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
5971 on parameters and accordingly set the marshalling info.
5973 2002-03-09 Miguel de Icaza <miguel@ximian.com>
5975 * class.cs: Optimizing slightly by removing redundant code after
5976 we switched to the `NoTypes' return value.
5977 (Property.DefineMethod): use NoTypes here too.
5979 This fixes the bug I introduced in my last batch of changes.
5981 2002-03-05 Ravi Pratap <ravi@ximian.com>
5983 * tree.cs (RecordEnum): Add. We now keep track of enums too.
5985 * class.cs (LookupInterfaceOrClass): Check against the list of recorded
5986 Enums since those are types too.
5988 * cs-parser.jay (enum_declaration): Record enums as we parse them.
5990 * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
5991 thanks to a call during the lookup process.
5993 2002-03-07 Miguel de Icaza <miguel@ximian.com>
5995 * statement.cs (Foreach): Lots of work to accomodate a particular
5996 kind of foreach statement that I had not kept in mind. It is
5997 possible to have foreachs on classes that provide a GetEnumerator
5998 method that return objects that implement the "pattern" for using
5999 a foreach, there is no need to support GetEnumerator
6002 This is needed to compile nant.
6004 * decl.cs: Only report 114 if the member is not `Finalize' and if
6005 the warning level is at least 2.
6007 * class.cs: Moved the compare function from Method to
6010 (MethodSignature.InheritableMemberSignatureCompare): Add new
6011 filter function that is used to extract inheritable methods from a
6014 (Method.Define): Use the new `inheritable_method_signature_filter'
6017 * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
6020 2002-03-06 Miguel de Icaza <miguel@ximian.com>
6022 * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
6024 * cs-parser.jay: Add opt_semicolon to the interface declaration.
6026 * expression.cs: Pass location information to
6027 ConvertImplicitStandard.
6029 * class.cs: Added debugging code to track return values from
6032 2002-03-05 Miguel de Icaza <miguel@ximian.com>
6034 * expression.cs (Is.DoResolve): If either side of the `is' is an
6035 interface, do not flag the warning.
6037 * ecore.cs (ImplicitReferenceConversion): We need a separate test
6040 * report.cs: Allow for --fatal to be used with --probe.
6042 * typemanager.cs (NoTypes): Move the definition for the empty Type
6045 * class.cs (TypeContainer.FindMembers): Also look for methods defined by
6047 (TypeContainer.DefineProxy): New function used to proxy to parent
6048 implementations when implementing interfaces.
6049 (TypeContainer.ParentImplements): used to lookup if our parent
6050 implements a public function that is required by an interface.
6051 (TypeContainer.VerifyPendingMethods): Hook this up.
6053 * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
6054 `modules' and `assemblies' arraylists into arrays. We only grow
6055 these are the very early start up of the program, so this improves
6056 the speedof LookupType (nicely measured).
6058 * expression.cs (MakeByteBlob): Replaced unsafe code with
6059 BitConverter, as suggested by Paolo.
6061 * cfold.cs (ConstantFold.Binary): Special case: perform constant
6062 folding of string concatenation, but if either side is a string,
6063 and the other is not, then return null, and let the runtime use
6064 the concatenation on the string plus the object (using
6067 2002-03-04 Miguel de Icaza <miguel@ximian.com>
6069 Constant Folding has been implemented now.
6071 * expression.cs (Unary.Reduce): Do not throw an exception, catch
6072 the error instead on types that are not supported in one's
6075 * constant.cs (Constant and all children): New set of functions to
6076 perform implict and explicit conversions.
6078 * ecore.cs (EnumConstant): Implement the new functions to perform
6079 conversion by proxying to the child expression.
6081 * codegen.cs: (ConstantCheckState): Constant evaluation has its
6082 own separate setting that can not be turned off from the command
6083 line using --unchecked or --checked and is only controlled using
6084 the checked/unchecked statements and expressions. This setting is
6085 used by the constant folder to flag errors.
6087 * expression.cs (CheckedExpr, UncheckedExpr): Set the
6088 ConstantCheckState as well.
6090 During Resolve, they also have to flag the state, because the
6091 constant folder runs completely in the Resolve phase.
6093 * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
6096 2002-03-01 Miguel de Icaza <miguel@ximian.com>
6098 * cfold.cs: New file, this file contains the constant folder.
6100 * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
6101 argument to track whether we are using the resulting address to
6102 load or store a value and provide better error messages.
6104 (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
6105 new AddressOf arguments.
6107 * statement.cs (Foreach.EmitCollectionForeach): Update
6109 * expression.cs (Argument.Emit): Call AddressOf with proper
6110 arguments to track usage.
6112 (New.DoEmit): Call AddressOf with new arguments.
6114 (Unary.Emit): Adjust AddressOf call.
6116 2002-03-01 Ravi Pratap <ravi@ximian.com>
6118 * cs-parser.jay (member_access): Change the case for pre-defined types
6119 to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
6122 * class.cs (Operator::Emit): If we are abstract or extern, we don't have
6125 * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
6126 essentially like methods and apply attributes like MethodImplOptions to them too.
6128 * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
6131 * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
6132 DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
6135 * Update code everywhere accordingly.
6137 * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
6139 * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
6141 2002-02-28 Ravi Pratap <ravi@ximian.com>
6143 * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
6144 try performing lookups against those instead of jumping straight into using
6145 the 'using' clauses.
6147 (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
6149 (LookupType): Perform lookups in implicit parents too.
6151 * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
6152 sequence as RootContext.LookupType.
6154 * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
6155 the various cases of namespace lookups into this method.
6157 2002-03-01 Miguel de Icaza <miguel@ximian.com>
6159 * cs-parser.jay: Add support for [Attribute ()] (empty arguments
6160 in positional arguments)
6162 * class.cs (Operator): Update the AllowedModifiers to contain
6165 * cs-parser.jay: Update operator declaration to allow for the
6166 operator body to be empty.
6168 * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
6171 2002-02-27 Miguel de Icaza <miguel@ximian.com>
6173 * class.cs (Method.Emit): Label parameters.
6175 * driver.cs: Return 1 or 0 as the program exit code.
6177 2002-02-26 Miguel de Icaza <miguel@ximian.com>
6179 * expression.cs: Special case the `null' object when trying to
6180 auto-compute the type, as anything can be explicitly converted to
6183 * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
6184 spotting this Paolo.
6186 (Expression.ImplicitNumericConversion): Perform comparissions of
6187 the type using the underlying type in the case of an enumeration
6188 rather than using the enumeration type for the compare.
6190 Cope with the underlying == type case, which is not possible to
6193 (Expression.ConvertNumericExplicit): Perform comparissions of
6194 the type using the underlying type in the case of an enumeration
6195 rather than using the enumeration type for the compare.
6197 * driver.cs: If the user does not supply an extension, assume .exe
6199 * cs-parser.jay (if_statement): Rewrote so that we can track the
6200 location for the if statement.
6202 * expression.cs (Binary.ConstantFold): Only concat strings when
6203 the operation is "+", not everything ;-)
6205 * statement.cs (Statement.EmitBoolExpression): Take a location
6207 (If, While, Do): Track location.
6209 * expression.cs (Binary.ResolveOperator): In the object + string
6210 case, I was missing a call to ConvertImplicit
6212 2002-02-25 Ravi Pratap <ravi@ximian.com>
6214 * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
6215 Location arguments. Ensure we use RootContext.LookupType to do our work
6216 and not try to do a direct Type.GetType and ModuleBuilder.GetType
6218 * interface.cs (PopulateMethod): Handle the type of the parameter being
6221 * expression.cs (Invocation.BetterFunction): Handle the case when we
6222 have a params method with no fixed arguments and a call is made with no
6225 2002-02-25 Miguel de Icaza <miguel@ximian.com>
6227 * cs-tokenizer.cs: Add support for the quote-escape-sequence in
6228 the verbatim-string-literal
6230 * support.cs (InternalParameters.ParameterModifier): handle null
6232 (InternalParameters.ParameterType): ditto.
6234 * parameter.cs (VerifyArgs): Also check if the fixed parameter is
6235 duplicating the name of the variable parameter.
6236 (GetParameterByName): Fix bug where we were not looking up array
6237 paramters if they were the only present (thanks Paolo!).
6238 (GetParameterInfo): We only have an empty set of types if both
6239 fixed and array are set to null.
6240 (GetParameterInfo-idx): Handle FixedParameter == null
6242 * cs-parser.jay: Handle the case where there is no catch
6243 statements (missing null test).
6245 2002-02-22 Miguel de Icaza <miguel@ximian.com>
6247 * driver.cs (MainDriver): Be conservative on our command line
6250 Catch DirectoryNotFoundException when calling GetFiles.
6252 (SplitPathAndPattern): Used to split the input specification into
6253 a path and a pattern that we can feed to Directory.GetFiles.
6255 2002-02-21 Miguel de Icaza <miguel@ximian.com>
6257 * statement.cs (Fixed): Implement the last case of the Fixed
6258 statement (string handling).
6260 * expression.cs (StringPtr): New class used to return a char * to
6261 a string; Used by the Fixed statement.
6263 * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
6265 * expression.cs (Binary.ResolveOperator): Remove redundant
6266 MemberLookup pn parent type.
6267 Optimize union call, we do not need a union if the types are the same.
6268 (Unary.ResolveOperator): REmove redundant MemberLookup on parent
6271 Specialize the use of MemberLookup everywhere, instead of using
6272 the default settings.
6274 (StackAlloc): Implement stackalloc keyword.
6276 * cs-parser.jay: Add rule to parse stackalloc.
6278 * driver.cs: Handle /h, /help, /?
6280 * expression.cs (MakeByteBlob): Removed the hacks we had in place
6281 before we supported unsafe code.
6283 * makefile: add --unsafe to the self compilation of mcs.
6285 2002-02-20 Miguel de Icaza <miguel@ximian.com>
6287 * expression.cs (PointerArithmetic): New class that is used to
6288 perform pointer arithmetic.
6289 (Binary.Resolve): Handle pointer arithmetic
6290 Handle pointer comparission.
6291 (ArrayPtr): Utility expression class that is used to take the
6292 address of an array.
6294 (ElementAccess): Implement array access for pointers
6296 * statement.cs (Fixed): Implement fixed statement for arrays, we
6297 are missing one more case before we are done.
6299 * expression.cs (Indirection): Implement EmitAssign and set the
6300 ExprClass to Variable. This allows pointer dereferences to be
6301 treated as variables, and to have values assigned to them.
6303 * ecore.cs (Expression.StoreFromPtr): New utility function to
6304 store values dereferencing.
6306 2002-02-20 Ravi Pratap <ravi@ximian.com>
6308 * expression.cs (Binary.ResolveOperator): Ensure that we are
6309 not trying to operate on a void type - this fixes the reported
6312 * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
6313 the parent implementation is sealed.
6315 * ../errors/cs0239.cs : Add.
6317 * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
6319 * typemanager.cs (unverifiable_code_type): Corresponds to
6320 System.Security.UnverifiableCodeAttribute. We need to emit this for modules
6321 which have unsafe code in them.
6323 * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
6326 2002-02-19 Miguel de Icaza <miguel@ximian.com>
6328 * cs-tokenizer.cs: Add support for @"litreal strings"
6330 Make tokenizer accept pre-processor directives
6331 on any column (remove the old C-like limitation).
6333 * rootcontext.cs (EmitCode): Emit any global attributes.
6334 (AddGlobalAttributes): Used to keep track of assembly attributes.
6336 * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
6338 * cs-parser.jay: Add support for global attributes.
6340 2002-02-17 Miguel de Icaza <miguel@ximian.com>
6342 * expression.cs (Indirection): New helper class. Unary will
6343 create Indirection classes to be able to implement the
6344 IMemoryLocation interface on it.
6346 2002-02-16 Miguel de Icaza <miguel@ximian.com>
6348 * cs-parser.jay (fixed_statement): reference the right statement.
6350 * statement.cs (Fixed.Emit): Finish implementing the fixed
6351 statement for the &x case.
6353 2002-02-14 Miguel de Icaza <miguel@ximian.com>
6355 * class.cs (Property.Define, Method.Define): Remove newslot when
6358 * modifiers.cs: My use of NewSlot when `Abstract' was set was
6359 wrong. NewSlot should only be used if the `new' keyword is present.
6361 * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
6362 locating our system dir. Sorry about this.
6364 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6366 * driver.cs (GetSystemDir): Compute correctly the location of our
6367 system assemblies. I was using the compiler directory instead of
6368 the library directory.
6370 2002-02-13 Ravi Pratap <ravi@ximian.com>
6372 * expression.cs (BetterFunction): Put back in what Miguel commented out
6373 since it is the correct fix. The problem is elsewhere ;-)
6375 (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
6376 parameters of the parms method are themselves compatible or not !
6378 (StandardConversionExists): Fix very dangerous bug where we were forgetting
6379 to check that a class implements an interface before saying that an implicit
6380 conversion was allowed. Use ImplementsInterface to do the checking.
6382 2002-02-13 Miguel de Icaza <miguel@ximian.com>
6384 * class.cs (Method.Define): Track whether we are an explicit
6385 implementation or not. And only call DefineMethodOverride if we
6386 are an explicit implementation.
6388 (Property.DefineMethod): Ditto.
6390 2002-02-11 Ravi Pratap <ravi@ximian.com>
6392 * expression.cs (BetterFunction): Catch hideous bug which was
6393 preventing us from detecting ambiguous calls due to implicit casts i.e
6396 2002-01-29 Miguel de Icaza <miguel@ximian.com>
6398 * support.cs (Pair): Remove un-needed method. I figured why I was
6399 getting the error in cs-parser.jay, the variable in a foreach loop
6400 is readonly, and the compiler does not really treat this as a variable.
6402 * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
6403 instead of EQUALS in grammar.
6405 * typemanager.cs (VerifyUnmanaged): Report correct error (208)
6407 * expression.cs (Unary.DoResolve): Check whether the argument is
6410 2002-01-28 Miguel de Icaza <miguel@ximian.com>
6412 * support.cs: Api for Pair to set a value. Despite the fact that
6413 the variables are public the MS C# compiler refuses to compile
6414 code that accesses the field if the variable is part of a foreach
6417 * statement.cs (Fixed): Begin implementation of the fixed
6420 (Block.AddVariable): Return the VariableInfo on success and null
6421 on failure instead of true/false.
6423 * cs-parser.jay (foreach): Catch errors on variables already
6424 defined (we were ignoring this value before) and properly unwind
6427 (fixed_statement): grammar for the fixed statement.
6429 2002-01-25 Miguel de Icaza <miguel@ximian.com>
6431 * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
6432 pointer types to be incretemented.
6434 (SizeOf): Implement.
6436 * cs-parser.jay (pointer_member_access): Implement
6437 expr->IDENTIFIER production.
6439 * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
6440 MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
6443 (Unary): Implement indirection.
6445 * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
6446 use in non-unsafe context).
6448 (SimpleName.DoResolve): Check for pointers in field access on safe
6451 (Expression.LoadFromPtr): Factor the load-indirect code in this
6452 function. This was duplicated in UnboxCast and ParameterReference
6454 2002-01-24 Miguel de Icaza <miguel@ximian.com>
6456 * expression.cs (ComposedCast): report an error if a pointer cast
6457 is used in a safe region.
6459 * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
6460 pointer type casts in unsafe context.
6462 * codegen.cs (EmitContext): Set up IsUnsafe.
6464 * cs-parser.jay (non_expression_type): Add productions for pointer
6467 * expression.cs (Invocation.EmitCall): Remove chunk of buggy
6468 code. We should not use force into static mode if the method is
6469 not virtual. Fixes bug in MIS
6471 * statement.cs (Do.Emit, While.Emit, For.Emit,
6472 Statement.EmitBoolExpression): Add support to Do and While to
6473 propagate infinite loop as `I do return' semantics.
6475 Improve the For case to also test for boolean constants.
6477 * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
6478 to the list of attributes we can add.
6480 Remove `EmitContext' argument.
6482 * class.cs (Method.Define): Apply parameter attributes.
6483 (Constructor.Define): Apply parameter attributes.
6484 (MethodCore.LabelParameters): Move here the core of labeling
6487 * support.cs (ReflectionParameters.ParameterModifier,
6488 InternalParameters.ParameterModifier): Use IsByRef on the type and
6489 only return the OUT bit for these parameters instead of in/out/ref
6492 This is because I miss-understood things. The ParameterInfo.IsIn
6493 and IsOut represent whether the parameter has the [In] and [Out]
6496 2002-01-22 Miguel de Icaza <miguel@ximian.com>
6498 * ecore.cs (FieldExpr.Emit): Release temporaries.
6500 * assign.cs (LocalTemporary.Release): new function.
6502 * codegen.cs (EmitContext.GetTemporaryStorage,
6503 EmitContext.FreeTemporaryStorage): Rework the way we deal with
6504 temporary storage. Now we can "put back" localbuilders when we
6507 2002-01-21 Miguel de Icaza <miguel@ximian.com>
6509 * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
6510 need to make a copy of the variable to generate verifiable code.
6512 2002-01-19 Miguel de Icaza <miguel@ximian.com>
6514 * driver.cs: Compute dynamically the system directory.
6516 * ecore.cs (CopyNewMethods): reworked, exposed, made public.
6517 Slower, but more generally useful. Used by the abstract
6518 registering implementation.
6520 * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
6521 the rules for the special rule on Type/instances. First check if
6522 we have the same name, and if so, try that special static path
6523 rather than the instance path.
6525 2002-01-18 Miguel de Icaza <miguel@ximian.com>
6527 * cs-parser.jay: Emit 642 (warning: possible empty statement) for
6530 * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
6531 Enum, ValueType, Delegate or Array for non-corlib compiles.
6533 * cs-tokenizer.cs: Catch long identifiers (645)
6535 * typemanager.cs (IndexerPropetyName): Ravi never tested this
6538 * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
6539 fix, we were returning too early, so we were not registering
6540 pending methods from abstract classes.
6542 Do not register pending methods if the class is abstract.
6544 * expression.cs (Conditional.DoResolve): Report circular implicit
6545 conversions when we neecd to compute it for conditional
6548 (Is.DoResolve): If the expression is always of the provided type,
6549 flag warning 183. If the expression can not ever be of the
6550 provided type flag warning 184.
6552 * class.cs: Catch 169 as well.
6554 * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
6557 2002-01-18 Nick Drochak <ndrochak@gol.com>
6559 * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
6561 2002-01-17 Miguel de Icaza <miguel@ximian.com>
6563 * interface.cs: (PopulateMethod): Check for pointers being defined
6564 only if the unsafe context is active.
6565 (PopulateProperty): ditto.
6566 (PopulateIndexer): ditto.
6568 * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
6569 specified. If pointers are present, make sure that they are
6570 present in an unsafe context.
6571 (Constructor, Constructor.Define): ditto.
6572 (Field, Field.Define): ditto.
6573 (Property, Property.Define): ditto.
6574 (Event, Event.Define): ditto.
6576 * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
6577 hashtable if there are classes or structs defined.
6579 * expression.cs (LocalVariableReference.DoResolve): Simplify this
6580 code, as the constant resolution moved.
6582 * statement.cs (Block.EmitMeta): Resolve all constants as we emit
6583 the metadata, so we can flag error 133.
6585 * decl.cs (MemberCore.UnsafeOK): New function to test that a
6586 pointer is being declared in an unsafe context.
6588 2002-01-16 Miguel de Icaza <miguel@ximian.com>
6590 * modifiers.cs (Modifiers.Check): Require a Location argument.
6591 Report error 227 for Unsafe use.
6593 * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
6595 * statement.cs (For.Emit): If the test is null, then report that
6596 we do `return', as we wont reach anything afterwards.
6598 (Switch.SwitchGoverningType): Track the expression that matched
6601 * driver.cs: Allow negative numbers as an error code to flag.
6603 * cs-parser.jay: Handle 1551.
6605 * namespace.cs: Add 1537 checking (repeated using alias namespaces).
6607 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6609 * cs-parser.jay: Report 1518 (type declaration can only contain
6610 class, struct, interface, enum or delegate)
6612 (switch_label): Report 1523 (keywords `case' or `default' must
6615 (opt_switch_sections): Report 1522 (empty switch)
6617 * driver.cs: Report 1515 (response file specified multiple times)
6618 Report 1516 (Source file specified multiple times).
6620 * expression.cs (Argument.Resolve): Signal 1510
6622 (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
6623 access not allowed in static code)
6625 2002-01-11 Ravi Pratap <ravi@ximian.com>
6627 * typemanager.cs (IsPointerType): Utility method which we are going
6630 * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
6631 the object type, so we take care of that.
6633 * expression.cs (FullMethodDesc): Also include the return type in descriptions.
6635 * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
6636 added to non-params parameters :-)
6638 * typemanager.cs (CSharpName): Include 'void' type too.
6640 (void_ptr_type): Include in the set of core types.
6642 * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
6645 (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
6648 * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
6649 completely forgotten about it.
6651 2002-01-10 Ravi Pratap <ravi@ximian.com>
6653 * cs-parser.jay (pointer_type): Add. This begins our implementation
6654 of parsing rules for unsafe code.
6656 (unsafe_statement): Implement.
6658 (embedded_statement): Modify to include the above.
6660 * statement.cs (Unsafe): Implement new class for unsafe blocks.
6662 * codegen.cs (EmitContext.InUnsafe): Add. This determines
6663 if the current context is an unsafe one.
6665 * cs-parser.jay (local_variable_pointer_type): Since local variable types
6666 are handled differently, we need separate rules for them.
6668 (local_variable_declaration): Update to use local_variable_pointer_type
6669 to allow variable declarations of unmanaged pointer types.
6671 * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
6674 * ../errors/cs0214.cs : Add.
6676 2002-01-16 Nick Drochak <ndrochak@gol.com>
6678 * makefile: remove 'response' file when cleaning.
6680 2002-01-15 Miguel de Icaza <miguel@ximian.com>
6682 * cs-parser.jay: Report 1524.
6684 2002-01-14 Miguel de Icaza <miguel@ximian.com>
6686 * typemanager.cs (RegisterMethod): drop checking if we have
6687 registered this from here
6689 2002-01-12 Miguel de Icaza <miguel@ximian.com>
6691 * class.cs (Method.EmitDestructor): Implement calling our base
6694 * statement.cs (Try.Emit): Fix to reset the InFinally to the old
6697 * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
6698 this routine and will wrap the call in a try/catch block. Deal
6701 2002-01-11 Miguel de Icaza <miguel@ximian.com>
6703 * ecore.cs (Expression.MemberLookup): instead of taking a
6704 parameter `same_type' that was used to tell whether we could
6705 access private members we compute our containing type from the
6708 (FieldExpr): Added partial support for volatile fields. This does
6709 not work for volatile fields exposed from assemblies, as I can not
6710 figure out how to extract the modreq from it.
6712 Updated all the source files to use this.
6714 * codegen.cs (EmitContext): Compute ContainerType ahead of time,
6715 because it is referenced by MemberLookup very often.
6717 2002-01-09 Ravi Pratap <ravi@ximian.com>
6719 * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
6720 TypeBuilder.GetCustomAttributes to retrieve what we need.
6722 Get rid of redundant default_member_attr_type as this is the same as
6723 default_member_type which already exists.
6725 * interface.cs, attribute.cs : Update accordingly.
6727 2002-01-08 Miguel de Icaza <miguel@ximian.com>
6729 * typemanager.cs: Enable IndexerPropertyName again. It does not
6730 work for TYpeBuilders though. Ravi, can you please fix this?
6732 * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
6734 * expression.cs (Argument.Emit): Handle the case of ref objects
6735 being passed to ref functions;
6737 (ParameterReference.EmitLoad): Loads the content of the pointer
6738 without dereferencing.
6740 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6742 * cs-tokenizer.cs: Implemented the pre-processing expressions.
6744 2002-01-08 Ravi Pratap <ravi@ximian.com>
6746 * class.cs (Indexer.DefineMethod): Incorporate the interface
6747 type in the name of the method if we are doing explicit interface
6750 * expression.cs (ConversionExists): Remove as it is completely obsolete.
6752 (BetterConversion): Fix extremely trivial bug where we were referring to
6753 ConversionExists instead of StandardConversionExists ! Hooray, things are fine
6756 * ../errors/bug16.cs : Add although we have fixed it.
6758 2002-01-07 Miguel de Icaza <miguel@ximian.com>
6760 * expression.cs (BaseIndexer): Begin implementation.
6762 * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
6764 * cs-parser.jay (indexer_declarator): Use qualified_identifier
6765 production directly to remove a shift/reduce, and implement
6766 explicit interface implementation.
6768 * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
6769 after a floating point suffix.
6771 * expression.cs (DoNumericPromotions): Improved the conversion for
6772 uint/uint. If we have a constant, we avoid doing a typecast to a
6775 * class.cs (Indexer): Implement explicit interface implementation
6778 Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
6780 * class.cs: make the default instance constructor public and hidebysig.
6782 2001-01-03 Ravi Pratap <ravi@ximian.com>
6784 * interface.cs (EmitDefaultMemberAttr): Make this helper method static
6785 so we can call it from elsewhere.
6787 * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
6788 we emit it internally if the class has a defined indexer; otherwise the user
6789 emits it by decorating the class definition with the DefaultMemberAttribute.
6791 * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
6792 attribute is not used on a type which defines an indexer.
6794 * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
6795 character when we skip whitespace.
6797 * ../errors/cs0646.cs : Add.
6799 2002-01-03 Miguel de Icaza <miguel@ximian.com>
6801 * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
6804 * makefile: Add practical target `mcs3.exe' which builds the third
6805 generation compiler.
6807 * expression.cs (New): Fix structures constructor calling.
6809 * class.cs (Property, Method, Indexer): Emit Final flag on the
6810 method if we are an interface implementation and we are not
6813 * ecore.cs (PropertyExpr): New public field `IsBase', tells
6814 whether this property is referencing a `base' method.
6816 * expression.cs (Invocation.EmitCall): take an extra argument:
6817 is_base, this is used to determine whether the `call' or
6818 `callvirt' opcode should be used.
6821 * delegate.cs: update EmitCall.
6823 * class.cs (Method.Define): Set NewSlot for the cases where we are
6824 not implementing an interface method.
6826 (Property.Define): ditto.
6828 2002-01-02 Miguel de Icaza <miguel@ximian.com>
6830 * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
6831 'r'. Allows mcs to parse itself fully.
6833 2002-01-02 Ravi Pratap <ravi@ximian.com>
6835 * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
6836 of the number of initializers that require the InitializeArray method.
6838 (CheckIndices): Store the Expression in all cases - not the plain value. Also
6839 update the above field where necessary.
6841 (MakeByteBlob): Update accordingly.
6843 (DoEmit): Call EmitStaticInitializers only if the number of initializers is
6846 (EmitDynamicInitializers): Update in accordance with the new optimization.
6848 (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
6849 same OpCode applies.
6851 * cs-parser.jay : Fix some glaring errors I introduced.
6853 2002-01-01 Ravi Pratap <ravi@ximian.com>
6855 * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
6856 so that we can check for name clashes there too.
6858 * typemanager.cs (default_member_attr_type): The attribute that we need to emit
6859 for interface indexers.
6861 * interfaces.cs (Define): Emit the default member attribute.
6863 * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
6864 variable was being referred to while setting the value ;-)
6866 2002-01-01 Miguel de Icaza <miguel@ximian.com>
6868 * expression.cs (MakeByteBlob): Optimize: we do not need to fill
6869 byte-by-byte information when we know the data is zero.
6871 Make the block always a multiple of 4, because
6872 DefineInitializedData has a bug.
6874 * assign.cs: Fix, we should assign from the temporary, not from
6877 * expression.cs (MakeByteBlob): Fix my incorrect code.
6879 2001-12-31 Miguel de Icaza <miguel@ximian.com>
6881 * typemanager.cs (EnumToUnderlying): This function is used to get
6882 the underlying type from an enumeration, because it does not
6885 * constant.cs: Use the I4_S form for values between -128 and 127.
6887 * statement.cs (Block.LookupLabel): Looks up a label.
6888 (Block): Drop support for labeled blocks.
6890 (LabeledStatement): New kind of statement that represents a label
6893 (Goto): Finally implement this bad boy.
6895 * cs-parser.jay: Update to reflect new mechanism to implement
6898 2001-12-30 Miguel de Icaza <miguel@ximian.com>
6900 * codegen.cs (EmitContext.This): a codegen property that keeps the
6901 a single instance of this instead of creating many different this
6904 * delegate.cs (Delegate.DoResolve): Update to use the property;
6906 * ecore.cs (SimpleName.SimpleNameResolve): Ditto
6908 * expression.cs (BaseAccess.DoResolve): Ditto.
6910 2001-12-29 Ravi Pratap <ravi@ximian.com>
6912 * typemanager.cs (methodimpl_attr_type): Add to hold the type
6913 corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
6915 (InitCoreTypes): Update accordingly.
6917 * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
6918 so we can quickly store the state.
6920 (ApplyAttributes): Set the correct implementation flags
6921 for InternalCall methods.
6923 2001-12-29 Miguel de Icaza <miguel@ximian.com>
6925 * expression.cs (EmitCall): if a method is not virtual, then do
6926 not use callvirt on it.
6928 (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
6929 user defined stuff) requires the use of stobj, which takes an
6930 address on the stack instead of an array and an index. So emit
6931 the Ldelema operation for it.
6933 (EmitStoreOpcode): Use stobj for valuetypes.
6935 (UnaryMutator.EmitCode): Use the right 1 value depending on
6936 whether we are dealing with int64/uint64, float or doubles.
6938 * class.cs (TypeContainer.AddConstructor): Fix the logic to define
6939 constructors that I implemented last night.
6941 (Constructor.IsDefault): Fix to work properly for static
6944 * cs-parser.jay (CheckDef): report method signature errors.
6945 Update error number 103 to be 132.
6947 * decl.cs: New AdditionResult enumeration value: MethodExists.
6948 Although we do this check for methods later on in the semantic
6949 analysis, catching repeated default constructors is so easy that
6950 we catch these here.
6952 * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
6955 (ParameterReference.EmitAssign, Emit): handle
6958 (ArrayAccess.EmitLoadOpcode): Handle bool type here.
6959 (ArrayAccess.EmitStoreOpcode): ditto.
6961 * cs-tokenizer.cs (is_punct): Eliminated empty computation.
6963 * expression.cs (MakeByteBlob): Complete all the missing types
6964 (uint, short, ushort, byte, sbyte)
6966 * class.cs: Only init instance field initializers on instance
6969 Rename `constructors' to instance_constructors.
6971 (TypeContainer.AddConstructor): Only add constructors to the list
6972 if it is not static.
6974 Make sure that we handle default_static_constructor independently
6975 everywhere where we handle instance_constructors
6977 2001-12-28 Miguel de Icaza <miguel@ximian.com>
6979 * class.cs: Do not lookup or create a base initializer for a
6982 (ConstructorInitializer.Resolve): use the proper type to lookup
6985 * cs-parser.jay: Report error 1585 (modifiers between type and name).
6987 * enum.cs, interface.cs: Remove CloseType, this is taken care by
6990 * decl.cs: CloseType is now an virtual method, the default
6991 implementation just closes this type.
6993 2001-12-28 Ravi Pratap <ravi@ximian.com>
6995 * attribute.cs (DefinePInvokeMethod): Set the implementation flags
6996 to PreserveSig by default. Also emit HideBySig on such methods.
6998 Basically, set the defaults to standard values.
7000 * expression.cs (Invocation.BetterFunction): We need to make sure that for each
7001 argument, if candidate is better, it can't be worse than the best !
7003 (Invocation): Re-write bits to differentiate between methods being
7004 applicable in their expanded form and their normal form - for params
7007 Get rid of use_standard everywhere as only standard conversions are allowed
7008 in overload resolution.
7010 More spec conformance.
7012 2001-12-27 Miguel de Icaza <miguel@ximian.com>
7014 * driver.cs: Add --timestamp, to see where the compiler spends
7017 * ecore.cs (SimpleName.DoResolve): Do not create an implicit
7018 `this' in static code.
7020 (SimpleName.DoResolve): Implement in terms of a helper function
7021 that allows static-references to be passed upstream to
7024 (Expression.ResolveWithSimpleName): Resolve specially simple
7025 names when called by MemberAccess to implement the special
7028 (Expression.ImplicitReferenceConversion): Handle conversions from
7029 Null to reference types before others, as Null's type is
7032 * expression.cs (Invocation.EmitCall): Handle the special case of
7033 calling methods declared on a reference type from a ValueType
7034 (Base classes System.Object and System.Enum)
7036 (MemberAccess.Resolve): Only perform lookups on Enumerations if
7037 the left hand side is a TypeExpr, not on every enumeration.
7039 (Binary.Resolve): If types are reference types, then do a cast to
7040 object on operators != and == of both arguments.
7042 * typemanager.cs (FindMembers): Extract instance and static
7043 members if requested.
7045 * interface.cs (PopulateProperty): Use void_type instead of null
7046 as the return type for the setter method.
7048 (PopulateIndexer): ditto.
7050 2001-12-27 Ravi Pratap <ravi@ximian.com>
7052 * support.cs (ReflectionParameters): Fix minor bug where we
7053 were examining the wrong parameter for the ParamArray attribute.
7055 Cope with requests for the type of the parameter at position
7056 greater than the params parameter's. We now return the element
7057 type of the params array as that makes more sense.
7059 * expression.cs (Invocation.IsParamsMethodApplicable): Update
7060 accordingly as we no longer have to extract the element type
7063 (Invocation.OverloadResolve): Update.
7065 2001-12-27 Miguel de Icaza <miguel@ximian.com>
7067 * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
7068 against IEnumerator, test whether the return value is a descendant
7069 of the IEnumerator interface.
7071 * class.cs (Indexer.Define): Use an auxiliary method to implement
7072 the other bits of the method definition. Begin support for
7073 explicit interface implementation.
7075 (Property.DefineMethod): Use TypeManager.void_type instead of null
7076 for an empty return value.
7078 2001-12-26 Miguel de Icaza <miguel@ximian.com>
7080 * expression.cs (MemberAccess.ResolveMemberAccess): if we are
7081 dealing with a FieldExpr which is composed of a FieldBuilder, in
7082 the code path we did extract the constant, but we should have
7083 obtained the underlying value to be able to cast it (otherwise we
7084 end up in an infinite loop, this is what Ravi was running into).
7086 (ArrayCreation.UpdateIndices): Arrays might be empty.
7088 (MemberAccess.ResolveMemberAccess): Add support for section
7089 14.5.4.1 that deals with the special case of E.I when E is a type
7090 and something else, that I can be a reference to a static member.
7092 (ArrayCreation.MakeByteBlob): It is not an error to not be able to
7093 handle a particular array type to create byte blobs, it is just
7094 something we dont generate byteblobs for.
7096 * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
7099 * location.cs (Push): remove the key from the hashtable that we
7100 are about to add. This happens for empty files.
7102 * driver.cs: Dispose files after we have parsed them.
7104 (tokenize): new function that only runs the tokenizer on its
7105 input, for speed testing.
7107 2001-12-26 Ravi Pratap <ravi@ximian.com>
7109 * class.cs (Event.Define): Define the private field only if there
7110 are no accessors defined.
7112 * expression.cs (ResolveMemberAccess): If there is no associated
7113 field with the event, that means we have an event defined with its
7114 own accessors and we should flag error cs0070 since transforming
7115 ourselves into a field is not valid in that case.
7117 * ecore.cs (SimpleName.DoResolve): Same as above.
7119 * attribute.cs (DefinePInvokeMethod): Set the default calling convention
7120 and charset to sane values.
7122 2001-12-25 Ravi Pratap <ravi@ximian.com>
7124 * assign.cs (DoResolve): Perform check on events only if they
7125 are being accessed outside the declaring type.
7127 * cs-parser.jay (event_declarations): Update rules to correctly
7128 set the type of the implicit parameter etc.
7130 (add_accessor, remove_accessor): Set current local parameters.
7132 * expression.cs (Binary): For delegate addition and subtraction,
7133 cast the return value from the method into the appropriate delegate
7136 2001-12-24 Ravi Pratap <ravi@ximian.com>
7138 * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
7139 of these as the workaround is unnecessary.
7141 * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
7142 delegate data - none of that is needed at all.
7144 Re-write bits to extract the instance expression and the delegate method
7147 * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
7150 * attribute.cs (ApplyAttributes): New method to take care of common tasks
7151 of attaching attributes instead of duplicating code everywhere.
7153 * everywhere : Update code to do attribute emission using the above method.
7155 2001-12-23 Miguel de Icaza <miguel@ximian.com>
7157 * expression.cs (IsParamsMethodApplicable): if there are not
7158 parameters, return immediately.
7160 * ecore.cs: The 0 literal can be implicity converted to an enum
7163 (SimpleName.DoResolve): First lookup the type, then lookup the
7166 (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
7167 want to get its address. If the InstanceExpression is not
7168 addressable, store the result in a temporary variable, then get
7171 * codegen.cs: Only display 219 errors on warning level or above.
7173 * expression.cs (ArrayAccess): Make it implement the
7174 IMemoryLocation interface.
7176 (Binary.DoResolve): handle the operator == (object a, object b)
7177 and operator != (object a, object b) without incurring into a
7178 BoxedCast (because 5 != o should never be performed).
7180 Handle binary enumerator operators.
7182 (EmitLoadOpcode): Use Ldelema if the object we are loading is a
7183 value type, otherwise use Ldelem_ref.
7185 Use precomputed names;
7187 (AddressOf): Implement address of
7189 * cs-parser.jay (labeled_statement): Fix recursive block
7190 addition by reworking the production.
7192 * expression.cs (New.DoEmit): New has a special case:
7194 If we are dealing with a ValueType, we have a few
7195 situations to deal with:
7197 * The target of New is a ValueType variable, that is
7198 easy, we just pass this as the variable reference
7200 * The target of New is being passed as an argument,
7201 to a boxing operation or a function that takes a
7204 In this case, we need to create a temporary variable
7205 that is the argument of New.
7208 2001-12-23 Ravi Pratap <ravi@ximian.com>
7210 * rootcontext.cs (LookupType): Check that current_type is not null before
7211 going about looking at nested types.
7213 * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
7214 not implement the IAssignMethod interface any more.
7216 * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
7217 where we tranform them into FieldExprs if they are being resolved from within
7220 * ecore.cs (SimpleName.DoResolve): Do the same here.
7222 * assign.cs (DoResolve, Emit): Clean up code considerably.
7224 * ../errors/bug10.cs : Add.
7226 * ../errors/cs0070.cs : Add.
7228 * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
7230 * assign.cs : Get rid of EventIsLocal everywhere.
7232 2001-12-23 Miguel de Icaza <miguel@ximian.com>
7234 * ecore.cs (ConvertIntLiteral): finished the implementation.
7236 * statement.cs (SwitchLabel): Convert the value we are using as a
7237 key before looking up the table.
7239 2001-12-22 Miguel de Icaza <miguel@ximian.com>
7241 * codegen.cs (EmitTopBlock): Require a Location argument now.
7243 * cs-parser.jay (constructor_declarator): We need to setup
7244 current_local_parameters before we parse the
7245 opt_constructor_initializer, to allow the variables to be bound
7246 to the constructor arguments.
7248 * rootcontext.cs (LookupType): First lookup nested classes in our
7249 class and our parents before we go looking outside our class.
7251 * expression.cs (ConstantFold): Extract/debox the values at the
7254 * rootcontext.cs (EmitCode): Resolve the constants first before we
7255 resolve the types. This is not really needed, but it helps debugging.
7257 * statement.cs: report location.
7259 * cs-parser.jay: pass location to throw statement.
7261 * driver.cs: Small bug fix.
7263 * report.cs: Updated format to be 4-zero filled digits.
7265 2001-12-22 Ravi Pratap <ravi@ximian.com>
7267 * expression.cs (CheckIndices): Fix minor bug where the wrong
7268 variable was being referred to ;-)
7270 (DoEmit): Do not call EmitStaticInitializers when the
7271 underlying type is System.Object.
7273 2001-12-21 Ravi Pratap <ravi@ximian.com>
7275 * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
7276 and do the usual workaround for SRE.
7278 * class.cs (MyEventBuilder.EventType): New member to get at the type
7279 of the event, quickly.
7281 * expression.cs (Binary.ResolveOperator): Handle delegate addition.
7283 * assign.cs (Assign.DoResolve): Handle the case when the target
7284 is an EventExpr and perform the necessary checks.
7286 * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
7289 (SimpleName.MemberStaticCheck): Include check for EventExpr.
7291 (EventExpr): Set the type in the constructor itself since we
7292 are meant to be born fully resolved.
7294 (EventExpr.Define): Revert code I wrote earlier.
7296 * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
7297 instance expression is null. The instance expression is a This in that case
7298 or a null, depending on whether it is a static method or not.
7300 Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
7301 refers to more than one method.
7303 * assign.cs (DoResolve): Check whether the event belongs to the same Type container
7304 and accordingly flag errors.
7306 2001-12-21 Miguel de Icaza <miguel@ximian.com>
7308 * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
7310 2001-12-22 Miguel de Icaza <miguel@ximian.com>
7312 * location.cs (ToString): Provide useful rutine.
7314 2001-12-21 Miguel de Icaza <miguel@ximian.com>
7316 * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
7317 objects, return the actual integral boxed.
7319 * statement.cs (SwitchLabel): define an ILLabel for each
7322 (Switch.CheckSwitch): If the value is a Literal, extract
7323 the underlying literal.
7325 Also in the unused hashtable we had, add the SwitchLabel so we can
7326 quickly look this value up.
7328 * constant.cs: Implement a bunch of new constants. Rewrite
7329 Literal based on this. Made changes everywhere to adapt to this.
7331 * expression.cs (Expression.MakeByteBlob): Optimize routine by
7332 dereferencing array only once, and also copes with enumrations.
7334 bytes are two bytes wide, not one.
7336 (Cast): Perform constant conversions.
7338 * ecore.cs (TryImplicitIntConversion): Return literals instead of
7339 wrappers to the literals here.
7341 * expression.cs (DoNumericPromotions): long literals can converted
7342 to ulong implicity (this is taken care of elsewhere, but I was
7345 * ecore.cs (Expression.Literalize): Make the return type Literal,
7346 to improve type checking.
7348 * rootcontext.cs: Lookup for nested classes in our class hierarchy.
7350 2001-12-20 Miguel de Icaza <miguel@ximian.com>
7352 * literal.cs: Revert code from ravi that checked the bounds. The
7353 bounds are sane by the definition of the type itself.
7355 * typemanager.cs: Fix implementation of ImplementsInterface. We
7356 need to actually look up in our parent hierarchy for interfaces
7359 * const.cs: Use the underlying type for enumerations
7361 * delegate.cs: Compute the basename for the delegate creation,
7362 that should fix the delegate test case, and restore the correct
7363 Type Lookup semantics in rootcontext
7365 * rootcontext.cs: Revert Ravi's last patch. The correct way of
7366 referencing a nested type with the Reflection API is using the "+"
7369 * cs-parser.jay: Do not require EOF token at the end.
7371 2001-12-20 Ravi Pratap <ravi@ximian.com>
7373 * rootcontext.cs (LookupType): Concatenate type names with
7374 a '.' instead of a '+' The test suite passes again.
7376 * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
7377 field of the enumeration.
7379 * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
7380 the case when the member is an EventExpr.
7382 * ecore.cs (EventExpr.InstanceExpression): Every event which is not
7383 static has an associated instance expression.
7385 * typemanager.cs (RegisterEvent): The usual workaround, now for events.
7387 (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
7389 * class.cs (Event.Define): Register event and perform appropriate checks
7392 We define the Add and Remove methods even if the use provides none because
7393 in that case, we provide default implementations ourselves.
7395 Define a private field of the type of the event. This is done by the CSC compiler
7396 and we should be doing it too ;-)
7398 * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
7399 More methods we use in code we generate.
7401 (multicast_delegate_type, delegate_type): Two separate types since the distinction
7404 (InitCoreTypes): Update accordingly for the above.
7406 * class.cs (Event.Emit): Generate code for default accessors that we provide
7408 (EmitDefaultMethod): Do the job in the above.
7410 * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
7413 2001-12-20 Miguel de Icaza <miguel@ximian.com>
7415 * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
7416 builders even if we were missing one.
7418 * interface.cs, class.cs, enum.cs: When calling DefineNestedType
7419 pass the Basename as our class name instead of the Name. The
7420 basename will be correctly composed for us.
7422 * parameter.cs (Paramters): Now takes a Location argument.
7424 * decl.cs (DeclSpace.LookupType): Removed convenience function and
7425 make all the code call directly LookupType in RootContext and take
7426 this chance to pass the Location information everywhere.
7428 * Everywhere: pass Location information.
7430 2001-12-19 Miguel de Icaza <miguel@ximian.com>
7432 * class.cs (Constructor.Define): Updated way of detecting the
7433 length of the parameters.
7435 (TypeContainer.DefineType): Use basename as the type name for
7438 (TypeContainer.Define): Do not recursively define types here, as
7439 definition is taken care in order by the RootContext.
7441 * tree.cs: Keep track of namespaces in a per-file basis.
7443 * parameter.cs (Parameter.ComputeSignature): Update to use
7446 (Parameters.GetSignature): ditto.
7448 * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
7449 instead of a TypeContainer.
7451 (Interface.SemanticAnalysis): Use `this' instead of our parent to
7452 resolve names. Because we need to be resolve in our context, not
7455 * driver.cs: Implement response files.
7457 * class.cs (TypeContainer.DefineType): If we are defined, do not
7460 (Event.Emit): Emit the code for add/remove handlers.
7461 (Event.Define): Save the MethodBuilders for add/remove.
7463 * typemanager.cs: Use pair here too.
7465 * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
7466 DictionaryEntry requires the first argument to be non-null.
7468 (enum_declaration): Compute full name for registering the
7471 (delegate_declaration): Instead of using
7472 formal_parameter_list, use opt_formal_parameter_list as the list
7475 * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
7476 (EventParsing): New property that controls whether `add' and
7477 `remove' are returned as tokens or identifiers (for events);
7479 2001-12-19 Ravi Pratap <ravi@ximian.com>
7481 * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
7482 use MyEventBuilder only and let it wrap the real builder for us.
7484 (MyEventBuilder): Revamp constructor etc.
7486 Implement all operations that we perform on EventBuilder in precisely the same
7489 (FindMembers): Update to use the EventBuilder member.
7491 (Event.Emit): Update accordingly.
7493 2001-12-18 Ravi Pratap <ravi@ximian.com>
7495 * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
7496 by calling the appropriate methods.
7498 (GetCustomAttributes): Make stubs as they cannot possibly do anything
7501 (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
7503 2001-12-17 Ravi Pratap <ravi@ximian.com>
7505 * delegate.cs (Delegate.Populate): Check that the return type
7506 and various parameters types are indeed accessible.
7508 * class.cs (Constructor.Define): Same here.
7510 (Field.Define): Ditto.
7512 (Event.Define): Ditto.
7514 (Operator.Define): Check that the underlying Method defined itself
7515 correctly - so it's MethodBuilder should not be null.
7517 * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
7518 expression happens to be null.
7520 * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
7521 members but as of now we don't seem to be able to do anything really useful with it.
7523 (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
7524 not the EventBuilder.
7526 2001-12-18 Miguel de Icaza <miguel@ximian.com>
7528 * cs-tokenizer.cs: Add support for defines.
7529 Add support for #if, #elif, #else, #endif
7531 (eval_var): evaluates a variable.
7532 (eval): stubbed for evaluating functions.
7534 * cs-parser.jay: Pass the defines information
7536 * driver.cs: Add --define command line option.
7538 * decl.cs: Move MemberCore here.
7540 Make it the base class for DeclSpace. This allows us to catch and
7541 report 108 and 109 for everything now.
7543 * class.cs (TypeContainer.Define): Extract all the members
7544 before populating and emit the warning 108 (new keyword required
7545 to override) instead of having each member implement this.
7547 (MemberCore.Define): New abstract method, we will be using this in
7548 the warning reporting engine in Populate.
7550 (Operator.Define): Adjust to new MemberCore protocol.
7552 * const.cs (Const): This does not derive from Expression, it is a
7553 temporary object we use to create fields, it is a MemberCore.
7555 * class.cs (Method.Define): Allow the entry point to be in a
7558 * driver.cs: Rewrite the argument handler to clean it up a bit.
7560 * rootcontext.cs: Made it just an auxiliary namespace feature by
7561 making everything static.
7563 * driver.cs: Adapt code to use RootContext type name instead of
7566 * delegate.cs: Remove RootContext argument.
7568 * class.cs: (Struct, TypeContainer, Class): Remove RootContext
7571 * class.cs (Event.Define): The lookup can fail.
7573 * cs-tokenizer.cs: Begin implementation of pre-procesor.
7575 * expression.cs: Resolve the this instance before invoking the code.
7577 2001-12-17 Miguel de Icaza <miguel@ximian.com>
7579 * cs-parser.jay: Add a production in element_access that allows
7580 the thing to become a "type" reference. This way we can parse
7581 things like "(string [])" as a type.
7583 Note that this still does not handle the more complex rules of
7587 * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
7589 * ecore.cs: (CopyNewMethods): new utility function used to
7590 assemble the list of methods from running FindMembers.
7592 (MemberLookup): Rework FindMembers so that
7594 2001-12-16 Miguel de Icaza <miguel@ximian.com>
7596 * class.cs (TypeContainer): Remove Delegates who fail to be
7599 * delegate.cs (Populate): Verify that we dont get null return
7600 values. TODO: Check for AsAccessible.
7602 * cs-parser.jay: Use basename to emit error 574 (destructor should
7603 have the same name as container class), not the full name.
7605 * cs-tokenizer.cs (adjust_int): Fit the integer in the best
7606 possible representation.
7608 Also implements integer type suffixes U and L.
7610 2001-12-15 Miguel de Icaza <miguel@ximian.com>
7612 * expression.cs (ArrayCreation.DoResolve): We need to do the
7613 argument resolution *always*.
7615 * decl.cs: Make this hold the namespace. Hold the root context as
7617 (LookupType): Move here.
7619 * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
7621 * location.cs (Row, Name): Fixed the code, it was always returning
7622 references to the first file.
7624 * interface.cs: Register properties defined through interfaces.
7626 * driver.cs: Add support for globbing on the command line
7628 * class.cs (Field): Make it derive from MemberCore as well.
7631 2001-12-15 Ravi Pratap <ravi@ximian.com>
7633 * class.cs (Event::Define): Check that the type of the event is a delegate
7634 type else flag error #66.
7636 Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
7639 * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
7640 values of EntryPoint, CharSet etc etc.
7642 Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
7644 * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
7645 be null and we should ignore this. I am not sure if this is really clean. Apparently,
7646 there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
7647 which needs this to do its work.
7649 * ../errors/cs0066.cs : Add.
7651 2001-12-14 Miguel de Icaza <miguel@ximian.com>
7653 * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
7656 * class.cs: (MethodSignature.MethodSignature): Removed hack that
7657 clears out the parameters field.
7658 (MemberSignatureCompare): Cleanup
7660 (MemberCore): New base class used to share code between MethodCore
7663 (RegisterRequiredImplementations) BindingFlags.Public requires
7664 either BindingFlags.Instace or Static. Use instance here.
7666 (Property): Refactored code to cope better with the full spec.
7668 * parameter.cs (GetParameterInfo): Return an empty array instead
7671 * class.cs (Property): Abstract or extern properties have no bodies.
7673 * parameter.cs (GetParameterInfo): return a zero-sized array.
7675 * class.cs (TypeContainer.MethodModifiersValid): Move all the
7676 method modifier validation to the typecontainer so we can reuse
7679 (MethodCore.ParameterTypes): return an empty sized array of types.
7681 (Property.Define): Test property modifier validity.
7683 Add tests for sealed/override too.
7685 (Method.Emit): abstract or extern methods have no bodies.
7687 2001-12-14 Ravi Pratap <ravi@ximian.com>
7689 * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
7692 (Method::Define, ::Emit): Modify accordingly.
7694 * expression.cs (Invocation::OverloadResolve): Handle error # 121.
7696 (ArrayCreation::MakeByteBlob): Handle floats and doubles.
7698 * makefile: Pass in /unsafe.
7700 2001-12-13 Miguel de Icaza <miguel@ximian.com>
7702 * class.cs (MakeKey): Kill routine.
7704 * class.cs (TypeContainer.Define): Correctly define explicit
7705 method implementations (they require the full interface name plus
7708 * typemanager.cs: Deply the PtrHashtable here and stop using the
7709 lame keys. Things work so much better.
7711 This of course broke everyone who depended on `RegisterMethod' to
7712 do the `test for existance' test. This has to be done elsewhere.
7714 * support.cs (PtrHashtable): A hashtable that avoid comparing with
7715 the object stupid Equals method (because, that like fails all over
7716 the place). We still do not use it.
7718 * class.cs (TypeContainer.SetRequiredInterface,
7719 TypeContainer.RequireMethods): Killed these two routines and moved
7720 all the functionality to RegisterRequiredImplementations.
7722 (TypeContainer.RegisterRequiredImplementations): This routine now
7723 registers all the implementations required in an array for the
7724 interfaces and abstract methods. We use an array of structures
7725 which can be computed ahead of time to reduce memory usage and we
7726 also assume that lookups are cheap as most classes will not
7727 implement too many interfaces.
7729 We also avoid creating too many MethodSignatures.
7731 (TypeContainer.IsInterfaceMethod): Update and optionally does not
7732 clear the "pending" bit if we find that there are problems with
7735 (TypeContainer.VerifyPendingMethods): Update to report errors of
7736 methods that look like implementations but are not.
7738 (TypeContainer.Define): Add support for explicit interface method
7741 2001-12-12 Miguel de Icaza <miguel@ximian.com>
7743 * typemanager.cs: Keep track of the parameters here instead of
7744 being a feature of the TypeContainer.
7746 * class.cs: Drop the registration of parameters here, as
7747 InterfaceMethods are also interface declarations.
7749 * delegate.cs: Register methods with the TypeManager not only with
7750 the TypeContainer. This code was buggy.
7752 * interface.cs: Full registation here.
7754 2001-12-11 Miguel de Icaza <miguel@ximian.com>
7756 * expression.cs: Remove reducer for binary expressions, it can not
7759 * const.cs: Put here the code that used to go into constant.cs
7761 * constant.cs: Put here the code for constants, this is a new base
7764 * literal.cs: Make Literal derive from Constant.
7766 2001-12-09 Miguel de Icaza <miguel@ximian.com>
7768 * statement.cs (Return.Emit): Report error 157 if the user
7769 attempts to return from a finally block.
7771 (Return.Emit): Instead of emitting a return, jump to the end of
7774 * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
7775 LocalBuilder to store the result of the function. ReturnLabel is
7776 the target where we jump.
7779 2001-12-09 Radek Doulik <rodo@ximian.com>
7781 * cs-parser.jay: remember alias in current namespace
7783 * ecore.cs (SimpleName::DoResolve): use aliases for types or
7786 * class.cs (LookupAlias): lookup alias in my_namespace
7788 * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
7790 (LookupAlias): lookup alias in this and if needed in parent
7793 2001-12-08 Miguel de Icaza <miguel@ximian.com>
7797 * rootcontext.cs: (ModuleBuilder) Made static, first step into
7798 making things static. I need this to avoid passing the
7799 TypeContainer when calling ParameterType.
7801 * support.cs (InternalParameters.ParameterType): Remove ugly hack
7802 that did string manipulation to compute the type and then call
7803 GetType. Use Parameter.ParameterType instead.
7805 * cs-tokenizer.cs: Consume the suffix for floating values.
7807 * expression.cs (ParameterReference): figure out whether this is a
7808 reference parameter or not. Kill an extra variable by computing
7809 the arg_idx during emission.
7811 * parameter.cs (Parameters.GetParameterInfo): New overloaded
7812 function that returns whether a parameter is an out/ref value or not.
7814 (Parameter.ParameterType): The type of the parameter (base,
7815 without ref/out applied).
7817 (Parameter.Resolve): Perform resolution here.
7818 (Parameter.ExternalType): The full type (with ref/out applied).
7820 * statement.cs (Using.Emit, Using.EmitExpression): Implement
7821 support for expressions on the using statement.
7823 2001-12-07 Miguel de Icaza <miguel@ximian.com>
7825 * statement.cs (Using.EmitLocalVariableDecls): Split the
7826 localvariable handling of the using statement.
7828 (Block.EmitMeta): Keep track of variable count across blocks. We
7829 were reusing slots on separate branches of blocks.
7831 (Try.Emit): Emit the general code block, we were not emitting it.
7833 Check the type of the declaration to be an IDisposable or
7834 something that can be implicity converted to it.
7836 Emit conversions if required.
7838 * ecore.cs (EmptyExpression): New utility class.
7839 (Expression.ImplicitConversionExists): New utility function.
7841 2001-12-06 Miguel de Icaza <miguel@ximian.com>
7843 * statement.cs (Using): Implement.
7845 * expression.cs (LocalVariableReference): Support read only variables.
7847 * statement.cs: Remove the explicit emit for the Leave opcode.
7848 (VariableInfo): Add a readonly field.
7850 2001-12-05 Miguel de Icaza <miguel@ximian.com>
7852 * ecore.cs (ConvCast): new class used to encapsulate the various
7853 explicit integer conversions that works in both checked and
7856 (Expression.ConvertNumericExplicit): Use new ConvCast class to
7857 properly generate the overflow opcodes.
7859 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7861 * statement.cs: The correct type for the EmptyExpression is the
7862 element_type, not the variable type. Ravi pointed this out.
7864 2001-12-04 Ravi Pratap <ravi@ximian.com>
7866 * class.cs (Method::Define): Handle PInvoke methods specially
7867 by using DefinePInvokeMethod instead of the usual one.
7869 * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
7870 above to do the task of extracting information and defining the method.
7872 2001-12-04 Ravi Pratap <ravi@ximian.com>
7874 * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
7875 of the condition for string type.
7877 (Emit): Move that here.
7879 (ArrayCreation::CheckIndices): Keep string literals in their expression
7882 (EmitDynamicInitializers): Handle strings appropriately.
7884 2001-12-04 Miguel de Icaza <miguel@ximian.com>
7886 * codegen.cs (EmitContext): Replace multiple variables with a
7887 single pointer to the current Switch statement.
7889 * statement.cs (GotoDefault, Switch): Adjust to cleaned up
7892 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7896 * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
7899 (Foreach.Emit): Foreach on arrays was not setting
7900 up the loop variables (for break/continue).
7902 (GotoCase): Semi-implented.
7904 2001-12-03 Ravi Pratap <ravi@ximian.com>
7906 * attribute.cs (CheckAttribute): Handle system attributes by using
7907 Attribute.GetAttributes to examine information we need.
7909 (GetValidPlaces): Same here.
7911 * class.cs (Method::Define): Catch invalid use of extern and abstract together.
7913 * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
7915 * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
7917 (Method::Define): Set appropriate flags if we have a DllImport attribute.
7919 (Method::Emit): Handle the case when we are a PInvoke method.
7921 2001-12-03 Miguel de Icaza <miguel@ximian.com>
7923 * expression.cs: Use ResolveWithSimpleName on compound names.
7925 2001-12-02 Ravi Pratap <ravi@ximian.com>
7927 * constant.cs (EmitConstant): Make sure we resolve the associated expression
7928 before trying to reduce it.
7930 * typemanager.cs (RegisterConstant, LookupConstant): Implement.
7932 * constant.cs (LookupConstantValue): Implement.
7934 (EmitConstant): Use the above in emitting the constant.
7936 * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
7937 that are user-defined by doing a LookupConstantValue on them.
7939 (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
7942 2001-11-29 Miguel de Icaza <miguel@ximian.com>
7944 * expression.cs (BaseAccess, BaseIndexer): Also split this out.
7946 (BaseAccess.DoResolve): Implement.
7948 (MemberAccess.DoResolve): Split this routine into a
7949 ResolveMemberAccess routine that can be used independently
7951 2001-11-28 Miguel de Icaza <miguel@ximian.com>
7953 * expression.cs (Probe, Is, As): Split Probe in two classes Is and
7954 As that share bits of the implementation. Is returns a boolean,
7955 while As returns the Type that is being probed.
7957 2001-12-01 Ravi Pratap <ravi@ximian.com>
7959 * enum.cs (LookupEnumValue): Re-write various bits, return an object value
7960 instead of a Literal - much easier.
7962 (EnumInTransit): Remove - utterly useless :-)
7964 (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
7966 * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
7968 * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
7969 chain when we have no associated expression.
7971 2001-11-30 Ravi Pratap <ravi@ximian.com>
7973 * constant.cs (Define): Use Location while reporting the errror.
7975 Also emit a warning when 'new' is used and there is no inherited
7978 * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
7981 (LookupEnumValue): Implement to lookup an enum member's value and define it
7984 (Populate): Re-write accordingly to use the above routine.
7986 2001-11-27 Miguel de Icaza <miguel@ximian.com>
7988 * expression.cs (This): Fix prototype for DoResolveLValue to
7989 override the base class DoResolveLValue.
7991 * cs-parser.cs: Report errors cs574 and cs575 (destructor
7994 * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
7995 (we need to load the address of the field here). This fixes
7998 (FieldExpr.DoResolveLValue): Call the DoResolve
7999 function to initialize the Instance expression.
8001 * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
8002 correctly the GetEnumerator operation on a value type.
8004 * cs-parser.jay: Add more simple parsing error catches.
8006 * statement.cs (Switch): Add support for string switches.
8007 Handle null specially.
8009 * literal.cs (NullLiteral): Make NullLiteral objects singletons.
8011 2001-11-28 Ravi Pratap <ravi@ximian.com>
8013 * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
8015 (declare_local_constant): New helper function.
8017 * statement.cs (AddConstant): Keep a separate record of constants
8019 (IsConstant): Implement to determine if a variable is a constant.
8021 (GetConstantExpression): Implement.
8023 * expression.cs (LocalVariableReference): Handle the case when it is a constant.
8025 * statement.cs (IsVariableDefined): Re-write.
8027 2001-11-27 Ravi Pratap <ravi@ximian.com>
8029 * class.cs (TypeContainer::FindMembers): Look for constants
8030 in the case when we are looking for MemberTypes.Field
8032 * expression.cs (MemberAccess::DoResolve): Check that in the
8033 case we are a FieldExpr and a Literal, we are not being accessed
8034 by an instance reference.
8036 * cs-parser.jay (local_constant_declaration): Implement.
8038 (declaration_statement): Implement for constant declarations.
8040 2001-11-26 Miguel de Icaza <miguel@ximian.com>
8042 * statement.cs (Switch): Catch double defaults.
8044 (Switch): More work on the switch() statement
8045 implementation. It works for integral values now, need to finish
8049 2001-11-24 Miguel de Icaza <miguel@ximian.com>
8051 * ecore.cs (Expression.ConvertIntLiteral): New function to convert
8052 integer literals into other integer literals. To be used by
8055 2001-11-24 Ravi Pratap <ravi@ximian.com>
8057 * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
8060 (EmitDynamicInitializers): Cope with the above since we extract data
8061 directly from ArrayData now.
8063 (ExpectInitializers): Keep track of whether initializers are mandatory
8066 (Bounds): Make it a hashtable to prevent the same dimension being
8067 recorded for every element in that dimension.
8069 (EmitDynamicInitializers): Fix bug which prevented the Set array method
8072 Also fix bug which was causing the indices to be emitted in the reverse
8075 2001-11-24 Miguel de Icaza <miguel@ximian.com>
8077 * expression.cs (ArrayCreation): Implement the bits that Ravi left
8078 unfinished. They do not work, because the underlying code is
8081 2001-11-22 Miguel de Icaza <miguel@ximian.com>
8083 * cs-parser.jay: Remove bogus fixme.
8085 * statement.cs (Switch, SwitchSection, SwithLabel): Started work
8086 on Switch statement.
8088 2001-11-23 Ravi Pratap <ravi@ximian.com>
8090 * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
8093 * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
8094 parameter. Apparently, any expression is allowed.
8096 (ValidateInitializers): Update accordingly.
8098 (CheckIndices): Fix some tricky bugs thanks to recursion.
8100 * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
8101 I was being completely brain-dead.
8103 (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
8104 and re-write acordingly.
8106 (DelegateInvocation): Re-write accordingly.
8108 * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
8110 (MakeByteBlob): Handle types more correctly.
8112 * expression.cs (ArrayCreation:Emit): Write preliminary code to do
8113 initialization from expressions but it is incomplete because I am a complete
8116 2001-11-22 Miguel de Icaza <miguel@ximian.com>
8118 * statement.cs (If.Emit): Fix a bug that generated incorrect code
8119 on If. Basically, we have to return `true' (ie, we do return to
8120 our caller) only if both branches of the if return.
8122 * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
8123 short-circuit operators, handle them as short circuit operators.
8125 (Cast.DoResolve): Resolve type.
8126 (Cast.Cast): Take an expression as the target type.
8128 * cs-parser.jay (cast_expression): Remove old hack that only
8129 allowed a limited set of types to be handled. Now we take a
8130 unary_expression and we resolve to a type during semantic
8133 Use the grammar productions from Rhys to handle casts (this is
8134 not complete like Rhys syntax yet, we fail to handle that corner
8135 case that C# has regarding (-x), but we will get there.
8137 2001-11-22 Ravi Pratap <ravi@ximian.com>
8139 * class.cs (EmitFieldInitializer): Take care of the case when we have a
8140 field which is an array type.
8142 * cs-parser.jay (declare_local_variables): Support array initialization too.
8144 * typemanager.cs (MakeKey): Implement.
8146 (everywhere): Use the above appropriately.
8148 * cs-parser.jay (for_statement): Update for array initialization while
8149 declaring variables.
8151 * ecore.cs : The error message was correct, it's the variable's names that
8152 were misleading ;-) Make the code more readable.
8154 (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
8155 the correct type etc.
8157 (ConvertExplicit): Handle Enum types by examining the underlying type.
8159 2001-11-21 Ravi Pratap <ravi@ximian.com>
8161 * parameter.cs (GetCallingConvention): Always return
8162 CallingConventions.Standard for now.
8164 2001-11-22 Miguel de Icaza <miguel@ximian.com>
8166 * expression.cs (Binary.ResolveOperator): Update the values of `l'
8167 and `r' after calling DoNumericPromotions.
8169 * ecore.cs: Fix error message (the types were in the wrong order).
8171 * statement.cs (Foreach.ProbeCollectionType): Need to pass
8172 BindingFlags.Instance as well
8174 * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
8175 implicit int literal conversion in an empty cast so that we
8176 propagate the right type upstream.
8178 (UnboxCast): new class used to unbox value types.
8179 (Expression.ConvertExplicit): Add explicit type conversions done
8182 (Expression.ImplicitNumericConversion): Oops, forgot to test for
8183 the target type before applying the implicit LongLiterals to ULong
8186 2001-11-21 Miguel de Icaza <miguel@ximian.com>
8188 * cs-parser.jay (for_statement): Reworked the way For works: now
8189 we declare manually any variables that are introduced in
8190 for_initializer to solve the problem of having out-of-band code
8191 emition (that is what got for broken).
8193 (declaration_statement): Perform the actual variable declaration
8194 that used to be done in local_variable_declaration here.
8196 (local_variable_declaration): Do not declare anything, just pass
8197 the information on a DictionaryEntry
8199 2001-11-20 Ravi Pratap <ravi@ximian.com>
8201 * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
8202 re-write of the logic to now make it recursive.
8204 (UpdateIndices): Re-write accordingly.
8206 Store element data in a separate ArrayData list in the above methods.
8208 (MakeByteBlob): Implement to dump the array data into a byte array.
8210 2001-11-19 Ravi Pratap <ravi@ximian.com>
8212 * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
8215 * constant.cs (Define): Implement.
8217 (EmitConstant): Re-write fully.
8219 Pass in location info.
8221 * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
8224 * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
8225 DictionaryEntry since we need location info too.
8227 (constant_declaration): Update accordingly.
8229 * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
8230 code into another method : UpdateIndices.
8232 2001-11-18 Ravi Pratap <ravi@ximian.com>
8234 * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
8235 some type checking etc.
8237 2001-11-17 Ravi Pratap <ravi@ximian.com>
8239 * expression.cs (ArrayCreation::ValidateInitializers): Implement
8240 bits to provide dimension info if the user skips doing that.
8242 Update second constructor to store the rank correctly.
8244 2001-11-16 Ravi Pratap <ravi@ximian.com>
8246 * expression.cs (ArrayCreation::ValidateInitializers): Poke around
8247 and try to implement.
8249 * ../errors/cs0150.cs : Add.
8251 * ../errors/cs0178.cs : Add.
8253 2001-11-16 Miguel de Icaza <miguel@ximian.com>
8255 * statement.cs: Implement foreach on multi-dimensional arrays.
8257 * parameter.cs (Parameters.GetParameterByName): Also lookup the
8258 name of the params argument.
8260 * expression.cs: Use EmitStoreOpcode to get the right opcode while
8261 initializing the array.
8263 (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
8264 we can use this elsewhere.
8266 * statement.cs: Finish implementation of foreach for single
8269 * cs-parser.jay: Use an out-of-band stack to pass information
8270 around, I wonder why I need this.
8272 foreach_block: Make the new foreach_block the current_block.
8274 * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
8275 function used to return a static Parameters structure. Used for
8276 empty parameters, as those are created very frequently.
8278 * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
8280 2001-11-15 Ravi Pratap <ravi@ximian.com>
8282 * interface.cs : Default modifier is private, not public. The
8283 make verify test passes again.
8285 2001-11-15 Ravi Pratap <ravi@ximian.com>
8287 * support.cs (ReflectionParameters): Fix logic to determine
8288 whether the last parameter is a params one. Test 9 passes again.
8290 * delegate.cs (Populate): Register the builders we define with
8291 RegisterParameterForBuilder. Test 19 passes again.
8293 * cs-parser.jay (property_declaration): Reference $6 instead
8294 of $$ to get at the location.
8296 (indexer_declaration): Similar stuff.
8300 * class.cs (Property): Register parameters for the Get and Set methods
8301 if they exist. Test 23 passes again.
8303 * expression.cs (ArrayCreation::Emit): Pass null for the method in the
8304 call to EmitArguments as we are sure there aren't any params arguments.
8305 Test 32 passes again.
8307 * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
8308 IndexOutOfRangeException.
8310 * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
8311 Test 33 now passes again.
8313 2001-11-15 Miguel de Icaza <miguel@ximian.com>
8315 * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
8316 broke a bunch of things. Will have to come up with a better way
8317 of tracking locations.
8319 * statement.cs: Implemented foreach for single dimension arrays.
8321 2001-11-09 Miguel de Icaza <miguel@ximian.com>
8323 * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
8324 an error. This removes the lookup from the critical path.
8326 * cs-parser.jay: Removed use of temporary_loc, which is completely
8329 2001-11-14 Miguel de Icaza <miguel@ximian.com>
8331 * support.cs (ReflectionParameters.ParameterModifier): Report
8332 whether the argument is a PARAMS argument or not.
8334 * class.cs: Set the attribute `ParamArrayAttribute' on the
8337 * typemanager.cs: Define param_array_type (ParamArrayAttribute)
8338 and cons_param_array_attribute (ConstructorInfo for
8339 ParamArrayAttribute).,
8341 * codegen.cs: Emit the return using the `Return' statement, that
8342 way we can report the error correctly for missing return values.
8344 * class.cs (Method.Emit): Clean up.
8346 * expression.cs (Argument.Resolve): Take another argument: the
8347 location where this argument is used. Notice that this is not
8348 part of the "Argument" class as to reduce the size of the
8349 structure (we know the approximate location anyways).
8351 Test if the argument is a variable-reference, if not, then
8352 complain with a 206.
8354 (Argument.Emit): Emit addresses of variables.
8356 (Argument.FullDesc): Simplify.
8358 (Invocation.DoResolve): Update for Argument.Resolve.
8360 (ElementAccess.DoResolve): ditto.
8362 * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
8363 method should be virtual, as this method is always virtual.
8365 (NewDelegate.DoResolve): Update for Argument.Resolve.
8367 * class.cs (ConstructorInitializer.DoResolve): ditto.
8369 * attribute.cs (Attribute.Resolve): ditto.
8371 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8373 * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
8375 * expression.cs (ParameterReference): Drop IStackStorage and implement
8376 IAssignMethod instead.
8378 (LocalVariableReference): ditto.
8380 * ecore.cs (FieldExpr): Drop IStackStorage and implement
8381 IAssignMethod instead.
8383 2001-11-13 Miguel de Icaza <miguel@ximian.com>
8385 * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
8386 enumerations that are used in heavily used structures derive from
8387 byte in a laughable and pathetic attempt to reduce memory usage.
8388 This is the kind of pre-optimzations that you should not do at
8389 home without adult supervision.
8391 * expression.cs (UnaryMutator): New class, used to handle ++ and
8392 -- separatedly from the other unary operators. Cleans up the
8393 code, and kills the ExpressionStatement dependency in Unary.
8395 (Unary): Removed `method' and `Arguments' from this class, making
8396 it smaller, and moving it all to SimpleCall, so I can reuse this
8397 code in other locations and avoid creating a lot of transient data
8398 strucutres when not required.
8400 * cs-parser.jay: Adjust for new changes.
8402 2001-11-11 Miguel de Icaza <miguel@ximian.com>
8404 * enum.cs (Enum.Populate): If there is a failure during
8407 * cs-parser.jay (opt_enum_base): we used to catch type errors
8408 here, but this is really incorrect. The type error should be
8409 catched during semantic analysis.
8411 2001-12-11 Ravi Pratap <ravi@ximian.com>
8413 * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
8414 current_local_parameters as expected since I, in my stupidity, had forgotten
8417 * attribute.cs (GetValidPlaces): Fix stupid bug.
8419 * class.cs (Method::Emit): Perform check on applicability of attributes.
8421 (Constructor::Emit): Ditto.
8423 (Field::Emit): Ditto.
8425 (Field.Location): Store location information.
8427 (Property, Event, Indexer, Operator): Ditto.
8429 * cs-parser.jay (field_declaration): Pass in location for each field.
8431 * ../errors/cs0592.cs : Add.
8433 2001-11-12 Ravi Pratap <ravi@ximian.com>
8435 * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
8437 (InitCoreTypes): Update accordingly.
8439 (RegisterAttrType, LookupAttr): Implement.
8441 * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
8442 info about the same.
8444 (Resolve): Update to populate the above as necessary.
8448 (GetValidPlaces): Helper to the above.
8450 (CheckAttribute): Implement to perform validity of attributes on declarative elements.
8452 * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
8454 2001-11-12 Ravi Pratap <ravi@ximian.com>
8456 * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
8458 * ../errors/cs0617.cs : Add.
8460 2001-11-11 Ravi Pratap <ravi@ximian.com>
8462 * enum.cs (Emit): Rename to Populate to be more consistent with what
8463 we expect it to do and when exactly it is called.
8465 * class.cs, rootcontext.cs : Update accordingly.
8467 * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
8468 FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
8470 * enum.cs (Populate): Register fields with TypeManager.RegisterField.
8472 * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
8473 of a fieldinfo using the above, when dealing with a FieldBuilder.
8475 2001-11-10 Ravi Pratap <ravi@ximian.com>
8477 * ../errors/cs0031.cs : Add.
8479 * ../errors/cs1008.cs : Add.
8481 * ../errrors/cs0543.cs : Add.
8483 * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
8486 (FindMembers): Implement.
8488 * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
8489 enums and delegates too.
8491 (enum_types): Rename to builder_to_enum.
8493 (delegate_types): Rename to builder_to_delegate.
8495 * delegate.cs (FindMembers): Implement.
8497 2001-11-09 Ravi Pratap <ravi@ximian.com>
8499 * typemanager.cs (IsEnumType): Implement.
8501 * enum.cs (Emit): Re-write parts to account for the underlying type
8502 better and perform checking etc.
8504 (GetNextDefaultValue): Helper to ensure we don't overshoot max value
8505 of the underlying type.
8507 * literal.cs (GetValue methods everywhere): Perform bounds checking and return
8510 * enum.cs (error31): Helper to report error #31.
8512 * cs-parser.jay (enum_declaration): Store location of each member too.
8514 * enum.cs (member_to_location): New hashtable.
8516 (AddEnumMember): Update location hashtable.
8518 (Emit): Use the location of each member while reporting errors.
8520 2001-11-09 Miguel de Icaza <miguel@ximian.com>
8522 * cs-parser.jay: A for_initializer if is a
8523 local_variable_declaration really ammount to have an implicit
8524 block with the variable declaration and no initializer for for.
8526 * statement.cs (For.Emit): Cope with null initializers.
8528 This fixes the infinite loop on for initializers.
8530 2001-11-08 Miguel de Icaza <miguel@ximian.com>
8532 * enum.cs: More cleanup.
8534 * ecore.cs: Remove dead code.
8536 * class.cs (Property.Emit): More simplification.
8537 (Event.Emit): ditto.
8539 Reworked to have less levels of indentation.
8541 2001-11-08 Ravi Pratap <ravi@ximian.com>
8543 * class.cs (Property): Emit attributes.
8553 * enum.cs (Emit): Ditto.
8555 * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
8558 * class.cs (Field, Event, etc.): Move attribute generation into the
8559 Emit method everywhere.
8561 * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
8562 we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
8563 as we had no way of defining nested enums !
8565 * rootcontext.cs : Adjust code accordingly.
8567 * typemanager.cs (AddEnumType): To keep track of enum types separately.
8569 2001-11-07 Ravi Pratap <ravi@ximian.com>
8571 * expression.cs (EvalConstantExpression): Move into ecore.cs
8573 * enum.cs (Enum): Rename some members and make them public and readonly
8574 according to our convention.
8576 * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
8579 * enum.cs (Enum::Define): Use the above instead of TypeAttr.
8581 (Enum::Emit): Write a simple version for now which doesn't try to compute
8582 expressions. I shall modify this to be more robust in just a while.
8584 * class.cs (TypeContainer::Emit): Make sure we include Enums too.
8586 (TypeContainer::CloseType): Create the Enum types too.
8588 * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
8590 * expression.cs (EvalConstantExpression): Get rid of completely.
8592 * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
8593 user-defined values and other cases.
8595 (IsValidEnumLiteral): Helper function.
8597 * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
8598 out there in the case we had a literal FieldExpr.
8600 (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
8602 (Literalize): Revamp a bit to take two arguments.
8604 (EnumLiteral): New class which derives from Literal to wrap enum literals.
8606 2001-11-06 Ravi Pratap <ravi@ximian.com>
8608 * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
8610 * expression.cs (ArrayCreation::ValidateInitializers): Implement.
8612 (Resolve): Use the above to ensure we have proper initializers.
8614 2001-11-05 Ravi Pratap <ravi@ximian.com>
8616 * expression.cs (Expression::EvalConstantExpression): New method to
8617 evaluate constant expressions.
8619 * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
8621 2001-11-07 Miguel de Icaza <miguel@ximian.com>
8623 * expression.cs (ArrayCreation.Emit): Some bits to initialize data
8626 (Binary.ResolveOperator): Handle operator != (object a, object b)
8627 and operator == (object a, object b);
8629 (Binary.DoNumericPromotions): Indicate whether the numeric
8630 promotion was possible.
8632 (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
8635 Made the ArrayAccess implement interface IAssignMethod instead of
8636 IStackStore as the order in which arguments are passed reflects
8639 * assign.cs: Instead of using expr.ExprClass to select the way of
8640 assinging, probe for the IStackStore/IAssignMethod interfaces.
8642 * typemanager.cs: Load InitializeArray definition.
8644 * rootcontext.cs (RootContext.MakeStaticData): Used to define
8645 static data that can be used to initialize arrays.
8647 2001-11-05 Miguel de Icaza <miguel@ximian.com>
8649 * expression.cs: Handle operator== and operator!= for booleans.
8651 (Conditioal.Reduce): Implement reducer for the ?: operator.
8653 (Conditional.Resolve): Implement dead code elimination.
8655 (Binary.Resolve): Catch string literals and return a new
8656 concatenated string.
8658 (Unary.Reduce): Implement reduction of unary expressions.
8660 * ecore.cs: Split out the expression core handling here.
8662 (Expression.Reduce): New method used to perform constant folding
8663 and CSE. This is needed to support constant-expressions.
8665 * statement.cs (Statement.EmitBoolExpression): Pass true and false
8666 targets, and optimize for !x.
8668 2001-11-04 Ravi Pratap <ravi@ximian.com>
8670 * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
8671 of an attribute gives us a CustomAttributeBuilder which we use accordingly to
8672 set custom atttributes.
8674 * literal.cs (Literal::GetValue): New abstract method to return the actual
8675 value of the literal, cast as an object.
8677 (*Literal): Implement GetValue method.
8679 * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
8680 expressions to the arraylist but objects of type Argument.
8682 * class.cs (TypeContainer::Emit): Emit our attributes too.
8684 (Method::Emit, Constructor::Emit): Ditto.
8686 * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
8687 to be ignoring earlier.
8689 2001-11-03 Ravi Pratap <ravi@ximian.com>
8691 * attribute.cs (AttributeSection::Define): Implement to do the business
8692 of constructing a CustomAttributeBuilder.
8694 (Attribute): New trivial class. Increases readability of code.
8696 * cs-parser.jay : Update accordingly.
8698 (positional_argument_list, named_argument_list, named_argument): New rules
8700 (attribute_arguments): Use the above so that we are more correct.
8702 2001-11-02 Ravi Pratap <ravi@ximian.com>
8704 * expression.cs (Invocation::IsParamsMethodApplicable): Implement
8705 to perform all checks for a method with a params parameter.
8707 (Invocation::OverloadResolve): Update to use the above method and therefore
8708 cope correctly with params method invocations.
8710 * support.cs (InternalParameters::ParameterDesc): Provide a desc for
8713 * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
8714 constructors in our parent too because we can't afford to miss out on
8717 * attribute.cs (AttributeSection): New name for the class Attribute
8719 Other trivial changes to improve readability.
8721 * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
8722 use the new class names.
8724 2001-11-01 Ravi Pratap <ravi@ximian.com>
8726 * class.cs (Method::Define): Complete definition for params types too
8728 (Indexer::Define): Ditto.
8730 * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
8731 Cope everywhere with a request for info about the array parameter.
8733 2001-11-01 Ravi Pratap <ravi@ximian.com>
8735 * tree.cs (RecordNamespace): Fix up to check for the correct key.
8737 * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
8738 local_variable_type to extract the string corresponding to the type.
8740 (local_variable_type): Fixup the action to use the new helper method.
8742 * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
8745 * expression.cs : Clean out code which uses the above.
8747 2001-10-31 Ravi Pratap <ravi@ximian.com>
8749 * typemanager.cs (RegisterMethod): Check if we already have an existing key
8750 and bale out if necessary by returning a false.
8752 (RegisterProperty): Ditto.
8754 * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
8755 and print out appropriate error messages.
8757 * interface.cs (everywhere): Ditto.
8759 * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
8760 location to constructor.
8762 * class.cs (Property, Event, Indexer): Update accordingly.
8764 * ../errors/cs111.cs : Added.
8766 * expression.cs (Invocation::IsApplicable): New static method to determine applicability
8767 of a method, as laid down by the spec.
8769 (Invocation::OverloadResolve): Use the above method.
8771 2001-10-31 Ravi Pratap <ravi@ximian.com>
8773 * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
8774 now take a TypeContainer and a Parameters object.
8776 (ParameterData): Modify return type of ParameterModifier method to be
8777 Parameter.Modifier and not a string.
8779 (ReflectionParameters, InternalParameters): Update accordingly.
8781 * expression.cs (Argument::GetParameterModifier): Same here.
8783 * support.cs (InternalParameters::ParameterType): Find a better way of determining
8784 if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
8785 symbol in it at all so maybe this is only for now.
8787 2001-10-30 Ravi Pratap <ravi@ximian.com>
8789 * support.cs (InternalParameters): Constructor now takes an extra argument
8790 which is the actual Parameters class.
8792 (ParameterDesc): Update to provide info on ref/out modifiers.
8794 * class.cs (everywhere): Update call to InternalParameters to pass in
8795 the second argument too.
8797 * support.cs (ParameterData): Add ParameterModifier, which is a method
8798 to return the modifier info [ref/out etc]
8800 (InternalParameters, ReflectionParameters): Implement the above.
8802 * expression.cs (Argument::ParameterModifier): Similar function to return
8803 info about the argument's modifiers.
8805 (Invocation::OverloadResolve): Update to take into account matching modifiers
8808 * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
8809 a new SetFormalParameters object which we pass to InternalParameters.
8811 2001-10-30 Ravi Pratap <ravi@ximian.com>
8813 * expression.cs (NewArray): Merge into the ArrayCreation class.
8815 2001-10-29 Ravi Pratap <ravi@ximian.com>
8817 * expression.cs (NewArray): Merge classes NewBuiltinArray and
8818 NewUserdefinedArray into one as there wasn't much of a use in having
8821 * expression.cs (Argument): Change field's name to ArgType from Type.
8823 (Type): New readonly property which returns the proper type, taking into
8824 account ref/out modifiers.
8826 (everywhere): Adjust code accordingly for the above.
8828 * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
8829 whether we are emitting for a ref or out parameter.
8831 * expression.cs (Argument::Emit): Use the above field to set the state.
8833 (LocalVariableReference::Emit): Update to honour the flag and emit the
8836 * parameter.cs (Attributes): Set the correct flags for ref parameters.
8838 * expression.cs (Argument::FullDesc): New function to provide a full desc.
8840 * support.cs (ParameterData): Add method ParameterDesc to the interface.
8842 (ReflectionParameters, InternalParameters): Implement the above method.
8844 * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
8847 (Invocation::FullMethodDesc): Ditto.
8849 2001-10-29 Miguel de Icaza <miguel@ximian.com>
8851 * cs-parser.jay: Add extra production for the second form of array
8854 * expression.cs (ArrayCreation): Update to reflect the above
8857 * Small changes to prepare for Array initialization.
8859 2001-10-28 Miguel de Icaza <miguel@ximian.com>
8861 * typemanager.cs (ImplementsInterface): interface might be null;
8862 Deal with this problem;
8864 Also, we do store negative hits on the cache (null values), so use
8865 this instead of calling t.GetInterfaces on the type everytime.
8867 2001-10-28 Ravi Pratap <ravi@ximian.com>
8869 * typemanager.cs (IsBuiltinType): New method to help determine the same.
8871 * expression.cs (New::DoResolve): Get rid of array creation code and instead
8872 split functionality out into different classes.
8874 (New::FormArrayType): Move into NewBuiltinArray.
8876 (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
8879 (NewBuiltinArray): New class to handle creation of built-in arrays.
8881 (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
8882 account creation of one-dimensional arrays.
8884 (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
8886 (NewUserdefinedArray::DoResolve): Implement.
8888 * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
8890 * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
8891 we maintain inside the TypeManager. This is necessary to perform lookups on the
8894 (LookupType): Update to perform GetType on the module builders too.
8896 * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
8898 * exprssion.cs (NewUserdefinedArray::Emit): Implement.
8900 2001-10-23 Ravi Pratap <ravi@ximian.com>
8902 * expression.cs (New::DoResolve): Implement guts of array creation.
8904 (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
8906 2001-10-27 Miguel de Icaza <miguel@ximian.com>
8908 * expression.cs: Fix bug I introduced lsat night that broke
8911 (Expression.Resolve): Report a 246 error (can not resolve name)
8912 if we find a SimpleName in the stream.
8914 (Expression.ResolveLValue): Ditto.
8916 (Expression.ResolveWithSimpleName): This function is a variant of
8917 ResolveName, this one allows SimpleNames to be returned without a
8918 warning. The only consumer of SimpleNames is MemberAccess
8920 2001-10-26 Miguel de Icaza <miguel@ximian.com>
8922 * expression.cs (Invocation::DoResolve): Catch SimpleNames that
8923 might arrive here. I have my doubts that this is correct.
8925 * statement.cs (Lock): Implement lock statement.
8927 * cs-parser.jay: Small fixes to support `lock' and `using'
8929 * cs-tokenizer.cs: Remove extra space
8931 * driver.cs: New flag --checked, allows to turn on integer math
8934 * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
8935 Threading.Monitor.Exit
8937 2001-10-23 Miguel de Icaza <miguel@ximian.com>
8939 * expression.cs (IndexerAccess::DoResolveLValue): Set the
8940 Expression Class to be IndexerAccess.
8942 Notice that Indexer::DoResolve sets the eclass to Value.
8944 2001-10-22 Miguel de Icaza <miguel@ximian.com>
8946 * class.cs (TypeContainer::Emit): Emit code for indexers.
8948 * assign.cs (IAssignMethod): New interface implemented by Indexers
8949 and Properties for handling assignment.
8951 (Assign::Emit): Simplify and reuse code.
8953 * expression.cs (IndexerAccess, PropertyExpr): Implement
8954 IAssignMethod, clean up old code.
8956 2001-10-22 Ravi Pratap <ravi@ximian.com>
8958 * typemanager.cs (ImplementsInterface): New method to determine if a type
8959 implements a given interface. Provides a nice cache too.
8961 * expression.cs (ImplicitReferenceConversion): Update checks to use the above
8964 (ConvertReferenceExplicit): Ditto.
8966 * delegate.cs (Delegate::Populate): Update to define the parameters on the
8967 various methods, with correct names etc.
8969 * class.cs (Operator::OpType): New members Operator.UnaryPlus and
8970 Operator.UnaryNegation.
8972 * cs-parser.jay (operator_declarator): Be a little clever in the case where
8973 we have a unary plus or minus operator.
8975 * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
8978 * everywhere : update accordingly.
8980 * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
8983 * class.cs (Method::Define): For the case where we are implementing a method
8984 inherited from an interface, we need to set the MethodAttributes.Final flag too.
8985 Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
8987 2001-10-21 Ravi Pratap <ravi@ximian.com>
8989 * interface.cs (FindMembers): Implement to work around S.R.E
8992 * typemanager.cs (IsInterfaceType): Implement.
8994 (FindMembers): Update to handle interface types too.
8996 * expression.cs (ImplicitReferenceConversion): Re-write bits which
8997 use IsAssignableFrom as that is not correct - it doesn't work.
8999 * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
9000 and accordingly override EmitStatement.
9002 * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
9003 using the correct logic :-)
9005 2001-10-19 Ravi Pratap <ravi@ximian.com>
9007 * ../errors/cs-11.cs : Add to demonstrate error -11
9009 2001-10-17 Miguel de Icaza <miguel@ximian.com>
9011 * assign.cs (Assign::Resolve): Resolve right hand side first, and
9012 then pass this as a hint to ResolveLValue.
9014 * expression.cs (FieldExpr): Add Location information
9016 (FieldExpr::LValueResolve): Report assignment to readonly
9019 (Expression::ExprClassFromMemberInfo): Pass location information.
9021 (Expression::ResolveLValue): Add new method that resolves an
9024 (Expression::DoResolveLValue): Default invocation calls
9027 (Indexers): New class used to keep track of indexers in a given
9030 (IStackStore): Renamed from LValue, as it did not really describe
9031 what this did. Also ResolveLValue is gone from this interface and
9032 now is part of Expression.
9034 (ElementAccess): Depending on the element access type
9036 * typemanager.cs: Add `indexer_name_type' as a Core type
9037 (System.Runtime.CompilerServices.IndexerNameAttribute)
9039 * statement.cs (Goto): Take a location.
9041 2001-10-18 Ravi Pratap <ravi@ximian.com>
9043 * delegate.cs (Delegate::VerifyDelegate): New method to verify
9044 if two delegates are compatible.
9046 (NewDelegate::DoResolve): Update to take care of the case when
9047 we instantiate a delegate from another delegate.
9049 * typemanager.cs (FindMembers): Don't even try to look up members
9050 of Delegate types for now.
9052 2001-10-18 Ravi Pratap <ravi@ximian.com>
9054 * delegate.cs (NewDelegate): New class to take care of delegate
9057 * expression.cs (New): Split the delegate related code out into
9058 the NewDelegate class.
9060 * delegate.cs (DelegateInvocation): New class to handle delegate
9063 * expression.cs (Invocation): Split out delegate related code into
9064 the DelegateInvocation class.
9066 2001-10-17 Ravi Pratap <ravi@ximian.com>
9068 * expression.cs (New::DoResolve): Implement delegate creation fully
9069 and according to the spec.
9071 (New::DoEmit): Update to handle delegates differently.
9073 (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
9074 because of which we were printing out arguments in reverse order !
9076 * delegate.cs (VerifyMethod): Implement to check if the given method
9077 matches the delegate.
9079 (FullDelegateDesc): Implement.
9081 (VerifyApplicability): Implement.
9083 * expression.cs (Invocation::DoResolve): Update to accordingly handle
9084 delegate invocations too.
9086 (Invocation::Emit): Ditto.
9088 * ../errors/cs1593.cs : Added.
9090 * ../errors/cs1594.cs : Added.
9092 * delegate.cs (InstanceExpression, TargetMethod): New properties.
9094 2001-10-16 Ravi Pratap <ravi@ximian.com>
9096 * typemanager.cs (intptr_type): Core type for System.IntPtr
9098 (InitCoreTypes): Update for the same.
9100 (iasyncresult_type, asynccallback_type): Ditto.
9102 * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
9105 * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
9108 * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
9109 the builders for the 4 members of a delegate type :-)
9111 (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
9114 * expression.cs (New::DoResolve): Implement guts for delegate creation.
9116 * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
9118 2001-10-15 Miguel de Icaza <miguel@ximian.com>
9120 * statement.cs (Break::Emit): Implement.
9121 (Continue::Emit): Implement.
9123 (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
9124 (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
9125 (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
9126 (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
9129 * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
9130 properties that track the label for the current loop (begin of the
9131 loop and end of the loop).
9133 2001-10-15 Ravi Pratap <ravi@ximian.com>
9135 * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
9136 use of emitting anything at all.
9138 * class.cs, rootcontext.cs : Get rid of calls to the same.
9140 * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
9142 (Populate): Define the constructor correctly and set the implementation
9145 * typemanager.cs (delegate_types): New hashtable to hold delegates that
9148 (AddDelegateType): Implement.
9150 (IsDelegateType): Implement helper method.
9152 * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
9154 * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
9155 and accordingly handle it.
9157 * delegate.cs (Populate): Take TypeContainer argument.
9158 Implement bits to define the Invoke method. However, I still haven't figured out
9159 how to take care of the native int bit :-(
9161 * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
9162 Qualify the name of the delegate, not its return type !
9164 * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
9167 (StandardConversionExists): Checking for array types turns out to be recursive.
9169 (ConvertReferenceExplicit): Implement array conversion.
9171 (ExplicitReferenceConversionExists): New method to determine precisely that :-)
9173 2001-10-12 Ravi Pratap <ravi@ximian.com>
9175 * cs-parser.jay (delegate_declaration): Store the fully qualified
9176 name as it is a type declaration.
9178 * delegate.cs (ReturnType, Name): Rename members to these. Make them
9181 (DefineDelegate): Renamed from Define. Does the same thing essentially,
9182 as TypeContainer::DefineType.
9184 (Populate): Method in which all the definition of the various methods (Invoke)
9187 (Emit): Emit any code, if necessary. I am not sure about this really, but let's
9190 (CloseDelegate): Finally creates the delegate.
9192 * class.cs (TypeContainer::DefineType): Update to define delegates.
9193 (Populate, Emit and CloseType): Do the same thing here too.
9195 * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
9196 delegates in all these operations.
9198 2001-10-14 Miguel de Icaza <miguel@ximian.com>
9200 * expression.cs: LocalTemporary: a new expression used to
9201 reference a temporary that has been created.
9203 * assign.cs: Handle PropertyAccess back here, so that we can
9204 provide the proper semantic access to properties.
9206 * expression.cs (Expression::ConvertReferenceExplicit): Implement
9207 a few more explicit conversions.
9209 * modifiers.cs: `NEW' modifier maps to HideBySig.
9211 * expression.cs (PropertyExpr): Make this into an
9212 ExpressionStatement, and support the EmitStatement code path.
9214 Perform get/set error checking, clean up the interface.
9216 * assign.cs: recognize PropertyExprs as targets, and if so, turn
9217 them into toplevel access objects.
9219 2001-10-12 Miguel de Icaza <miguel@ximian.com>
9221 * expression.cs: PropertyExpr::PropertyExpr: use work around the
9224 * typemanager.cs: Keep track here of our PropertyBuilders again to
9225 work around lameness in SRE.
9227 2001-10-11 Miguel de Icaza <miguel@ximian.com>
9229 * expression.cs (LValue::LValueResolve): New method in the
9230 interface, used to perform a second resolution pass for LValues.
9232 (This::DoResolve): Catch the use of this in static methods.
9234 (This::LValueResolve): Implement.
9236 (This::Store): Remove warning, assigning to `this' in structures
9239 (Invocation::Emit): Deal with invocation of
9240 methods on value types. We need to pass the address to structure
9241 methods rather than the object itself. (The equivalent code to
9242 emit "this" for structures leaves the entire structure on the
9243 stack instead of a pointer to it).
9245 (ParameterReference::DoResolve): Compute the real index for the
9246 argument based on whether the method takes or not a `this' pointer
9247 (ie, the method is static).
9249 * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
9250 value types returned from functions when we need to invoke a
9251 method on the sturcture.
9254 2001-10-11 Ravi Pratap <ravi@ximian.com>
9256 * class.cs (TypeContainer::DefineType): Method to actually do the business of
9257 defining the type in the Modulebuilder or Typebuilder. This is to take
9258 care of nested types which need to be defined on the TypeBuilder using
9261 (TypeContainer::GetClassBases): Implement. Essentially the code from the
9262 methods in RootContext, only ported to be part of TypeContainer.
9264 (TypeContainer::GetInterfaceOrClass): Ditto.
9266 (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
9268 * interface.cs (Interface::DefineInterface): New method. Does exactly
9269 what RootContext.CreateInterface did earlier, only it takes care of nested types
9272 (Interface::GetInterfaces): Move from RootContext here and port.
9274 (Interface::GetInterfaceByName): Same here.
9276 * rootcontext.cs (ResolveTree): Re-write.
9278 (PopulateTypes): Re-write.
9280 * class.cs (TypeContainer::Populate): Populate nested types too.
9281 (TypeContainer::Emit): Emit nested members too.
9283 * typemanager.cs (AddUserType): Do not make use of the FullName property,
9284 instead just use the name argument passed in as it is already fully
9287 (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
9288 to TypeContainer mapping to see if a type is user-defined.
9290 * class.cs (TypeContainer::CloseType): Implement.
9292 (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
9293 the default constructor.
9295 (TypeContainer::Populate): Fix minor bug which led to creating default constructors
9298 (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
9300 * interface.cs (CloseType): Create the type here.
9302 * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
9305 Remove all the methods which are now in TypeContainer.
9307 2001-10-10 Ravi Pratap <ravi@ximian.com>
9309 * delegate.cs (Define): Re-write bits to define the delegate
9312 2001-10-10 Miguel de Icaza <miguel@ximian.com>
9314 * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
9316 * expression.cs (ImplicitReferenceConversion): handle null as well
9317 as a source to convert to any reference type.
9319 * statement.cs (Return): Perform any implicit conversions to
9320 expected return type.
9322 Validate use of return statement.
9324 * codegen.cs (EmitContext): Pass the expected return type here.
9326 * class.cs (Method, Constructor, Property): Pass expected return
9327 type to EmitContext.
9329 2001-10-09 Miguel de Icaza <miguel@ximian.com>
9331 * expression.cs: Make DoResolve take an EmitContext instead of a
9334 Replaced `l' and `location' for `loc', for consistency.
9336 (Error, Warning): Remove unneeded Tc argument.
9338 * assign.cs, literal.cs, constant.cs: Update to new calling
9341 * codegen.cs: EmitContext now contains a flag indicating whether
9342 code is being generated in a static method or not.
9344 * cs-parser.jay: DecomposeQI, new function that replaces the old
9345 QualifiedIdentifier. Now we always decompose the assembled
9346 strings from qualified_identifier productions into a group of
9349 2001-10-08 Miguel de Icaza <miguel@ximian.com>
9351 * rootcontext.cs: Deal with field-less struct types correctly now
9352 by passing the size option to Define Type.
9354 * class.cs: Removed hack that created one static field.
9356 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9358 * statement.cs: Moved most of the code generation here.
9360 2001-10-09 Ravi Pratap <ravi@ximian.com>
9362 * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
9365 (ElementAccess): Remove useless bits for now - keep checks as the spec
9368 2001-10-08 Ravi Pratap <ravi@ximian.com>
9370 * expression.cs (ElementAccess::DoResolve): Remove my crap code
9371 and start performing checks according to the spec.
9373 2001-10-07 Ravi Pratap <ravi@ximian.com>
9375 * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
9376 rank_specifiers instead.
9378 (rank_specifiers): Change the order in which the rank specifiers are stored
9380 (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
9382 * expression.cs (ElementAccess): Implement the LValue interface too.
9384 2001-10-06 Ravi Pratap <ravi@ximian.com>
9386 * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
9387 except that user defined conversions are not included.
9389 (UserDefinedConversion): Update to use the ConvertExplicitStandard to
9390 perform the conversion of the return type, if necessary.
9392 (New::DoResolve): Check whether we are creating an array or an object
9393 and accordingly do the needful.
9395 (New::Emit): Same here.
9397 (New::DoResolve): Implement guts of array creation.
9399 (New::FormLookupType): Helper function.
9401 2001-10-07 Miguel de Icaza <miguel@ximian.com>
9403 * codegen.cs: Removed most of the code generation here, and move the
9404 corresponding code generation bits to the statement classes.
9406 Added support for try/catch/finalize and throw.
9408 * cs-parser.jay: Added support for try/catch/finalize.
9410 * class.cs: Catch static methods having the flags override,
9411 virtual or abstract.
9413 * expression.cs (UserCast): This user cast was not really doing
9414 what it was supposed to do. Which is to be born in fully resolved
9415 state. Parts of the resolution were being performed at Emit time!
9419 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9421 * expression.cs: Implicity convert the result from UserCast.
9423 2001-10-05 Ravi Pratap <ravi@ximian.com>
9425 * expression.cs (Expression::FindMostEncompassingType): Fix bug which
9426 prevented it from working correctly.
9428 (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
9429 merely ConvertImplicit.
9431 2001-10-05 Miguel de Icaza <miguel@ximian.com>
9433 * typemanager.cs: Make the LookupTypeContainer function static,
9434 and not per-instance.
9436 * class.cs: Make static FindMembers (the one that takes a Type
9439 * codegen.cs: Add EmitForeach here.
9441 * cs-parser.jay: Make foreach a toplevel object instead of the
9442 inline expansion, as we need to perform semantic analysis on it.
9444 2001-10-05 Ravi Pratap <ravi@ximian.com>
9446 * expression.cs (Expression::ImplicitUserConversion): Rename to
9447 UserDefinedConversion.
9449 (Expression::UserDefinedConversion): Take an extra argument specifying
9450 whether we look for explicit user conversions too.
9452 (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
9454 (UserDefinedConversion): Incorporate support for user defined explicit conversions.
9456 (ExplicitUserConversion): Make it a call to UserDefinedConversion
9457 with the appropriate arguments.
9459 * cs-parser.jay (cast_expression): Record location too.
9461 * expression.cs (Cast): Record location info.
9463 (Expression::ConvertExplicit): Take location argument.
9465 (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
9466 to determine if we are doing explicit conversions.
9468 (UserCast::Emit): Update accordingly.
9470 (Expression::ConvertExplicit): Report an error if everything fails.
9472 * ../errors/cs0030.cs : Add.
9474 2001-10-04 Miguel de Icaza <miguel@ximian.com>
9476 * modifiers.cs: If the ABSTRACT keyword is present, also set the
9477 virtual and newslot bits.
9479 * class.cs (TypeContainer::RegisterRequiredImplementations):
9480 Record methods we need.
9482 (TypeContainer::MakeKey): Helper function to make keys for
9483 MethodBases, since the Methodbase key is useless.
9485 (TypeContainer::Populate): Call RegisterRequiredImplementations
9486 before defining the methods.
9488 Create a mapping for method_builders_to_methods ahead of time
9489 instead of inside a tight loop.
9491 (::RequireMethods): Accept an object as the data to set into the
9492 hashtable so we can report interface vs abstract method mismatch.
9494 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9496 * report.cs: Make all of it static.
9498 * rootcontext.cs: Drop object_type and value_type computations, as
9499 we have those in the TypeManager anyways.
9501 Drop report instance variable too, now it is a global.
9503 * driver.cs: Use try/catch on command line handling.
9505 Add --probe option to debug the error reporting system with a test
9508 * report.cs: Add support for exiting program when a probe
9509 condition is reached.
9511 2001-10-03 Ravi Pratap <ravi@ximian.com>
9513 * expression.cs (Binary::DoNumericPromotions): Fix the case when
9514 we do a forcible conversion regardless of type, to check if
9515 ForceConversion returns a null.
9517 (Binary::error19): Use location to report error.
9519 (Unary::error23): Use location here too.
9521 * ../errors/cs0019.cs : Check in.
9523 * ../errors/cs0023.cs : Check in.
9525 * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
9526 case of a non-null MethodInfo object with a length of 0 !
9528 (Binary::ResolveOperator): Flag error if overload resolution fails to find
9529 an applicable member - according to the spec :-)
9530 Also fix logic to find members in base types.
9532 (Unary::ResolveOperator): Same here.
9534 (Unary::report23): Change name to error23 and make first argument a TypeContainer
9535 as I was getting thoroughly confused between this and error19 :-)
9537 * expression.cs (Expression::ImplicitUserConversion): Re-write fully
9538 (::FindMostEncompassedType): Implement.
9539 (::FindMostEncompassingType): Implement.
9540 (::StandardConversionExists): Implement.
9542 (UserImplicitCast): Re-vamp. We now need info about most specific
9543 source and target types so that we can do the necessary conversions.
9545 (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
9546 mathematical union with no duplicates.
9548 2001-10-03 Miguel de Icaza <miguel@ximian.com>
9550 * rootcontext.cs (RootContext::PopulateTypes): Populate containers
9551 in order from base classes to child classes, so that we can in
9552 child classes look up in our parent for method names and
9553 attributes (required for handling abstract, virtual, new, override
9554 constructs: we need to instrospect our base class, and if we dont
9555 populate the classes in order, the introspection might be
9556 incorrect. For example, a method could query its parent before
9557 the parent has any methods and would determine that the parent has
9558 no abstract methods (while it could have had them)).
9560 (RootContext::CreateType): Record the order in which we define the
9563 2001-10-02 Miguel de Icaza <miguel@ximian.com>
9565 * class.cs (TypeContainer::Populate): Also method definitions can
9566 fail now, keep track of this.
9568 (TypeContainer::FindMembers): Implement support for
9569 DeclaredOnly/noDeclaredOnly flag.
9571 (Constructor::Emit) Return the ConstructorBuilder.
9573 (Method::Emit) Return the MethodBuilder.
9574 Check for abstract or virtual methods to be public.
9576 * rootcontext.cs (RootContext::CreateType): Register all the
9577 abstract methods required for the class to be complete and the
9578 interface methods that must be implemented.
9580 * cs-parser.jay: Report error 501 (method requires body if it is
9581 not marked abstract or extern).
9583 * expression.cs (TypeOf::Emit): Implement.
9585 * typemanager.cs: runtime_handle_type, new global type.
9587 * class.cs (Property::Emit): Generate code for properties.
9589 2001-10-02 Ravi Pratap <ravi@ximian.com>
9591 * expression.cs (Unary::ResolveOperator): Find operators on base type
9592 too - we now conform exactly to the spec.
9594 (Binary::ResolveOperator): Same here.
9596 * class.cs (Operator::Define): Fix minor quirk in the tests.
9598 * ../errors/cs0215.cs : Added.
9600 * ../errors/cs0556.cs : Added.
9602 * ../errors/cs0555.cs : Added.
9604 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9606 * cs-tokenizer.cs: Reimplemented Location to be a struct with a
9607 single integer which is really efficient
9609 2001-10-01 Ravi Pratap <ravi@ximian.com>
9611 * expression.cs (Expression::ImplicitUserConversion): Use location
9612 even in the case when we are examining True operators.
9614 * class.cs (Operator::Define): Perform extensive checks to conform
9615 with the rules for operator overloading in the spec.
9617 * expression.cs (Expression::ImplicitReferenceConversion): Implement
9618 some of the other conversions mentioned in the spec.
9620 * typemanager.cs (array_type): New static member for the System.Array built-in
9623 (cloneable_interface): For System.ICloneable interface.
9625 * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
9626 we start resolving the tree and populating types.
9628 * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
9630 2001-10-01 Miguel de Icaza <miguel@ximian.com>
9632 * expression.cs (Expression::ExprClassFromMemberInfo,
9633 Expression::Literalize): Create literal expressions from
9634 FieldInfos which are literals.
9636 (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
9637 type casts, because they were wrong. The test suite in tests
9640 (ImplicitNumericConversion): ushort to ulong requires a widening
9643 Int32 constant to long requires widening cast as well.
9645 * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
9646 for integers because the type on the stack is not i4.
9648 2001-09-30 Miguel de Icaza <miguel@ximian.com>
9650 * expression.cs (report118): require location argument.
9652 * parameter.cs: Do not dereference potential null value.
9654 * class.cs: Catch methods that lack the `new' keyword when
9655 overriding a name. Report warnings when `new' is used without
9656 anything being there to override.
9658 * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
9660 * class.cs: Only add constructor to hashtable if it is non-null
9661 (as now constructors can fail on define).
9663 (TypeManager, Class, Struct): Take location arguments.
9665 Catch field instance initialization in structs as errors.
9667 accepting_filter: a new filter for FindMembers that is static so
9668 that we dont create an instance per invocation.
9670 (Constructor::Define): Catch errors where a struct constructor is
9673 * cs-parser.jay: Pass location information for various new
9676 * delegate.cs (Delegate): take a location argument.
9678 * driver.cs: Do not call EmitCode if there were problesm in the
9679 Definition of the types, as many Builders wont be there.
9681 * decl.cs (Decl::Decl): Require a location argument.
9683 * cs-tokenizer.cs: Handle properly hex constants that can not fit
9684 into integers, and find the most appropiate integer for it.
9686 * literal.cs: Implement ULongLiteral.
9688 * rootcontext.cs: Provide better information about the location of
9689 failure when CreateType fails.
9691 2001-09-29 Miguel de Icaza <miguel@ximian.com>
9693 * rootcontext.cs (RootContext::PopulateTypes): Populates structs
9696 * expression.cs (Binary::CheckShiftArguments): Add missing type
9698 (Binary::ResolveOperator): Add type to the logical and and logical
9699 or, Bitwise And/Or and Exclusive Or code paths, it was missing
9702 (Binary::DoNumericPromotions): In the case where either argument
9703 is ulong (and most signed types combined with ulong cause an
9704 error) perform implicit integer constant conversions as well.
9706 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9708 * expression.cs (UserImplicitCast): Method should always be
9710 (Invocation::BetterConversion): Simplified test for IntLiteral.
9712 (Expression::ImplicitNumericConversion): Split this routine out.
9713 Put the code that performs implicit constant integer conversions
9716 (Expression::Resolve): Become a wrapper around DoResolve so we can
9717 check eclass and type being set after resolve.
9719 (Invocation::Badness): Remove this dead function
9721 (Binary::ResolveOperator): Do not compute the expensive argumnets
9722 unless we have a union for it.
9724 (Probe::Emit): Is needs to do an isinst and then
9725 compare against null.
9727 (::CanConvert): Added Location argument. If the Location argument
9728 is null (Location.Null), then we do not report errors. This is
9729 used by the `probe' mechanism of the Explicit conversion. We do
9730 not want to generate an error for something that the user
9731 explicitly requested to be casted. But the pipeline for an
9732 explicit cast first tests for potential implicit casts.
9734 So for now, if the Location is null, it means `Probe only' to
9735 avoid adding another argument. Might have to revise this
9738 (ClassCast): New class used to type cast objects into arbitrary
9739 classes (used in Explicit Reference Conversions).
9741 Implement `as' as well.
9743 Reverted all the patches from Ravi below: they were broken:
9745 * The use of `level' as a mechanism to stop recursive
9746 invocations is wrong. That was there just to catch the
9747 bug with a strack trace but not as a way of addressing
9750 To fix the problem we have to *understand* what is going
9751 on and the interactions and come up with a plan, not
9752 just get things going.
9754 * The use of the type conversion cache that I proposed
9755 last night had an open topic: How does this work across
9756 protection domains. A user defined conversion might not
9757 be public in the location where we are applying the
9758 conversion, a different conversion might be selected
9759 (ie, private A->B (better) but public B->A (worse),
9760 inside A, A->B applies, but outside it, B->A will
9763 * On top of that (ie, even if the above is solved),
9764 conversions in a cache need to be abstract. Ie, `To
9765 convert from an Int to a Short use an OpcodeCast', not
9766 `To convert from an Int to a Short use the OpcodeCast on
9767 the variable 5' (which is what this patch was doing).
9769 2001-09-28 Ravi Pratap <ravi@ximian.com>
9771 * expression.cs (Invocation::ConversionExists): Re-write to use
9772 the conversion cache
9774 (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
9775 cache all conversions done, not just user-defined ones.
9777 (Invocation::BetterConversion): The real culprit. Use ConversionExists
9778 to determine if a conversion exists instead of acutually trying to
9779 perform the conversion. It's faster too.
9781 (Expression::ConvertExplicit): Modify to use ConversionExists to check
9782 and only then attempt the implicit conversion.
9784 2001-09-28 Ravi Pratap <ravi@ximian.com>
9786 * expression.cs (ConvertImplicit): Use a cache for conversions
9787 already found. Check level of recursion and bail out if necessary.
9789 2001-09-28 Miguel de Icaza <miguel@ximian.com>
9791 * typemanager.cs (string_concat_string_string, string_concat_object_object):
9792 Export standard methods that we expect for string operations.
9794 * statement.cs (Block::UsageWarning): Track usage of variables and
9795 report the errors for not used variables.
9797 * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
9800 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9802 * codegen.cs: remove unnneded code
9804 * expression.cs: Removed BuiltinTypeAccess class
9806 Fix the order in which implicit conversions are
9809 The previous fixed dropped support for boxed conversions (adding a
9810 test to the test suite now)
9812 (UserImplicitCast::CanConvert): Remove test for source being null,
9813 that code is broken. We should not feed a null to begin with, if
9814 we do, then we should track the bug where the problem originates
9815 and not try to cover it up here.
9817 Return a resolved expression of type UserImplicitCast on success
9818 rather than true/false. Ravi: this is what I was talking about,
9819 the pattern is to use a static method as a "constructor" for
9822 Also, do not create arguments until the very last minute,
9823 otherwise we always create the arguments even for lookups that
9824 will never be performed.
9826 (UserImplicitCast::Resolve): Eliminate, objects of type
9827 UserImplicitCast are born in a fully resolved state.
9829 * typemanager.cs (InitCoreTypes): Init also value_type
9832 * expression.cs (Cast::Resolve): First resolve the child expression.
9834 (LValue): Add new method AddressOf to be used by
9837 Change the argument of Store to take an EmitContext instead of an
9838 ILGenerator, because things like FieldExpr need to be able to call
9839 their children expression to generate the instance code.
9841 (Expression::Error, Expression::Warning): Sugar functions for
9844 (Expression::MemberLookup): Accept a TypeContainer instead of a
9845 Report as the first argument.
9847 (Expression::ResolvePrimary): Killed. I still want to improve
9848 this as currently the code is just not right.
9850 (Expression::ResolveMemberAccess): Simplify, but it is still
9853 (Unary::Resolve): Catch errors in AddressOf operators.
9855 (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
9856 index to a byte for the short-version, or the compiler will choose
9857 the wrong Emit call, which generates the wrong data.
9859 (ParameterReference::Emit, ::Store): same.
9861 (FieldExpr::AddressOf): Implement.
9863 * typemanager.cs: TypeManager: made public variable instead of
9866 * driver.cs: document --fatal.
9868 * report.cs (ErrorMessage, WarningMessage): new names for the old
9869 Error and Warning classes.
9871 * cs-parser.jay (member_access): Turn built-in access to types
9872 into a normal simplename
9874 2001-09-27 Ravi Pratap <ravi@ximian.com>
9876 * expression.cs (Invocation::BetterConversion): Fix to cope
9877 with q being null, since this was introducing a bug.
9879 * expression.cs (ConvertImplicit): Do built-in conversions first.
9881 2001-09-27 Ravi Pratap <ravi@ximian.com>
9883 * expression.cs (UserImplicitCast::Resolve): Fix bug.
9885 2001-09-27 Ravi Pratap <ravi@ximian.com>
9887 * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
9888 I had introduced long ago (what's new ?).
9890 * expression.cs (UserImplicitCast::CanConvert): Static method to do
9891 the work of all the checking.
9892 (ConvertImplicit): Call CanConvert and only then create object if necessary.
9893 (UserImplicitCast::CanConvert, ::Resolve): Re-write.
9895 (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
9896 that is the right way.
9898 (Invocation::MakeUnionSet): Convenience function to make unions of sets for
9899 overloading resolution. Use everywhere instead of cutting and pasting code.
9901 (Binary::ResolveOperator): Use MakeUnionSet.
9903 (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
9904 we have to convert to bool types. Not complete yet.
9906 2001-09-27 Miguel de Icaza <miguel@ximian.com>
9908 * typemanager.cs (TypeManager::CSharpName): support ushort.
9910 * expression.cs (Expression::TryImplicitIntConversion): Attempts
9911 to provide an expression that performsn an implicit constant int
9912 conversion (section 6.1.6).
9913 (Expression::ConvertImplicitRequired): Reworked to include
9914 implicit constant expression conversions.
9916 (Expression::ConvertNumericExplicit): Finished.
9918 (Invocation::Emit): If InstanceExpression is null, then it means
9919 that we perform a call on this.
9921 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9923 * expression.cs (Unary::Emit): Remove some dead code.
9924 (Probe): Implement Resolve and Emit for `is'.
9925 (Expression::ConvertImplicitRequired): Attempt to do constant
9926 expression conversions here. Maybe should be moved to
9927 ConvertImplicit, but I am not sure.
9928 (Expression::ImplicitLongConstantConversionPossible,
9929 Expression::ImplicitIntConstantConversionPossible): New functions
9930 that tell whether is it possible to apply an implicit constant
9931 expression conversion.
9933 (ConvertNumericExplicit): Started work on explicit numeric
9936 * cs-parser.jay: Update operator constants.
9938 * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
9939 (Parameters::GetSignature): Hook up VerifyArgs here.
9940 (Parameters::VerifyArgs): Verifies that no two arguments have the
9943 * class.cs (Operator): Update the operator names to reflect the
9944 ones that the spec expects (as we are just stringizing the
9947 * expression.cs (Unary::ResolveOperator): Fix bug: Use
9948 MethodInfo's ReturnType instead of LookupMethodByBuilder as the
9949 previous usage did only work for our methods.
9950 (Expression::ConvertImplicit): Handle decimal implicit numeric
9951 conversions as well.
9952 (Expression::InternalTypeConstructor): Used to invoke constructors
9953 on internal types for default promotions.
9955 (Unary::Emit): Implement special handling for the pre/post
9956 increment/decrement for overloaded operators, as they need to have
9957 the same semantics as the other operators.
9959 (Binary::ResolveOperator): ditto.
9960 (Invocation::ConversionExists): ditto.
9961 (UserImplicitCast::Resolve): ditto.
9963 2001-09-26 Ravi Pratap <ravi@ximian.com>
9965 * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
9966 operator, return after emitting body. Regression tests pass again !
9968 * expression.cs (ConvertImplicit): Take TypeContainer as first argument
9969 (Unary::ForceConversion, Binary::ForceConversion): Ditto.
9970 (Invocation::OverloadResolve): Ditto.
9971 (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
9973 * everywhere : update calls to the above methods accordingly.
9975 2001-09-26 Miguel de Icaza <miguel@ximian.com>
9977 * assign.cs (Assign): Make it inherit from ExpressionStatement.
9979 * expression.cs (ExpressionStatement): New base class used for
9980 expressions that can appear in statements, so that we can provide
9981 an alternate path to generate expression that do not leave a value
9984 (Expression::Emit, and all the derivatives): We no longer return
9985 whether a value is left on the stack or not. Every expression
9986 after being emitted leaves a single value on the stack.
9988 * codegen.cs (EmitContext::EmitStatementExpression): Use the
9989 facilties of ExpressionStatement if possible.
9991 * cs-parser.jay: Update statement_expression.
9993 2001-09-25 Miguel de Icaza <miguel@ximian.com>
9995 * driver.cs: Change the wording of message
9997 2001-09-25 Ravi Pratap <ravi@ximian.com>
9999 * expression.cs (Binary::ResolveOperator): Had forgottten to set
10000 the type of the expression to the return type of the method if
10001 we have an overloaded operator match ! The regression tests pass again !
10002 (Unary::ResolveOperator): Ditto.
10004 * expression.cs (Invocation::ConversionExists): Correct the member lookup
10005 to find "op_Implicit", not "implicit" ;-)
10006 (UserImplicitCast): New class to take care of user-defined implicit conversions.
10007 (ConvertImplicit, ForceConversion): Take TypeContainer argument
10009 * everywhere : Correct calls to the above accordingly.
10011 * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
10012 (ConvertImplicit): Do user-defined conversion if it exists.
10014 2001-09-24 Miguel de Icaza <miguel@ximian.com>
10016 * assign.cs: track location.
10017 (Resolve): Use implicit conversions on assignment.
10019 * literal.cs: Oops. Not good, Emit of short access values should
10020 pass (Bytes) or the wrong argument will be selected.
10022 * expression.cs (Unary::Emit): Emit code for -expr.
10024 (Unary::ResolveOperator): Handle `Substract' for non-constants
10025 (substract from zero from the non-constants).
10026 Deal with Doubles as well.
10028 (Expression::ConvertImplicitRequired): New routine that reports an
10029 error if no implicit conversion exists.
10031 (Invocation::OverloadResolve): Store the converted implicit
10032 expressions if we make them
10034 2001-09-24 Ravi Pratap <ravi@ximian.com>
10036 * class.cs (ConstructorInitializer): Take a Location argument.
10037 (ConstructorBaseInitializer): Same here.
10038 (ConstructorThisInitializer): Same here.
10040 * cs-parser.jay : Update all calls accordingly.
10042 * expression.cs (Unary, Binary, New): Take location argument.
10043 Update accordingly everywhere.
10045 * cs-parser.jay : Update all calls to the above to take a location
10048 * class.cs : Ditto.
10050 2001-09-24 Ravi Pratap <ravi@ximian.com>
10052 * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
10053 (Invocation::BetterConversion): Same here
10054 (Invocation::ConversionExists): Ditto.
10056 (Invocation::ConversionExists): Implement.
10058 2001-09-22 Ravi Pratap <ravi@ximian.com>
10060 * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
10061 Also take an additional TypeContainer argument.
10063 * All over : Pass in TypeContainer as argument to OverloadResolve.
10065 * typemanager.cs (CSharpName): Update to check for the string type and return
10068 * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
10071 2001-09-21 Ravi Pratap <ravi@ximian.com>
10073 * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
10074 (Invocation::BetterFunction): Implement.
10075 (Invocation::BetterConversion): Implement.
10076 (Invocation::ConversionExists): Skeleton, no implementation yet.
10078 Okay, things work fine !
10080 2001-09-21 Miguel de Icaza <miguel@ximian.com>
10082 * typemanager.cs: declare and load enum_type, delegate_type and
10085 * expression.cs (Expression::Emit): Now emit returns a value that
10086 tells whether a value is left on the stack or not. This strategy
10087 might be reveted tomorrow with a mechanism that would address
10088 multiple assignments.
10089 (Expression::report118): Utility routine to report mismatches on
10092 (Unary::Report23): Report impossible type/operator combination
10095 (Unary::IsIncrementableNumber): Whether the type can be
10096 incremented or decremented with add.
10097 (Unary::ResolveOperator): Also allow enumerations to be bitwise
10099 (Unary::ResolveOperator): Implement ++, !, ~,
10101 (Invocation::Emit): Deal with new Emit convetion.
10103 * All Expression derivatives: Updated their Emit method to return
10104 whether they leave values on the stack or not.
10106 * codegen.cs (CodeGen::EmitStatement): Pop values left on the
10107 stack for expressions that are statements.
10109 2001-09-20 Miguel de Icaza <miguel@ximian.com>
10111 * expression.cs (LValue): New interface. Must be implemented by
10113 (LocalVariableReference, ParameterReference, FieldExpr): Implement
10116 * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
10117 interface for generating code, simplifies the code.
10119 2001-09-20 Ravi Pratap <ravi@ximian.com>
10121 * expression.cs (everywhere): Comment out return statements in ::Resolve
10122 methods to avoid the warnings.
10124 2001-09-20 Miguel de Icaza <miguel@ximian.com>
10126 * driver.cs (parse): Report error 2001 if we can not open the
10129 * expression.cs (SimpleName::ResolveSimpleName): Error if we can
10132 * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
10135 * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
10136 otherwise nested blocks end up with the same index.
10138 * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
10140 * expression.cs: Instead of having FIXMEs in the Resolve
10141 functions, throw exceptions so it is obvious that we are facing a
10144 * cs-parser.jay (invocation_expression): Pass Location information.
10146 * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
10147 Use a basename for those routines because .NET does not like paths
10150 * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
10153 2001-09-19 Miguel de Icaza <miguel@ximian.com>
10155 * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
10156 are loading the correct data types (throws an exception if not).
10157 (TypeManager::InitCoreTypes): Use CoreLookupType
10159 * expression.cs (Unary::ResolveOperator): return the child
10160 expression for expressions which are just +expr.
10161 (Unary::ResolveOperator): Return negative literals for -LITERAL
10162 expressions (otherwise they are Unary {Literal}).
10163 (Invocation::Badness): Take into account `Implicit constant
10164 expression conversions'.
10166 * literal.cs (LongLiteral): Implement long literal class.
10167 (IntLiteral): export the `Value' of the intliteral.
10169 2001-09-19 Ravi Pratap <ravi@ximian.com>
10171 * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
10173 * class.cs (Operator::Define): Change the methodname prefix to 'op_'
10174 instead of 'Operator'
10176 * expression.cs (Binary::ResolveOperator): Update accordingly.
10177 (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
10180 * cs-parser.jay (unary_expression): Update to use the new names.
10182 * gen-treedump.cs (GetUnary): Same here.
10184 * expression.cs (Unary::Resolve): Implement.
10185 (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
10186 operators are found instead of making noise ;-)
10187 (Unary::ResolveOperator): New method to do precisely the same thing which
10188 Binary::ResolveOperator does for Binary expressions.
10189 (Unary.method, .Arguments): Add.
10190 (Unary::OperName): Implement.
10191 (Unary::ForceConversion): Copy and Paste !
10193 * class.cs (Operator::Define): Fix a small bug for the case when we have
10196 * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
10197 for the inbuilt operators. Only overloading works for now ;-)
10199 2001-09-18 Miguel de Icaza <miguel@ximian.com>
10201 * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
10202 UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
10204 * expression.cs (This::Emit): Implement.
10205 (This::Resolve): Implement.
10206 (TypeOf:Resolve): Implement.
10207 (Expression::ResolveSimpleName): Add an implicit this to instance
10209 (MemberAccess::Resolve): Deal with Parameters and Fields.
10210 Bind instance variable to Field expressions.
10211 (FieldExpr::Instance): New field used to track the expression that
10212 represents the object instance.
10213 (FieldExpr::Resolve): Track potential errors from MemberLookup not
10215 (FieldExpr::Emit): Implement.
10217 * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
10218 the last instruction contains a return opcode to avoid generating
10219 the last `ret' instruction (this generates correct code, and it is
10220 nice to pass the peverify output).
10222 * class.cs (TypeContainer::EmitFieldInitializers): Implement field
10223 initializer for static and instance variables.
10224 (Constructor::Emit): Allow initializer to be null in the case of
10225 static constructors. Only emit initializer for instance
10228 (TypeContainer::FindMembers): Return a null array if there are no
10231 Also fix the code for the MemberTypes.Method branch, as it was not
10232 scanning that for operators (or tried to access null variables before).
10234 * assign.cs (Assign::Emit): Handle instance and static fields.
10238 * driver.cs: Stop compilation if there are parse errors.
10240 * cs-parser.jay (constructor_declaration): Provide default base
10241 initializer for non-static constructors.
10242 (constructor_declarator): Do not provide a default base
10243 initializers if none was specified.
10244 Catch the fact that constructors should not have parameters.
10246 * class.cs: Do not emit parent class initializers for static
10247 constructors, that should be flagged as an error.
10249 2001-09-18 Ravi Pratap <ravi@ximian.com>
10251 * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
10252 Move back code into TypeContainer::Populate.
10254 2001-09-18 Ravi Pratap <ravi@ximian.com>
10256 * class.cs (TypeContainer::AddConstructor): Fix the check to
10257 compare against Name, not Basename.
10258 (Operator::OpType): Change Plus and Minus to Add and Subtract.
10260 * cs-parser.jay : Update accordingly.
10262 * class.cs (TypeContainer::FindMembers): For the case where we are searching
10263 for methods, don't forget to look into the operators too.
10264 (RegisterMethodBuilder): Helper method to take care of this for
10265 methods, constructors and operators.
10266 (Operator::Define): Completely revamp.
10267 (Operator.OperatorMethod, MethodName): New fields.
10268 (TypeContainer::Populate): Move the registering of builders into
10269 RegisterMethodBuilder.
10270 (Operator::Emit): Re-write.
10272 * expression.cs (Binary::Emit): Comment out code path to emit method
10273 invocation stuff for the case when we have a user defined operator. I am
10274 just not able to get it right !
10276 2001-09-17 Miguel de Icaza <miguel@ximian.com>
10278 * expression.cs (Expression::OverloadResolve): Drop TypeContainer
10281 (Expression::MemberLookup): Provide a version that allows to
10282 specify the MemberTypes and BindingFlags.
10284 * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
10285 so it was not fetching variable information from outer blocks.
10287 * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
10288 Beforefieldinit as it was buggy.
10290 * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
10291 that Ravi put here.
10293 * class.cs (Constructor::Emit): Only emit if block is not null.
10294 (TypeContainer::EmitDefaultConstructor): Removed routine, now we
10295 deal with this by semantically definining it as if the user had
10298 (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
10299 constructors as we now "emit" them at a higher level.
10301 (TypeContainer::DefineDefaultConstructor): Used to define the
10302 default constructors if none was provided.
10304 (ConstructorInitializer): Add methods Resolve and Emit.
10306 * expression.cs: Cast to ConstructorInfo instead of MethodInfo
10308 2001-09-17 Ravi Pratap <ravi@ximian.com>
10310 * class.cs (TypeContainer::EmitDefaultConstructor): Register
10311 the default constructor builder with our hashtable for methodbuilders
10314 * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
10315 and argument_count is 0 in which case we have a match.
10316 (Binary::ResolveOperator): More null checking and miscellaneous coding
10319 2001-09-17 Ravi Pratap <ravi@ximian.com>
10321 * rootcontext.cs (IsNameSpace): Compare against null.
10323 * everywhere : Correct spelling to 'Greater' and to 'Subtract'
10325 * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
10326 and Unary::Operator.
10328 * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
10331 * expression.cs (Binary::method): New member to hold the MethodBase for the case when
10332 we have overloaded operators.
10333 (Binary::ResolveOperator): Implement the part which does the operator overload
10336 * class.cs (Operator::Emit): Implement.
10337 (TypeContainer::Emit): Emit the operators we have too.
10339 * expression.cs (Binary::Emit): Update to emit the appropriate code for
10340 the case when we have a user-defined operator.
10342 2001-09-17 Miguel de Icaza <miguel@ximian.com>
10344 * rootcontext.cs: Fix bug: tree.Namespaces might be null.
10346 2001-09-16 Ravi Pratap <ravi@ximian.com>
10348 * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
10349 (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
10350 (Constructor::Emit): Implement.
10351 (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
10352 if we have no work to do.
10353 (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
10356 * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
10357 (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
10359 * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
10362 2001-09-15 Ravi Pratap <ravi@ximian.com>
10364 * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
10366 (Tree::RecordNamespace): Method to do what the name says ;-)
10367 (Tree::Namespaces): Property to get at the namespaces hashtable.
10369 * cs-parser.jay (namespace_declaration): Call RecordNamespace to
10372 * rootcontext.cs (IsNamespace): Fixed it :-)
10374 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10376 * class.cs (TypeContainer::FindMembers): Add support for
10378 (MethodCore): New class that encapsulates both the shared aspects
10379 of a Constructor and a Method.
10380 (Method, Constructor): Factored pieces into MethodCore.
10382 * driver.cs: Added --fatal which makes errors throw exceptions.
10383 Load System assembly as well as part of the standard library.
10385 * report.cs: Allow throwing exceptions on errors for debugging.
10387 * modifiers.cs: Do not use `parent', instead use the real type
10388 container to evaluate permission settings.
10390 * class.cs: Put Ravi's patch back in. He is right, and we will
10391 have to cope with the
10393 2001-09-14 Ravi Pratap <ravi@ximian.com>
10395 * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
10396 FamORAssem, not FamANDAssem.
10398 2001-09-14 Miguel de Icaza <miguel@ximian.com>
10400 * driver.cs: Added --parse option that only parses its input files
10403 * class.cs: Reverted last change from Ravi to IsTopLevel. That is
10404 incorrect. IsTopLevel is not used to tell whether an object is
10405 root_types or not (that can be achieved by testing this ==
10406 root_types). But to see if this is a top-level *class* (not
10407 necessarly our "toplevel" container).
10409 2001-09-14 Ravi Pratap <ravi@ximian.com>
10411 * enum.cs (Enum::Define): Modify to call the Lookup method on the
10412 parent instead of a direct call to GetType.
10414 2001-09-14 Ravi Pratap <ravi@ximian.com>
10416 * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
10417 Modifiers.TypeAttr. This should just be a call to that method.
10419 * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
10420 object so that we can determine if we are top-level or not.
10422 * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
10425 * enum.cs (Enum::Define): Ditto.
10427 * modifiers.cs (FieldAttr): Re-write.
10429 * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
10430 (TypeContainer::HaveStaticConstructor): New property to provide access
10431 to precisely that info.
10433 * modifiers.cs (MethodAttr): Re-write.
10434 (EventAttr): Remove altogether as there seems to be no ostensible use for it.
10436 * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
10437 of top-level types as claimed.
10439 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10441 * expression.cs (MemberLookup): Fruitless attempt to lookup
10442 constructors. Maybe I need to emit default constructors? That
10443 might be it (currently .NET emits this for me automatically).
10444 (Invocation::OverloadResolve): Cope with Arguments == null.
10445 (Invocation::EmitArguments): new function, shared by the new
10446 constructor and us.
10447 (Invocation::Emit): Handle static and instance methods. Emit
10448 proper call instruction for virtual or non-virtual invocations.
10449 (New::Emit): Implement.
10450 (New::Resolve): Implement.
10451 (MemberAccess:Resolve): Implement.
10452 (MethodGroupExpr::InstanceExpression): used conforming to the spec
10453 to track instances.
10454 (FieldExpr::Resolve): Set type.
10456 * support.cs: Handle empty arguments.
10458 * cs-parser.jay (CompositeLookup, QualifierIdentifier,
10459 SimpleLookup): Auxiliary routines to help parse a qualifier
10462 Update qualifier_identifier rule.
10464 * codegen.cs: Removed debugging messages.
10466 * class.cs: Make this a global thing, this acts just as a "key" to
10467 objects that we might have around.
10469 (Populate): Only initialize method_builders_to_methods once.
10471 * expression.cs (PropertyExpr): Initialize type from the
10474 * codegen.cs (EmitContext::EmitBoolExpression): Use propper
10475 Resolve pattern. Attempt to implicitly convert value to boolean.
10478 * expression.cs: Set the type for the int32/int32 argument case.
10479 (Binary::ResolveOperator): Set the return type to boolean for
10480 comparission operators
10482 * typemanager.cs: Remove debugging print code.
10484 (Invocation::Resolve): resolve type.
10486 * class.cs: Allocate a MemberInfo of the correct size, as the code
10487 elsewhere depends on the test to reflect the correct contents.
10489 (Method::) Keep track of parameters, due to System.Reflection holes
10491 (TypeContainer::Populate): Keep track of MethodBuilders to Method
10494 (TypeContainer::FindMembers): Use ArrayList and then copy an array
10495 of the exact size and return that.
10497 (Class::LookupMethodByBuilder): New function that maps
10498 MethodBuilders to its methods. Required to locate the information
10499 on methods because System.Reflection bit us again.
10501 * support.cs: New file, contains an interface ParameterData and
10502 two implementations: ReflectionParameters and InternalParameters
10503 used to access Parameter information. We will need to grow this
10506 * expression.cs (Invocation::GetParameterData): implement a cache
10507 and a wrapper around the ParameterData creation for methods.
10508 (Invocation::OverloadResolve): Use new code.
10510 2001-09-13 Ravi Pratap <ravi@ximian.com>
10512 * class.cs (TypeContainer::EmitField): Remove and move into
10513 (Field::Define): here and modify accordingly.
10514 (Field.FieldBuilder): New member.
10515 (TypeContainer::Populate): Update accordingly.
10516 (TypeContainer::FindMembers): Implement.
10518 2001-09-13 Miguel de Icaza <miguel@ximian.com>
10520 * statement.cs: (VariableInfo::VariableType): New field to be
10521 initialized with the full type once it is resolved.
10523 2001-09-12 Miguel de Icaza <miguel@ximian.com>
10525 * parameter.cs (GetParameterInfo): Use a type cache to compute
10526 things only once, and to reuse this information
10528 * expression.cs (LocalVariableReference::Emit): Implement.
10529 (OpcodeCast::Emit): fix.
10531 (ParameterReference::Resolve): Implement.
10532 (ParameterReference::Emit): Implement.
10534 * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
10535 that are expressions need to stay as Expressions.
10537 * typemanager.cs (CSharpName): Returns the C# name of a type if
10540 * expression.cs (Expression::ConvertImplicit): New function that
10541 implements implicit type conversions.
10543 (Expression::ImplicitReferenceConversion): Implements implicit
10544 reference conversions.
10546 (EmptyCast): New type for transparent casts.
10548 (OpcodeCast): New type for casts of types that are performed with
10549 a sequence of bytecodes.
10551 (BoxedCast): New type used for casting value types into reference
10552 types. Emits a box opcode.
10554 (Binary::DoNumericPromotions): Implements numeric promotions of
10555 and computation of the Binary::Type.
10557 (Binary::EmitBranchable): Optimization.
10559 (Binary::Emit): Implement code emission for expressions.
10561 * typemanager.cs (TypeManager): Added two new core types: sbyte
10564 2001-09-12 Ravi Pratap <ravi@ximian.com>
10566 * class.cs (TypeContainer::FindMembers): Method which does exactly
10567 what Type.FindMembers does, only we don't have to use reflection. No
10568 implementation yet.
10570 * typemanager.cs (typecontainers): New hashtable to hold the corresponding
10571 typecontainer objects as we need to get at them.
10572 (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
10574 * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
10575 typecontainer object.
10577 * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
10578 of just a Report object.
10580 2001-09-11 Ravi Pratap <ravi@ximian.com>
10582 * class.cs (Event::Define): Go back to using the prefixes "add_" and
10584 (TypeContainer::Populate): Now define the delegates of the type too.
10585 (TypeContainer.Delegates): Property to access the list of delegates defined
10588 * delegates.cs (Delegate::Define): Implement partially.
10590 * modifiers.cs (TypeAttr): Handle more flags.
10592 2001-09-11 Ravi Pratap <ravi@ximian.com>
10594 * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
10596 (Operator::Define): Re-write logic to get types by using the LookupType method
10597 instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
10598 (Indexer::Define): Ditto.
10599 (Event::Define): Ditto.
10600 (Property::Define): Ditto.
10602 2001-09-10 Ravi Pratap <ravi@ximian.com>
10604 * class.cs (TypeContainer::Populate): Now define operators too.
10605 (TypeContainer.Operators): New property to access the list of operators
10607 (Operator.OperatorMethodBuilder): New member to hold the method builder
10608 for the operator we are defining.
10609 (Operator::Define): Implement.
10611 2001-09-10 Ravi Pratap <ravi@ximian.com>
10613 * class.cs (Event::Define): Make the prefixes of the accessor methods
10614 addOn_ and removeOn_
10616 * genericparser.cs (GenericParser::error): Overloaded method to handle the case
10617 of the location being passed in too. Ideally, this should go later since all
10618 error reporting should be done through the Report object.
10620 * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
10621 (Populate): Iterate thru the indexers we have and define them too.
10622 (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
10623 for the get and set accessors.
10624 (Indexer::Define): Implement.
10626 2001-09-09 Miguel de Icaza <miguel@ximian.com>
10628 * expression.cs (Binary::Resolve): Beginning of it. I scratched
10629 my previous implementation, did not work.
10631 * typemanager.cs: Add a couple of missing types (the longs).
10633 * literal.cs: Use TypeManager.bool_type instead of getting it.
10635 * expression.cs (EventExpr): New kind of expressions.
10636 (Expressio::ExprClassFromMemberInfo): finish
10638 2001-09-08 Miguel de Icaza <miguel@ximian.com>
10640 * assign.cs: Emit stores to static fields differently.
10642 2001-09-08 Ravi Pratap <ravi@ximian.com>
10644 * Merge in changes and adjust code to tackle conflicts. Backed out my
10645 code in Assign::Resolve ;-)
10647 2001-09-08 Ravi Pratap <ravi@ximian.com>
10649 * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
10650 instead Report.Error and also pass in the location.
10651 (CSharpParser::Lexer): New readonly property to return the reference
10652 to the Tokenizer object.
10653 (declare_local_variables): Use Report.Error with location instead of plain
10657 * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
10658 (Operator.CheckBinaryOperator): Ditto.
10660 * cs-parser.jay (operator_declarator): Update accordingly.
10662 * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
10663 (CheckBinaryOperator): Same here.
10665 * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
10666 on the name without any prefixes of namespace names etc. This is because we
10667 already might have something already fully qualified like
10668 'System.Console.WriteLine'
10670 * assign.cs (Resolve): Begin implementation. Stuck ;-)
10672 2001-09-07 Ravi Pratap <ravi@ximian.com>
10674 * cs-tokenizer.cs (location): Return a string which also contains
10677 * expression.cs (ElementAccess): New class for expressions of the
10678 type 'element access.'
10679 (BaseAccess): New class for expressions of the type 'base access.'
10680 (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
10683 * cs-parser.jay (element_access): Implement action.
10684 (base_access): Implement actions.
10685 (checked_expression, unchecked_expression): Implement.
10687 * cs-parser.jay (local_variable_type): Correct and implement.
10688 (type_suffixes, type_suffix_list, type_suffix): Implement actions.
10690 * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
10692 * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
10693 name and the specifiers.
10695 * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
10697 * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
10698 making them all public ;-)
10700 * cs-parser.jay (error): Remove entirely as we have an implementation in the base
10703 2001-09-07 Miguel de Icaza <miguel@ximian.com>
10705 * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
10707 (FieldExpr, PropertyExprs): New resolved expressions.
10708 (SimpleName::MemberStaticCheck): Perform static checks for access
10709 to non-static fields on static methods. Maybe this should be
10710 generalized for MemberAccesses.
10711 (SimpleName::ResolveSimpleName): More work on simple name
10714 * cs-parser.jay (primary_expression/qualified_identifier): track
10715 the parameter index.
10717 * codegen.cs (CodeGen::Save): Catch save exception, report error.
10718 (EmitContext::EmitBoolExpression): Chain to expression generation
10719 instead of temporary hack.
10720 (::EmitStatementExpression): Put generic expression code generation.
10722 * assign.cs (Assign::Emit): Implement variable assignments to
10723 local variables, parameters and fields.
10725 2001-09-06 Miguel de Icaza <miguel@ximian.com>
10727 * statement.cs (Block::GetVariableInfo): New method, returns the
10728 VariableInfo for a variable name in a block.
10729 (Block::GetVariableType): Implement in terms of GetVariableInfo
10731 * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
10732 DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
10734 2001-09-06 Ravi Pratap <ravi@ximian.com>
10736 * cs-parser.jay (operator_declaration): Continue on my quest : update
10737 to take attributes argument.
10738 (event_declaration): Ditto.
10739 (enum_declaration): Ditto.
10740 (indexer_declaration): Ditto.
10742 * class.cs (Operator::Operator): Update constructor accordingly.
10743 (Event::Event): Ditto.
10745 * delegate.cs (Delegate::Delegate): Same here.
10747 * enum.cs (Enum::Enum): Same here.
10749 2001-09-05 Ravi Pratap <ravi@ximian.com>
10751 * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
10753 * ../tests/cs0658.cs : New file to demonstrate error 0658.
10755 * attribute.cs (Attributes): New class to encapsulate all attributes which were
10756 being passed around as an arraylist.
10757 (Attributes::AddAttribute): Method to add attribute sections.
10759 * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
10760 (struct_declaration): Update accordingly.
10761 (constant_declaration): Update.
10762 (field_declaration): Update.
10763 (method_header): Update.
10764 (fixed_parameter): Update.
10765 (parameter_array): Ditto.
10766 (property_declaration): Ditto.
10767 (destructor_declaration): Ditto.
10769 * class.cs (Struct::Struct): Update constructors accordingly.
10770 (Class::Class): Ditto.
10771 (Field::Field): Ditto.
10772 (Method::Method): Ditto.
10773 (Property::Property): Ditto.
10774 (TypeContainer::OptAttribute): update property's return type.
10776 * interface.cs (Interface.opt_attributes): New member.
10777 (Interface::Interface): Update to take the extra Attributes argument.
10779 * parameter.cs (Parameter::Parameter): Ditto.
10781 * constant.cs (Constant::Constant): Ditto.
10783 * interface.cs (InterfaceMemberBase): New OptAttributes field.
10784 (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
10785 the attributes as a parameter.
10786 (InterfaceProperty): Update constructor call.
10787 (InterfaceEvent): Ditto.
10788 (InterfaceMethod): Ditto.
10789 (InterfaceIndexer): Ditto.
10791 * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
10792 pass the attributes too.
10793 (interface_event_declaration): Ditto.
10794 (interface_property_declaration): Ditto.
10795 (interface_method_declaration): Ditto.
10796 (interface_declaration): Ditto.
10798 2001-09-05 Miguel de Icaza <miguel@ximian.com>
10800 * class.cs (Method::Define): Track the "static Main" definition to
10801 create an entry point.
10803 * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
10804 EntryPoint if we find it.
10806 * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
10807 (EmitContext::ig): Make this variable public.
10809 * driver.cs: Make the default output file be the first file name
10810 with the .exe extension.
10812 Detect empty compilations
10814 Handle various kinds of output targets. Handle --target and
10815 rename -t to --dumper.
10817 * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
10818 methods inherited from Expression return now an Expression. This
10819 will is used during the tree rewriting as we resolve them during
10822 (Expression::MemberLookup): Implements the MemberLookup (7.3) from
10823 the spec. Missing entirely is the information about
10824 accessability of elements of it.
10826 (Expression::ExprClassFromMemberInfo): New constructor for
10827 Expressions that creates a fully initialized Expression based on
10828 a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
10831 (Invocation::Resolve): Begin implementing resolution of invocations.
10833 * literal.cs (StringLiteral): Implement Emit.
10835 2001-09-05 Ravi Pratap <ravi@ximian.com>
10837 * cs-parser.jay (error): Add new modifier because we are hiding an inherited
10840 2001-09-04 Ravi Pratap <ravi@ximian.com>
10842 * cs-parser.jay (attribute_arguments): Implement actions.
10843 (attribute): Fix bug in production. Implement action.
10844 (attribute_list): Implement.
10845 (attribute_target): Implement.
10846 (attribute_target_specifier, opt_target_specifier): Implement
10847 (CheckAttributeTarget): New method to check if the attribute target
10849 (attribute_section): Implement.
10850 (opt_attributes): Implement.
10852 * attribute.cs : New file to handle attributes.
10853 (Attribute): Class to hold attribute info.
10855 * cs-parser.jay (opt_attribute_target_specifier): Remove production
10856 (attribute_section): Modify production to use 2 different rules to
10857 achieve the same thing. 1 s/r conflict down !
10858 Clean out commented, useless, non-reducing dimension_separator rules.
10860 * class.cs (TypeContainer.attributes): New member to hold list
10861 of attributes for a type.
10862 (Struct::Struct): Modify to take one more argument, the attribute list.
10863 (Class::Class): Ditto.
10864 (Field::Field): Ditto.
10865 (Method::Method): Ditto.
10866 (Property::Property): Ditto.
10868 * cs-parser.jay (struct_declaration): Update constructor call to
10869 pass in the attributes too.
10870 (class_declaration): Ditto.
10871 (constant_declaration): Ditto.
10872 (field_declaration): Ditto.
10873 (method_header): Ditto.
10874 (fixed_parameter): Ditto.
10875 (parameter_array): Ditto.
10876 (property_declaration): Ditto.
10878 * constant.cs (Constant::Constant): Update constructor similarly.
10879 Use System.Collections.
10881 * parameter.cs (Parameter::Parameter): Update as above.
10883 2001-09-02 Ravi Pratap <ravi@ximian.com>
10885 * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
10886 (TypeContainer.delegates): New member to hold list of delegates.
10888 * cs-parser.jay (delegate_declaration): Implement the action correctly
10889 this time as I seem to be on crack ;-)
10891 2001-09-02 Miguel de Icaza <miguel@ximian.com>
10893 * rootcontext.cs (RootContext::IsNamespace): new function, used to
10894 tell whether an identifier represents a namespace.
10896 * expression.cs (NamespaceExpr): A namespace expression, used only
10897 temporarly during expression resolution.
10898 (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
10899 utility functions to resolve names on expressions.
10901 2001-09-01 Miguel de Icaza <miguel@ximian.com>
10903 * codegen.cs: Add hook for StatementExpressions.
10905 * class.cs: Fix inverted test for static flag in methods.
10907 2001-09-02 Ravi Pratap <ravi@ximian.com>
10909 * class.cs (Operator::CheckUnaryOperator): Correct error number used
10910 to make it coincide with MS' number.
10911 (Operator::CheckBinaryOperator): Ditto.
10913 * ../errors/errors.txt : Remove error numbers added earlier.
10915 * ../errors/cs1019.cs : Test case for error # 1019
10917 * ../errros/cs1020.cs : Test case for error # 1020
10919 * cs-parser.jay : Clean out commented cruft.
10920 (dimension_separators, dimension_separator): Comment out. Ostensibly not
10921 used anywhere - non-reducing rule.
10922 (namespace_declarations): Non-reducing rule - comment out.
10924 * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
10925 with TypeContainer::AddEnum.
10927 * delegate.cs : New file for delegate handling classes.
10928 (Delegate): Class for declaring delegates.
10930 * makefile : Update.
10932 * cs-parser.jay (delegate_declaration): Implement.
10934 2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
10936 * class.cs (Event::Define): Implement.
10937 (Event.EventBuilder): New member.
10939 * class.cs (TypeContainer::Populate): Update to define all enums and events
10941 (Events): New property for the events arraylist we hold. Shouldn't we move to using
10942 readonly fields for all these cases ?
10944 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10946 * class.cs (Property): Revamp to use the convention of making fields readonly.
10947 Accordingly modify code elsewhere.
10949 * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
10950 the Define method of the Property class.
10952 * class.cs : Clean up applied patch and update references to variables etc. Fix
10954 (TypeContainer::Populate): Update to define all the properties we have. Also
10955 define all enumerations.
10957 * enum.cs (Define): Implement.
10959 2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
10961 * cs-parser.jay (overloadable_operator): The semantic value is an
10962 enum of the Operator class.
10963 (operator_declarator): Implement actions.
10964 (operator_declaration): Implement.
10966 * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
10967 validity of definitions.
10968 (Operator::CheckBinaryOperator): Static method to check for binary operators
10969 (TypeContainer::AddOperator): New method to add an operator to a type.
10971 * cs-parser.jay (indexer_declaration): Added line to actually call the
10972 AddIndexer method so it gets added ;-)
10974 * ../errors/errors.txt : Update to include new error numbers. Are these numbers
10975 already taken care of by the MS compiler ?
10977 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10979 * class.cs (Operator): New class for operator declarations.
10980 (Operator::OpType): Enum for the various operators.
10982 2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
10984 * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
10985 ostensibly handle this in semantic analysis.
10987 * cs-parser.jay (general_catch_clause): Comment out
10988 (specific_catch_clauses, specific_catch_clause): Ditto.
10989 (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
10990 (catch_args, opt_catch_args): New productions.
10991 (catch_clause): Rewrite to use the new productions above
10992 (catch_clauses): Modify accordingly.
10993 (opt_catch_clauses): New production to use in try_statement
10994 (try_statement): Revamp. Basically, we get rid of one unnecessary rule
10995 and re-write the code in the actions to extract the specific and
10996 general catch clauses by being a little smart ;-)
10998 * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
10999 Hooray, try and catch statements parse fine !
11001 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11003 * statement.cs (Block::GetVariableType): Fix logic to extract the type
11004 string from the hashtable of variables.
11006 * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
11007 I end up making that mistake ;-)
11008 (catch_clauses): Fixed gross error which made Key and Value of the
11009 DictionaryEntry the same : $1 !!
11011 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11013 * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
11015 * cs-parser.jay (event_declaration): Correct to remove the semicolon
11016 when the add and remove accessors are specified.
11018 2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
11020 * cs-parser.jay (IndexerDeclaration): New helper class to hold
11021 information about indexer_declarator.
11022 (indexer_declarator): Implement actions.
11023 (parsing_indexer): New local boolean used to keep track of whether
11024 we are parsing indexers or properties. This is necessary because
11025 implicit_parameters come into picture even for the get accessor in the
11026 case of an indexer.
11027 (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
11029 * class.cs (Indexer): New class for indexer declarations.
11030 (TypeContainer::AddIndexer): New method to add an indexer to a type.
11031 (TypeContainer::indexers): New member to hold list of indexers for the
11034 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
11036 * cs-parser.jay (add_accessor_declaration): Implement action.
11037 (remove_accessor_declaration): Implement action.
11038 (event_accessors_declaration): Implement
11039 (variable_declarators): swap statements for first rule - trivial.
11041 * class.cs (Event): New class to hold information about event
11043 (TypeContainer::AddEvent): New method to add an event to a type
11044 (TypeContainer::events): New member to hold list of events.
11046 * cs-parser.jay (event_declaration): Implement actions.
11048 2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
11050 * cs-parser.jay (dim_separators): Implement. Make it a string
11051 concatenating all the commas together, just as they appear.
11052 (opt_dim_separators): Modify accordingly
11053 (rank_specifiers): Update accordingly. Basically do the same
11054 thing - instead, collect the brackets here.
11055 (opt_rank_sepcifiers): Modify accordingly.
11056 (array_type): Modify to actually return the complete type string
11057 instead of ignoring the rank_specifiers.
11058 (expression_list): Implement to collect the expressions
11059 (variable_initializer): Implement. We make it a list of expressions
11060 essentially so that we can handle the array_initializer case neatly too.
11061 (variable_initializer_list): Implement.
11062 (array_initializer): Make it a list of variable_initializers
11063 (opt_array_initializer): Modify accordingly.
11065 * expression.cs (New::NType): Add enumeration to help us
11066 keep track of whether we have an object/delegate creation
11067 or an array creation.
11068 (New:NewType, New::Rank, New::Indices, New::Initializers): New
11069 members to hold data about array creation.
11070 (New:New): Modify to update NewType
11071 (New:New): New Overloaded contructor for the array creation
11074 * cs-parser.jay (array_creation_expression): Implement to call
11075 the overloaded New constructor.
11077 2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
11079 * class.cs (TypeContainer::Constructors): Return member
11080 constructors instead of returning null.
11082 2001-08-26 Miguel de Icaza <miguel@ximian.com>
11084 * typemanager.cs (InitCoreTypes): Initialize the various core
11085 types after we have populated the type manager with the user
11086 defined types (this distinction will be important later while
11087 compiling corlib.dll)
11089 * expression.cs, literal.cs, assign.cs, constant.cs: Started work
11090 on Expression Classification. Now all expressions have a method
11091 `Resolve' and a method `Emit'.
11093 * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
11094 generation from working. Also add some temporary debugging
11097 2001-08-24 Miguel de Icaza <miguel@ximian.com>
11099 * codegen.cs: Lots of code generation pieces. This is only the
11100 beginning, will continue tomorrow with more touches of polish. We
11101 handle the fundamentals of if, while, do, for, return. Others are
11102 trickier and I need to start working on invocations soon.
11104 * gen-treedump.cs: Bug fix, use s.Increment here instead of
11107 * codegen.cs (EmitContext): New struct, used during code
11108 emission to keep a context. Most of the code generation will be
11111 * cs-parser.jay: Add embedded blocks to the list of statements of
11112 this block. So code generation proceeds in a top down fashion.
11114 2001-08-23 Miguel de Icaza <miguel@ximian.com>
11116 * statement.cs: Add support for multiple child blocks.
11118 2001-08-22 Miguel de Icaza <miguel@ximian.com>
11120 * codegen.cs (EmitCode): New function, will emit the code for a
11121 Block of code given a TypeContainer and its ILGenerator.
11123 * statement.cs (Block): Standard public readonly optimization.
11124 (Block::Block constructors): Link children.
11125 (Block::Child): Child Linker.
11126 (Block::EmitVariables): Emits IL variable declarations.
11128 * class.cs: Drop support for MethodGroups here, delay until
11130 (Method::): Applied the same simplification that I did before, and
11131 move from Properties to public readonly fields.
11132 (Method::ParameterTypes): Returns the parameter types for the
11133 function, and implements a cache that will be useful later when I
11134 do error checking and the semantic analysis on the methods is
11136 (Constructor::GetCallingConvention): Renamed from CallingConvetion
11137 and made a method, optional argument tells whether this is a class
11138 or a structure to apply the `has-this' bit.
11139 (Method::GetCallingConvention): Implement, returns the calling
11141 (Method::Define): Defines the type, a second pass is performed
11142 later to populate the methods.
11144 (Constructor::ParameterTypes): implement a cache similar to the
11145 one on Method::ParameterTypes, useful later when we do semantic
11148 (TypeContainer::EmitMethod): New method. Emits methods.
11150 * expression.cs: Removed MethodGroup class from here.
11152 * parameter.cs (Parameters::GetCallingConvention): new method.
11154 2001-08-21 Miguel de Icaza <miguel@ximian.com>
11156 * class.cs (TypeContainer::Populate): Drop RootContext from the
11159 (Constructor::CallingConvention): Returns the calling convention.
11160 (Constructor::ParameterTypes): Returns the constructor parameter
11163 (TypeContainer::AddConstructor): Keep track of default constructor
11164 and the default static constructor.
11166 (Constructor::) Another class that starts using `public readonly'
11167 instead of properties.
11169 (Constructor::IsDefault): Whether this is a default constructor.
11171 (Field::) use readonly public fields instead of properties also.
11173 (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
11174 track of static constructors; If none is used, turn on
11175 BeforeFieldInit in the TypeAttributes.
11177 * cs-parser.jay (opt_argument_list): now the return can be null
11178 for the cases where there are no arguments.
11180 (constructor_declarator): If there is no implicit `base' or
11181 `this', then invoke the default parent constructor.
11183 * modifiers.cs (MethodAttr): New static function maps a set of
11184 modifiers flags into a MethodAttributes enum
11185 (FieldAttr): renamed from `Map'. So now we have FieldAttr,
11186 MethodAttr, TypeAttr to represent the various mappings where the
11187 modifiers are used.
11188 (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
11190 2001-08-19 Miguel de Icaza <miguel@ximian.com>
11192 * parameter.cs (GetParameterInfo): Fix bug where there would be no
11195 * interface.cs (PopulateIndexer): Implemented the code generator
11196 for interface indexers.
11198 2001-08-17 Miguel de Icaza <miguel@ximian.com>
11200 * interface.cs (InterfaceMemberBase): Now we track the new status
11203 (PopulateProperty): Implement property population. Woohoo! Got
11204 Methods and Properties going today.
11206 Removed all the properties for interfaces, and replaced them with
11207 `public readonly' fields.
11209 2001-08-16 Miguel de Icaza <miguel@ximian.com>
11211 * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
11212 initialize their hashtables/arraylists only when they are needed
11213 instead of doing this always.
11215 * parameter.cs: Handle refs and out parameters.
11217 * cs-parser.jay: Use an ArrayList to construct the arguments
11218 instead of the ParameterCollection, and then cast that to a
11221 * parameter.cs: Drop the use of ParameterCollection and use
11222 instead arrays of Parameters.
11224 (GetParameterInfo): Use the Type, not the Name when resolving
11227 2001-08-13 Miguel de Icaza <miguel@ximian.com>
11229 * parameter.cs: Eliminate the properties Name, Type and ModFlags,
11230 and instead use public readonly fields.
11232 * class.cs: Put back walking code for type containers.
11234 2001-08-11 Miguel de Icaza <miguel@ximian.com>
11236 * class.cs (MakeConstant): Code to define constants.
11238 * rootcontext.cs (LookupType): New function. Used to locate types
11241 2001-08-08 Miguel de Icaza <miguel@ximian.com>
11243 * rootcontext.cs: OH MY! My trick works! It is amazing how nice
11244 this System.Reflection code is. Kudos to Microsoft
11246 * typemanager.cs: Implement a type cache and avoid loading all
11247 types at boot time. Wrap in LookupType the internals. This made
11248 the compiler so much faster. Wow. I rule!
11250 * driver.cs: Make sure we always load mscorlib first (for
11251 debugging purposes, nothing really important).
11253 * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
11254 have moved to `CSC' rather than `CIR'. Oh man! The confussion!
11256 * rootcontext.cs: Lookup types on their namespace; Lookup types
11257 on namespaces that have been imported using the `using' keyword.
11259 * class.cs (TypeContainer::TypeAttr): Virtualize.
11260 (Class::TypeAttr): Return attributes suitable for this bad boy.
11261 (Struct::TypeAttr): ditto.
11262 Handle nested classes.
11263 (TypeContainer::) Remove all the type visiting code, it is now
11264 replaced with the rootcontext.cs code
11266 * rootcontext.cs (GetClassBases): Added support for structs.
11268 2001-08-06 Miguel de Icaza <miguel@ximian.com>
11270 * interface.cs, statement.cs, class.cs, parameter.cs,
11271 rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
11272 Drop use of TypeRefs, and use strings instead.
11274 2001-08-04 Miguel de Icaza <miguel@ximian.com>
11278 * class.cs (Struct::Struct): set the SEALED flags after
11279 checking the modifiers.
11280 (TypeContainer::TypeAttr): new property, returns the
11281 TypeAttributes for a class.
11283 * cs-parser.jay (type_list): Oops, list production was creating a
11284 new list of base types.
11286 * rootcontext.cs (StdLib): New property.
11287 (GetInterfaceTypeByName): returns an interface by type name, and
11288 encapsulates error handling here.
11289 (GetInterfaces): simplified.
11290 (ResolveTree): Encapsulated all the tree resolution here.
11291 (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
11294 * driver.cs: Add support for --nostdlib, to avoid loading the
11295 default assemblies.
11296 (Main): Do not put tree resolution here.
11298 * rootcontext.cs: Beginning of the class resolution.
11300 2001-08-03 Miguel de Icaza <miguel@ximian.com>
11302 * rootcontext.cs: Provide better error reporting.
11304 * cs-parser.jay (interface_base): set our $$ to be interfaces.
11306 * rootcontext.cs (CreateInterface): Handle the case where there
11307 are no parent interfaces.
11309 (CloseTypes): Routine to flush types at the end.
11310 (CreateInterface): Track types.
11311 (GetInterfaces): Returns an array of Types from the list of
11312 defined interfaces.
11314 * typemanager.c (AddUserType): Mechanism to track user types (puts
11315 the type on the global type hash, and allows us to close it at the
11318 2001-08-02 Miguel de Icaza <miguel@ximian.com>
11320 * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
11321 RecordInterface instead.
11323 * cs-parser.jay: Updated to reflect changes above.
11325 * decl.cs (Definition): Keep track of the TypeBuilder type that
11326 represents this type here. Not sure we will use it in the long
11327 run, but wont hurt for now.
11329 * driver.cs: Smaller changes to accomodate the new code.
11331 Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
11334 * rootcontext.cs (CreateInterface): New method, used to create
11335 the System.TypeBuilder type for interfaces.
11336 (ResolveInterfaces): new entry point to resolve the interface
11338 (CodeGen): Property, used to keep track of the code generator.
11340 2001-07-26 Miguel de Icaza <miguel@ximian.com>
11342 * cs-parser.jay: Add a second production for delegate_declaration
11345 (enum_body): Put an opt_comma here instead of putting it on
11346 enum_body or enum_member_declarations so we can handle trailing
11347 commas on enumeration members. Gets rid of a shift/reduce.
11349 (type_list): Need a COMMA in the middle.
11351 (indexer_declaration): Tell tokenizer to recognize get/set
11353 * Remove old targets.
11355 * Re-add the parser target.
11357 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11359 * cs-parser.jay: Add precendence rules for a number of operators
11360 ot reduce the number of shift/reduce conflicts in the grammar.
11362 2001-07-17 Miguel de Icaza <miguel@ximian.com>
11364 * tree.cs: moved IGenerator interface and renamed it to ITreeDump
11367 Get rid of old crufty code.
11369 * rootcontext.cs: Use this to keep track of the parsed
11370 representation and the defined types available to the program.
11372 * gen-treedump.cs: adjust for new convention.
11374 * type.cs: Split out the type manager, and the assembly builder
11377 * typemanager.cs: the type manager will live here now.
11379 * cil-codegen.cs: And the code generator here.
11381 2001-07-14 Sean MacIsaac <macisaac@ximian.com>
11383 * makefile: Fixed up for easy making.
11385 2001-07-13 Simon Cozens <simon@simon-cozens.org>
11387 * cs-parser.jay (rank_specifier): Remove a conflict by reordering
11390 (unary_expression): Expand pre_increment_expression and
11391 post_decrement_expression to reduce a shift/reduce.
11393 2001-07-11 Simon Cozens
11395 * cs-tokenizer.cs: Hex numbers should begin with a 0.
11397 Improve allow_keyword_as_indent name.
11399 2001-06-19 Miguel de Icaza <miguel@ximian.com>
11401 * Adjustments for Beta2.
11403 2001-06-13 Miguel de Icaza <miguel@ximian.com>
11405 * decl.cs: Added `Define' abstract method.
11406 (InTransit): new property, used to catch recursive definitions.
11408 * interface.cs: Implement `Define'.
11410 * modifiers.cs: Map Modifiers.constants to
11411 System.Reflection.TypeAttribute flags.
11413 * class.cs: Keep track of types and user-defined types.
11414 (BuilderInit): New method for creating an assembly
11415 (ResolveType): New function to launch the resolution process, only
11416 used by interfaces for now.
11418 * cs-parser.jay: Keep track of Classes, Structs and Interfaces
11419 that are inserted into the name space.
11421 2001-06-08 Miguel de Icaza <miguel@ximian.com>
11423 * ARGH. I have screwed up my tree so many times due to the use of
11424 rsync rather than using CVS. Going to fix this at once.
11426 * driver.cs: Objetify driver. Load assemblies, use assemblies to
11429 2001-06-07 Miguel de Icaza <miguel@ximian.com>
11431 * Experiment successful: Use System.Type rather that our own
11434 2001-05-25 Miguel de Icaza <miguel@ximian.com>
11436 * cs-parser.jay: Removed nsAliases from here.
11438 Use new namespaces, handle `using XXX;'
11440 * namespace.cs: Reimplemented namespace handling, use a recursive
11441 definition of the class. Now we can keep track of using clauses
11442 and catch invalid using clauses.
11444 2001-05-24 Miguel de Icaza <miguel@ximian.com>
11446 * gen-treedump.cs: Adapted for all the renaming.
11448 * expression.cs (Expression): this class now has a Type property
11449 which returns an expression Type.
11451 (Probe::, New::, TypeOf::, SizeOf::, Constant::): renamed from
11452 `Type', as this has a different meaning now in the base
11454 2001-05-22 Miguel de Icaza <miguel@ximian.com>
11456 * interface.cs, class.cs: Removed from all the sources the
11457 references to signature computation, as we can not do method
11458 signature computation during the parsing time, as we are not
11459 trying to solve at that point distinguishing:
11463 void a (NS.Blah x) {}
11466 Which depending on the context might be valid or not, as we do not
11467 know if Blah is the same thing as NS.Blah at that point.
11469 * Redid everything so the code uses TypeRefs now instead of
11470 Types. TypeRefs are just temporary type placeholders, that need
11471 to be resolved. They initially have a pointer to a string and the
11472 current scope in which they are used. This is used later by the
11473 compiler to resolve the reference to an actual Type.
11475 * DeclSpace is no longer a CIR.Type, and neither are
11476 TypeContainers (Class and Struct) nor Interfaces nor Enums. They
11477 are all DeclSpaces, but no Types.
11479 * type.cs (TypeRefManager): This implements the TypeRef manager,
11480 which keeps track of all the types that need to be resolved after
11481 the parsing has finished.
11483 2001-05-13 Miguel de Icaza <miguel@ximian.com>
11485 * ARGH. We are going to have to store `foreach' as a class rather
11486 than resolving it, as we need to verify error 1579 after name
11487 resolution. *OR* we could keep a flag that says `This request to
11488 IEnumerator comes from a foreach statement' which we can then use
11489 to generate the error.
11491 2001-05-10 Miguel de Icaza <miguel@ximian.com>
11493 * class.cs (TypeContainer.AddMethod): we now add methods to the
11494 MethodGroup instead of the method hashtable.
11496 * expression.cs: Add MethodGroup abstraction, which gets us one
11497 step closer to the specification in the way we handle method
11500 * cs-parser.jay (primary_expression): qualified_identifier now
11501 tried to match up an identifier to a local variable reference or
11502 to a parameter reference.
11504 current_local_parameters is now a parser global variable that
11505 points to the current parameters for the block, used during name
11508 (property_declaration): Now creates an implicit `value' argument to
11511 2001-05-09 Miguel de Icaza <miguel@ximian.com>
11513 * parameter.cs: Do not use `param' arguments as part of the
11514 signature, per the spec.
11516 2001-05-08 Miguel de Icaza <miguel@ximian.com>
11518 * decl.cs: Base class for classes, structs and interfaces. This
11519 is the "Declaration Space"
11521 * cs-parser.jay: Use CheckDef for checking declaration errors
11522 instead of having one on each function.
11524 * class.cs: Factor out some code for handling error handling in
11525 accordance to the "Declarations" section in the "Basic Concepts"
11526 chapter in the ECMA C# spec.
11528 * interface.cs: Make all interface member classes derive from
11529 InterfaceMemberBase.
11531 2001-05-07 Miguel de Icaza <miguel@ximian.com>
11533 * Many things: all interfaces are parsed and generated in
11534 gen-treedump. Support for member variables, constructors,
11535 destructors, properties, constants is there.
11537 Beginning of the IL backend, but very little done, just there for
11540 2001-04-29 Miguel de Icaza <miguel@ximian.com>
11542 * cs-parser.jay: Fix labeled statement.
11544 * cs-tokenizer.cs (escape): Escape " and ' always.
11545 ref_line, ref_name: keep track of the line/filename as instructed
11546 by #line by the compiler.
11549 2001-04-27 Miguel de Icaza <miguel@ximian.com>
11551 * System.CodeDOM/CodeBinaryOperatorExpression.cs: Rearrange enum
11552 to match the values in System.CodeDOM.
11554 Divid renamed to Divide.
11556 * System.CodeDOM/CodeForLoopStatement.cs: Always have valid
11558 (Statements.set): remove.
11560 * System.CodeDOM/CodeCatchClause.cs: always have a valid
11563 * System.CodeDOM/CodeIfStatement.cs: trueStatements and
11564 falseStatements always have valid values.
11566 * cs-parser.jay: Use System.CodeDOM now.